/* =====================================================================
   EsoTech Dashboard theme — EsoTech AI brand (teal #0F766E + near-black #111)
   Hand-written, no build step required.
   ===================================================================== */

:root {
  --font-body: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Space Grotesk", "Manrope", system-ui, sans-serif;

  --ink: #111111;
  --ink-2: #3c3c3c;
  --muted: #62676a;
  --faint: #9a9fa1;

  --bg: #f5f6f6;
  --surface: #ffffff;
  --surface-2: #f9fafa;
  --surface-3: #eff1f1;
  --border: #e4e7e6;
  --border-strong: #cfd4d3;

  --brand: #0F766E;
  --brand-strong: #0B5F58;
  --brand-ink: #ffffff;
  --brand-soft: #E6F4F2;
  --brand-ring: rgba(15, 118, 110, .18);

  --accent: #14B8A6;
  --accent-strong: #0F766E;
  --accent-ink: #042F2E;
  --accent-soft: #DDF5F1;

  --success: #13803c;
  --success-soft: #e3f6ea;
  --warning: #b45309;
  --warning-soft: #fdf0dc;
  --danger: #c8262a;
  --danger-soft: #fde7e7;
  --info: #1f62b4;
  --info-soft: #e5effb;
  --neutral-soft: #eef0f6;

  --side-bg-1: #171818;
  --side-bg-2: #0b0c0c;
  --side-text: #d6d8d8;
  --side-muted: #8d9393;
  --side-active: rgba(20, 184, 166, .15);

  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(17, 17, 17, .06);
  --shadow: 0 1px 2px rgba(17, 17, 17, .05), 0 8px 24px -12px rgba(17, 17, 17, .16);
  --shadow-lg: 0 24px 60px -20px rgba(11, 12, 12, .35);
  --sidebar-w: 268px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #ececec; --ink-2: #c8cbcb; --muted: #a0a6a6; --faint: #707676;
    --bg: #0d0e0e; --surface: #161818; --surface-2: #1b1d1d; --surface-3: #222525;
    --border: #2a2d2d; --border-strong: #3a3e3e;
    --brand: #2DD4BF; --brand-strong: #5EEAD4; --brand-ink: #042F2E; --brand-soft: #0f2e2b; --brand-ring: rgba(45, 212, 191, .25);
    --accent-soft: #0f2e2b; --accent-ink: #042F2E;
    --success: #4ade80; --success-soft: #0f2d1c; --warning: #fbbf24; --warning-soft: #33260b;
    --danger: #f87171; --danger-soft: #3a1416; --info: #7cb4ff; --info-soft: #11233d; --neutral-soft: #232626;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px -12px rgba(0, 0, 0, .6);
  }
}
:root[data-theme="dark"] {
  --ink: #ececec; --ink-2: #c8cbcb; --muted: #a0a6a6; --faint: #707676;
  --bg: #0d0e0e; --surface: #161818; --surface-2: #1b1d1d; --surface-3: #222525;
  --border: #2a2d2d; --border-strong: #3a3e3e;
  --brand: #2DD4BF; --brand-strong: #5EEAD4; --brand-ink: #042F2E; --brand-soft: #0f2e2b; --brand-ring: rgba(45, 212, 191, .25);
  --accent-soft: #0f2e2b; --accent-ink: #042F2E;
  --success: #4ade80; --success-soft: #0f2d1c; --warning: #fbbf24; --warning-soft: #33260b;
  --danger: #f87171; --danger-soft: #3a1416; --info: #7cb4ff; --info-soft: #11233d; --neutral-soft: #232626;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px -12px rgba(0, 0, 0, .6);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 500 14.5px/1.55 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4 { font-family: var(--font-display); letter-spacing: -.01em; margin: 0; color: var(--ink); }
h1 { font-size: 1.55rem; font-weight: 700; }
h2 { font-size: 1.12rem; font-weight: 700; }
h3 { font-size: .98rem; font-weight: 700; }
p { margin: 0; }
hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
.num, .money { font-family: var(--font-display); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.mso { font-family: "Material Symbols Outlined"; font-weight: normal; font-style: normal; font-size: 20px; line-height: 1; display: inline-block; vertical-align: middle; font-variation-settings: "FILL" 0, "wght" 500, "GRAD" 0, "opsz" 24; user-select: none; }

/* ---------- App shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background:
    radial-gradient(600px 300px at -20% -10%, rgba(20, 184, 166, .18), transparent 60%),
    linear-gradient(180deg, var(--side-bg-1), var(--side-bg-2));
  color: var(--side-text); padding: 18px 14px 24px; display: flex; flex-direction: column; gap: 18px;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 10px; color: #fff; }
.brand:hover { text-decoration: none; }
.brand img { width: 42px; height: 42px; border-radius: 50%; background: #fff; }
.brand .et-logo { width: 40px; height: 40px; color: #fff; flex: none; }
.brand strong { display: block; font-family: var(--font-display); font-size: 1.08rem; letter-spacing: .01em; }
.brand small { display: block; color: var(--side-muted); font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .12em; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: .68rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--side-muted); padding: 0 12px 6px; }
.nav-link {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px;
  color: var(--side-text); font-weight: 600; font-size: .92rem; position: relative; transition: background .15s, color .15s;
}
.nav-link .mso { font-size: 20px; color: var(--side-muted); transition: color .15s; }
.nav-link:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.nav-link:hover .mso { color: #fff; }
.nav-link.active { background: var(--side-active); color: #fff; }
.nav-link.active .mso { color: var(--accent); }
.nav-link.active::before { content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--accent); }
.nav-count { margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 99px; background: var(--accent); color: var(--accent-ink); font-size: .72rem; font-weight: 800; text-align: center; }
.nav-count.muted { background: rgba(255,255,255,.12); color: #fff; }
.sidebar-foot { margin-top: auto; padding: 12px; border-radius: 12px; background: rgba(255,255,255,.05); font-size: .78rem; color: var(--side-muted); }
.sidebar-foot a { color: var(--accent); font-weight: 700; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px;
  padding: 12px 28px; background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--border);
}
.menu-btn { display: none; }
.search { position: relative; flex: 1; max-width: 520px; }
.search .mso { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.search input { width: 100%; padding: 10px 14px 10px 40px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--ink); font: inherit; }
.search input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-ring); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--ink-2); display: inline-grid; place-items: center; cursor: pointer; }
.icon-btn:hover { border-color: var(--border-strong); color: var(--ink); }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 800; font-size: .8rem; background: linear-gradient(135deg, var(--brand), #14B8A6); color: #fff; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 10px 4px 4px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; list-style: none; }
.user-chip::-webkit-details-marker { display: none; }
.user-chip strong { display: block; font-size: .82rem; line-height: 1.1; }
.user-chip small { display: block; font-size: .7rem; color: var(--muted); }

.content { padding: 26px 28px 60px; max-width: 1480px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head .eyebrow { font-size: .72rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; display: flex; gap: 6px; align-items: center; }
.page-head .eyebrow a { color: var(--muted); }
.page-head p.sub { color: var(--muted); margin-top: 4px; max-width: 720px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Cards & layout ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-head h2, .card-head h3 { display: flex; align-items: center; gap: 8px; }
.card-head .mso { color: var(--brand); }
.card-body { padding: 18px 20px; }
.card-foot { padding: 12px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.grid { display: grid; gap: 18px; }
.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-main { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: 18px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: .82rem; }
.tiny { font-size: .74rem; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.strong { font-weight: 800; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 18px; } .mt-4 { margin-top: 26px; }
.mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 18px; }
.w-100 { width: 100%; }
.hide { display: none !important; }
.divider { height: 1px; background: var(--border); margin: 14px 0; }

/* ---------- Hero banner ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 20px; padding: 26px 28px; color: #fff;
  background:
    radial-gradient(420px 220px at 92% 10%, rgba(20,184,166,.35), transparent 65%),
    radial-gradient(500px 300px at 10% 120%, rgba(110, 99, 255, .45), transparent 60%),
    linear-gradient(120deg, #0B5F58, #0b0c0c 75%);
  box-shadow: var(--shadow-lg);
}
.hero h1 { color: #fff; font-size: 1.7rem; }
.hero p { color: #cfe9e5; }
.hero .star { position: absolute; right: -30px; top: -40px; width: 220px; height: 220px; opacity: .14; pointer-events: none; }
.hero .star .et-logo { width: 220px; height: 220px; }
.hero .star .et-logo .et-e { fill: #2DD4BF; }
.hero-metrics { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin-top: 22px; }
.hero-metric { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); border-radius: 14px; padding: 14px 16px; }
.hero-metric span { display: block; font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #a7d8d1; }
.hero-metric strong { display: block; font-family: var(--font-display); font-size: 1.35rem; margin-top: 4px; }
.hero-metric small { color: #a7d8d1; font-size: .75rem; }
.hero-metric.accent { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.hero-metric.accent span, .hero-metric.accent small { color: #4a3f00; }

/* ---------- KPI tiles ---------- */
.stat { padding: 16px 18px; display: flex; gap: 14px; align-items: flex-start; }
.stat-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; background: var(--brand-soft); color: var(--brand); }
.stat-icon .mso { font-size: 22px; }
.stat.tone-success .stat-icon { background: var(--success-soft); color: var(--success); }
.stat.tone-warning .stat-icon { background: var(--warning-soft); color: var(--warning); }
.stat.tone-danger .stat-icon { background: var(--danger-soft); color: var(--danger); }
.stat.tone-accent .stat-icon { background: var(--accent-soft); color: #8a6d00; }
.stat-label { font-size: .74rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.stat-value { font-family: var(--font-display); font-size: 1.38rem; font-weight: 700; margin-top: 2px; line-height: 1.2; }
.stat-hint { font-size: .78rem; color: var(--muted); margin-top: 2px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .9rem; }
.tbl th { text-align: left; font-size: .7rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 11px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .right { text-align: right; }
.tbl td.title a { font-weight: 700; color: var(--ink); }
.tbl td .sub { display: block; font-size: .78rem; color: var(--muted); }
.tbl tfoot td { font-weight: 800; background: var(--surface-2); border-top: 1px solid var(--border); }
.tbl-compact td, .tbl-compact th { padding: 8px 12px; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: .74rem; font-weight: 800; white-space: nowrap; background: var(--neutral-soft); color: var(--ink-2); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.plain::before { display: none; }
.badge.success { background: var(--success-soft); color: var(--success); }
.badge.warning { background: var(--warning-soft); color: var(--warning); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.brand { background: var(--brand-soft); color: var(--brand); }
.badge.accent { background: var(--accent); color: var(--accent-ink); }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 6px; background: var(--surface-3); color: var(--ink-2); font-size: .76rem; font-weight: 700; }

/* ---------- Buttons ---------- */
.btn {
  --b: var(--surface); --c: var(--ink); --bd: var(--border-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 11px;
  border: 1px solid var(--bd); background: var(--b); color: var(--c); font: 700 .88rem/1.2 var(--font-body);
  cursor: pointer; white-space: nowrap; transition: transform .08s, box-shadow .15s, background .15s, border-color .15s;
}
.btn:hover { text-decoration: none; border-color: var(--brand); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(1px); }
.btn .mso { font-size: 18px; }
.btn-primary { --b: var(--brand); --c: var(--brand-ink); --bd: var(--brand); box-shadow: 0 6px 16px -8px var(--brand); }
.btn-primary:hover { --b: var(--brand-strong); border-color: var(--brand-strong); }
.btn-accent { --b: var(--accent); --c: var(--accent-ink); --bd: var(--accent-strong); }
.btn-accent:hover { --b: #ffd21f; border-color: var(--accent-strong); }
.btn-danger { --b: var(--danger); --c: #fff; --bd: var(--danger); }
.btn-success { --b: var(--success); --c: #fff; --bd: var(--success); }
.btn-ghost { --b: transparent; --bd: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-3); border-color: transparent; box-shadow: none; }
.btn-sm { padding: 6px 11px; font-size: .8rem; border-radius: 9px; }
.btn-lg { padding: 12px 20px; font-size: .95rem; }
.btn[disabled], .btn.disabled { opacity: .5; pointer-events: none; }
.link-btn { background: none; border: 0; padding: 0; color: var(--brand); font: inherit; font-weight: 700; cursor: pointer; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-grid.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field label, .label { display: block; font-size: .78rem; font-weight: 800; color: var(--ink-2); margin-bottom: 6px; }
.field .req { color: var(--danger); }
.input, .select, .textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--ink); font: 500 .92rem/1.4 var(--font-body); transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 96px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-ring); }
.input[readonly] { background: var(--surface-2); color: var(--muted); }
.input-group { display: flex; align-items: stretch; }
.input-group .addon { display: grid; place-items: center; padding: 0 12px; border: 1px solid var(--border-strong); border-right: 0; border-radius: 10px 0 0 10px; background: var(--surface-2); color: var(--muted); font-weight: 800; font-size: .78rem; }
.input-group .input { border-radius: 0 10px 10px 0; }
.help { font-size: .76rem; color: var(--muted); margin-top: 5px; }
.error { font-size: .78rem; color: var(--danger); margin-top: 5px; font-weight: 700; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 600; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); margin-top: 2px; flex-shrink: 0; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; padding: 14px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); border-radius: var(--radius) var(--radius) 0 0; }
.filters .field { min-width: 150px; }
.filters .field label { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.filters .input, .filters .select { padding: 8px 10px; font-size: .86rem; }
fieldset.section { border: 0; padding: 0; margin: 0 0 22px; }
fieldset.section legend { font-family: var(--font-display); font-weight: 700; font-size: 1rem; margin-bottom: 12px; display: flex; gap: 8px; align-items: center; }

/* ---------- Segmented / pills ---------- */
.seg { display: inline-flex; padding: 4px; gap: 2px; border-radius: 12px; background: var(--surface-3); border: 1px solid var(--border); flex-wrap: wrap; }
.seg a, .seg button { padding: 6px 12px; border-radius: 9px; font-weight: 700; font-size: .82rem; color: var(--ink-2); border: 0; background: none; cursor: pointer; }
.seg a:hover { text-decoration: none; color: var(--ink); }
.seg .on { background: var(--surface); color: var(--brand); box-shadow: var(--shadow-sm); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 10px 14px; font-weight: 700; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.on { color: var(--brand); border-bottom-color: var(--brand); }
.tabs .count { font-size: .7rem; padding: 0 6px; border-radius: 99px; background: var(--surface-3); color: var(--muted); }

/* ---------- Alerts ---------- */
.alert { display: flex; gap: 12px; padding: 13px 16px; border-radius: 12px; border: 1px solid; font-weight: 600; margin-bottom: 18px; align-items: flex-start; }
.alert .mso { flex-shrink: 0; }
.alert ul { margin: 4px 0 0; padding-left: 18px; }
.alert.success { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 30%, transparent); color: var(--success); }
.alert.danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); color: var(--danger); }
.alert.warning { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 30%, transparent); color: var(--warning); }
.alert.info { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 30%, transparent); color: var(--info); }

/* ---------- Key/value ---------- */
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 9px 14px; font-size: .9rem; }
.kv dt { color: var(--muted); font-weight: 700; font-size: .8rem; }
.kv dd { margin: 0; font-weight: 600; word-break: break-word; }
.totals { display: grid; gap: 8px; }
.totals div { display: flex; justify-content: space-between; gap: 12px; }
.totals .grand { padding-top: 10px; border-top: 1px dashed var(--border-strong); font-size: 1.08rem; font-weight: 800; }
.totals .due { padding: 12px 14px; border-radius: 12px; background: var(--brand); color: var(--brand-ink); font-weight: 800; }

