/* IDCL Subscriptions Monitor — UI
   Tokens first; every component reads from them so light and dark stay in step. */
:root {
  --bg: #f5f6f8; --surface: #ffffff; --surface-2: #f8f9fb; --surface-3: #f1f3f6;
  --line: #e6e8ed; --line-strong: #d4d8e0;
  --ink: #0f172a; --ink-2: #475569; --ink-3: #64748b;
  --brand: #1e3a5f; --accent: #2563eb; --accent-hover: #1d4ed8; --accent-soft: #eef3ff; --accent-ink: #ffffff;
  --ring: rgba(37, 99, 235, .28);
  --series-1: #3b6fe0; --series-2: #b8c6dd;
  --good: #15803d; --good-bg: #ecfdf3; --good-line: #b7e4c7;
  --warn: #a16207; --warn-bg: #fefbe8; --warn-line: #f4dfa0;
  --serious: #c2410c; --serious-bg: #fff4ed; --serious-line: #fbcfae;
  --crit: #dc2626; --crit-bg: #fef2f2; --crit-line: #f8c4c4;
  --info: #1d4ed8; --info-bg: #eff6ff; --info-line: #c3d6fb;
  --neutral: #475569; --neutral-bg: #f1f5f9;
  --radius: 12px; --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .05);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, .08), 0 1px 3px rgba(15, 23, 42, .06);
  --shadow-lg: 0 20px 48px rgba(15, 23, 42, .18), 0 4px 12px rgba(15, 23, 42, .08);
  --side-w: 252px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
  font-size: 15px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0f16; --surface: #121823; --surface-2: #161d2a; --surface-3: #1b2332;
    --line: #232c3b; --line-strong: #313c50;
    --ink: #e7ebf2; --ink-2: #aab4c5; --ink-3: #8592a7;
    --brand: #13243a; --accent: #6b9cff; --accent-hover: #86afff; --accent-soft: #172440; --accent-ink: #08101f;
    --ring: rgba(107, 156, 255, .35);
    --series-1: #6b9cff; --series-2: #3a4a62;
    --good: #5fd08e; --good-bg: #0f2a1c; --good-line: #1f5236;
    --warn: #f1c24f; --warn-bg: #2b2310; --warn-line: #5a4719;
    --serious: #f59e5b; --serious-bg: #2e1c10; --serious-line: #5e391c;
    --crit: #f68a84; --crit-bg: #2e1517; --crit-line: #5f2a2c;
    --info: #8db6ff; --info-bg: #13213b; --info-line: #27406b;
    --neutral: #aab4c5; --neutral-bg: #1e2737;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-md: 0 6px 16px rgba(0, 0, 0, .35);
    --shadow-lg: 0 24px 56px rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--ink); line-height: 1.5; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
