/*!
 * Meraki Admin Dashboard - design system
 * Tidewell Cinematic palette, Geist + Geist Mono, Keenicons duotone, golden-ratio scale.
 * Sizes: Fibonacci (2 3 5 8 13 21 34 55 89 144 233 377 610 987).
 * Type: 13 x sqrt(phi)^n (10.2 13 16.5 21 26.8 34), then Fibonacci 55 and 89 for display numbers.
 * Tokens live in tokens.css, which every page loads first.
 */
/* Logo images. A url() inside a custom property resolves against the stylesheet that uses it, so each stylesheet sets its own. */
:root { --mk: url("../img/meraki-logo.png"); --mk-mono: url("../img/meraki-logo-mono.png"); }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-height: 100%; }
body { background: var(--surface); color: var(--text); font-family: var(--font-sans); font-size: var(--fs-2); line-height: 1.618; -webkit-font-smoothing: antialiased; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--surface); }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.02em; }
p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
.num, .mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: var(--fs-1); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.link, .link-btn { color: var(--accent); text-decoration: none; font-weight: 500; }
.link:hover, .link-btn:hover { text-decoration: underline; text-underline-offset: 3px; }
.link-btn { border: 0; background: none; cursor: pointer; font-size: var(--fs-2); padding: 0; }

.ki { width: var(--icon); height: var(--icon); fill: currentColor; flex: none; display: inline-block; vertical-align: middle; }
.ki .d { opacity: .3; }
.ki-sm, .side-toggle .ki { width: var(--icon-sm); height: var(--icon-sm); }
.ki-xs, .check .ki, .delta .ki { width: var(--icon-xs); height: var(--icon-xs); }
.ki-lg, .empty .ki, .kpi-icon .ki, .state .tile .ki, .dropzone .ki { width: var(--icon-lg); height: var(--icon-lg); }

.mk { display: inline-block; width: 34px; height: 34px; flex: none; border-radius: var(--r-2); background: #FFFFFF var(--mk) center / cover no-repeat; box-shadow: 0 0 0 1px var(--border); }

/* Theme toggle: show the moon in dark, whether dark comes from the OS or from data-theme. */
.theme-btn .moon, :root[data-theme="dark"] .theme-btn .sun { display: none; }
:root[data-theme="dark"] .theme-btn .moon { display: inline-block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-btn .sun { display: none; }
  :root:not([data-theme="light"]) .theme-btn .moon { display: inline-block; }
}

/* =====================================================================
   Shell: sidebar, header, page frame
   ===================================================================== */
.app { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; transition: grid-template-columns .233s; }
.sidebar { position: sticky; top: 0; height: 100vh; align-self: start; width: var(--sidebar); z-index: 8; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; transition: width .233s, box-shadow .233s; padding-left: env(safe-area-inset-left, 0px); }
.side-head { height: var(--bar); display: flex; align-items: center; justify-content: space-between; padding: 0 var(--s-4); border-bottom: 1px solid var(--border); position: relative; flex: none; }
.brand-link { display: flex; align-items: center; gap: var(--s-2); text-decoration: none; color: var(--text); min-width: 0; }
.brand-link b { font-size: var(--fs-4); font-weight: 600; letter-spacing: -0.03em; }
/* Mono tag: sidebar version tag, kbd, tab counts. */
.brand-link .tag, kbd, .tab .n { font: 500 var(--fs-1)/1 var(--font-mono); padding: 3px var(--s-1); border-radius: var(--r-1); color: var(--text-2); }
.brand-link .tag { color: var(--text-3); border: 1px solid var(--border); }
.side-toggle { position: absolute; right: 0; top: 50%; transform: translate(50%, -50%); z-index: 8; width: var(--ctl-sm); height: var(--ctl-sm); padding: 0; border-radius: var(--r-2); border: 1px solid var(--border); background: var(--surface); color: var(--text-2); display: grid; place-items: center; cursor: pointer; box-shadow: var(--shadow); }
.side-toggle:hover { color: var(--text); background: var(--surface-2); }
.side-toggle .ki { transition: transform .233s; }
.nav { flex: 1; overflow-y: auto; padding: var(--s-1) var(--s-3) var(--s-3); display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: var(--s-3); height: var(--ctl); padding: 0 var(--s-2); border-radius: var(--r-2); color: var(--text-2); font-size: var(--fs-2); font-weight: 500; text-decoration: none; border: 0; background: transparent; cursor: pointer; width: 100%; text-align: left; white-space: nowrap; }
.nav-item .ki { color: var(--text-3); }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item[aria-current="page"] { background: var(--accent-tint); color: var(--accent); }
.nav-item[aria-current="page"] .ki { color: var(--accent); }
.nav-head { padding: var(--s-4) var(--s-2) var(--s-1); font-weight: 500; }
.nav-group { display: grid; gap: 2px; }
.nav-item .caret { margin-left: auto; color: var(--text-3); transition: transform .233s; }
.nav-item[aria-expanded="true"] .caret { transform: rotate(180deg); }
.nav-sub { display: grid; gap: 1px; padding-left: var(--s-5); margin: 2px 0 var(--s-1); }
.nav-sub a { height: var(--ctl-sm); display: flex; align-items: center; padding: 0 var(--s-3); border-radius: var(--r-2); color: var(--text-2); font-size: var(--fs-2); text-decoration: none; position: relative; white-space: nowrap; }
.nav-sub a::before { content: ""; position: absolute; left: -13px; top: 50%; width: 5px; height: 5px; border-radius: 50%; background: var(--border); transform: translateY(-50%); }
.nav-sub a:hover { color: var(--text); background: var(--surface-2); }
.nav-sub a[aria-current="page"] { color: var(--accent); font-weight: 500; }
.nav-sub a[aria-current="page"]::before { background: var(--hi); }
.side-user { display: flex; align-items: center; gap: var(--s-2); padding: var(--s-3) var(--s-4); border-top: 1px solid var(--border); flex: none; }
.side-user .who { min-width: 0; flex: 1; }
.side-user b { display: block; font-size: var(--fs-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user .who span { font-size: var(--fs-1); color: var(--text-3); }
.side-av { display: contents; }
.side-scrim { display: none; }
@media (min-width: 988px) {
  .sb-collapsed .app { grid-template-columns: var(--rail) minmax(0, 1fr); }
  .sb-collapsed .side-toggle .ki { transform: rotate(180deg); }
  .sb-collapsed .sidebar { width: var(--rail); }
  .sb-collapsed .sidebar.peek { width: var(--sidebar); box-shadow: var(--shadow-pop); }
  .sb-collapsed .sidebar:not(.peek) .side-head { padding: 0; justify-content: center; }
  .sb-collapsed .sidebar:not(.peek) .nav-item { justify-content: center; padding: 0; gap: 0; font-size: 0; }
  .sb-collapsed .sidebar:not(.peek) .nav-head { font-size: 0; padding: 0; height: 1px; background: var(--border); margin: var(--s-3) var(--s-2); }
  .sb-collapsed .sidebar:not(.peek) .brand-link b, .sb-collapsed .sidebar:not(.peek) .brand-link .tag,
  .sb-collapsed .sidebar:not(.peek) .nav-sub, .sb-collapsed .sidebar:not(.peek) .caret,
  .sb-collapsed .sidebar:not(.peek) .side-user .who, .sb-collapsed .sidebar:not(.peek) .side-user .hbtn { display: none; }
  .sb-collapsed .sidebar:not(.peek) .side-user { justify-content: center; padding-left: 0; padding-right: 0; }
}

.header { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 7; height: var(--bar); background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: saturate(1.4) blur(8px); -webkit-backdrop-filter: saturate(1.4) blur(8px); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: var(--s-3); padding-inline: var(--pad-inline-wide); }
.crumbs { display: flex; align-items: center; gap: var(--s-2); font-size: var(--fs-2); color: var(--text-3); min-width: 0; flex-wrap: wrap; }
.crumbs a { color: inherit; text-decoration: none; }
.crumbs a:hover { color: var(--text); }
.crumbs i { width: 5px; height: 5px; border-radius: 50%; background: var(--text-3); opacity: .55; flex: none; }
.crumbs b { color: var(--text); font-weight: 600; white-space: nowrap; }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: var(--s-1); }
.hbtn { width: var(--ctl); height: var(--ctl); border-radius: 50%; border: 0; background: transparent; color: var(--text-2); display: grid; place-items: center; cursor: pointer; position: relative; flex: none; padding: 0; }
.hbtn:hover { background: var(--surface-2); color: var(--text); }
.hbtn .dot { position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--hi); border: 2px solid var(--surface); }
.search-btn { height: var(--ctl); width: 233px; border: 1px solid var(--border); border-radius: var(--r-2); background: var(--bg); color: var(--text-3); display: flex; align-items: center; gap: var(--s-2); padding: 0 var(--s-3); cursor: pointer; font-size: var(--fs-2); }
.search-btn kbd { margin-left: auto; }
kbd { border: 1px solid var(--border); border-bottom-width: 2px; background: var(--surface); }
.user-btn { border: 0; background: transparent; padding: 0; cursor: pointer; border-radius: 50%; }
.user-btn .pv { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--border); }
.h-menu-btn { display: none; }
.h-logo { display: none; }