/* ---------- Meters / bars ---------- */
.meter { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand), #14B8A6); }
.meter.success > span { background: var(--success); }
.meter.warning > span { background: var(--accent); }
.bars { display: flex; align-items: flex-end; gap: 12px; height: 180px; padding: 8px 4px 0; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; min-width: 0; }
.bar-stack { width: 100%; max-width: 46px; display: flex; flex-direction: column-reverse; border-radius: 8px 8px 3px 3px; overflow: hidden; background: var(--surface-3); }
.bar-stack span:nth-child(1) { background: var(--brand); }
.bar-stack span:nth-child(2) { background: var(--accent); }
.bar small { font-size: .72rem; color: var(--muted); font-weight: 700; }
.legend { display: flex; gap: 14px; font-size: .78rem; color: var(--muted); font-weight: 700; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ---------- Lists / timeline ---------- */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; gap: 12px; align-items: center; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 700; color: var(--ink); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot-ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex-shrink: 0; }
.dot-ico.warning { background: var(--warning-soft); color: var(--warning); }
.dot-ico.danger { background: var(--danger-soft); color: var(--danger); }
.dot-ico.success { background: var(--success-soft); color: var(--success); }
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ""; position: absolute; left: 8px; top: 4px; bottom: 4px; width: 2px; background: var(--border); }
.tl-item { position: relative; padding-bottom: 18px; }
.tl-item::before { content: ""; position: absolute; left: -23px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 3px solid var(--brand); }
.tl-item.done::before { border-color: var(--success); }
.tl-item .meta { font-size: .76rem; color: var(--muted); font-weight: 700; }
.tl-item .body { margin-top: 4px; white-space: pre-line; }

