/* ============================================================
   Active Aries — design system
   Brand: vivid Aries blue (#29A9E1) over deep navy chrome, on a
   cool off-white ground. Inter (UI) + Space Grotesk (display),
   both self-hosted. No gradients except the sidebar and the hero.
   ============================================================ */

:root {
  --brand: #29A9E1;
  --brand-deep: #1B6FB5;
  --brand-dark: #14568F;
  --brand-soft: #E8F5FC;
  --brand-soft-2: #D3ECFA;
  --brand-ink: #0E2A3F;

  --navy-950: #071522;
  --navy-900: #0B2033;
  --navy-800: #10293E;
  --navy-700: #17364E;

  --ink: #16212B;
  --ink-2: #23323F;
  --slate: #405264;
  --muted: #64748B;
  --faint: #94A3B8;

  --bg: #F4F7FA;
  --card: #FFFFFF;
  --line: #E3EAF0;
  --line-soft: #EEF3F7;

  --ok: #12996A;
  --ok-soft: #E4F6EE;
  --warn: #D98005;
  --warn-soft: #FDF3E3;
  --err: #D9424E;
  --err-soft: #FDECEE;
  --purple: #7C5CD6;
  --purple-soft: #F1ECFC;
  --teal: #0E9FB5;
  --teal-soft: #E2F6F9;
  --amber: #E0A106;

  --shadow-xs: 0 1px 2px rgba(16, 41, 62, .06);
  --shadow-sm: 0 1px 2px rgba(16, 41, 62, .05), 0 2px 8px rgba(16, 41, 62, .04);
  --shadow-md: 0 4px 14px rgba(16, 41, 62, .08), 0 1px 4px rgba(16, 41, 62, .05);
  --shadow-lg: 0 18px 48px rgba(9, 26, 43, .17);
  --shadow-brand: 0 6px 20px rgba(41, 169, 225, .28);

  --r-xs: 6px;
  --r-sm: 9px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;

  --sidebar-w: 256px;
  --topbar-h: 62px;

  --font: 'Inter', -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Space Grotesk', 'Inter', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, h3, h4 { font-family: var(--display); letter-spacing: -.012em; color: var(--brand-ink); font-weight: 700; }
a { color: var(--brand-deep); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
::selection { background: var(--brand); color: #fff; }
svg { flex-shrink: 0; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #C8D4E0; border-radius: 6px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #AAB9C8; border: 2px solid transparent; background-clip: content-box; }

/* ---------- wordmark ---------- */
.wordmark { font-family: var(--display); font-weight: 800; letter-spacing: .055em; line-height: 1; white-space: nowrap; }
.wordmark .w-a { color: var(--ink); }
.wordmark .w-b { color: var(--brand); }
.wordmark.on-dark .w-a { color: #fff; }
.tagline {
  font-size: 9px; letter-spacing: .17em; text-transform: uppercase;
  color: var(--muted); font-weight: 600; line-height: 1.45;
}

/* ---------- app shell ---------- */
#app { min-height: 100vh; }
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  background: linear-gradient(178deg, var(--navy-800) 0%, var(--navy-950) 100%);
  color: #C3D2E0;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  z-index: 40;
}
.sidebar::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(520px 300px at -10% 0%, rgba(41, 169, 225, .18), transparent 70%);
}
.sidebar > * { position: relative; z-index: 1; }
.sidebar-brand {
  display: flex; align-items: center; gap: 11px;
  padding: 16px 16px 15px;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.logo-chip {
  width: 42px; height: 42px; border-radius: 12px; background: #fff;
  display: grid; place-items: center; flex-shrink: 0;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .32);
}
.logo-chip img { width: 30px; height: 30px; }
.sidebar-brand .wordmark { font-size: 16.5px; }
.sidebar-brand .tagline { color: #7E97AE; font-size: 8px; margin-top: 4px; letter-spacing: .15em; }

.nav { flex: 1; overflow-y: auto; padding: 12px 10px 6px; }
.nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .13); border: 2px solid transparent; background-clip: content-box; }
.nav-section {
  font-size: 9.5px; font-weight: 700; letter-spacing: .15em; text-transform: uppercase;
  color: #5F7893; padding: 15px 10px 5px;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 10px; margin: 1px 0; border-radius: 9px;
  color: #AEC0D1; font-size: 13.5px; font-weight: 500;
  cursor: pointer; user-select: none; position: relative;
  transition: background .15s, color .15s;
}
.nav-item svg { width: 18px; height: 18px; opacity: .82; }
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
.nav-item.active { background: linear-gradient(90deg, rgba(41, 169, 225, .3), rgba(41, 169, 225, .08)); color: #fff; }
.nav-item.active::before {
  content: ''; position: absolute; left: -10px; top: 7px; bottom: 7px; width: 3px;
  background: var(--brand); border-radius: 0 3px 3px 0;
}
.nav-item.active svg { opacity: 1; color: #6FCBF2; }
.nav-badge {
  margin-left: auto; background: var(--brand); color: #fff;
  font-size: 10.5px; font-weight: 700; min-width: 19px; height: 19px;
  display: grid; place-items: center; border-radius: 10px; padding: 0 5px;
}
.nav-badge.warn { background: var(--warn); }
.nav-badge.err { background: var(--err); }
.sidebar-foot {
  padding: 12px 16px 14px; border-top: 1px solid rgba(255, 255, 255, .07);
  font-size: 10.5px; color: #6D839A; line-height: 1.6;
}
.sidebar-foot b { color: #A9BCCE; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: var(--topbar-h); background: var(--card); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px; padding: 0 20px;
  position: sticky; top: 0; z-index: 30;
}
.page-title { font-family: var(--display); font-weight: 700; font-size: 17px; color: var(--brand-ink); }
.page-sub { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.top-search {
  margin-left: auto; display: flex; align-items: center; gap: 8px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  padding: 7px 11px; color: var(--muted); font-size: 13px; cursor: pointer;
  min-width: 250px; transition: border-color .15s, box-shadow .15s;
}
.top-search:hover { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.top-search kbd {
  margin-left: auto; font-family: var(--font); font-size: 10px; font-weight: 600;
  background: #fff; border: 1px solid var(--line); border-radius: 5px; padding: 1.5px 5px; color: var(--faint);
}
.top-icon {
  width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--card); color: var(--slate); display: grid; place-items: center;
  cursor: pointer; position: relative; transition: background .15s, border-color .15s;
}
.top-icon:hover { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-deep); }
.top-icon .dot {
  position: absolute; top: 6px; right: 6px; width: 8px; height: 8px;
  background: var(--err); border-radius: 50%; border: 2px solid #fff;
}
.user-pill {
  display: flex; align-items: center; gap: 9px; padding: 5px 10px 5px 5px;
  border-radius: 999px; border: 1px solid var(--line); cursor: pointer; background: var(--card);
  transition: border-color .15s, background .15s;
}
.user-pill:hover { border-color: var(--brand); background: var(--brand-soft); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-deep)); color: #fff;
  font-size: 11.5px; font-weight: 700; letter-spacing: .02em; flex-shrink: 0;
}
.avatar.lg { width: 44px; height: 44px; font-size: 15px; }
.avatar.sm { width: 24px; height: 24px; font-size: 9.5px; }
.u-name { font-size: 12.5px; font-weight: 600; line-height: 1.2; }
.u-role { font-size: 10.5px; color: var(--muted); text-transform: capitalize; }

.content { padding: 20px 22px 60px; flex: 1; min-width: 0; }
.view { animation: fade .22s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

/* ---------- layout helpers ---------- */
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spacer { margin-left: auto; }
.mb { margin-bottom: 14px; }
.mb-lg { margin-bottom: 22px; }
.mt { margin-top: 14px; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: 1.55fr 1fr; gap: 16px; align-items: start; }
.split-3 { display: grid; grid-template-columns: 300px 1fr; gap: 16px; align-items: start; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pos { color: var(--ok); }
.neg { color: var(--err); }

/* ---------- cards ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.card-h {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border-bottom: 1px solid var(--line-soft);
}
.card-h h3 { font-size: 14.5px; }
.card-h .sub { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.card-b { padding: 16px; }
.card-b.tight { padding: 10px 12px; }
.card-f { padding: 11px 16px; border-top: 1px solid var(--line-soft); background: #FBFDFE; border-radius: 0 0 var(--r-lg) var(--r-lg); }
.card.flat { box-shadow: none; }
.card.brand { border-color: var(--brand-soft-2); background: linear-gradient(180deg, #fff, var(--brand-soft)); }

/* ---------- stat tiles ---------- */
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 14px 15px; box-shadow: var(--shadow-xs); position: relative; overflow: hidden;
}
.stat .s-top { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.stat .s-ic {
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand-deep);
}
.stat .s-ic.ok { background: var(--ok-soft); color: var(--ok); }
.stat .s-ic.warn { background: var(--warn-soft); color: var(--warn); }
.stat .s-ic.err { background: var(--err-soft); color: var(--err); }
.stat .s-ic.purple { background: var(--purple-soft); color: var(--purple); }
.stat .s-ic.teal { background: var(--teal-soft); color: var(--teal); }
.stat .s-label { font-size: 11.5px; color: var(--muted); font-weight: 600; letter-spacing: .01em; }
.stat .s-value { font-family: var(--display); font-size: 25px; font-weight: 700; color: var(--brand-ink); line-height: 1.05; }
.stat .s-sub { font-size: 11.5px; color: var(--muted); margin-top: 4px; display: flex; align-items: center; gap: 5px; }
.stat.clickable { cursor: pointer; transition: transform .14s, box-shadow .14s, border-color .14s; }
.stat.clickable:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--brand-soft-2); }
.delta { font-weight: 700; font-size: 11.5px; }
.delta.up { color: var(--ok); }
.delta.down { color: var(--err); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink-2);
  padding: 8px 13px; border-radius: 9px; font-size: 13px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  transition: background .14s, border-color .14s, box-shadow .14s, transform .1s;
}
.btn:hover { border-color: #C9D6E2; background: #FAFCFE; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: var(--shadow-brand); }
.btn-primary:hover { background: var(--brand-deep); border-color: var(--brand-deep); color: #fff; }
.btn-dark { background: var(--brand-ink); border-color: var(--brand-ink); color: #fff; }
.btn-dark:hover { background: var(--navy-800); border-color: var(--navy-800); color: #fff; }
.btn-soft { background: var(--brand-soft); border-color: var(--brand-soft-2); color: var(--brand-dark); }
.btn-soft:hover { background: var(--brand-soft-2); border-color: var(--brand); color: var(--brand-dark); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--slate); }
.btn-ghost:hover { background: var(--line-soft); border-color: transparent; }
.btn-danger { background: var(--err); border-color: var(--err); color: #fff; }
.btn-danger:hover { background: #C2313D; border-color: #C2313D; color: #fff; }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-ok:hover { background: #0E8259; border-color: #0E8259; color: #fff; }
.btn-sm { padding: 5.5px 10px; font-size: 12px; border-radius: 8px; }
.btn-sm svg { width: 14px; height: 14px; }
.btn-lg { padding: 11px 20px; font-size: 14px; border-radius: 11px; }
.btn-block { width: 100%; }
.x-btn {
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid transparent;
  background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; font-size: 15px;
}
.x-btn:hover { background: var(--line-soft); color: var(--ink); }
.btn-group { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--card); }
.btn-group button {
  border: 0; background: transparent; padding: 7px 12px; font-size: 12.5px; font-weight: 600;
  color: var(--slate); cursor: pointer; border-right: 1px solid var(--line);
}
.btn-group button:last-child { border-right: 0; }
.btn-group button.active { background: var(--brand-soft); color: var(--brand-dark); }
.btn-group button:hover:not(.active) { background: var(--line-soft); }

/* ---------- chips & badges ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2.5px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  background: var(--line-soft); color: var(--slate); white-space: nowrap; line-height: 1.5;
}
.chip::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .75; }
.chip.plain::before { display: none; }
.c-grey { background: #EEF2F6; color: #5A6B7C; }
.c-blue { background: var(--brand-soft); color: var(--brand-dark); }
.c-green { background: var(--ok-soft); color: var(--ok); }
.c-amber { background: var(--warn-soft); color: #A96204; }
.c-red { background: var(--err-soft); color: #B93440; }
.c-purple { background: var(--purple-soft); color: #5F44AC; }
.c-teal { background: var(--teal-soft); color: #0A7E90; }
.c-navy { background: #E7EDF3; color: var(--brand-ink); }
.chip.live::before { animation: pulse 1.6s infinite; }
@keyframes pulse { 0%, 100% { opacity: .3; } 50% { opacity: 1; } }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--line); font-size: 11.5px; font-weight: 600; color: var(--slate); background: #fff;
}
.tag {
  display: inline-block; padding: 1.5px 8px; border-radius: 6px; font-size: 11px; font-weight: 600;
  background: var(--brand-soft); color: var(--brand-dark);
}
.dot-sep { color: var(--faint); margin: 0 6px; }

/* ---------- tables ---------- */
.table-wrap { width: 100%; overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl thead th {
  text-align: left; font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted); padding: 9px 12px; border-bottom: 1px solid var(--line);
  background: #FAFCFD; white-space: nowrap; cursor: pointer; user-select: none; position: sticky; top: 0; z-index: 2;
}
.tbl thead th.num, .tbl td.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl thead th:hover { color: var(--brand-deep); }
.tbl thead th .arr { margin-left: 4px; font-size: 8px; color: var(--brand); }
.tbl tbody td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl tbody tr.clickable:hover { background: #F7FBFD; }
.tbl tbody tr.row-warn { background: #FFFBF3; }
.tbl tbody tr.row-err { background: #FFF7F8; }
.tbl-foot { padding: 9px 12px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); background: #FAFCFD; }
.t-main { font-weight: 600; color: var(--ink); }
.t-sub { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.cell-stack { display: flex; flex-direction: column; line-height: 1.35; }

/* ---------- forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.form-grid.g1 { grid-template-columns: 1fr; }
.form-grid.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 11.5px; font-weight: 600; color: var(--slate); }
.field .req { color: var(--err); }
.input {
  width: 100%; padding: 8.5px 11px; border: 1px solid var(--line); border-radius: 9px;
  font-size: 13.5px; color: var(--ink); background: #fff; transition: border-color .14s, box-shadow .14s;
}
.input:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.input:disabled, .input[readonly] { background: #F7F9FB; color: var(--muted); }
textarea.input { min-height: 82px; resize: vertical; line-height: 1.55; }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M5 9l7 7 7-7'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }
.input-note { font-size: 11px; color: var(--muted); }
.input-err { border-color: var(--err) !important; }
.checkbox-row {
  display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--ink-2);
  padding: 8px 11px; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; background: #fff;
}
.checkbox-row:hover { border-color: var(--brand-soft-2); background: var(--brand-soft); }
.checkbox-row input { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; }
.checkbox-row.full { grid-column: 1 / -1; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 9px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  width: 38px; height: 21px; border-radius: 999px; background: #CBD5E1; position: relative; transition: background .18s;
}
.switch .track::after {
  content: ''; position: absolute; top: 2.5px; left: 2.5px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; box-shadow: var(--shadow-xs); transition: transform .18s;
}
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(17px); }
.fieldset-title {
  grid-column: 1 / -1; font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--brand-deep); margin-top: 6px; padding-bottom: 5px; border-bottom: 1px solid var(--line-soft);
}

/* ---------- filter bar ---------- */
.toolbar {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.search-box { position: relative; flex: 1; min-width: 200px; max-width: 380px; }
.search-box svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); width: 16px; height: 16px; }
.search-box .input { padding-left: 34px; }
.filter-select { min-width: 130px; }
.filter-select .input { padding-top: 7.5px; padding-bottom: 7.5px; font-size: 12.5px; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tab {
  padding: 9px 14px; font-size: 13px; font-weight: 600; color: var(--muted);
  cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap;
  display: flex; align-items: center; gap: 7px; background: none; border-top: 0; border-left: 0; border-right: 0;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--brand-deep); border-bottom-color: var(--brand); }
.tab .count {
  background: var(--line-soft); color: var(--slate); font-size: 10.5px; font-weight: 700;
  padding: 1px 6px; border-radius: 999px;
}
.tab.active .count { background: var(--brand-soft); color: var(--brand-dark); }

/* ---------- overlays ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(11, 32, 51, .45); backdrop-filter: blur(2px);
  display: grid; place-items: center; z-index: 100; padding: 20px; animation: fade .16s;
}
.modal {
  background: var(--card); border-radius: var(--r-xl); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 560px; max-height: 88vh; display: flex; flex-direction: column;
  animation: pop .2s cubic-bezier(.2, .9, .3, 1.2);
}
.modal.wide { max-width: 900px; }
.modal.xwide { max-width: 1180px; }
@keyframes pop { from { transform: scale(.96) translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-h { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line-soft); }
.modal-h h3 { font-size: 16px; flex: 1; }
.modal-b { padding: 18px; overflow-y: auto; flex: 1; }
.modal-f { padding: 13px 18px; border-top: 1px solid var(--line-soft); display: flex; gap: 9px; justify-content: flex-end; background: #FBFDFE; border-radius: 0 0 var(--r-xl) var(--r-xl); }

.drawer-wrap { position: fixed; inset: 0; z-index: 100; }
.drawer-wrap .overlay { position: absolute; z-index: 0; }
/* the panel sits above its own backdrop, or every click lands on the backdrop */
.drawer {
  position: absolute; right: 0; top: 0; bottom: 0; width: min(560px, 96vw); z-index: 1;
  background: var(--card); box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
  animation: slideIn .22s cubic-bezier(.2, .8, .3, 1);
}
.drawer.wide { width: min(880px, 98vw); }
@keyframes slideIn { from { transform: translateX(24px); opacity: .4; } to { transform: none; opacity: 1; } }
.drawer-h { display: flex; align-items: flex-start; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line-soft); }
.drawer-b { padding: 18px; overflow-y: auto; flex: 1; }
.drawer-f { padding: 13px 18px; border-top: 1px solid var(--line-soft); display: flex; gap: 9px; justify-content: flex-end; background: #FBFDFE; }

/* ---------- toasts ---------- */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 9px; }
.toast {
  background: var(--brand-ink); color: #fff; padding: 11px 15px; border-radius: 11px;
  box-shadow: var(--shadow-lg); font-size: 13px; max-width: 380px;
  display: flex; align-items: flex-start; gap: 9px; animation: toastIn .22s;
  border-left: 3px solid var(--brand);
}
.toast.ok { border-left-color: #38D39F; }
.toast.err { border-left-color: #FF7B85; }
.toast.warn { border-left-color: #FFC24D; }
.toast .t-sub { font-size: 11.5px; opacity: .78; font-weight: 400; margin-top: 2px; }
.toast.out { animation: toastOut .24s forwards; }
@keyframes toastIn { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toastOut { to { transform: translateX(30px); opacity: 0; } }

/* ---------- empty & loading ---------- */
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.empty .e-ic {
  width: 52px; height: 52px; border-radius: 15px; background: var(--brand-soft); color: var(--brand);
  display: grid; place-items: center; margin: 0 auto 12px;
}
.empty .e-ic svg { width: 26px; height: 26px; }
.empty b { display: block; font-size: 14.5px; color: var(--ink); margin-bottom: 3px; font-family: var(--display); }
.empty span { font-size: 12.5px; display: block; max-width: 380px; margin: 0 auto; }
.skeleton {
  background: linear-gradient(90deg, #EEF2F6 25%, #F7FAFC 50%, #EEF2F6 75%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 8px;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.sk-row { height: 44px; margin-bottom: 8px; }
.spinner {
  width: 18px; height: 18px; border: 2px solid var(--brand-soft-2); border-top-color: var(--brand);
  border-radius: 50%; animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- progress ---------- */
.bar { height: 7px; background: var(--line-soft); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--brand); border-radius: 999px; transition: width .5s ease; }
.bar > i.ok { background: var(--ok); }
.bar > i.warn { background: var(--warn); }
.bar > i.err { background: var(--err); }
.ring { position: relative; display: inline-grid; place-items: center; }
.ring svg { transform: rotate(-90deg); }
.ring .ring-val { position: absolute; font-family: var(--display); font-weight: 700; font-size: 13px; color: var(--brand-ink); }

/* ---------- timeline ---------- */
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ''; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl-item { position: relative; padding-bottom: 16px; }
.tl-item::before {
  content: ''; position: absolute; left: -20px; top: 4px; width: 10px; height: 10px;
  border-radius: 50%; background: #fff; border: 2px solid var(--brand);
}
.tl-item.ok::before { border-color: var(--ok); }
.tl-item.warn::before { border-color: var(--warn); }
.tl-item.err::before { border-color: var(--err); }
.tl-item.grey::before { border-color: var(--faint); }
.tl-title { font-size: 13px; font-weight: 600; color: var(--ink); }
.tl-meta { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.tl-body { font-size: 12.5px; color: var(--slate); margin-top: 4px; line-height: 1.55; }

/* ---------- list rows ---------- */
.list-row {
  display: flex; align-items: center; gap: 11px; padding: 11px 12px;
  border: 1px solid var(--line); border-radius: var(--r-md); background: #fff; margin-bottom: 8px;
  transition: border-color .14s, box-shadow .14s;
}
.list-row:hover { border-color: var(--brand-soft-2); box-shadow: var(--shadow-xs); }
.list-row.clickable { cursor: pointer; }
.list-row .lr-main { flex: 1; min-width: 0; }
.list-row .lr-title { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.list-row .lr-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.icon-badge {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand-deep); flex-shrink: 0;
}
.icon-badge.ok { background: var(--ok-soft); color: var(--ok); }
.icon-badge.warn { background: var(--warn-soft); color: var(--warn); }
.icon-badge.err { background: var(--err-soft); color: var(--err); }
.icon-badge.purple { background: var(--purple-soft); color: var(--purple); }
.icon-badge.grey { background: #EEF2F6; color: var(--slate); }

/* ---------- key/value display ---------- */
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 13px 18px; }
.kv .k { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.kv .v { font-size: 13.5px; color: var(--ink); font-weight: 500; margin-top: 2px; word-break: break-word; }
.kv .v.big { font-family: var(--display); font-size: 16px; font-weight: 700; color: var(--brand-ink); }

/* ---------- board (pipeline / claims) ---------- */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: flex-start; }
.board-col { min-width: 268px; flex: 1; background: #EFF4F8; border-radius: var(--r-md); padding: 10px; }
.board-col-h { display: flex; align-items: center; gap: 8px; padding: 2px 4px 10px; }
.board-col-h b { font-size: 12.5px; color: var(--brand-ink); }
.board-col-h .count { font-size: 11px; color: var(--muted); background: #fff; padding: 1px 7px; border-radius: 999px; }
.board-card {
  background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 11px;
  margin-bottom: 8px; cursor: pointer; box-shadow: var(--shadow-xs); transition: transform .12s, box-shadow .12s;
}
.board-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.board-card .bc-title { font-size: 13px; font-weight: 600; }
.board-card .bc-sub { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.board-card .bc-foot { display: flex; align-items: center; gap: 6px; margin-top: 8px; }

/* ---------- calendar ---------- */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.cal-head { background: #FAFCFD; padding: 8px; text-align: center; font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.cal-day { background: #fff; min-height: 96px; padding: 6px 7px; }
.cal-day.other { background: #FAFBFC; }
.cal-day.today { background: var(--brand-soft); }
.cal-day .cd-num { font-size: 11.5px; font-weight: 700; color: var(--slate); margin-bottom: 4px; }
.cal-day.today .cd-num { color: var(--brand-dark); }
.cal-ev {
  font-size: 10.5px; padding: 2px 5px; border-radius: 5px; margin-bottom: 3px; cursor: pointer;
  background: var(--brand-soft); color: var(--brand-dark); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cal-ev.birthday { background: var(--purple-soft); color: #5F44AC; }
.cal-ev.renewal { background: var(--warn-soft); color: #A96204; }
.cal-ev.claim { background: var(--err-soft); color: #B93440; }
.cal-ev.task { background: var(--ok-soft); color: var(--ok); }

/* ---------- charts ---------- */
.chart { width: 100%; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; font-size: 11.5px; color: var(--slate); }
.chart-legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; margin-right: 5px; }
.spark { display: block; }

/* ---------- documents ---------- */
.doc-tile {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: var(--r-md); background: #fff; cursor: pointer; transition: border-color .14s, box-shadow .14s;
}
.doc-tile:hover { border-color: var(--brand); box-shadow: var(--shadow-xs); }
.doc-ic { width: 34px; height: 42px; border-radius: 6px; background: var(--brand-soft); color: var(--brand-deep); display: grid; place-items: center; font-size: 9px; font-weight: 800; letter-spacing: .04em; }
.doc-ic.pdf { background: #FDECEE; color: #B93440; }
.doc-ic.img { background: var(--purple-soft); color: #5F44AC; }
.doc-ic.doc { background: var(--brand-soft); color: var(--brand-dark); }
.doc-ic.sheet { background: var(--ok-soft); color: var(--ok); }
.dropzone {
  border: 1.5px dashed var(--line); border-radius: var(--r-md); padding: 24px; text-align: center;
  color: var(--muted); font-size: 13px; cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.over { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); }

/* compliance checklist */
.check-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.check-row:last-child { border-bottom: 0; }
.check-ic { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; }
.check-ic.ok { background: var(--ok-soft); color: var(--ok); }
.check-ic.missing { background: var(--err-soft); color: var(--err); }
.check-ic.expiring { background: var(--warn-soft); color: var(--warn); }
.check-ic.expired { background: var(--err-soft); color: var(--err); }

/* ---------- signature pad ---------- */
.sig-pad {
  border: 1.5px dashed var(--line); border-radius: var(--r-md); background: #FCFDFE;
  position: relative; touch-action: none; cursor: crosshair; overflow: hidden;
}
.sig-pad canvas { display: block; width: 100%; height: 100%; }
.sig-pad .sig-hint {
  position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none;
  color: var(--faint); font-size: 12.5px;
}
.sig-pad.signed { border-style: solid; border-color: var(--brand-soft-2); background: #fff; }
.sig-line { border-top: 1px solid var(--slate); margin-top: 4px; padding-top: 5px; font-size: 11px; color: var(--muted); }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; }
.login-hero {
  background: linear-gradient(160deg, var(--navy-800), var(--navy-950) 60%, #04101B);
  color: #fff; padding: 46px 52px; display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
.login-hero::before {
  content: ''; position: absolute; width: 620px; height: 620px; border-radius: 50%;
  background: radial-gradient(circle, rgba(41, 169, 225, .3), transparent 62%);
  top: -180px; right: -190px;
}
.login-hero::after {
  content: ''; position: absolute; width: 420px; height: 420px; border-radius: 50%;
  background: radial-gradient(circle, rgba(27, 111, 181, .26), transparent 65%);
  bottom: -170px; left: -130px;
}
.login-hero > * { position: relative; z-index: 1; }
.login-hero h1 { color: #fff; font-size: 33px; line-height: 1.16; max-width: 460px; letter-spacing: -.02em; }
.login-hero p { color: #A9C0D4; font-size: 14.5px; margin-top: 14px; max-width: 430px; line-height: 1.6; }
.hero-points { display: flex; flex-direction: column; gap: 11px; margin-top: 28px; }
.hero-point { display: flex; align-items: center; gap: 11px; font-size: 13.5px; color: #C9DAE8; }
.hero-point .hp-ic {
  width: 30px; height: 30px; border-radius: 9px; background: rgba(41, 169, 225, .18);
  color: #6FCBF2; display: grid; place-items: center;
}
.login-panel { display: grid; place-items: center; padding: 34px; background: var(--card); }
.login-card { width: 100%; max-width: 380px; }
.login-card .lc-head { margin-bottom: 22px; }
.login-card h2 { font-size: 21px; }
.login-card .lc-sub { color: var(--muted); font-size: 13px; margin-top: 5px; }
.login-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.login-logo img { width: 48px; height: 48px; }
.login-err {
  background: var(--err-soft); color: #B93440; border: 1px solid #F6CFD3; border-radius: 9px;
  padding: 9px 12px; font-size: 12.5px; margin-bottom: 14px;
}
.login-foot { margin-top: 22px; font-size: 11.5px; color: var(--faint); line-height: 1.7; }

/* ---------- command palette ---------- */
.palette { width: 100%; max-width: 620px; background: var(--card); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); overflow: hidden; }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line-soft); }
.palette-input input { flex: 1; border: 0; outline: 0; font-size: 15px; color: var(--ink); }
.palette-list { max-height: 380px; overflow-y: auto; padding: 6px; }
.palette-item { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 9px; cursor: pointer; }
.palette-item:hover, .palette-item.sel { background: var(--brand-soft); }
.palette-item .pi-title { font-size: 13.5px; font-weight: 600; }
.palette-item .pi-sub { font-size: 11.5px; color: var(--muted); }
.palette-group { font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); padding: 10px 11px 4px; }

/* ---------- misc ---------- */
.divider { height: 1px; background: var(--line-soft); margin: 14px 0; }
.note-box { background: var(--brand-soft); border: 1px solid var(--brand-soft-2); border-radius: var(--r-md); padding: 11px 13px; font-size: 12.5px; color: var(--brand-dark); }
.note-box.warn { background: var(--warn-soft); border-color: #F5E2C0; color: #8A5104; }
.note-box.err { background: var(--err-soft); border-color: #F6CFD3; color: #B93440; }
.note-box.ok { background: var(--ok-soft); border-color: #C6EBDB; color: #0C7A54; }
.hint { font-size: 11.5px; color: var(--muted); }
.mono { font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; font-size: 12px; }
.link-btn { background: none; border: 0; color: var(--brand-deep); font-size: 12.5px; font-weight: 600; cursor: pointer; padding: 0; }
.link-btn:hover { text-decoration: underline; }

/* ---------- responsive ---------- */
@media (max-width: 1240px) {
  .g5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1080px) {
  .split, .split-3 { grid-template-columns: minmax(0, 1fr); }
  .login-wrap { grid-template-columns: 1fr; }
  .login-hero { display: none; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: 262px;
    transform: translateX(-100%); transition: transform .25s cubic-bezier(.2, .8, .3, 1);
  }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .content { padding: 16px 14px 60px; }
  .top-search { min-width: 0; flex: 1; }
  .top-search span, .top-search kbd { display: none; }
  .user-pill > div:not(.avatar) { display: none; }
  .g3, .g4, .g5, .g2 { grid-template-columns: 1fr; }
  .form-grid, .form-grid.g3 { grid-template-columns: 1fr; }
  .modal { max-height: 92vh; }
}
@media (min-width: 901px) { .burger { display: none; } }

/* ---------- print (schedules, packs, signed forms) ---------- */
@media print {
  .sidebar, .topbar, .toasts, .btn, .tabs { display: none !important; }
  .shell { grid-template-columns: 1fr; }
  .content { padding: 0; }
  .card { box-shadow: none; border-color: #ccc; break-inside: avoid; }
  body { background: #fff; }
}