h1 { font-size: 1.55rem; font-weight: 700; margin: 0; letter-spacing: -.02em; line-height: 1.25; }
h2 { font-size: 1.02rem; font-weight: 650; margin: 0 0 .75rem; letter-spacing: -.01em; }
h3 { font-size: .93rem; font-weight: 650; margin: 0 0 .5rem; }
code { font-family: var(--mono); font-size: .88em; }
.muted { color: var(--ink-3); }
.small { font-size: .85rem; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.ic { width: 18px; height: 18px; flex: none; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--line); padding: 18px 14px 14px; overflow-y: auto; z-index: 40; }
.brand { display: flex; gap: 11px; align-items: center; padding: 2px 8px 20px; color: var(--ink); }
.brand .logo { width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, var(--accent), #1e40af); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: .7rem; letter-spacing: .02em; box-shadow: 0 2px 6px rgba(37, 99, 235, .35); flex: none; }
.brand b { display: block; font-size: .95rem; font-weight: 700; letter-spacing: -.01em; line-height: 1.2; }
.brand span { display: block; font-size: .76rem; color: var(--ink-3); }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-label { font-size: .7rem; font-weight: 650; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); padding: 14px 10px 6px; }
.nav-label:first-child { padding-top: 0; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--ink-2); font-size: .9rem; font-weight: 500; transition: background .12s, color .12s; }
.nav a span:not(.count) { flex: 1; }
.nav a .ic { color: var(--ink-3); transition: color .12s; }
.nav a:hover { background: var(--surface-3); color: var(--ink); text-decoration: none; }
.nav a:hover .ic { color: var(--ink-2); }
.nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav a.on .ic { color: var(--accent); }
.nav .sep { height: 1px; background: var(--line); margin: 10px 4px; }
.nav .count { background: var(--accent); color: var(--accent-ink); border-radius: 999px; min-width: 20px; padding: 1px 7px; font-size: .72rem; font-weight: 700; text-align: center; line-height: 1.5; }
.me { margin-top: 16px; padding: 12px 8px 0; border-top: 1px solid var(--line); }
.me .who { display: flex; gap: 10px; align-items: center; min-width: 0; }
.me .who b { display: block; font-size: .86rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me .who > div span { display: block; font-size: .76rem; color: var(--ink-3); }
.me .who > div { min-width: 0; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: .78rem; font-weight: 700; flex: none; }
.me-links { display: flex; gap: 4px; margin-top: 10px; }
.me-links form { display: contents; }
.me-links a, .me-links button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 6px 8px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font: inherit; font-size: .8rem; font-weight: 500; cursor: pointer; }
.me-links .ic { width: 15px; height: 15px; }
.me-links a:hover, .me-links button:hover { background: var(--surface-3); color: var(--ink); text-decoration: none; }
.main { padding: 28px 36px 64px; min-width: 0; max-width: 1480px; width: 100%; }
.mobilebar, .scrim { display: none; }
.top { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.top .sub { color: var(--ink-3); font-size: .9rem; margin-top: 5px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Cards & grid ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow-sm); min-width: 0; }
.card + .card, .grid + .card, .card + .grid, .grid + .grid { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.grid > .card + .card { margin-top: 0; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.mt { margin-top: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }

/* ---------- KPI tiles ---------- */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm); overflow: hidden; min-width: 0; }
.kpi .label { font-size: .76rem; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; }
.kpi .value { font-size: 1.7rem; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; letter-spacing: -.025em; line-height: 1.15; }
.kpi .hint { font-size: .8rem; color: var(--ink-2); margin-top: 4px; }
.kpi.alert { border-color: var(--warn-line); background: linear-gradient(180deg, var(--warn-bg), var(--surface) 70%); }
.kpi.alert::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: var(--warn); }
.meter { height: 6px; background: var(--neutral-bg); border-radius: 999px; margin-top: 10px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--series-1); border-radius: 999px; }
.meter i.over { background: var(--crit); }

/* ---------- Tables ---------- */
.tbl-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .875rem; }
.t th { text-align: left; font-weight: 600; color: var(--ink-3); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; padding: 10px 10px; background: var(--surface-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); white-space: nowrap; }
.t th:first-child { border-top-left-radius: var(--radius-sm); border-bottom-left-radius: var(--radius-sm); border-left: 1px solid var(--line); }
.t th:last-child { border-top-right-radius: var(--radius-sm); border-bottom-right-radius: var(--radius-sm); border-right: 1px solid var(--line); }
.t th a { color: inherit; }
.t th a:hover { color: var(--ink); text-decoration: none; }
.t td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.t tbody tr { transition: background .1s; }
.t tbody tr:hover td { background: var(--surface-2); }
.t tbody tr:last-child td { border-bottom: 0; }
.t tfoot td { font-weight: 700; border-top: 1px solid var(--line-strong); border-bottom: 0; }
.t .svc { font-weight: 600; color: var(--ink); }
.t .code { font-family: var(--mono); font-size: .78rem; color: var(--ink-3); }
.t td .btn.sm + .btn.sm, .t td form.inline + form.inline { margin-left: 4px; }