/* ---------- Repeater ---------- */
.repeater-row { display: grid; gap: 10px; align-items: end; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); margin-bottom: 10px; position: relative; }
.repeater-row .remove-row { align-self: center; }
.sum-check { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-radius: 12px; font-weight: 800; background: var(--surface-3); }
.sum-check.ok { background: var(--success-soft); color: var(--success); }
.sum-check.bad { background: var(--danger-soft); color: var(--danger); }

/* ---------- Empty ---------- */
.empty { text-align: center; padding: 42px 20px; color: var(--muted); }
.empty .mso { font-size: 40px; color: var(--faint); display: block; margin: 0 auto 8px; }
.empty strong { display: block; color: var(--ink); font-size: 1rem; margin-bottom: 4px; }

/* ---------- Dropdown & dialog ---------- */
details.dropdown { position: relative; }
details.dropdown > summary { list-style: none; }
details.dropdown > summary::-webkit-details-marker { display: none; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 50; }
.menu a, .menu button { display: flex; width: 100%; gap: 10px; align-items: center; padding: 9px 12px; border-radius: 9px; color: var(--ink); font: 600 .88rem var(--font-body); background: none; border: 0; cursor: pointer; text-align: left; }
.menu a:hover, .menu button:hover { background: var(--surface-3); text-decoration: none; }
.menu .mso { color: var(--muted); font-size: 19px; }
dialog.modal { border: 0; padding: 0; border-radius: 18px; width: min(560px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); }
dialog.modal::backdrop { background: rgba(10, 9, 40, .55); backdrop-filter: blur(3px); }
dialog.modal .card-head { border-radius: 18px 18px 0 0; }

