/* ERP Command Center + Module Dashboard */
:root {
  --ed-bg: #0b0f1a;
  --ed-surface: #12182a;
  --ed-surface2: #1a2238;
  --ed-border: rgba(99, 102, 241, 0.18);
  --ed-text: #e8ecf7;
  --ed-muted: #8b95b5;
  --ed-accent: #6366f1;
  --ed-green: #10b981;
  --ed-red: #ef4444;
  --ed-amber: #f59e0b;
}

* { box-sizing: border-box; }

body.ed-body {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--ed-bg);
  color: var(--ed-text);
  min-height: 100vh;
}

.ed-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.ed-sidebar {
  background: var(--ed-surface);
  border-right: 1px solid var(--ed-border);
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ed-brand {
  font-size: 1.1rem;
  font-weight: 700;
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(16, 185, 129, 0.15));
}

.ed-brand small {
  display: block;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--ed-muted);
  margin-top: 0.15rem;
}

.ed-nav a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  color: var(--ed-muted);
  text-decoration: none;
  font-size: 0.88rem;
}

.ed-nav a:hover,
.ed-nav a.active {
  background: rgba(99, 102, 241, 0.15);
  color: var(--ed-text);
}

.ed-main {
  padding: 1.25rem 1.5rem 2rem;
  overflow-x: hidden;
}

.ed-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.ed-topbar h1 {
  margin: 0;
  font-size: 1.45rem;
}

.ed-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ed-btn {
  border: 1px solid var(--ed-border);
  background: var(--ed-surface2);
  color: var(--ed-text);
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
}

.ed-btn:hover { border-color: var(--ed-accent); }

.ed-pill {
  font-size: 0.75rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.15);
  color: var(--ed-green);
}

.ed-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.ed-kpi {
  background: var(--ed-surface);
  border: 1px solid var(--ed-border);
  border-radius: 12px;
  padding: 1rem;
}

.ed-kpi-label {
  font-size: 0.75rem;
  color: var(--ed-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ed-kpi-value {
  font-size: 1.55rem;
  font-weight: 700;
  margin-top: 0.35rem;
}

.ed-kpi-value.positive { color: var(--ed-green); }
.ed-kpi-value.negative { color: var(--ed-red); }

.ed-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.ed-panel {
  background: var(--ed-surface);
  border: 1px solid var(--ed-border);
  border-radius: 12px;
  padding: 1rem;
}

.ed-panel-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0 0 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ed-module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.65rem;
}

.ed-module-card {
  background: var(--ed-surface2);
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0.75rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s;
}

.ed-module-card:hover {
  border-color: var(--ed-accent);
}

.ed-module-card .icon {
  font-size: 1.2rem;
  color: var(--ed-accent);
  margin-bottom: 0.35rem;
}

.ed-module-card .name {
  font-size: 0.82rem;
  font-weight: 600;
}

.ed-module-card .meta {
  font-size: 0.72rem;
  color: var(--ed-muted);
  margin-top: 0.25rem;
}

.ed-table-wrap {
  overflow-x: auto;
  max-height: 360px;
}

.ed-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.ed-table th,
.ed-table td {
  padding: 0.5rem 0.6rem;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.ed-table th {
  color: var(--ed-muted);
  font-weight: 500;
  position: sticky;
  top: 0;
  background: var(--ed-surface);
}

.ed-badge {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  font-size: 0.7rem;
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
}

.ed-sync-row {
  display: flex;
  justify-content: space-between;
  padding: 0.45rem 0;
  font-size: 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.ed-sync-row:last-child { border-bottom: none; }

.ed-empty {
  text-align: center;
  padding: 2rem;
  color: var(--ed-muted);
  font-size: 0.9rem;
}

@media (max-width: 900px) {
  .ed-shell { grid-template-columns: 1fr; }
  .ed-sidebar { display: none; }
  .ed-grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .ed-shell {
    min-width: 0;
    overflow-x: hidden;
  }

  .ed-panel {
    min-width: 0;
    max-width: 100%;
  }

  .ed-table-wrap {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .ed-module-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .ed-module-grid {
    grid-template-columns: 1fr;
  }
}