.main { min-width: 0; display: flex; flex-direction: column; background: var(--surface); outline: none; }
.main.bg { background: var(--bg); }
.flush-view { display: flex; flex-direction: column; flex: 1; min-width: 0; background: var(--surface); outline: none; }
.content { display: grid; gap: var(--s-4); align-content: start; padding-block: var(--s-5) var(--s-6); padding-inline: var(--pad-inline-wide); max-width: 1597px; width: 100%; background: var(--bg); flex: 1; }
.toolbar-h { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap; }
.toolbar-h h1 { font-size: var(--fs-4); }
.toolbar-h p { color: var(--text-2); margin-top: 2px; }
.footer { display: flex; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; padding-block: var(--s-3); padding-inline: var(--pad-inline-wide); border-top: 1px solid var(--border); color: var(--text-3); font-size: var(--fs-2); background: var(--surface); }
.footer a { color: inherit; text-decoration: none; }
.footer a:hover { color: var(--text); }
.page-head { min-height: var(--bar); display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding-block: var(--s-2); padding-inline: var(--pad-inline); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.page-head h1 { display: inline-flex; align-items: center; gap: var(--s-2); font-size: var(--fs-3); min-width: 0; }
.page-head h1 .ki { color: var(--accent); }
.head-actions { display: flex; gap: var(--s-2); align-items: center; flex-wrap: wrap; }
.pad { padding-block: var(--s-4); padding-inline: var(--pad-inline); display: grid; gap: var(--s-4); align-content: start; background: var(--bg); flex: 1; }

@media (max-width: 987px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; z-index: 25; left: 0; top: 0; bottom: 0; width: var(--sidebar); transform: translateX(-100%); transition: transform .233s; padding-top: env(safe-area-inset-top, 0px); }
  .sidebar.open { transform: none; box-shadow: var(--shadow-pop); }
  .side-scrim.open { display: block; z-index: 24; }
  .side-toggle { display: none; }
  .h-menu-btn, .h-logo { display: grid; }
  .header .crumbs { display: none; }
  .content { padding-block: var(--s-4) var(--s-5); }
  .search-btn { width: var(--ctl); padding: 0; justify-content: center; border-radius: 50%; border-color: transparent; background: transparent; }
  .search-btn .label, .search-btn kbd { display: none; }
}

/* =====================================================================
   Buttons, tabs, toolbar
   ===================================================================== */
.btn { height: var(--ctl); padding: 0 var(--s-3); border-radius: var(--r-2); border: 1px solid var(--border); background: var(--surface); color: var(--text); display: inline-flex; align-items: center; gap: var(--s-2); font-size: var(--fs-2); font-weight: 500; cursor: pointer; white-space: nowrap; transition: filter .144s; text-decoration: none; }
.btn:not(.btn-primary, .btn-danger):hover { background: var(--surface-2); }
.btn-primary { background: var(--btn); border-color: var(--btn); color: var(--on-btn); }
.btn-primary:hover { filter: brightness(1.1); }
.btn-sm { height: var(--ctl-sm); padding: 0 var(--s-2); gap: var(--s-1); }
.btn-lg { height: var(--ctl-lg); padding: 0 var(--s-4); font-size: var(--fs-3); }
.btn-block { width: 100%; justify-content: center; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-danger { background: var(--bad-tint); border-color: transparent; color: var(--bad-ink); }
.btn-danger:hover { filter: brightness(.97); }
.btn[disabled] { opacity: .45; cursor: not-allowed; filter: none; }
.btn .badge-n { min-width: 16.5px; height: 16.5px; padding: 0 3px; border-radius: var(--r-1); display: grid; place-items: center; font: 600 var(--fs-1)/1 var(--font-mono); background: var(--accent-tint); color: var(--accent); }
.btn.active { border-color: var(--accent); color: var(--accent); }
.icon-btn { width: var(--ctl-sm); height: var(--ctl-sm); border-radius: var(--r-1); border: 0; background: transparent; color: var(--text-3); display: inline-grid; place-items: center; cursor: pointer; padding: 0; flex: none; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.on { color: var(--hi); }

.tabs { display: flex; gap: var(--s-4); padding-inline: var(--pad-inline); border-bottom: 1px solid var(--border); overflow-x: auto; background: var(--surface); flex: none; }
.tab { height: var(--ctl-lg); display: inline-flex; align-items: center; gap: var(--s-2); border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--text-2); font-size: var(--fs-2); font-weight: 500; cursor: pointer; white-space: nowrap; margin-bottom: -1px; padding: 0; }
.tab .ki { color: var(--text-3); }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--hi); }
.tab[aria-selected="true"] .ki { color: var(--accent); }
.tab .n { background: var(--surface-2); }
.tabs.sm .tab { height: var(--ctl); }

.toolbar { display: flex; align-items: center; gap: var(--s-2); padding-block: var(--s-3); padding-inline: var(--pad-inline); flex-wrap: wrap; border-bottom: 1px solid var(--border); background: var(--surface); }
.toolbar .end { margin-left: auto; }
.search { position: relative; }
.search .ki { position: absolute; left: var(--s-2); top: 50%; transform: translateY(-50%); color: var(--text-3); }
.search input { height: var(--ctl-sm); width: 233px; border: 1px solid var(--border); border-radius: var(--r-2); background: var(--surface); padding: 0 var(--s-2) 0 var(--s-5); font-size: var(--fs-2); }
.search input::placeholder { color: var(--text-3); }
.seg { display: inline-flex; padding: 3px; gap: 3px; border: 1px solid var(--border); border-radius: var(--r-2); background: var(--bg); }
.seg button { height: var(--ctl-sm); padding: 0 var(--s-3); border: 0; border-radius: var(--r-1); background: transparent; color: var(--text-2); font-size: var(--fs-2); font-weight: 500; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--border); }