/* ---------- Pagination ---------- */
.pager { display: flex; gap: 6px; align-items: center; justify-content: space-between; padding: 12px 18px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.pager .pages { display: flex; gap: 4px; flex-wrap: wrap; }
.pager a, .pager span.pg { min-width: 34px; height: 34px; padding: 0 10px; display: inline-grid; place-items: center; border-radius: 9px; border: 1px solid var(--border); font-weight: 700; font-size: .84rem; color: var(--ink-2); background: var(--surface); }
.pager a:hover { border-color: var(--brand); text-decoration: none; }
.pager .on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.pager .off { opacity: .45; }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art {
  position: relative; overflow: hidden; color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(500px 300px at 90% 0%, rgba(20,184,166,.32), transparent 60%), radial-gradient(600px 400px at 0% 100%, rgba(15,118,110,.45), transparent 60%), linear-gradient(140deg, #171818, #0b0c0c);
}
.auth-art h1 { color: #fff; font-size: 2.3rem; line-height: 1.15; max-width: 520px; }
.auth-art p { color: #cfe9e5; max-width: 460px; margin-top: 14px; }
.auth-art .points { display: grid; gap: 12px; margin-top: 30px; }
.auth-art .points div { display: flex; gap: 12px; align-items: center; color: #e3f2ef; font-weight: 600; }
.auth-art .points .mso { color: var(--accent); }
.auth-art .big-star { position: absolute; right: -120px; bottom: -120px; width: 460px; opacity: .1; pointer-events: none; }
.auth-art .big-star .et-logo { width: 460px; height: 460px; }
.auth-form { display: grid; place-items: center; padding: 40px 24px; background: var(--bg); }
.auth-card { width: min(420px, 100%); }
.auth-card .card { padding: 30px; }

/* ---------- Documents (print view) ---------- */
.doc { max-width: 860px; margin: 0 auto; background: #fff; color: #111111; border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; }
.doc-band { height: 8px; background: linear-gradient(90deg, #111111 70%, #0F766E 70%); }
.doc-inner { padding: 36px 40px; }
.doc table { width: 100%; border-collapse: collapse; }
.doc th { background: #111111; color: #fff; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; padding: 10px; text-align: left; }
.doc td { padding: 10px; border-bottom: 1px solid #e3e6f1; }
.watermark { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; font: 800 7rem var(--font-display); color: rgba(200, 38, 42, .09); transform: rotate(-28deg); }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 60; transform: translateX(-102%); transition: transform .22s ease; }
  body.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(8,9,9,.5); z-index: 55; }
  .menu-btn { display: inline-grid; }
  .content { padding: 18px 16px 50px; }
  .topbar { padding: 10px 16px; }
  .g-2, .g-3 { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .user-chip .who { display: none; }
}
@media (max-width: 640px) {
  .g-4, .hero-metrics { grid-template-columns: 1fr 1fr; }
  .form-grid, .form-grid.g-3 { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dd { margin-bottom: 8px; }
  .search { display: none; }
  h1 { font-size: 1.3rem; }
}

@media print {
  .sidebar, .topbar, .no-print, .page-actions { display: none !important; }
  .shell { display: block; }
  body { background: #fff; }
  .content { padding: 0; max-width: none; }
  .doc { box-shadow: none; border-radius: 0; }
}

/* EsoTech logo (inline SVG, same mark as EsoTech AI): ring and rays follow the text colour, the E is teal. */
.et-logo { display: block; flex: none; overflow: visible; }
.et-logo .et-ring { fill: none; stroke: currentColor; stroke-width: 22.4; }
.et-logo .et-rays { fill: currentColor; }
.et-logo .et-e { fill: #0F766E; }
.sidebar .et-logo .et-e, .auth-art .et-logo .et-e { fill: #2DD4BF; }