/* ---------- Chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 2px 9px; font-size: .74rem; font-weight: 600; line-height: 1.5; white-space: nowrap; background: var(--neutral-bg); color: var(--neutral); box-shadow: inset 0 0 0 1px rgba(100, 116, 139, .14); }
.chip.good { background: var(--good-bg); color: var(--good); box-shadow: inset 0 0 0 1px var(--good-line); }
.chip.warn { background: var(--warn-bg); color: var(--warn); box-shadow: inset 0 0 0 1px var(--warn-line); }
.chip.serious { background: var(--serious-bg); color: var(--serious); box-shadow: inset 0 0 0 1px var(--serious-line); }
.chip.crit { background: var(--crit-bg); color: var(--crit); box-shadow: inset 0 0 0 1px var(--crit-line); }
.chip.info { background: var(--info-bg); color: var(--info); box-shadow: inset 0 0 0 1px var(--info-line); }
.chip.muted { background: transparent; color: var(--ink-3); box-shadow: inset 0 0 0 1px var(--line-strong); }
.chips { display: flex; gap: 4px; flex-wrap: wrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot.good { background: var(--good); } .dot.warn { background: var(--warn); } .dot.crit { background: var(--crit); } .dot.neutral { background: var(--ink-3); } .dot.future { background: var(--line-strong); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); border-radius: var(--radius-sm); padding: 7px 14px; font: inherit; font-size: .875rem; font-weight: 600; line-height: 1.2; cursor: pointer; text-decoration: none; white-space: nowrap; box-shadow: var(--shadow-sm); transition: background .12s, border-color .12s, box-shadow .12s, color .12s, transform .05s; }
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 1px 2px rgba(37, 99, 235, .25), inset 0 1px 0 rgba(255, 255, 255, .12); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.good { background: var(--good); border-color: var(--good); color: #fff; }
@media (prefers-color-scheme: dark) { .btn.good { color: #06150d; } }
.btn.good:hover { filter: brightness(1.07); }
.btn.danger { color: var(--crit); border-color: var(--crit-line); background: var(--surface); }
.btn.danger:hover { background: var(--crit-bg); border-color: var(--crit); }
.btn.danger-solid { background: var(--crit); border-color: var(--crit); color: #fff; }
@media (prefers-color-scheme: dark) { .btn.danger-solid { color: #1f0809; } }
.btn.danger-solid:hover { filter: brightness(1.07); }
.btn.sm { min-height: 30px; padding: 4px 10px; font-size: .8rem; border-radius: 7px; }
.btn.link { border: 0; background: none; color: var(--accent); padding: 0; min-height: 0; box-shadow: none; font-weight: 600; }
.btn.link:hover { text-decoration: underline; background: none; }
form.inline { display: inline; }
details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
details > summary.btn { display: inline-flex; }

/* ---------- Forms ---------- */
label { display: block; font-size: .82rem; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
label .req { color: var(--crit); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=month], input[type=search], input[type=url], input[type=tel], input[type=file], select, textarea {
  width: 100%; min-height: 38px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 8px 11px; font: inherit; font-size: .9rem; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); transition: border-color .12s, box-shadow .12s;
}
input[type=file] { padding: 6px 8px; }
input::placeholder, textarea::placeholder { color: var(--ink-3); opacity: .8; }
select { appearance: none; -webkit-appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
select[multiple] { background-image: none; padding-right: 11px; }
input:hover, select:hover, textarea:hover { border-color: var(--ink-3); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-3); color: var(--ink-3); cursor: not-allowed; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
textarea { min-height: 88px; resize: vertical; }
.field { margin-bottom: 16px; }
.field .help { font-size: .78rem; color: var(--ink-3); margin-top: 5px; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 18px; }
.form-grid .span2 { grid-column: span 2; } .form-grid .span3 { grid-column: 1 / -1; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px 4px; margin: 0 0 18px; background: var(--surface); box-shadow: var(--shadow-sm); }
legend { font-weight: 650; font-size: .9rem; padding: 0 8px; margin-left: -8px; color: var(--ink); }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; color: var(--ink); cursor: pointer; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.checks .check { font-size: .86rem; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.filters > div { min-width: 130px; flex: 1 1 130px; }
.filters .grow { flex: 2 1 220px; }
.filters label { font-size: .76rem; }

/* ---------- Inline alerts (form errors) ---------- */
.flash { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: .88rem; border: 1px solid transparent; }
.flash::before { flex: none; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: .72rem; font-weight: 800; color: #fff; margin-top: 1px; }
.flash.ok { background: var(--good-bg); color: var(--good); border-color: var(--good-line); } .flash.ok::before { content: "✓"; background: var(--good); }
.flash.err { background: var(--crit-bg); color: var(--crit); border-color: var(--crit-line); } .flash.err::before { content: "!"; background: var(--crit); }
.flash.warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); } .flash.warn::before { content: "!"; background: var(--warn); }
.flash.info { background: var(--info-bg); color: var(--info); border-color: var(--info-line); } .flash.info::before { content: "i"; background: var(--info); }
@media (prefers-color-scheme: dark) { .flash::before { color: var(--bg); } }

/* ---------- Toasts ---------- */
.toasts { position: fixed; top: 18px; right: 18px; z-index: 1000; display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: 11px; align-items: flex-start; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 12px 13px 14px; box-shadow: var(--shadow-lg); font-size: .88rem; line-height: 1.45; position: relative; overflow: hidden; animation: toast-in .28s cubic-bezier(.2, .9, .3, 1.2); }
.toast::after { content: ""; position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: currentColor; opacity: .0; transform-origin: left; }
.toast.timed::after { opacity: .35; animation: toast-timer var(--toast-ms, 5000ms) linear forwards; color: var(--t-color, var(--accent)); }
.toast.paused::after { animation-play-state: paused; }
.toast.leaving { animation: toast-out .2s ease-in forwards; }
.toast-icon { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: .78rem; font-weight: 800; color: #fff; background: var(--t-color, var(--accent)); }
.toast-icon::before { content: "i"; }
.toast.ok { --t-color: var(--good); } .toast.ok .toast-icon::before { content: "✓"; }
.toast.err { --t-color: var(--crit); border-color: var(--crit-line); } .toast.err .toast-icon::before { content: "!"; }
.toast.warn { --t-color: var(--warn); } .toast.warn .toast-icon::before { content: "!"; }
.toast.info { --t-color: var(--info); }
@media (prefers-color-scheme: dark) { .toast-icon { color: var(--bg); } }
.toast-msg { flex: 1; min-width: 0; padding-top: 1px; overflow-wrap: anywhere; }
.toast-x { flex: none; border: 0; background: none; color: var(--ink-3); font-size: 1.25rem; line-height: 1; width: 26px; height: 26px; border-radius: 6px; cursor: pointer; margin: -2px -2px 0 0; }
.toast-x:hover { background: var(--surface-3); color: var(--ink); }
@keyframes toast-in { from { opacity: 0; transform: translateX(24px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(24px) scale(.97); } }
@keyframes toast-timer { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* ---------- Modals ---------- */
dialog.modal { border: 0; padding: 0; border-radius: 16px; width: min(460px, calc(100vw - 32px)); max-height: calc(100vh - 48px); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); overflow: hidden; }
dialog.modal[open] { animation: modal-in .22s cubic-bezier(.2, .9, .3, 1.15); }
dialog.modal::backdrop { background: rgba(15, 23, 42, .5); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); animation: fade-in .2s ease; }
dialog.modal.closing { animation: modal-out .15s ease-in forwards; }
dialog.modal.closing::backdrop { animation: fade-out .15s ease-in forwards; }
.modal-body { display: flex; gap: 14px; padding: 22px 22px 18px; }
.modal-body > div:not(.modal-icon) { flex: 1; min-width: 0; }
.modal-body h2 { font-size: 1.08rem; margin: 2px 0 6px; }
.modal-body p { margin: 0; color: var(--ink-2); font-size: .9rem; overflow-wrap: anywhere; }
.modal-body .field { margin: 14px 0 0; }
.modal-icon { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 1.05rem; background: var(--accent-soft); color: var(--accent); }
.modal-icon.danger { background: var(--crit-bg); color: var(--crit); }
.modal-icon.good { background: var(--good-bg); color: var(--good); }
.modal-icon.warn { background: var(--warn-bg); color: var(--warn); }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; background: var(--surface-2); border-top: 1px solid var(--line); }
.copy-field { display: flex; gap: 8px; align-items: center; margin-top: 14px; padding: 8px 8px 8px 12px; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); background: var(--surface-2); }
.copy-field code { flex: 1; font-size: 1.05rem; font-weight: 600; user-select: all; overflow-wrap: anywhere; color: var(--ink); }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes modal-out { to { opacity: 0; transform: translateY(6px) scale(.98); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
body.modal-open { overflow: hidden; }

/* ---------- Tabs / pills ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 9px 12px; color: var(--ink-3); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 600; font-size: .88rem; white-space: nowrap; transition: color .12s, border-color .12s; }
.tabs a.on { color: var(--accent); border-color: var(--accent); }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.pills { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.pills a { border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: .8rem; font-weight: 500; color: var(--ink-2); background: var(--surface); transition: background .12s, border-color .12s; }
.pills a:hover { text-decoration: none; background: var(--surface-3); }
.pills a.on { background: var(--accent-soft); border-color: transparent; color: var(--accent); font-weight: 600; }

/* ---------- Bar charts (HTML) ---------- */
.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(110px, 38%) 1fr auto; gap: 12px; align-items: center; font-size: .85rem; }
.bar-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.bar-track { position: relative; height: 14px; background: var(--surface-3); border-radius: 4px; }
.bar { position: absolute; left: 0; top: 0; height: 14px; background: var(--series-1); border-radius: 4px; min-width: 2px; }
.bar.budget { background: transparent; border: 2px solid var(--ink-3); border-left: 0; border-radius: 0 4px 4px 0; height: 14px; }
.bar.pair { height: 6px; }
.bar.pair.b2 { top: 8px; background: var(--series-2); }
.bar-row .val { font-variant-numeric: tabular-nums; font-size: .82rem; color: var(--ink); min-width: 64px; text-align: right; font-weight: 500; }
.legend { display: flex; gap: 16px; font-size: .78rem; color: var(--ink-2); margin-bottom: 12px; flex-wrap: wrap; align-items: center; }
.legend i { display: inline-block; width: 12px; height: 8px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }
.vbars { display: flex; align-items: flex-end; gap: 6px; height: 150px; padding-top: 8px; }
.vbars .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; height: 100%; justify-content: flex-end; min-width: 0; }
.vbars .col .b { width: 100%; max-width: 34px; background: var(--series-1); border-radius: 5px 5px 2px 2px; min-height: 2px; transition: filter .12s; }
.vbars .col:hover .b { filter: brightness(1.12); }
.vbars .col .lab { font-size: .7rem; color: var(--ink-3); white-space: nowrap; }