/* =====================================================================
   Popover menu, checkbox tick, switch
   ===================================================================== */
.pop { position: fixed; z-index: 15; width: 233px; max-height: 377px; overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-3); box-shadow: var(--shadow-pop); padding: var(--s-1); }
.pop-search { display: flex; align-items: center; gap: var(--s-2); padding: 0 var(--s-2); border-bottom: 1px solid var(--border); margin: calc(-1 * var(--s-1)) calc(-1 * var(--s-1)) var(--s-1); color: var(--text-3); position: sticky; top: calc(-1 * var(--s-1)); background: var(--surface); }
.pop-search input { height: var(--ctl); width: 100%; border: 0; background: transparent; outline: none; font-size: var(--fs-2); color: var(--text); }
.pop-head { padding: var(--s-2) var(--s-2) var(--s-1); }
.opt { display: flex; align-items: center; gap: var(--s-2); width: 100%; min-height: var(--ctl); padding: 0 var(--s-2); border: 0; border-radius: var(--r-1); background: transparent; cursor: pointer; text-align: left; font-size: var(--fs-2); color: var(--text); text-decoration: none; }
.opt:hover { background: var(--surface-2); }
.opt .ki { color: var(--text-3); }
.opt.muted { color: var(--text-3); }
.opt.danger { color: var(--bad-ink); }
.opt .end { margin-left: auto; color: var(--text-3); }
.opt-note { align-items: flex-start; padding: var(--s-2); cursor: default; }
.opt-note > span { white-space: normal; }
.opt-note .small, .opt-note b { display: block; }
.sep { height: 1px; background: var(--border); margin: var(--s-1) calc(-1 * var(--s-1)); }
.cb { width: 16.5px; height: 16.5px; border-radius: var(--r-1); border: 1px solid var(--border); display: grid; place-items: center; flex: none; background: var(--surface); }
.cb.on { background: var(--btn); border-color: var(--btn); color: var(--on-btn); }
.cb.on::after { content: ""; width: 8px; height: 5px; border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg) translate(1px, -1px); }
.switch { width: 34px; height: 21px; border-radius: var(--r-pill); background: var(--surface-2); border: 1px solid var(--border); position: relative; flex: none; display: inline-block; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 13px; height: 13px; border-radius: 50%; background: var(--text-3); transition: transform .233s; }
.switch.on { background: var(--accent); border-color: var(--accent); }
.switch.on::after { transform: translateX(13px); background: var(--on-accent); }
button.switch { padding: 0; cursor: pointer; }

/* =====================================================================
   Badges, tones, chips, avatars
   ===================================================================== */
.badge { display: inline-flex; align-items: center; gap: var(--s-1); font: 500 var(--fs-1)/1 var(--font-sans); padding: var(--s-1) var(--s-2); border-radius: var(--r-1); white-space: nowrap; }
.badge.dot::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
/* Tones work on any element (.badge, .pv, .tile, .tl .ic). Deal stages are here, not in crm.css, because profile.html shows them too. */
.t-bad, .badge.lost { background: var(--bad-tint); color: var(--bad-ink); }
.t-warn, .badge.negotiation { background: var(--warn-tint); color: var(--warn-ink); }
.t-good, .badge.won { background: var(--good-tint); color: var(--good-ink); }
.t-accent, .badge.proposal { background: var(--accent-tint); color: var(--accent); }
.t-hi { background: var(--hi-tint); color: var(--hi-ink); }
.t-neutral { background: var(--surface-2); color: var(--text-2); }
.chips { display: flex; gap: var(--s-1); flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: var(--s-1); height: var(--ctl-sm); padding: 0 var(--s-2) 0 3px; border: 1px solid var(--border); border-radius: var(--r-pill); font-size: var(--fs-2); background: var(--surface); white-space: nowrap; text-decoration: none; }
.pv { width: 21px; height: 21px; border-radius: 50%; display: inline-grid; place-items: center; font: 600 var(--fs-1)/1 var(--font-sans); flex: none; }
.pv.lg { width: 34px; height: 34px; font-size: var(--fs-2); }
.pv.xl { width: 55px; height: 55px; font-size: var(--fs-3); }
.stack-av { display: flex; }
.stack-av .pv { box-shadow: 0 0 0 2px var(--surface); }
.stack-av .pv + .pv { margin-left: -5px; }
.tile { width: 26.8px; height: 26.8px; border-radius: var(--r-2); display: inline-grid; place-items: center; font: 600 var(--fs-2)/1 var(--font-sans); flex: none; }
.tile.lg { width: 34px; height: 34px; }
.more-n { font: 500 var(--fs-1)/1 var(--font-mono); color: var(--text-3); }
.conn { display: inline-flex; align-items: center; gap: var(--s-2); white-space: nowrap; }
.conn i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.acct-lg { width: 34px; height: 34px; border-radius: var(--r-2); display: grid; place-items: center; font: 600 var(--fs-2)/1 var(--font-sans); background: var(--surface-2); color: var(--text-2); flex: none; }

/* =====================================================================
   Data grid
   ===================================================================== */
