/* ============================================================
   ROTOPLAS · Sistema de gestión de traslado de personal
   Paleta inspirada en ERA Group (navy + cyan)
   ============================================================ */

/* --- Tokens ----------------------------------------------- */
:root, html[data-theme="light"]{
  --bg:           #f4f7f9;
  --surface:      #ffffff;
  --surface-2:    #eef3f7;
  --surface-3:    #e3ebf1;
  --border:       #d8e1e9;
  --border-soft:  #e8eef3;
  --text:         #0B1E38;
  --text-2:       #4A6380;
  --muted:        #6a8194;
  --muted-2:      #91a4b4;

  --navy:         #023c59;
  --navy-2:       #045b80;
  --cyan:         #00C2A8;
  --cyan-2:       #1dd1bb;
  --cyan-soft:    rgba(0,194,168,0.10);

  --good:         #1b8454;
  --good-bg:      #e0f2e9;
  --warn:         #c48214;
  --warn-bg:      #fbeed3;
  --bad:          #c0432c;
  --bad-bg:       #fbe1da;
  --info:         #045b80;
  --info-bg:      #dceef7;

  --shadow-sm:    0 1px 2px rgba(2, 60, 89, 0.06);
  --shadow:       0 2px 6px rgba(2, 60, 89, 0.06), 0 1px 2px rgba(2, 60, 89, 0.04);
  --shadow-lg:    0 12px 32px rgba(2, 60, 89, 0.10), 0 4px 12px rgba(2, 60, 89, 0.06);

  --radius-sm:    6px;
  --radius:       10px;
  --radius-lg:    14px;

  --topbar-h:     56px;
  --sidebar-w:    232px;
  --filterbar-h:  52px;

  --font-sans:    'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  --font-mono:    'IBM Plex Mono', ui-monospace, monospace;
}

html[data-theme="dark"]{
  --bg:           #061421;
  --surface:      #0e2638;
  --surface-2:    #143049;
  --surface-3:    #1a3d5c;
  --border:       #1d4060;
  --border-soft:  #163350;
  --text:         #eaf2f8;
  --text-2:       #c9d8e3;
  --muted:        #8ba8bf;
  --muted-2:      #6c8499;

  --navy:         #00C2A8;
  --navy-2:       #1dd1bb;
  --cyan:         #1dd1bb;
  --cyan-2:       #5fd1ec;
  --cyan-soft:    rgba(0,194,168,0.16);

  --good:         #4ad295;
  --good-bg:      rgba(74,210,149,.14);
  --warn:         #f4b860;
  --warn-bg:      rgba(244,184,96,.14);
  --bad:          #e85d5d;
  --bad-bg:       rgba(232,93,93,.14);
  --info:         #5fd1ec;
  --info-bg:      rgba(95,209,236,.14);

  --shadow-sm:    0 1px 2px rgba(0,0,0,.4);
  --shadow:       0 2px 6px rgba(0,0,0,.35), 0 1px 2px rgba(0,0,0,.25);
  --shadow-lg:    0 12px 32px rgba(0,0,0,.45), 0 4px 12px rgba(0,0,0,.3);
}

/* --- Base ------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background .2s ease, color .2s ease;
}

button { font-family: inherit; }
input, select, textarea { font-family: inherit; color: inherit; }

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.num  { font-variant-numeric: tabular-nums; }

/* --- App Shell -------------------------------------------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  grid-template-areas:
    "side top"
    "side main";
  min-height: 100vh;
}

/* Top bar ------------------------------------------------- */
.topbar {
  grid-area: top;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 24px;
  gap: 20px;
  position: sticky; top: 0; z-index: 30;
}
.topbar .crumbs {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--muted);
  flex: 1; min-width: 0; white-space: nowrap; overflow: hidden;
}
.topbar .crumbs .here { color: var(--text); font-weight: 600; }
.topbar .crumbs .sep { color: var(--muted-2); }
.topbar .actions { display: flex; align-items: center; gap: 10px; }

.icon-btn {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  color: var(--muted);
  cursor: pointer;
  transition: all .15s ease;
}
.icon-btn:hover { color: var(--navy); border-color: var(--navy); background: var(--surface-2); }
.icon-btn.active { color: var(--navy); border-color: var(--navy); background: var(--cyan-soft); }
html[data-theme="dark"] .icon-btn:hover { color: var(--cyan); border-color: var(--cyan); }

.role-pill {
  display: inline-flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 12px 0 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-2);
  white-space: nowrap;
  flex-shrink: 0;
}
.role-pill .avatar {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--navy); color: white;
  font-size: 10px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.role-pill .role { color: var(--muted); font-weight: 500; font-size: 11px; }