/* ---------- Timeline ---------- */
.timeline { position: relative; height: 56px; margin: 10px 4px 4px; }
.timeline .axis { position: absolute; left: 0; right: 0; top: 26px; height: 2px; background: var(--line-strong); border-radius: 2px; }
.timeline .tick { position: absolute; top: 34px; font-size: .7rem; color: var(--ink-3); transform: translateX(-50%); white-space: nowrap; }
.timeline .tick::before { content: ""; position: absolute; left: 50%; top: -10px; width: 1px; height: 6px; background: var(--line-strong); }
.timeline .ev { position: absolute; top: 19px; width: 16px; height: 16px; margin-left: -8px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--line-strong); cursor: pointer; transition: transform .12s; }
.timeline .ev.good { background: var(--good); } .timeline .ev.warn { background: var(--warn); } .timeline .ev.crit { background: var(--crit); } .timeline .ev.neutral { background: var(--ink-3); }
.timeline .ev:hover { transform: scale(1.3); }
.tip { position: fixed; z-index: 1100; background: var(--ink); color: var(--surface); padding: 6px 10px; border-radius: 7px; font-size: .78rem; font-weight: 500; pointer-events: none; max-width: 280px; box-shadow: var(--shadow-md); }

/* ---------- Action queue ---------- */
.queue { list-style: none; margin: 0; padding: 0; }
.queue li { display: grid; grid-template-columns: auto 1fr; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: .87rem; }
.queue li:last-child { border-bottom: 0; }
.queue .sev { width: 4px; border-radius: 2px; }
.queue .sev.s3 { background: var(--crit); } .queue .sev.s2 { background: var(--warn); } .queue .sev.s1 { background: var(--info); }