.grid-host { display: flex; flex-direction: column; flex: 1; }
.table-scroll { overflow-x: auto; flex: 1; background: var(--surface); }
table.grid { width: 100%; border-collapse: collapse; font-size: var(--fs-2); min-width: 987px; }
table.grid thead th { text-align: left; height: var(--ctl); padding: 0 var(--s-3); font-size: var(--fs-2); font-weight: 500; color: var(--text-3); border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--bg); }
table.grid thead th + th { border-left: 1px solid var(--border); }
table.grid thead th button { border: 0; background: none; padding: 0; color: inherit; font: inherit; cursor: pointer; display: inline-flex; gap: var(--s-1); align-items: center; }
table.grid thead th button:hover { color: var(--text); }
table.grid thead th button .ki { opacity: .55; }
table.grid thead th button[data-dir] .ki { opacity: 1; color: var(--accent); }
table.grid td { height: var(--ctl-lg); padding: 0 var(--s-3); border-bottom: 1px solid var(--border); white-space: nowrap; max-width: 377px; overflow: hidden; text-overflow: ellipsis; }
table.grid td + td { border-left: 1px solid var(--border); }
table.grid td.grid-empty { height: auto; max-width: none; }
table.grid .c-sel, table.grid .c-act { width: 55px; text-align: center; padding: 0; }
table.grid tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 45%, transparent); }
table.grid tbody tr.clickable { cursor: pointer; }
table.grid tbody tr.done .t-title { color: var(--text-3); text-decoration: line-through; }
.chk { width: 16.5px; height: 16.5px; accent-color: var(--accent); cursor: pointer; vertical-align: middle; }
.check { width: 21px; height: 21px; border-radius: 50%; border: 1.5px solid var(--border); background: var(--surface); display: inline-grid; place-items: center; cursor: pointer; padding: 0; color: transparent; flex: none; }
.check:hover { border-color: var(--good); color: var(--good); }
.check.on { background: var(--good); border-color: var(--good); color: var(--surface); }
.check.on .ki .d { opacity: 1; }
.t-title { font-weight: 500; display: block; overflow: hidden; text-overflow: ellipsis; }
.t-sub { display: block; font-size: var(--fs-1); color: var(--text-3); overflow: hidden; text-overflow: ellipsis; line-height: 1.3; }
.person { display: flex; align-items: center; gap: var(--s-2); min-width: 0; }
.due.overdue { color: var(--bad-ink); font-weight: 500; }
.empty { padding: var(--s-6) var(--s-4); text-align: center; color: var(--text-3); display: grid; gap: var(--s-2); justify-items: center; white-space: normal; }
.empty b { color: var(--text); font-size: var(--fs-3); font-weight: 600; }
.table-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding-block: var(--s-2); padding-inline: var(--pad-inline); border-top: 1px solid var(--border); color: var(--text-3); flex-wrap: wrap; background: var(--surface); }
.table-foot select { height: var(--ctl-sm); border: 1px solid var(--border); border-radius: var(--r-1); background: var(--surface); padding: 0 var(--s-1); font-size: var(--fs-2); margin-left: var(--s-2); }
.pager { display: flex; align-items: center; gap: var(--s-2); }
.pager button { width: var(--ctl-sm); height: var(--ctl-sm); border-radius: var(--r-1); border: 1px solid var(--border); background: var(--surface); display: grid; place-items: center; cursor: pointer; color: var(--text-2); padding: 0; }
.pager button:disabled { opacity: .45; cursor: default; }
.users-card { overflow: hidden; }
.users-card .toolbar { border-radius: var(--r-3) var(--r-3) 0 0; }
.bulk { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; padding: var(--s-2) var(--s-4); background: var(--accent-tint); color: var(--accent); border-bottom: 1px solid var(--border); }
.bulk b { font-weight: 600; margin-right: auto; }

/* =====================================================================
   Cards, stats, grids, charts
   ===================================================================== */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-3); box-shadow: var(--shadow); min-width: 0; display: flex; flex-direction: column; }
.card-head { min-height: var(--ctl-lg); padding: var(--s-2) var(--s-4); display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head h3 { font-size: var(--fs-3); display: flex; align-items: center; gap: var(--s-2); }
.card-head h3 .ki { color: var(--accent); }
.card-body { padding: var(--s-4); flex: 1; display: grid; gap: var(--s-3); align-content: start; }
.card-foot { border-top: 1px solid var(--border); padding: var(--s-3) var(--s-4); display: flex; justify-content: center; }
.danger-card { border-color: var(--bad-tint); }
.g4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-4); }
.g3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-3); }
.gg { display: grid; grid-template-columns: minmax(0, 1.618fr) minmax(0, 1fr); gap: var(--s-4); }
.stat { padding: var(--s-4); display: grid; gap: var(--s-3); }
.stat-top { display: flex; align-items: center; justify-content: space-between; color: var(--text-2); }
.stat-val { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.stat-val b { font: 600 var(--fs-5)/1 var(--font-mono); letter-spacing: -0.03em; }
.delta { display: inline-flex; align-items: center; gap: 3px; font: 500 var(--fs-1)/1 var(--font-mono); padding: var(--s-1); border-radius: var(--r-1); }
.delta.up { background: var(--good-tint); color: var(--good-ink); }
.delta.down { background: var(--bad-tint); color: var(--bad-ink); }
.stat-foot { border-top: 1px dashed var(--border); padding-top: var(--s-3); color: var(--text-3); }
.stat-foot b { color: var(--text); font-weight: 600; }
.big-money { display: flex; align-items: baseline; gap: var(--s-2); }
.big-money b { font: 600 var(--fs-6)/1 var(--font-mono); letter-spacing: -0.03em; }
.kv { display: flex; justify-content: space-between; align-items: center; background: var(--bg); border-radius: var(--r-2); padding: var(--s-2) var(--s-3); }
.kv b { font-family: var(--font-mono); font-weight: 600; }
.progress { height: 8px; border-radius: var(--r-pill); background: var(--surface-2); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--series-1); border-radius: var(--r-pill); }
.progress.hi span { background: var(--series-2); }
.mini { background: var(--bg); border-radius: var(--r-2); padding: var(--s-3); text-align: center; display: grid; gap: 2px; }
.mini b { font: 600 var(--fs-4)/1.2 var(--font-mono); }
.metric { display: flex; align-items: center; gap: var(--s-3); }
.metric .ic { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--border); display: grid; place-items: center; color: var(--text-2); flex: none; }
.metric b { font: 600 var(--fs-4)/1.2 var(--font-mono); }
.metric .plus { font: 500 var(--fs-1)/1 var(--font-mono); color: var(--good-ink); margin-left: var(--s-1); }
.chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font: 400 var(--fs-1) var(--font-mono); fill: var(--text-3); }
.chart text.peak { fill: var(--text); font-weight: 600; }
.chart .gl { stroke: var(--grid); stroke-width: 1; stroke-dasharray: 3 5; }
.sub-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); }
.sub-head h4 { font-size: var(--fs-2); display: flex; align-items: center; gap: var(--s-2); }
.sub-head h4 .ki { color: var(--text-3); }