/* Sidebar ------------------------------------------------- */
.sidebar {
  grid-area: side;
  background: var(--surface);
  border-right: 1px solid var(--border);
  height: 100vh; position: sticky; top: 0;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.sidebar .brand {
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--border-soft);
  display: flex; align-items: center; gap: 10px;
}
.sidebar .brand .era-logo {
  height: 30px;
  width: auto;
  max-width: 90px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}
html[data-theme="dark"] .sidebar .brand .era-logo {
  filter: brightness(0) invert(1);
}
.sidebar .brand .title {
  font-size: 13px; font-weight: 700; color: var(--text);
  line-height: 1.2;
}
.sidebar .brand .title small {
  display: block; font-weight: 500; font-size: 10.5px;
  color: var(--muted); letter-spacing: .3px;
}
.sidebar nav {
  flex: 1; overflow-y: auto;
  padding: 12px 10px;
}
.sidebar .group-label {
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 1px;
  color: var(--muted-2);
  padding: 14px 12px 6px;
}
.sidebar a.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 12px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-2);
  text-decoration: none;
  cursor: pointer;
  margin-bottom: 1px;
  transition: background .12s ease, color .12s ease;
  position: relative;
}
.sidebar a.nav-item:hover { background: var(--surface-2); color: var(--text); }
.sidebar a.nav-item.active {
  background: var(--cyan-soft);
  color: var(--navy);
  font-weight: 600;
}
html[data-theme="dark"] .sidebar a.nav-item.active { color: var(--cyan-2); }
.sidebar a.nav-item.active::before {
  content: '';
  position: absolute; left: 0; top: 7px; bottom: 7px; width: 2px;
  background: var(--cyan); border-radius: 2px;
}
.sidebar a.nav-item .ico { width: 16px; height: 16px; flex: 0 0 16px; }
.sidebar a.nav-item .badge {
  margin-left: auto;
  background: var(--bad); color: white;
  font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 999px;
  min-width: 18px; text-align: center;
}
.sidebar a.nav-item .badge.warn { background: var(--warn); color: white; }
.sidebar a.nav-item .badge.muted { background: var(--surface-3); color: var(--muted); }

.sidebar .foot {
  padding: 12px 16px;
  border-top: 1px solid var(--border-soft);
  font-size: 11px; color: var(--muted);
  display: flex; align-items: center; gap: 8px;
}
.sidebar .foot .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 0 3px var(--good-bg);
}

/* Main area ----------------------------------------------- */
.main { grid-area: main; min-width: 0; display: flex; flex-direction: column; }

/* Global filter bar */
.filterbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: var(--filterbar-h);
  display: flex; align-items: center;
  gap: 8px;
  position: sticky; top: var(--topbar-h); z-index: 20;
  overflow-x: auto;
}
.filterbar::-webkit-scrollbar { display: none; }
.filterbar .label {
  font-size: 11px; font-weight: 600;
  color: var(--muted-2); text-transform: uppercase;
  letter-spacing: .8px; margin-right: 4px;
}
.filterbar .spacer { flex: 1; }

.f-chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 10px 0 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--text-2);
  cursor: pointer;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}
.f-chip:hover { border-color: var(--navy); background: var(--surface); }
.f-chip strong { color: var(--text); font-weight: 600; }
.f-chip .caret { color: var(--muted); font-size: 10px; }
.f-chip.has-value { background: var(--cyan-soft); border-color: var(--cyan); color: var(--navy); }

.seg {
  display: inline-flex; align-items: stretch;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px;
}
.seg button {
  border: none; background: transparent;
  font-size: 11.5px; font-weight: 600;
  padding: 4px 12px;
  border-radius: 999px;
  cursor: pointer; color: var(--muted);
}
.seg button.active { background: var(--surface); color: var(--navy); box-shadow: var(--shadow-sm); }
html[data-theme="dark"] .seg button.active { color: var(--cyan-2); background: var(--surface-3); }

/* Content ------------------------------------------------- */
.content { padding: 24px; max-width: 1600px; margin: 0 auto; width: 100%; flex: 1; }
.page-head { margin-bottom: 20px; }
.page-head h1 {
  margin: 0 0 4px; font-size: 22px; font-weight: 600;
  letter-spacing: -.3px;
}
.page-head .sub { color: var(--muted); font-size: 13.5px; max-width: 800px; }
.page-head .row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* Cards --------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-h {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-soft);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-h h3 {
  margin: 0; font-size: 13.5px; font-weight: 600;
  color: var(--text);
}
.card-h .sub { font-size: 12px; color: var(--muted); }
.card-h .actions { display: flex; gap: 6px; }
.card-b { padding: 16px 18px; }
.card-b.tight { padding: 10px 0; }
.card-b.flush { padding: 0; }

