/* Nakiba Pay dashboard, in the Nakiba identity: navy ink and one brand
   blue on clean, cool white. The tenant scope band stays the loudest
   element; everything else is quiet. Fonts and logo come from /brand/. */

@font-face { font-family: "Jakarta"; src: url("/brand/fonts/plus-jakarta-sans-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Jakarta"; src: url("/brand/fonts/plus-jakarta-sans-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Jakarta"; src: url("/brand/fonts/plus-jakarta-sans-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Jakarta"; src: url("/brand/fonts/plus-jakarta-sans-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  color-scheme: light;
  --paper: #f5f7fb;
  --surface: #ffffff;
  --ink: #0a1931;
  --ink-2: #44506a;
  --ink-3: #737e94;
  --rule: #e3e8f0;
  --rule-strong: #c9d1de;
  --accent: #185adb;
  --accent-ink: #ffffff;
  --accent-soft: #eaf0fd;
  --ok: #137a4a;
  --wait: #985b00;
  --bad: #c0262d;
  --ok-soft: #e3f4ea;
  --wait-soft: #fcf1dc;
  --bad-soft: #fde8e8;
  --band: #0a1931;
  --band-ink: #f5f7fb;
  --series-1: #185adb;
  --grid: #e6ebf3;
  --axis: #c9d1de;
  --focus: #185adb;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #0a1120;
    --surface: #111b2e;
    --ink: #e7ecf5;
    --ink-2: #aeb8cc;
    --ink-3: #7f8ba3;
    --rule: #1f2b42;
    --rule-strong: #2e3c57;
    --accent: #5b8df0;
    --accent-ink: #0a1120;
    --accent-soft: #16264a;
    --ok: #4cc386;
    --wait: #e3a94b;
    --bad: #f27c7c;
    --ok-soft: #12301f;
    --wait-soft: #33270f;
    --bad-soft: #3b1719;
    --band: #172a52;
    --band-ink: #eaf0ff;
    --series-1: #5b8df0;
    --grid: #1c2740;
    --axis: #2e3c57;
    --focus: #8fb2f6;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0a1120; --surface: #111b2e; --ink: #e7ecf5; --ink-2: #aeb8cc; --ink-3: #7f8ba3;
  --rule: #1f2b42; --rule-strong: #2e3c57; --accent: #5b8df0; --accent-ink: #0a1120; --accent-soft: #16264a;
  --ok: #4cc386; --wait: #e3a94b; --bad: #f27c7c; --ok-soft: #12301f; --wait-soft: #33270f; --bad-soft: #3b1719;
  --band: #172a52; --band-ink: #eaf0ff; --series-1: #5b8df0; --grid: #1c2740; --axis: #2e3c57; --focus: #8fb2f6;
}

* { box-sizing: border-box; }
html { font-size: 15px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Jakarta", system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.5;
}
a { color: var(--accent); text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1 { font-size: 1.65rem; font-weight: 700; margin: 0 0 .25rem; letter-spacing: -0.02em; }
h2 { font-size: 1.1rem; font-weight: 700; margin: 2rem 0 .75rem; letter-spacing: -0.01em; }
h3 { font-size: 1rem; font-weight: 600; margin: 1.25rem 0 .5rem; }
p { max-width: 72ch; }
.lede { color: var(--ink-2); margin: 0 0 1.5rem; }
.muted { color: var(--ink-3); }
.signin-docs { margin-top: 1.5rem; font-size: .9rem; }
.signin-docs a { color: var(--accent); }
.num, td.num, th.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
code, .code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .88em; }

/* Shell: sidebar + main */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side {
  background: var(--surface);
  border-right: 1px solid var(--rule);
  padding: 1.25rem 1rem;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: block; color: var(--ink); text-decoration: none; margin: .1rem .5rem 1.75rem; }
.brand img { display: block; height: 30px; width: auto; }
.brand small { display: block; font-weight: 500; font-size: .78rem; color: var(--ink-3); margin-top: .45rem; letter-spacing: .01em; }
/* The light logo is for dark backgrounds. */
.logo-light { display: none !important; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-dark { display: none !important; }
  :root:not([data-theme="light"]) .logo-light { display: block !important; }
}
:root[data-theme="dark"] .logo-dark { display: none !important; }
:root[data-theme="dark"] .logo-light { display: block !important; }
.nav-group { margin: 0 0 1.25rem; padding: 0; list-style: none; }
.nav-group-title { font-size: .8rem; color: var(--ink-3); margin: 0 0 .25rem .5rem; }
.nav-group a {
  display: block; padding: .4rem .6rem; border-radius: 8px;
  color: var(--ink-2); text-decoration: none; font-weight: 500;
}
.nav-group a:hover { background: var(--paper); color: var(--ink); }
.nav-group a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.side-foot { margin-top: 2rem; font-size: .85rem; color: var(--ink-3); }
.side-foot form { margin-top: .5rem; }

main { min-width: 0; }
.content { padding: 1.5rem 2rem 4rem; max-width: 1280px; }

/* The scope band: which tenant every action on this page touches. */
.band {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  background: var(--band); color: var(--band-ink);
  padding: .7rem 2rem;
}
.band-label { font-size: .85rem; opacity: .75; }
.band-tenant { font-size: 1.35rem; font-weight: 700; letter-spacing: .02em; }
.band-name { opacity: .8; }
.band form { margin-left: auto; display: flex; gap: .5rem; align-items: center; }
.band label { color: inherit; }
.band select { background: transparent; color: var(--band-ink); border: 1px solid currentColor; border-radius: 8px; padding: .3rem .5rem; font: inherit; }
.band select option { color: #0a1931; }
.band button { background: var(--band-ink); color: var(--band); border: 0; }

/* Messages */
.flash, .alert { padding: .7rem 1rem; border-radius: 6px; margin: 0 0 1.25rem; border-left: 4px solid; }
.flash { background: var(--ok-soft); border-color: var(--ok); }
.alert { background: var(--bad-soft); border-color: var(--bad); }
.notice { background: var(--wait-soft); border-left: 4px solid var(--wait); padding: .7rem 1rem; border-radius: 6px; margin: 0 0 1.25rem; }
.once { background: var(--surface); border: 2px solid var(--wait); border-radius: 8px; padding: 1rem 1.25rem; margin: 0 0 1.5rem; }
.once .secret { font-family: ui-monospace, Consolas, monospace; font-size: 1rem; word-break: break-all; user-select: all; background: var(--paper); padding: .5rem .75rem; border-radius: 6px; display: block; margin: .5rem 0; }

/* Stat strip: one row of figures separated by rules, not boxes. */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); border-top: 1px solid var(--rule-strong); border-bottom: 1px solid var(--rule); margin: 0 0 1.5rem; }
.stat { padding: .9rem 1rem .9rem 0; }
.stat + .stat { padding-left: 1rem; border-left: 1px solid var(--rule); }
.stat-label { color: var(--ink-2); font-size: .88rem; }
.stat-value { font-size: 1.6rem; font-weight: 700; margin-top: .15rem; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-note { color: var(--ink-3); font-size: .82rem; }

/* Tables */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th { text-align: left; font-weight: 600; font-size: .85rem; color: var(--ink-2); padding: .6rem .75rem; border-bottom: 1px solid var(--rule-strong); white-space: nowrap; }
td { padding: .55rem .75rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
td .sub, dd .sub { display: block; color: var(--ink-3); font-size: .82rem; }
.empty { padding: 2rem 1rem; text-align: center; color: var(--ink-2); }

/* Status: icon glyph + label, never color alone. */
.status { display: inline-flex; align-items: center; gap: .3rem; padding: .05rem .5rem; border-radius: 999px; font-size: .82rem; white-space: nowrap; }
.status::before { font-size: .75rem; }
.status.ok { background: var(--ok-soft); color: var(--ok); }
.status.ok::before { content: "✓"; }
.status.wait { background: var(--wait-soft); color: var(--wait); }
.status.wait::before { content: "◷"; }
.status.bad { background: var(--bad-soft); color: var(--bad); }
.status.bad::before { content: "✕"; }
.status.muted { background: var(--paper); color: var(--ink-2); border: 1px solid var(--rule); }
.status.muted::before { content: "–"; }

/* Forms */
form.inline { display: inline; }
.filters { display: flex; flex-wrap: wrap; gap: .75rem; align-items: end; margin: 0 0 1rem; }
label { display: block; font-size: .85rem; color: var(--ink-2); }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--rule-strong); border-radius: 8px; padding: .45rem .65rem; margin-top: .2rem;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: 2px solid var(--accent-soft); outline-offset: 0; }
textarea { width: 100%; min-height: 4.5rem; }
.field { margin: 0 0 .8rem; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .75rem 1rem; align-items: end; }
.checks { display: flex; flex-wrap: wrap; gap: .25rem 1rem; }
.checks label { display: flex; gap: .35rem; align-items: center; color: var(--ink); font-size: .9rem; }
.checks input { margin: 0; }
button, .button {
  font: inherit; font-weight: 500; cursor: pointer; display: inline-block; text-decoration: none;
  background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent);
  border-radius: 8px; padding: .45rem .95rem; line-height: 1.4;
}
button:hover, .button:hover { filter: brightness(1.08); }
button.quiet, .button.quiet { background: transparent; color: var(--accent); }
button.danger { background: transparent; color: var(--bad); border-color: var(--bad); }
button.small { padding: .15rem .55rem; font-size: .85rem; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
details.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: .8rem 1rem; margin: 0 0 1rem; }
details.panel summary { cursor: pointer; font-weight: 600; }
details.panel[open] summary { margin-bottom: .75rem; }
.reveal { font-family: ui-monospace, Consolas, monospace; background: var(--wait-soft); padding: .1rem .4rem; border-radius: 4px; }

/* Definition list for detail pages */
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1.5rem; margin: 0 0 1.5rem; }
dl.facts dt { color: var(--ink-2); }
dl.facts dd { margin: 0; }
.two-col { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 2rem; }

/* Timeline */
ol.timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--rule); }
ol.timeline li { position: relative; padding: 0 0 .9rem 1rem; }
ol.timeline li::before { content: ""; position: absolute; left: -6px; top: .45rem; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); }
ol.timeline .when { color: var(--ink-3); font-size: .82rem; }
pre.payload { background: var(--paper); border: 1px solid var(--rule); border-radius: 6px; padding: .5rem .75rem; overflow-x: auto; font-size: .8rem; max-height: 14rem; }