/* Overview widgets */
.kpi { padding: var(--s-4); display: grid; gap: var(--s-3); grid-template-columns: 1fr auto; align-content: start; }
.kpi-icon { width: 55px; height: 55px; border-radius: var(--r-3); display: grid; place-items: center; background: var(--accent-tint); color: var(--accent); }
.kpi-icon.hi { background: var(--hi-tint); color: var(--hi-ink); }
.kpi .spark { width: 89px; height: 34px; align-self: center; }
.kpi .lbl { grid-column: 1 / -1; color: var(--text-2); }
.kpi .val { grid-column: 1 / -1; font: 600 var(--fs-6)/1 var(--font-mono); letter-spacing: -0.03em; margin-top: calc(-1 * var(--s-1)); }
.kpi .foot { grid-column: 1 / -1; display: flex; align-items: center; gap: var(--s-2); color: var(--text-3); flex-wrap: wrap; }
.chart-wrap { position: relative; padding: var(--s-3) var(--s-4); }
.chart-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--border); }
.chart-summary div { padding: var(--s-3) var(--s-4); display: grid; gap: 2px; border-right: 1px solid var(--border); }
.chart-summary div:last-child { border-right: 0; }
.chart-summary span { color: var(--text-3); }
.chart-summary b { font: 600 var(--fs-3)/1.2 var(--font-mono); }
.legend { display: flex; gap: var(--s-4); flex-wrap: wrap; color: var(--text-2); align-items: center; }
.legend i { display: inline-block; width: 13px; height: 3px; border-radius: 2px; margin-right: var(--s-1); vertical-align: middle; background: var(--series-1); }
.legend i.dash { background: repeating-linear-gradient(90deg, var(--series-2) 0 5px, transparent 5px 8px); }
.tip { position: absolute; pointer-events: none; padding: var(--s-2) var(--s-3); border-radius: var(--r-2); background: var(--text); color: var(--bg); font-size: var(--fs-1); line-height: 1.618; white-space: nowrap; transform: translate(-50%, calc(-100% - 13px)); box-shadow: var(--shadow-pop); }
.tip b { font: 600 var(--fs-2)/1.3 var(--font-mono); display: block; }
.move { display: grid; gap: var(--s-3); }
.move-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: var(--s-3); align-items: center; }
.move-row .mi { width: 34px; height: 34px; border-radius: var(--r-2); display: grid; place-items: center; }
.move-row .mi.pos { background: var(--accent-tint); color: var(--accent); }
.move-row .mi.neg { background: var(--bad-tint); color: var(--bad-ink); }
.move-row .t { display: grid; gap: var(--s-1); min-width: 0; }
.move-row .t b { font-weight: 500; }
.track { height: 5px; border-radius: var(--r-pill); background: var(--surface-2); overflow: hidden; }
.track span { display: block; height: 100%; border-radius: var(--r-pill); }
.move-row .num { font-weight: 600; text-align: right; }
.net { display: flex; justify-content: space-between; align-items: baseline; padding-top: var(--s-3); border-top: 1px dashed var(--border); }
.net .num { font-size: var(--fs-4); font-weight: 600; color: var(--good); }
.formula { font: 400 var(--fs-1)/1.618 var(--font-mono); color: var(--text-3); }
.target { display: grid; grid-template-columns: minmax(0, 1.618fr) minmax(0, 1fr); overflow: hidden; }
.target-copy { padding: var(--s-4); display: grid; gap: var(--s-2); align-content: center; }
.target-copy .num { font-size: var(--fs-6); font-weight: 600; letter-spacing: -0.03em; line-height: 1; }
.target-copy p { color: var(--text-2); }
.target-art { background: var(--bg); display: grid; place-items: center; padding: var(--s-3); border-left: 1px solid var(--border); }
.mix-bar { display: flex; height: 8px; border-radius: var(--r-pill); overflow: hidden; gap: 3px; margin-bottom: var(--s-3); }
.mix-list { display: grid; gap: var(--s-2); }
.mix-list div { display: grid; grid-template-columns: 13px 1fr auto 34px; gap: var(--s-2); align-items: center; }
.mix-list i { width: 8px; height: 8px; border-radius: 2px; }
.mix-list .num { text-align: right; color: var(--text-2); }

/* Activity timeline (Overview, profile, company detail) */
.timeline { display: grid; }
.tl { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: var(--s-3); position: relative; padding-bottom: var(--s-4); }
.tl::before { content: ""; position: absolute; left: 16.5px; top: 34px; bottom: 0; border-left: 1px dashed var(--border); }
.tl:last-child::before { display: none; }
.tl .ic { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; }
/* Zero specificity so a tone class (.t-good etc.) on the icon wins without re-declaring it. */
:where(.tl .ic) { background: var(--surface-2); color: var(--text-2); }
.tl p { padding-top: var(--s-1); }
.tl p b { font-weight: 600; }
.tl p span { display: block; font-size: var(--fs-1); color: var(--text-3); }

/* Definition list and row lists */
.dl { display: grid; }
.dl-row { display: grid; grid-template-columns: 144px minmax(0, 1fr); gap: var(--s-3); align-items: center; min-height: var(--ctl); padding: var(--s-1) 0; }
.dl-row dt { display: flex; align-items: center; gap: var(--s-2); color: var(--text-3); }
.dl-row dd { margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.app-row, .list-row, .team-row { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) 0; border-bottom: 1px solid var(--border); }
.app-row:last-child, .list-row:last-child, .team-row:last-child { border-bottom: 0; }
.list-row { flex-wrap: wrap; }
.team-row { justify-content: space-between; padding: var(--s-2) 0; }
.app-row .txt { flex: 1; min-width: 0; }
.list-row .txt { flex: 1; min-width: 144px; }
.app-row .txt b, .list-row .txt b, .team-row b { display: block; font-weight: 600; }

@media (max-width: 1220px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 987px) { .gg { grid-template-columns: minmax(0, 1fr); } .hide-md { display: none !important; } }
@media (max-width: 610px) {
  .g4, .g3 { grid-template-columns: minmax(0, 1fr); }
  .search input { width: 144px; }
  .hide-sm { display: none !important; }
  .dl-row { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .target { grid-template-columns: minmax(0, 1fr); } .target-art { border-left: 0; border-top: 1px solid var(--border); }
  .chart-summary { grid-template-columns: minmax(0, 1fr); } .chart-summary div { border-right: 0; border-bottom: 1px solid var(--border); }
}

/* =====================================================================
   Overlays: sheet form, toast, command palette, modal, tooltip
   ===================================================================== */
/* Backdrops */
.scrim, .palette-wrap, .modal-wrap, .side-scrim.open { position: fixed; inset: 0; background: var(--scrim); }
.scrim { z-index: 20; }
.sheet { position: fixed; top: 0; right: 0; bottom: 0; z-index: 21; width: min(377px, 100%); background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-pop); display: flex; flex-direction: column; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); padding-right: env(safe-area-inset-right, 0px); }
.sheet header { height: var(--bar); display: flex; align-items: center; justify-content: space-between; padding: 0 var(--s-4); border-bottom: 1px solid var(--border); flex: none; }
.sheet header h2 { font-size: var(--fs-3); display: flex; align-items: center; gap: var(--s-2); }
.sheet header h2 .ki { color: var(--accent); }
.sheet form { flex: 1; overflow-y: auto; padding: var(--s-4); display: grid; gap: var(--s-4); align-content: start; }
.sheet footer { display: flex; justify-content: flex-end; gap: var(--s-2); padding: var(--s-3) var(--s-4); border-top: 1px solid var(--border); flex: none; }
.sheet .seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; }
.pick { display: flex; flex-wrap: wrap; gap: var(--s-1); }
.pick button { display: inline-flex; align-items: center; gap: var(--s-1); height: var(--ctl-sm); padding: 0 var(--s-2); border: 1px solid var(--border); border-radius: var(--r-pill); background: var(--surface); font-size: var(--fs-2); cursor: pointer; color: var(--text-2); }
.pick button.has-av { padding-left: 3px; }
.pick button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-tint); color: var(--accent); }