/* KPI ------------------------------------------------------ */
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.kpi.elevated {
  background: linear-gradient(135deg, var(--navy) 0%, #054a6e 70%, #0c6488 100%);
  color: #f0fbff;
  border-color: transparent;
}
.kpi.elevated .label, .kpi.elevated .delta { color: rgba(255,255,255,.78); }
.kpi.elevated .value { color: #fff; }
.kpi .label {
  font-size: 11px; font-weight: 600; letter-spacing: .6px;
  text-transform: uppercase; color: var(--muted);
  display: flex; align-items: center; gap: 6px;
}
.kpi .value {
  font-size: 26px; font-weight: 600; margin-top: 6px;
  color: var(--text); line-height: 1.1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.5px;
}
.kpi .value small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 4px; }
.kpi.elevated .value small { color: rgba(255,255,255,.7); }
.kpi .delta {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  display: flex; align-items: center; gap: 4px;
}
.kpi .delta.up   { color: var(--bad); }
.kpi .delta.down { color: var(--good); }
.kpi.elevated .delta.up { color: #fbbe9e; }
.kpi.elevated .delta.down { color: #b6e9cd; }

.kpi .spark { position: absolute; right: -10px; bottom: -6px; opacity: .6; pointer-events: none; }
.kpi.elevated .spark { opacity: .25; }

/* Grid helpers -------------------------------------------- */
.grid { display: grid; gap: 14px; }
.g-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.g-6 { grid-template-columns: repeat(6, minmax(0,1fr)); }
.g-12 { grid-template-columns: repeat(12, minmax(0,1fr)); }
@media (max-width: 1180px) { .g-4 { grid-template-columns: repeat(2, 1fr); } .g-6 { grid-template-columns: repeat(3,1fr); } }
@media (max-width: 900px)  { .g-2, .g-3, .g-4, .g-6 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px)  { .g-2, .g-3, .g-4, .g-6 { grid-template-columns: 1fr; } }

.col-4 { grid-column: span 4; } .col-6 { grid-column: span 6; }
.col-8 { grid-column: span 8; } .col-12 { grid-column: span 12; }

/* Tables -------------------------------------------------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl thead th {
  text-align: left;
  font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .8px;
  color: var(--muted);
  background: var(--surface-2);
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
}
.tbl tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text-2);
  vertical-align: middle;
}
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl td.tight, .tbl th.tight { width: 1%; white-space: nowrap; }
.tbl .strong { color: var(--text); font-weight: 600; }
.tbl tr.danger td { background: rgba(192,67,44,.05); }
.tbl tr.warn td { background: rgba(196,130,20,.04); }

/* Pills --------------------------------------------------- */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid transparent;
  letter-spacing: .2px;
}
.pill .dotp { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok   { background: var(--good-bg); color: var(--good); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad  { background: var(--bad-bg);  color: var(--bad);  }
.pill.info { background: var(--info-bg); color: var(--info); }
.pill.solid-navy { background: var(--navy); color: white; }
.pill.solid-cyan { background: var(--cyan); color: var(--navy); }

/* Buttons ------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 14px;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  transition: all .12s ease;
}
.btn:hover { border-color: var(--navy); color: var(--text); }
.btn.primary {
  background: var(--navy); color: white; border-color: var(--navy);
}
.btn.primary:hover { background: #034a6e; border-color: #034a6e; color: #fff; }
html[data-theme="dark"] .btn.primary { background: var(--cyan); border-color: var(--cyan); color: #052436; }
html[data-theme="dark"] .btn.primary:hover { background: var(--cyan-2); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.sm { height: 26px; padding: 0 10px; font-size: 12px; }
.btn.lg { height: 38px; padding: 0 18px; font-size: 14px; }

/* Callouts ------------------------------------------------ */
.callout {
  display: flex; gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--info-bg); color: var(--info);
  font-size: 13px;
  border-left: 3px solid currentColor;
}
.callout .ico { flex: 0 0 16px; padding-top: 2px; }
.callout .body { color: var(--text-2); flex: 1; }
.callout .body strong { color: var(--text); }
.callout.warn { background: var(--warn-bg); color: var(--warn); }
.callout.bad { background: var(--bad-bg); color: var(--bad); }
.callout.good { background: var(--good-bg); color: var(--good); }

/* Charts -------------------------------------------------- */
.chart { position: relative; height: 220px; }
.chart.tall { height: 300px; }
.chart.xtall { height: 360px; }
.chart.short { height: 140px; }

/* Donut center label */
.donut-wrap { position: relative; }
.donut-center {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  flex-direction: column; pointer-events: none;
}
.donut-center .big { font-size: 22px; font-weight: 600; color: var(--text); }
.donut-center .lbl { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }

/* Search bar ---------------------------------------------- */
.search {
  display: inline-flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  width: 240px;
}
.search input { border: none; outline: none; background: transparent; flex: 1; color: var(--text); }
.search input::placeholder { color: var(--muted); }

/* Map placeholder ---------------------------------------- */
.map-shell {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-3);
}
.leaflet-container { background: var(--surface-3) !important; }
html[data-theme="light"] .leaflet-container { background: #e8f0f5 !important; }
.leaflet-popup-content-wrapper { background: var(--surface) !important; color: var(--text) !important; border: 1px solid var(--border) !important; box-shadow: var(--shadow-lg) !important; }
.leaflet-popup-tip { background: var(--surface) !important; }
.leaflet-popup-content { margin: 10px 14px !important; font-size: 12.5px !important; font-family: var(--font-sans); }
.leaflet-control-zoom a {
  background: var(--surface) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}

/* Sparkline color stops via CSS vars (data colors palette) */
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* Tab strip ----------------------------------------------- */
.tabs {
  display: flex; gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.tabs .tab {
  padding: 8px 14px;
  font-size: 13px; font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabs .tab:hover { color: var(--text); }
.tabs .tab.active { color: var(--navy); border-color: var(--cyan); font-weight: 600; }
html[data-theme="dark"] .tabs .tab.active { color: var(--cyan-2); }

/* Dropdown menu ------------------------------------------- */
.menu {
  position: absolute;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 50;
  min-width: 200px;
}
.menu .opt {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 5px;
  cursor: pointer;
  color: var(--text-2);
}
.menu .opt:hover { background: var(--surface-2); color: var(--text); }
.menu .opt.active { background: var(--cyan-soft); color: var(--navy); }
.menu .opt .check { margin-left: auto; opacity: 0; font-size: 11px; }
.menu .opt.active .check { opacity: 1; }
.menu .sep { height: 1px; background: var(--border-soft); margin: 4px 0; }
.menu .head { font-size: 10px; font-weight: 600; letter-spacing: .8px; text-transform: uppercase; color: var(--muted); padding: 8px 10px 4px; }

/* Dropzone ----------------------------------------------- */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 40px 24px;
  text-align: center;
  transition: all .15s ease;
  cursor: pointer;
}
.dropzone:hover, .dropzone.over {
  border-color: var(--cyan);
  background: var(--cyan-soft);
}
.dropzone .big { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.dropzone .small { font-size: 12px; color: var(--muted); }
.dropzone .formats {
  display: inline-flex; gap: 6px; margin-top: 12px;
}
.dropzone .formats .fmt {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  color: var(--muted);
}

/* List rows ---------------------------------------------- */
.row-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13px;
  cursor: pointer;
}
.row-item:hover { background: var(--surface-2); }
.row-item:last-child { border-bottom: none; }
.row-item .avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--surface-3); color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 12px; flex: 0 0 34px;
}
.row-item .avatar.cyan { background: var(--cyan-soft); color: var(--navy); }
.row-item .avatar.navy { background: var(--navy); color: white; }
.row-item .avatar.warn { background: var(--warn-bg); color: var(--warn); }

.row-item .main-info { flex: 1; min-width: 0; }
.row-item .main-info .t1 { color: var(--text); font-weight: 500; }
.row-item .main-info .t2 { color: var(--muted); font-size: 12px; }
.row-item .meta { color: var(--muted); font-size: 12px; }

/* Mini table ---------------------------------------------- */
.mini { font-size: 12px; }
.mini th { font-size: 10px; padding: 6px 10px; }
.mini td { padding: 7px 10px; }

/* Misc helpers ------------------------------------------- */
.muted { color: var(--muted); }
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.aic { align-items: center; }
.jcb { justify-content: space-between; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-24 { gap: 24px; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.txt-xs { font-size: 11px; } .txt-sm { font-size: 12px; } .txt-md { font-size: 14px; } .txt-lg { font-size: 16px; }
.fw-6 { font-weight: 600; } .fw-5 { font-weight: 500; }
.txt-good { color: var(--good); } .txt-warn { color: var(--warn); } .txt-bad { color: var(--bad); }
.txt-navy { color: var(--navy); } .txt-cyan { color: var(--cyan); }
.text-right { text-align: right; }

.divider { height: 1px; background: var(--border-soft); margin: 16px 0; }

/* Tooltip-ish hover labels for rows */
.kbd { font-family: var(--font-mono); font-size: 11px; padding: 1px 5px; border-radius: 3px; background: var(--surface-2); border: 1px solid var(--border-soft); color: var(--muted); }

/* Scrollbars (subtle) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 5px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--muted-2); }
::-webkit-scrollbar-track { background: transparent; }

/* Loading shimmer */
@keyframes shimmer { 0% { background-position: -200px 0; } 100% { background-position: 200px 0; } }
.shimmer { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 400px 100%; animation: shimmer 1.5s infinite; border-radius: 4px; }

/* Bar segments (horizontal stacked rows) */
.hbar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; display: flex; }
.hbar > span { display: block; height: 100%; }

/* Cluster card */
.cluster-card {
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.empty {
  text-align: center; padding: 40px 20px;
  color: var(--muted); font-size: 13px;
}
.empty .ico { font-size: 32px; color: var(--muted-2); margin-bottom: 8px; }

/* Tweaks panel */
.tweaks-panel {
  position: fixed; right: 18px; bottom: 18px; z-index: 100;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 290px;
  padding: 16px;
  font-size: 13px;
}
.tweaks-panel h4 { margin: 0 0 12px; font-size: 13px; color: var(--text); display: flex; align-items: center; justify-content: space-between; }
.tweaks-panel h4 button { background: none; border: none; color: var(--muted); cursor: pointer; }
.tweak-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.tweak-row label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; font-weight: 600; }
.tweak-row .swatches { display: flex; gap: 6px; }
.tweak-row .sw { width: 28px; height: 28px; border-radius: 50%; cursor: pointer; border: 2px solid var(--border); }
.tweak-row .sw.active { border-color: var(--text); }

/* Modal --------------------------------------------------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(2,20,33,.55);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 580px;
  max-height: 82vh;
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: fadeIn .15s ease-out;
}
.modal-box.wide { max-width: 900px; }
.modal-h {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border-soft);
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; flex-shrink: 0;
}
.modal-h h3 { margin: 0; font-size: 15px; }
.modal-b { padding: 18px 20px; overflow-y: auto; flex: 1; }

/* Pagination ---------------------------------------------- */
.pagination {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  border-top: 1px solid var(--border-soft);
  background: var(--surface-2);
  border-radius: 0 0 var(--radius) var(--radius);
}

/* Toast --------------------------------------------------- */
.toast-container {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 6px;
  z-index: 300; pointer-events: none;
}
.toast {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px;
  border-radius: 999px;
  background: var(--navy); color: white;
  font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: fadeInUp .2s ease;
  white-space: nowrap;
}
.toast.warn { background: var(--warn); }
.toast.bad  { background: var(--bad); }
.toast.info { background: var(--info); }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* Extra utility */
.gap-4 { gap: 4px; }
.col-3 { grid-column: span 3; }
.col-9 { grid-column: span 9; }
.col-2 { grid-column: span 2; }

/* Resolved alert (dim) */
.alert-resolved { opacity: .45; filter: grayscale(.6); }

/* Focus visible — accessibility */
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, [tabindex="0"]:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Sortable table headers */
.tbl th.sortable { cursor: pointer; user-select: none; }
.tbl th.sortable:hover { color: var(--text); background: var(--surface-2); }
.tbl th.sorted { color: var(--cyan); }
.sort-icon { font-size: 9px; margin-left: 3px; opacity: .35; transition: opacity .1s; }
th.sorted .sort-icon { opacity: 1; }

/* Form controls */
.form-label {
  display: block; font-size: 11px; font-weight: 600;
  color: var(--muted); text-transform: uppercase; letter-spacing: .5px;
  margin-bottom: 5px;
}
.form-input {
  width: 100%; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font-family: var(--font); font-size: 13px;
  transition: border-color .15s, box-shadow .15s;
  box-sizing: border-box;
}
.form-input:focus {
  outline: none; border-color: var(--cyan);
  box-shadow: 0 0 0 3px var(--cyan-soft);
}
select.form-input { cursor: pointer; }
.form-row { margin-bottom: 14px; }
.form-row:last-of-type { margin-bottom: 0; }
