:root {
  --bg: #0b1220;
  --surface: #111827;
  --surface-2: #151e30;
  --surface-3: #1b2740;
  --border: #243046;
  --text: #e8eef9;
  --text-muted: #a6b3c9;
  --text-faint: #6b7a97;
  --accent: #00b2a9;
  --accent-hover: #00918a;
  --accent-soft: rgba(0,178,169,0.14);
  --error: #ef4f5f;
  --warning: #f59e0b;
  --success: #0ea07b;
  --radius: 12px;
  --shadow: 0 10px 30px rgba(0,0,0,0.28);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: Inter, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
.shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}
.sidebar {
  background: #0f1728;
  border-right: 1px solid var(--border);
  padding: 24px 18px;
}
.brand {
  margin-bottom: 24px;
}
.brand h1 {
  font-size: 18px;
  margin-bottom: 4px;
}
.brand p {
  font-size: 12px;
  color: var(--text-faint);
}
.nav-section {
  margin-bottom: 22px;
}
.nav-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin-bottom: 10px;
}
.nav-link {
  display: block;
  padding: 11px 12px;
  border-radius: 10px;
  color: var(--text-muted);
  margin-bottom: 6px;
  border: 1px solid transparent;
}
.nav-link:hover {
  background: var(--surface-2);
  color: var(--text);
}
.nav-link.active {
  background: var(--accent-soft);
  color: var(--text);
  border-color: rgba(0,178,169,0.35);
}
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(11,18,32,0.75);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 5;
}
.topbar h2 {
  font-size: 18px;
}
.topbar p {
  font-size: 12px;
  color: var(--text-faint);
}
.topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}
.panel-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.panel-brand-logo {
  height: 40px;
  width: auto;
  display: block;
}
.panel-brand-eyebrow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin-bottom: 4px;
}
.topbar-sub {
  font-size: 12px;
  color: var(--text-faint);
}
.content {
  padding: 24px;
}
.container {
  max-width: 1280px;
}
.page-head {
  margin-bottom: 20px;
}
.page-head h1 {
  font-size: 28px;
  margin-bottom: 6px;
}
.page-head p {
  color: var(--text-muted);
  font-size: 14px;
}
h1, h2, h3, h4 {
  margin-bottom: 12px;
  font-weight: 600;
}
h2 { font-size: 20px; }
section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge-high { background: rgba(239,79,95,0.15); color: #ff6b7a; }
.badge-medium { background: rgba(245,158,11,0.15); color: #fbbf24; }
.badge-low { background: rgba(14,160,123,0.15); color: #34d399; }
.badge-neutral { background: rgba(166,179,201,0.12); color: var(--text-muted); }
.btn {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
}
.btn-primary {
  background: var(--accent);
  color: #042f2e;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger {
  background: var(--error);
  color: #fff;
}
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface-2); }
.table {
  width: 100%;
  border-collapse: collapse;
}
.table th, .table td {
  text-align: left;
  padding: 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.table th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 13px;
}
.table tr:last-child td {
  border-bottom: none;
}
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
@media (min-width: 900px) {
  .grid { grid-template-columns: 2fr 1fr; }
}
.card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.code {
  font-family: ui-monospace, monospace;
  font-size: 12px;
  background: rgba(0,0,0,0.25);
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--text-muted);
  display: inline-block;
  margin-top: 6px;
}
.meta {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 4px;
}
.eyebrow {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.list {
  padding-left: 18px;
}
.list li { margin-bottom: 8px; }
.inline-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.status-panel {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 10px;
}
@media (max-width: 920px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .kpi-grid { grid-template-columns: 1fr; }
}


/* Panel Director / Operator: layout sin sidebar */
.panel-shell {
  display: block;
  width: 100%;
  min-height: 100vh;
}

.panel-shell .main {
  width: 100%;
  min-width: 0;
}

.panel-shell .topbar {
  width: 100%;
  min-height: 88px;
  gap: 24px;
}

.panel-shell .panel-brand {
  min-width: 0;
}

.panel-shell .panel-brand-logo {
  width: 52px;
  height: 52px;
  object-fit: contain;
  flex: 0 0 52px;
}

.panel-shell .panel-brand > div {
  min-width: 0;
}

.panel-shell .panel-brand-eyebrow,
.panel-shell .panel-brand h2 {
  white-space: nowrap;
}

.panel-shell .panel-brand h2 {
  margin-bottom: 0;
}

.panel-shell .topbar-sub {
  margin-left: auto;
  max-width: 360px;
  text-align: right;
}

.panel-shell .content {
  width: 100%;
  padding: 28px;
}

.panel-shell .container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
}