.toast { position: fixed; left: 50%; bottom: calc(var(--s-5) + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 30; background: var(--text); color: var(--bg); padding: var(--s-2) var(--s-2) var(--s-2) var(--s-3); border-radius: var(--r-2); font-size: var(--fs-2); max-width: calc(100% - 2 * var(--gutter)); display: flex; gap: var(--s-2); align-items: center; box-shadow: var(--shadow-pop); }
.toast button { border: 0; background: transparent; color: inherit; font-weight: 600; cursor: pointer; padding: 3px var(--s-2); border-radius: var(--r-1); text-decoration: underline; text-underline-offset: 3px; }

.palette-wrap { z-index: 22; display: grid; place-items: start center; padding: 89px var(--gutter) 16px; }
.palette { width: min(610px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-3); box-shadow: var(--shadow-pop); overflow: hidden; }
.palette-search { display: flex; align-items: center; gap: var(--s-2); padding: 0 var(--s-4); border-bottom: 1px solid var(--border); color: var(--text-3); }
.palette input { width: 100%; height: var(--ctl-lg); border: 0; background: transparent; color: var(--text); font-size: var(--fs-3); outline: none; }
.palette ul { list-style: none; margin: 0; padding: var(--s-2); max-height: 377px; overflow: auto; }
.palette li.grp { padding: var(--s-2) var(--s-3) var(--s-1); }
.palette li a, .palette li button { width: 100%; display: flex; gap: var(--s-3); align-items: center; height: var(--ctl); padding: 0 var(--s-3); border: 0; border-radius: var(--r-2); background: transparent; color: var(--text); font-size: var(--fs-2); cursor: pointer; text-align: left; text-decoration: none; }
.palette li .ki { color: var(--text-3); }
.palette li [aria-selected="true"], .palette li a:hover, .palette li button:hover { background: var(--accent-tint); color: var(--accent); }
.palette li [aria-selected="true"] .ki { color: var(--accent); }
.palette .empty-p { padding: var(--s-4); color: var(--text-3); }

.modal-wrap { z-index: 23; display: grid; place-items: center; padding: var(--s-4) var(--gutter); }
.modal { width: min(610px, 100%); max-height: calc(100vh - 2 * var(--s-4)); overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-3); box-shadow: var(--shadow-pop); display: flex; flex-direction: column; }
.modal header { display: flex; justify-content: space-between; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--border); min-height: var(--ctl-lg); }
.modal header h2 { font-size: var(--fs-3); }
.modal .body { padding: var(--s-4); display: grid; gap: var(--s-3); }
.modal footer { display: flex; justify-content: flex-end; gap: var(--s-2); padding: var(--s-3) var(--s-4); border-top: 1px solid var(--border); }
[data-tip] { position: relative; }
[data-tip]:hover::after, [data-tip]:focus-visible::after { content: attr(data-tip); position: absolute; bottom: calc(100% + var(--s-2)); left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); font-size: var(--fs-1); line-height: 1.3; padding: var(--s-1) var(--s-2); border-radius: var(--r-1); white-space: nowrap; z-index: 30; pointer-events: none; }

/* =====================================================================
   Auth and error pages
   ===================================================================== */
.auth { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.618fr); min-height: 100vh; background: var(--surface); }
.auth-form { display: flex; flex-direction: column; padding-block: var(--s-5); padding-inline: var(--pad-inline-wide); }
.auth-form .inner { width: 100%; max-width: 377px; margin: auto; display: grid; gap: var(--s-4); }
.auth-form h1 { font-size: var(--fs-5); letter-spacing: -0.03em; }
.auth-form .lead { color: var(--text-2); }
.auth-form .brand-link { margin-bottom: var(--s-3); }
.auth-form form { display: grid; gap: var(--s-3); }
.auth-form .row-between { display: flex; justify-content: space-between; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.auth-form .btn-primary { justify-content: center; }
.auth-foot { text-align: center; color: var(--text-2); }
.or { display: flex; align-items: center; gap: var(--s-3); }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.sso { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-2); }
.sso .btn { justify-content: center; }
.state { display: grid; gap: var(--s-3); justify-items: start; }
.state .tile { width: 55px; height: 55px; border-radius: var(--r-3); }
.otp { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--s-2); }
.otp input { height: var(--ctl-lg); text-align: center; font: 600 var(--fs-4) var(--font-mono); border: 1px solid var(--border); border-radius: var(--r-2); background: var(--surface); width: 100%; }
.otp input:focus { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: 1px; }
.demo-note { font-size: var(--fs-1); color: var(--text-3); background: var(--bg); border: 1px dashed var(--border); border-radius: var(--r-2); padding: var(--s-2) var(--s-3); }
.auth-art { position: relative; overflow: hidden; background: var(--panel); color: var(--panel-text); display: flex; flex-direction: column; justify-content: space-between; padding: var(--s-6); }
.auth-art > * { position: relative; }
.auth-art .pattern { position: absolute; inset: 0; }
.auth-art blockquote { margin: 0; max-width: 34ch; font-size: var(--fs-5); line-height: 1.3; letter-spacing: -0.02em; font-weight: 500; }
.auth-art blockquote em { font-style: normal; color: var(--panel-hi); }
.auth-art .who { display: flex; align-items: center; gap: var(--s-3); margin-top: var(--s-4); color: var(--panel-muted); }
.auth-art .who .pv { background: var(--panel-hi-tint); color: var(--panel-hi); }
.auth-art .iso { max-width: 377px; align-self: flex-end; }
.auth-art .iso polygon { stroke: var(--panel); }
/* Tiled logo watermark on the brand panels. */
.auth-art .pattern::before, .cover::before { content: ""; position: absolute; inset: 0; background: var(--panel-text); -webkit-mask: var(--mk-mono) 0 0 / 233px repeat; mask: var(--mk-mono) 0 0 / 233px repeat; opacity: .06; }
.cover::before { -webkit-mask-size: 144px; mask-size: 144px; opacity: .08; }
.err-page { min-height: 100vh; display: grid; place-items: center; text-align: center; background: var(--bg); padding-block: var(--s-5); padding-inline: var(--pad-inline); }
.err-page .inner { display: grid; gap: var(--s-4); justify-items: center; max-width: 610px; }
.err-page .code { font: 600 var(--fs-8)/1 var(--font-mono); letter-spacing: -0.05em; color: var(--accent); }
.err-page .iso { width: 233px; }
@media (max-width: 987px) { .auth { grid-template-columns: minmax(0, 1fr); } .auth-art { display: none; } }

/* =====================================================================
   Form controls (standalone, usable outside sheets)
   ===================================================================== */