/* ---------- Detail ---------- */
.dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 20px; margin: 0; }
.dl div { min-width: 0; }
.dl dt { font-size: .72rem; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; }
.dl dd { margin: 3px 0 0; font-size: .92rem; overflow-wrap: anywhere; }
.section-title { font-size: .74rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); margin: 22px 0 10px; font-weight: 700; }
.log { font-size: .83rem; }
.log .when { color: var(--ink-3); white-space: nowrap; }
.callout { border-radius: var(--radius-sm); padding: 12px 16px; background: var(--warn-bg); color: var(--ink); border: 1px solid var(--warn-line); border-left: 4px solid var(--warn); margin-bottom: 18px; font-size: .9rem; }
.callout.crit { background: var(--crit-bg); border-color: var(--crit-line); border-left-color: var(--crit); }
.callout.info { background: var(--info-bg); border-color: var(--info-line); border-left-color: var(--info); }
.callout.good { background: var(--good-bg); border-color: var(--good-line); border-left-color: var(--good); }
pre { font-family: var(--mono); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; overflow-x: auto; }

/* ---------- Calendar ---------- */
.cal { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.cal .m { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; min-height: 128px; box-shadow: var(--shadow-sm); }
.cal .m.dec { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow-sm); }
.cal .m h3 { display: flex; justify-content: space-between; align-items: center; font-size: .88rem; margin-bottom: 8px; }
.cal .m ul { list-style: none; padding: 0; margin: 0; }
.cal .m li { display: flex; gap: 6px; align-items: center; font-size: .8rem; padding: 4px 0; border-top: 1px solid var(--line); }
.cal .m li .d { color: var(--ink-3); width: 20px; flex: none; font-variant-numeric: tabular-nums; }
.cal .m li a { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.cal .m li.future a { color: var(--ink-3); }
.progress { height: 10px; background: var(--neutral-bg); border-radius: 999px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--good); border-radius: 999px; }