.panel-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 28px;
}

.panel-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 8px 12px;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.panel-nav a:hover {
  color: var(--text);
  background: var(--surface-2);
  border-color: rgba(0, 178, 169, 0.45);
}

.panel-nav a.active {
  color: var(--text);
  background: var(--accent-soft);
  border-color: rgba(0, 178, 169, 0.55);
}

#director-page .grid {
  width: 100%;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

#director-page .card {
  min-width: 0;
}

#director-page .card h2 {
  margin-bottom: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 800px) {
  .panel-shell .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
  }

  .panel-shell .content {
    padding: 16px;
  }

  .panel-shell .topbar-sub {
    margin-left: 0;
    max-width: none;
    text-align: left;
  }

  .panel-shell .panel-brand-eyebrow,
  .panel-shell .panel-brand h2 {
    white-space: normal;
  }

  #director-page .grid {
    grid-template-columns: 1fr;
  }
}

/* Branding visible en el sidebar de Home */
.brand-with-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-brand-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  flex: 0 0 44px;
}

.brand-with-logo h1 {
  margin: 0 0 3px;
  font-size: 16px;
  line-height: 1.2;
}

.brand-with-logo p {
  margin: 0;
  line-height: 1.35;
}

/* Módulo de Supervisión */
#supervision-page .supervision-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 24px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}

#supervision-page .supervision-tab {
  appearance: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 9px 14px;
}

#supervision-page .supervision-tab:hover,
#supervision-page .supervision-tab.active {
  color: var(--text);
  background: var(--accent-soft);
  border-color: rgba(0, 178, 169, 0.55);
}

#supervision-page .supervision-panel {
  display: grid;
  gap: 16px;
}

#supervision-page .summary-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

#supervision-page .metric-card {
  min-width: 0;
}

#supervision-page .metric-card h3 {
  font-size: 26px;
  margin: 4px 0 8px;
  overflow-wrap: anywhere;
}

#supervision-page .table-wrap {
  overflow-x: auto;
}

#supervision-page .table th,
#supervision-page .table td {
  white-space: nowrap;
}

@media (max-width: 700px) {
  #supervision-page .supervision-tabs {
    flex-direction: column;
  }

  #supervision-page .supervision-tab {
    width: 100%;
    text-align: left;
  }

  #supervision-page .table th,
  #supervision-page .table td {
    min-width: 120px;
    white-space: normal;
  }
}

/* Default Operations Dashboard: full-width layout without sidebar */
.shell:has(#default-page) {
  display: block;
  width: 100%;
  min-height: 100vh;
}

#default-page {
  width: 100%;
  min-width: 0;
}

#default-page .content {
  width: 100%;
  padding: 28px;
}

#default-page .container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
}

#default-page nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 28px;
}

#default-page nav a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 8px 12px;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
}

#default-page nav a:hover {
  color: var(--text);
  background: var(--surface-2);
  border-color: rgba(0, 178, 169, 0.45);
}

#default-page .grid {
  width: 100%;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

#default-page .card {
  min-width: 0;
}

#default-page .card h3 {
  margin-bottom: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 800px) {
  #default-page .content {
    padding: 16px;
  }

  #default-page .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  #default-page .grid {
    grid-template-columns: 1fr;
  }
}