.input, .select, .textarea { width: 100%; height: var(--ctl); border: 1px solid var(--border); border-radius: var(--r-2); background: var(--surface); color: var(--text); padding: 0 var(--s-3); font-size: var(--fs-2); }
.textarea { height: 89px; padding: var(--s-2) var(--s-3); line-height: 1.618; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: 1px; }
.input:disabled, .select:disabled, .textarea:disabled { background: var(--bg); color: var(--text-3); cursor: not-allowed; }
.input.sm, .select.sm { height: var(--ctl-sm); }
.input.lg { height: var(--ctl-lg); font-size: var(--fs-3); }
.help { font-size: var(--fs-1); color: var(--text-3); }
.help.err { color: var(--bad-ink); }
.help.ok { color: var(--good-ink); }
.field-row { display: grid; gap: var(--s-1); }
.field-row > label, .field-row > .lbl { font-size: var(--fs-2); font-weight: 500; }
.field-row .req { color: var(--bad-ink); }
.input-group { display: flex; align-items: stretch; border: 1px solid var(--border); border-radius: var(--r-2); background: var(--surface); overflow: hidden; height: var(--ctl); }
.input-group:focus-within { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: 1px; }
.input.is-invalid, .select.is-invalid, .textarea.is-invalid, .input-group.is-invalid, .otp input.is-invalid, .seg.is-invalid { border-color: var(--bad); }
.input.is-valid, .select.is-valid, .textarea.is-valid, .input-group.is-valid, .otp input.is-valid, .seg.is-valid { border-color: var(--good); }
/* .pick has no border of its own. */
.pick.is-invalid { outline: 1px solid var(--bad); outline-offset: var(--s-1); border-radius: var(--r-2); }
.input-group .addon { display: grid; place-items: center; padding: 0 var(--s-3); background: var(--bg); color: var(--text-3); font-size: var(--fs-2); border-right: 1px solid var(--border); }
.input-group .addon.end { border-right: 0; border-left: 1px solid var(--border); }
.input-group input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 0 var(--s-3); font-size: var(--fs-2); outline: none; color: var(--text); }
.pw-toggle { border: 0; background: transparent; color: var(--text-3); padding: 0 var(--s-3); cursor: pointer; display: grid; place-items: center; }
.pw-toggle:hover { color: var(--text); }
/* Password strength: data-s = 1..4 fills that many bars. */
.meter { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-1); }
.meter i { height: 5px; border-radius: var(--r-pill); background: var(--surface-2); }
.meter[data-s="1"] i:nth-child(-n+1) { background: var(--bad); }
.meter[data-s="2"] i:nth-child(-n+2) { background: var(--warn); }
.meter[data-s="3"] i:nth-child(-n+3) { background: var(--series-1); }
.meter[data-s="4"] i:nth-child(-n+4) { background: var(--good); }
.check-row { display: flex; align-items: center; gap: var(--s-2); font-size: var(--fs-2); cursor: pointer; }
.check-row input[type="checkbox"], .check-row input[type="radio"] { width: 16.5px; height: 16.5px; accent-color: var(--accent); margin: 0; cursor: pointer; flex: none; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-3) 0; border-bottom: 1px solid var(--border); }
.switch-row:last-child { border-bottom: 0; }
.switch-row b { display: block; font-weight: 500; }
.switch-row span.help { display: block; }
.range { width: 100%; accent-color: var(--accent); }
.dropzone { border: 1.5px dashed var(--border); border-radius: var(--r-3); background: var(--bg); padding: var(--s-5) var(--s-4); text-align: center; display: grid; gap: var(--s-2); justify-items: center; color: var(--text-2); cursor: pointer; }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-tint); }
.dropzone .ki { color: var(--accent); }
.file-list { display: grid; gap: var(--s-1); }
.file-list div { display: flex; justify-content: space-between; gap: var(--s-2); padding: var(--s-1) var(--s-2); background: var(--bg); border-radius: var(--r-1); font-size: var(--fs-2); }
.avatar-up { display: flex; align-items: center; gap: var(--s-4); flex-wrap: wrap; }
.avatar-up img, .avatar-up .pv.xl { width: 89px; height: 89px; border-radius: 50%; object-fit: cover; font-size: var(--fs-4); }
.key-new { display: flex; gap: var(--s-2); align-items: center; }
.key-new input { flex: 1; min-width: 0; font-family: var(--font-mono); }
/* Two-factor setup. QR codes stay dark-on-white in both themes so phone cameras can read them. */
.steps-list { margin: 0; padding-left: 1.25em; display: grid; gap: var(--s-4); }
.steps-list > li { display: grid; gap: var(--s-2); }
.qr { width: 176px; padding: var(--s-2); background: #fff; border: 1px solid var(--border); border-radius: var(--r-2); }
.qr svg { display: block; width: 100%; height: auto; }
.backup-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-2) var(--s-4); margin: 0; padding: var(--s-3) var(--s-4); list-style: none; font: 500 var(--fs-2) var(--font-mono); background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-2); }
.usage { display: grid; gap: var(--s-1); }
.usage .sub-head span:last-child { font-family: var(--font-mono); color: var(--text-2); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-3) var(--s-4); }
.form-grid .full { grid-column: 1 / -1; }
.el-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-4); }
.el-grid .wide { grid-column: 1 / -1; }
.form-h .field-row { grid-template-columns: 144px minmax(0, 1fr); align-items: center; gap: var(--s-3); }
.form-h .field-row > label { text-align: right; }
.form-inline { display: flex; gap: var(--s-2); flex-wrap: wrap; align-items: flex-end; }
.form-actions { display: flex; justify-content: flex-end; gap: var(--s-2); padding-top: var(--s-3); border-top: 1px solid var(--border); }
.fieldset { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.618fr); gap: var(--s-4); padding: var(--s-4) 0; border-bottom: 1px solid var(--border); }
.fieldset:last-of-type { border-bottom: 0; }
.fieldset h3 { font-size: var(--fs-3); }
.fieldset > div:first-child p { color: var(--text-2); margin-top: var(--s-1); }
@media (max-width: 987px) { .el-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 610px) { .form-grid { grid-template-columns: minmax(0, 1fr); } .form-h .field-row { grid-template-columns: minmax(0, 1fr); } .form-h .field-row > label { text-align: left; } .fieldset { grid-template-columns: minmax(0, 1fr); } }

/* Plan pickers: wizard cards (.plan) and settings radio cards (.plan-opt) */
.plans, .plan-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-3); }
.plan { text-align: left; border: 1px solid var(--border); border-radius: var(--r-3); background: var(--surface); padding: var(--s-4); display: grid; gap: var(--s-2); cursor: pointer; color: var(--text); }
.plan:hover { border-color: var(--text-3); }
.plan[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); background: var(--accent-tint); }
.plan b, .plan-opt b { font-size: var(--fs-3); }
.plan .price { font: 600 var(--fs-5)/1 var(--font-mono); letter-spacing: -0.02em; }
.plan ul { margin: 0; padding-left: 13px; color: var(--text-2); display: grid; gap: 2px; }
.plan-opt { border: 1px solid var(--border); border-radius: var(--r-3); padding: var(--s-3); cursor: pointer; display: grid; gap: var(--s-1); align-content: start; }
.plan-opt input { accent-color: var(--accent); }
.plan-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-tint); }
.plan-opt .price { font: 600 var(--fs-4)/1.2 var(--font-mono); }
@media (max-width: 610px) { .plans, .plan-grid { grid-template-columns: minmax(0, 1fr); } }

/* Wizard: stepper, invite rows, review list, finish state */
.stepper { display: flex; gap: var(--s-2); flex-wrap: wrap; counter-reset: step; }
.step { flex: 1; min-width: 144px; display: flex; align-items: center; gap: var(--s-2); padding: var(--s-3); border-radius: var(--r-2); border: 1px solid var(--border); background: var(--surface); color: var(--text-2); }
.step .no { width: 26.8px; height: 26.8px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font: 600 var(--fs-2)/1 var(--font-mono); flex: none; }
.step b { display: block; font-weight: 600; color: var(--text); }
.step span.help { display: block; }
.step.current { border-color: var(--accent); }
.step.current .no { background: var(--btn); color: var(--on-btn); }
.step.done .no { background: var(--good-tint); color: var(--good-ink); }
.invite { display: grid; grid-template-columns: minmax(0, 1.618fr) minmax(0, 1fr) auto; gap: var(--s-2); align-items: start; }
.review { display: grid; }
.review div { display: grid; grid-template-columns: 144px minmax(0, 1fr); gap: var(--s-3); padding: var(--s-2) 0; border-bottom: 1px solid var(--border); }
.review div:last-child { border-bottom: 0; }
.review dt { color: var(--text-3); }
.review dd { margin: 0; }
.done-state { display: grid; justify-items: center; text-align: center; gap: var(--s-3); padding: var(--s-5) var(--s-4); }
.done-state .iso { max-width: 233px; }
@media (max-width: 610px) { .invite { grid-template-columns: minmax(0, 1fr) auto; } .invite .select { grid-column: 1 / 2; } .review div { grid-template-columns: minmax(0, 1fr); gap: 0; } }