/* Chart */
.viz { background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: 1rem 1rem .5rem; position: relative; margin: 0; }
.viz-title { font-weight: 600; margin: 0; }
.viz-sub { color: var(--ink-3); font-size: .85rem; margin: 0 0 .5rem; }
.viz svg { width: 100%; height: auto; display: block; }
.viz .grid line { stroke: var(--grid); stroke-width: 1; }
.viz .baseline { stroke: var(--axis); stroke-width: 1; }
.viz .tick { fill: var(--ink-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.viz .bar { fill: var(--series-1); }
.viz .hit { fill: transparent; cursor: default; }
.viz .hit:focus { outline: none; }
.viz g.col:hover .bar, .viz g.col:focus-within .bar { opacity: .8; }
.viz-tip {
  position: absolute; pointer-events: none; background: var(--surface); color: var(--ink);
  border: 1px solid var(--rule-strong); border-radius: 6px; padding: .35rem .6rem; font-size: .85rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.12); white-space: nowrap; transform: translate(-50%, -110%);
}
.viz-tip strong { display: block; }
.viz-tip[hidden] { display: none; }
.viz details { margin-top: .5rem; font-size: .9rem; }

/* Bare pages: sign-in, MFA */
.bare { max-width: 440px; margin: 10vh auto; padding: 0 1rem; }
.bare-logo { display: block; margin: 0 0 1.75rem; }
.bare-logo img { height: 36px; width: auto; }
.bare h1 { margin-bottom: .5rem; }
.bare .box { background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; padding: 1.5rem; }
.otp { font-size: 1.6rem; letter-spacing: .3em; width: 11ch; text-align: center; font-variant-numeric: tabular-nums; }
.codes { columns: 2; font-family: ui-monospace, Consolas, monospace; font-size: 1.05rem; padding-left: 1.2rem; }
.qr { display: block; margin: .5rem 0; border: 8px solid #fff; border-radius: 6px; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--rule); }
  .content { padding: 1rem; }
  .band { padding: .7rem 1rem; }
  .band form { margin-left: 0; }
  .two-col { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