/* ---------- Sign-in ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background:
  radial-gradient(900px 500px at 15% -10%, rgba(37, 99, 235, .14), transparent 60%),
  radial-gradient(700px 500px at 110% 110%, rgba(30, 58, 95, .14), transparent 60%), var(--bg); }
.login .card { width: 100%; max-width: 400px; padding: 32px 30px; box-shadow: var(--shadow-lg); border-radius: 16px; }
.login .brand { padding: 0 0 22px; }
.login h1 { font-size: 1.35rem; margin-bottom: 4px; }
.login .btn.primary { width: 100%; min-height: 40px; margin-top: 4px; }

.empty { text-align: center; padding: 36px 12px; color: var(--ink-3); font-size: .9rem; }
.sticky-actions { position: sticky; bottom: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); padding: 14px 0; display: flex; gap: 8px; border-top: 1px solid var(--line); }

/* ---------- Responsive ---------- */
@media (max-width: 1280px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } .cal { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 960px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset: 0 auto 0 0; width: min(280px, 86vw); height: 100%; transform: translateX(-102%); transition: transform .22s ease; box-shadow: var(--shadow-lg); }
  body.nav-open .side { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 30; background: rgba(15, 23, 42, .45); opacity: 0; pointer-events: none; transition: opacity .2s; }
  body.nav-open .scrim { opacity: 1; pointer-events: auto; }
  body.nav-open { overflow: hidden; }
  .mobilebar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20; margin: -16px -16px 18px; padding: 10px 16px; background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
  .mobilebar .brand { padding: 0; }
  .mobilebar .brand .logo { width: 30px; height: 30px; font-size: .6rem; border-radius: 8px; }
  .menu-btn { display: grid; place-items: center; width: 38px; height: 38px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
  .menu-btn .ic { width: 20px; height: 20px; }
  .main { padding: 16px 16px 56px; }
  .g2, .g3, .g-main { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 14px; }
  .kpi .value { font-size: 1.4rem; }
  .form-grid { grid-template-columns: minmax(0, 1fr); } .form-grid .span2 { grid-column: auto; }
  .dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cal { grid-template-columns: minmax(0, 1fr); }
  .card { padding: 16px; }
  .tbl-wrap { margin: 0 -16px; padding: 0 16px; }
  h1 { font-size: 1.35rem; }
  .toasts { top: auto; bottom: 16px; right: 16px; left: 16px; width: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .toast.timed::after { animation-duration: var(--toast-ms, 5000ms) !important; }
}
@media print {
  .side, .mobilebar, .scrim, .toasts, .actions, .no-print, .filters, .pills, .tabs { display: none !important; }
  .shell { display: block; } .main { padding: 0; max-width: none; } body { background: #fff; color: #000; }
  .card, .kpi, fieldset { box-shadow: none; border-color: #ccc; break-inside: avoid; }
}

/* Compact inline controls (inside table rows) */
input.input-sm, select.input-sm { min-height: 30px; padding: 4px 9px; font-size: .82rem; width: auto; min-width: 140px; }
select.input-sm { padding-right: 28px; background-position: right 7px center; }
input[type=file]::file-selector-button { font: inherit; font-size: .8rem; font-weight: 600; color: var(--ink); background: var(--surface-3); border: 1px solid var(--line-strong); border-radius: 6px; padding: 4px 10px; margin-right: 10px; cursor: pointer; }
input[type=file]::file-selector-button:hover { background: var(--line); }