/* =====================================================================
   Side-nav layouts (settings, docs, UI kit): sticky contents column
   ===================================================================== */
.set-layout { display: grid; grid-template-columns: 233px minmax(0, 1fr); gap: var(--s-4); align-items: start; }
.docs { display: grid; grid-template-columns: 233px minmax(0, 1fr); gap: var(--s-5); align-items: start; }
.ui-layout { display: grid; grid-template-columns: 144px minmax(0, 1fr); gap: var(--s-4); align-items: start; }
.set-nav, .doc-toc, .ui-toc { position: sticky; top: calc(var(--bar) + var(--s-5)); display: grid; gap: 2px; }
.ui-main section, .doc-sec { scroll-margin-top: calc(var(--bar) + var(--s-5)); }
.set-nav { padding: var(--s-2); }
.set-nav a { display: flex; align-items: center; gap: var(--s-3); height: var(--ctl); padding: 0 var(--s-3); border-radius: var(--r-2); color: var(--text-2); text-decoration: none; font-weight: 500; white-space: nowrap; }
.set-nav a .ki { color: var(--text-3); }
.set-nav a[aria-current="page"] { background: var(--accent-tint); color: var(--accent); }
.set-nav a[aria-current="page"] .ki { color: var(--accent); }
.doc-toc { padding: var(--s-3); }
.doc-toc b { padding: 0 var(--s-2) var(--s-1); }
.doc-toc a { height: var(--ctl); display: flex; align-items: center; padding: 0 var(--s-2); border-radius: var(--r-2); color: var(--text-2); text-decoration: none; }
.ui-toc a { display: block; padding: var(--s-1) var(--s-2); border-radius: var(--r-1); color: var(--text-2); text-decoration: none; font-size: var(--fs-2); }
.set-nav a:hover, .doc-toc a:hover, .ui-toc a:hover { background: var(--surface-2); color: var(--text); }
.pane, .doc-main, .ui-main { display: grid; gap: var(--s-4); min-width: 0; }
.doc-sec h3 { font-size: var(--fs-3); }
.doc-sec p { max-width: 89ch; }
.doc-sec table.grid td { white-space: normal; max-width: none; height: auto; padding-block: var(--s-2); vertical-align: top; overflow: visible; }
.doc-sec table.grid td.mono { word-break: break-word; min-width: 144px; }
@media (max-width: 987px) {
  .set-layout, .docs, .ui-layout { grid-template-columns: minmax(0, 1fr); }
  .set-nav, .doc-toc, .ui-toc { position: static; }
  .set-nav { display: flex; overflow-x: auto; }
  .doc-toc { grid-template-columns: repeat(auto-fill, minmax(144px, 1fr)); }
  .doc-toc b { grid-column: 1 / -1; }
  .ui-toc { display: flex; flex-wrap: wrap; gap: var(--s-1); }
  .ui-toc a { border: 1px solid var(--border); }
}

/* =====================================================================
   UI components: alerts, pagination, spinner, skeleton, demo rows
   ===================================================================== */
.alert { display: flex; gap: var(--s-3); align-items: flex-start; padding: var(--s-3) var(--s-4); border-radius: var(--r-3); border: 1px solid transparent; }
.alert .ki { flex: none; margin-top: 1px; }
.alert b { display: block; font-weight: 600; }
.alert.info { background: var(--accent-tint); color: var(--accent); }
.alert.success { background: var(--good-tint); color: var(--good-ink); }
.alert.warning { background: var(--warn-tint); color: var(--warn-ink); }
.alert.danger { background: var(--bad-tint); color: var(--bad-ink); }
.alert .x { margin-left: auto; }
.pagination { display: flex; gap: var(--s-1); align-items: center; }
.pagination a, .pagination button { min-width: var(--ctl); height: var(--ctl); padding: 0 var(--s-2); border-radius: var(--r-2); border: 1px solid var(--border); background: var(--surface); color: var(--text-2); display: grid; place-items: center; font: 500 var(--fs-2)/1 var(--font-mono); cursor: pointer; text-decoration: none; }
.pagination [aria-current="page"] { background: var(--btn); border-color: var(--btn); color: var(--on-btn); }
.spinner { width: var(--icon); height: var(--icon); border-radius: 50%; border: 2px solid var(--surface-2); border-top-color: var(--accent); animation: spin .89s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--bg), var(--surface-2)); background-size: 233px 100%; animation: shimmer 1.44s linear infinite; border-radius: var(--r-1); height: 13px; }
@keyframes shimmer { from { background-position: -233px 0; } to { background-position: 233px 0; } }
.demo-row { display: flex; gap: var(--s-2); flex-wrap: wrap; align-items: center; }
.code-snip { font: 400 var(--fs-1)/1.618 var(--font-mono); background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-2); padding: var(--s-2) var(--s-3); color: var(--text-2); overflow-x: auto; white-space: pre; }

/* Profile header */
.profile-hero { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--s-4); align-items: center; padding: var(--s-4); }
.profile-hero h2 { font-size: var(--fs-4); }
.profile-hero .meta { display: flex; gap: var(--s-4); flex-wrap: wrap; color: var(--text-2); margin-top: var(--s-1); }
.profile-hero .meta span { display: inline-flex; align-items: center; gap: var(--s-1); }
.cover { height: 144px; border-radius: var(--r-3) var(--r-3) 0 0; background: var(--panel); position: relative; overflow: hidden; }
.hero-card { overflow: hidden; }
.hero-card .profile-hero { margin-top: calc(-1 * var(--s-5)); position: relative; }
.hero-card .profile-hero .pv.xl { box-shadow: 0 0 0 3px var(--surface); }
@media (max-width: 610px) { .profile-hero { grid-template-columns: minmax(0, 1fr); } }

/* Isometric illustrations (faces coloured by the --iso-* tokens) */
.iso { display: block; width: 100%; height: auto; }
.a-t { fill: var(--iso-a-t); } .a-l { fill: var(--iso-a-l); } .a-r { fill: var(--iso-a-r); }
.b-t { fill: var(--iso-b-t); } .b-l { fill: var(--iso-b-l); } .b-r { fill: var(--iso-b-r); }
.n-t { fill: var(--iso-n-t); } .n-l { fill: var(--iso-n-l); } .n-r { fill: var(--iso-n-r); }
.iso polygon { stroke: var(--surface); stroke-width: .6; stroke-linejoin: round; }

/* Utilities: last so they win over component rules of equal specificity. */
.ink-good { color: var(--good-ink); }
.ink-warn { color: var(--warn-ink); }
.ink-accent { color: var(--accent); }
.ink-hi { color: var(--hi); }
.ink-text { color: var(--text); }
.center { text-align: center; }
.justify-start { justify-self: start; }
/* Uppercase micro label. */
.eyebrow, .nav-head, .palette li.grp, .doc-toc b, .or { font-size: var(--fs-1); text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); }
.eyebrow { padding-top: var(--s-3); }
.sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
@media (prefers-reduced-motion: reduce) { *, *::after { transition: none !important; } .spinner, .skeleton { animation: none; } }
