/* The Zenith365 console, redesigned 2026-10-15 (owner-approved structure). Follows the OKDR brandbook (/opt/strata/design-system):
   dark by default with an equal light theme, zinc neutrals, ONE indigo accent for identity and the active item, colour kept for state,
   a 240 px grouped sidebar and a 56 px top bar. Loaded AFTER app.css: it re-points the existing variable names at the brandbook values,
   so every existing page changes with it, and adds the new shell. The theme is data-theme on <html>: dark (default), light, system. */
@font-face { font-family: "Geist"; src: url("fonts/Geist-Variable.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("fonts/GeistMono-Variable.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  color-scheme: dark;
  --bg: #0b0b0d; --surface: #141417; --surface-2: #1b1b1f; --fg: #ededef; --muted: #9b9ba4;
  --line: rgba(255,255,255,.08); --line-strong: rgba(255,255,255,.14);
  --accent: #7c83ff; --accent-2: #7c83ff; --accent-fg: #0b0b0d;
  --ok: #3fcb5a; --warn: #fbbf3c; --err: #f47575;
  --sidebar: #0e0e11; --sidebar-fg: #b4b4bc; --sidebar-active: #222227;
  --primary: #ededef; --primary-fg: #111113;
  --shadow: 0 1px 2px rgba(0,0,0,.35); --shadow-pop: 0 18px 40px -8px rgba(0,0,0,.6);
  --radius: 10px; --radius-sm: 8px; --radius-lg: 14px;
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sidebar-w: 240px; --header-h: 56px; --content-max: 1440px;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f7f7f8; --surface: #ffffff; --surface-2: #f1f1f3; --fg: #111113; --muted: #62626b;
  --line: #e3e3e8; --line-strong: #d4d4db;
  --accent: #5b5bf0; --accent-2: #5b5bf0; --accent-fg: #ffffff;
  --ok: #0a7414; --warn: #8a5a00; --err: #b3261e;
  --sidebar: #f1f1f3; --sidebar-fg: #3f3f46; --sidebar-active: #e3e3e9;
  --primary: #18181b; --primary-fg: #fafafa;
  --shadow: 0 1px 2px rgba(17,17,19,.06); --shadow-pop: 0 18px 40px -10px rgba(17,17,19,.22);
}
@media (prefers-color-scheme: light) {
  :root[data-theme="system"] {
    color-scheme: light;
    --bg: #f7f7f8; --surface: #ffffff; --surface-2: #f1f1f3; --fg: #111113; --muted: #62626b;
    --line: #e3e3e8; --line-strong: #d4d4db;
    --accent: #5b5bf0; --accent-2: #5b5bf0; --accent-fg: #ffffff;
    --ok: #0a7414; --warn: #8a5a00; --err: #b3261e;
    --sidebar: #f1f1f3; --sidebar-fg: #3f3f46; --sidebar-active: #e3e3e9;
    --primary: #18181b; --primary-fg: #fafafa;
    --shadow: 0 1px 2px rgba(17,17,19,.06); --shadow-pop: 0 18px 40px -10px rgba(17,17,19,.22);
  }
}

body { font-family: var(--font); font-size: 14px; letter-spacing: -.003em; -webkit-font-smoothing: antialiased; }
code, kbd, pre { font-family: var(--mono); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---------- shared components, re-skinned ---------- */
.btn { border: 1px solid var(--line-strong); background: var(--surface); color: var(--fg); border-radius: var(--radius-sm); font-weight: 500; }
.btn:hover { background: var(--surface-2); border-color: var(--line-strong); color: var(--fg); }
.btn.primary { background: var(--primary); color: var(--primary-fg); border-color: transparent; font-weight: 600; }
.btn.primary:hover { background: var(--primary); color: var(--primary-fg); filter: none; opacity: .88; }
.btn.danger:hover { border-color: var(--err); color: var(--err); background: transparent; }
.tile { border-radius: var(--radius-lg); box-shadow: none; padding: 16px 18px; }
.tile .k { font-size: 11.5px; letter-spacing: .06em; font-weight: 600; }
.tile .v { font-size: 26px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.tile.clickable:hover { border-color: var(--line-strong); background: var(--surface-2); transform: none; }
.panel { border-radius: var(--radius-lg); box-shadow: none; }
.panel .phead { padding: 14px 18px; }
.panel .phead h2 { font-size: 14.5px; font-weight: 650; letter-spacing: -.01em; }
th { font-weight: 600; font-size: 11.5px; letter-spacing: .05em; }
tbody tr:hover { background: var(--surface-2); }
.badge { background: transparent; font-weight: 600; }
.badge.green { background: color-mix(in srgb, var(--ok) 13%, transparent); border-color: transparent; }
.badge.red { background: color-mix(in srgb, var(--err) 13%, transparent); border-color: transparent; }
.badge.amber { background: color-mix(in srgb, var(--warn) 14%, transparent); border-color: transparent; }
.badge.gray { background: var(--surface-2); border-color: transparent; }
.modal-bg { background: rgba(0,0,0,.55); backdrop-filter: blur(2px); }
.modal { border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); }
.toast { background: var(--primary); color: var(--primary-fg); border-radius: var(--radius-sm); box-shadow: var(--shadow-pop); }
.toast.err { background: var(--err); color: #fff; }
.field input, .field select, .field textarea, select.t-f { background: var(--surface-2); border-color: var(--line-strong); border-radius: var(--radius-sm); }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }
.search { border-radius: var(--radius-sm); border-color: var(--line-strong); }
.mtab { font-weight: 550; }
.mtab.active { color: var(--fg); border-bottom-color: var(--accent); }
.mtab.active .mtab-c { background: var(--accent); color: var(--accent-fg); }
/* the usage tabs on the Overview page sit one level below the page's own tabs */
#zenith_tabs { border-bottom: 0; gap: 6px; margin: 4px 0 14px; }
#zenith_tabs .mtab { border: 1px solid var(--line); border-radius: 999px; padding: 7px 13px; font-size: 12.5px; }
#zenith_tabs .mtab.active { background: var(--surface-2); border-color: var(--line-strong); color: var(--fg); }
.login { background: var(--bg); }
.login .card { box-shadow: var(--shadow-pop); }
.brandmark, .idcard .big, .avatar { background: var(--accent); color: var(--accent-fg); }
.pcard { border-radius: var(--radius-lg); box-shadow: none; }
.pcard:hover { transform: none; box-shadow: none; border-color: var(--line-strong); background: var(--surface-2); }
.plogo { box-shadow: none; }
.hub-title { font-size: 22px; font-weight: 650; }
.note { border-radius: var(--radius-sm); }

/* ---------- the shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; transition: grid-template-columns .16s ease; }
.shell.collapsed { grid-template-columns: 64px minmax(0, 1fr); }
.sb { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--sidebar); color: var(--sidebar-fg); border-right: 1px solid var(--line); overflow: hidden; }
.sb-head { height: var(--header-h); display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 0 10px 0 14px; border-bottom: 1px solid var(--line); flex: 0 0 auto; }
.sb-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--fg); font-weight: 650; letter-spacing: -.01em; min-width: 0; }
.sb-mk { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex: 0 0 auto; }
.sb-mk svg { width: 16px; height: 16px; }
.sb-name { white-space: nowrap; }
.sb-collapse, .tb-icon, .hamburger { width: 34px; height: 34px; display: inline-grid; place-items: center; border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent; color: var(--muted); }
.sb-collapse:hover, .tb-icon:hover, .hamburger:hover { background: var(--surface-2); color: var(--fg); }
.tb-icon { border-color: var(--line-strong); background: var(--surface); }
.sb-nav { flex: 1; overflow-y: auto; padding: 8px 8px 16px; scrollbar-width: thin; }
.sb-sec { margin-bottom: 4px; }
.sb-sec-h { display: flex; width: 100%; align-items: center; justify-content: space-between; background: none; border: 0; color: var(--muted); font: 600 11px/1 var(--font); letter-spacing: .08em; text-transform: uppercase; padding: 12px 10px 6px; cursor: pointer; text-align: left; }
.sb-sec-h:hover { color: var(--fg); }
.sb-sec-h .chev { width: 14px; height: 14px; transition: transform .15s; flex: 0 0 auto; }
.sb-sec.closed .chev { transform: rotate(-90deg); }
.sb-sec.closed .sb-items { display: none; }
.sb-items { display: flex; flex-direction: column; gap: 1px; }
.sb-items a { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: var(--radius-sm); color: var(--sidebar-fg); text-decoration: none; font-weight: 500; font-size: 13.5px; white-space: nowrap; }
.sb-items a .ico { width: 17px; height: 17px; flex: 0 0 auto; opacity: .85; }
.sb-items a:hover { background: var(--surface-2); color: var(--fg); }
.sb-items a.active { background: var(--sidebar-active); color: var(--fg); box-shadow: inset 2px 0 0 var(--accent); }
.sb-items a.active .ico { color: var(--accent); opacity: 1; }
.sb-foot { flex: 0 0 auto; display: flex; justify-content: space-between; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--muted); }
.sb-foot-r { font-family: var(--mono); }
.shell.collapsed .sb-name, .shell.collapsed .sb-l, .shell.collapsed .sb-sec-h span, .shell.collapsed .sb-sec-h .chev, .shell.collapsed .sb-foot { display: none; }
.shell.collapsed .sb-head { justify-content: center; padding: 0; flex-direction: column; height: auto; padding: 10px 0; gap: 8px; }
.shell.collapsed .sb-sec-h { padding: 6px 0; border-top: 1px solid var(--line); margin: 6px 6px 0; width: auto; }
.shell.collapsed .sb-sec:first-child .sb-sec-h { border-top: 0; }
.shell.collapsed .sb-sec.closed .sb-items { display: flex; }
.shell.collapsed .sb-items a { justify-content: center; padding: 0; }

.main { display: flex; flex-direction: column; min-width: 0; }
.tb { position: sticky; top: 0; z-index: 20; height: var(--header-h); display: flex; align-items: center; gap: 12px; padding: 0 20px; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.tb .grow { flex: 1; }
.hamburger { display: none; }
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; white-space: nowrap; min-width: 0; }
.crumb-s { color: var(--muted); }
.crumb-sep { color: var(--muted); opacity: .5; }
.crumb-p { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.tb-search { display: flex; align-items: center; gap: 8px; width: min(380px, 34vw); height: 34px; padding: 0 8px 0 10px; margin-left: 10px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); color: var(--muted); font: 13px var(--font); cursor: pointer; text-align: left; }
.tb-search:hover { border-color: var(--accent); color: var(--fg); }
.tb-search .ico { width: 15px; height: 15px; flex: 0 0 auto; }
.tb-search-t { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
kbd { font-size: 11px; padding: 2px 6px; border: 1px solid var(--line-strong); border-radius: 5px; color: var(--muted); background: var(--surface-2); }
.tenant-pill { display: flex; align-items: center; gap: 8px; background: transparent; border: 0; padding: 0; position: relative; }
.tenant-pill .tp-l { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.tenant-pill button { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); color: var(--fg); font: 600 13px var(--font); max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tenant-pill button:hover { border-color: var(--accent); }
.tenant-pill .chev { width: 14px; height: 14px; color: var(--muted); flex: 0 0 auto; }
.tpicker { border-radius: var(--radius); box-shadow: var(--shadow-pop); }
.usermenu { position: relative; display: flex; align-items: center; }
.avatar { width: 34px; height: 34px; border: 0; font-size: 12.5px; letter-spacing: .02em; }
.acctmenu { border-radius: var(--radius); box-shadow: var(--shadow-pop); padding: 6px; }
.acct-who { display: flex; flex-direction: column; gap: 2px; padding: 10px 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.acct-theme { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px 4px 8px; }
.acct-theme button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: transparent; color: var(--muted); font: 500 12px var(--font); }
.acct-theme button .ico { width: 16px; height: 16px; }
.acct-theme button:hover { background: var(--surface-2); color: var(--fg); }
.acct-theme button.on { border-color: var(--accent); color: var(--fg); background: var(--surface-2); }
.acct-item { display: flex; align-items: center; gap: 9px; width: 100%; padding: 9px 10px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--fg); font: 500 13px var(--font); text-align: left; cursor: pointer; }
.acct-item:hover { background: var(--surface-2); }
.acct-item .ico { width: 16px; height: 16px; color: var(--muted); }
.ico { width: 18px; height: 18px; flex: 0 0 auto; }

.content { padding: 24px 28px 56px; width: 100%; max-width: var(--content-max); margin: 0 auto; overflow: visible; }
.pagehead h1 { font-size: 22px; font-weight: 650; letter-spacing: -.02em; margin: 0; line-height: 1.2; }
.pagehead p { margin: 5px 0 20px; color: var(--muted); font-size: 13.5px; max-width: 72ch; }
.tenant-banner { margin: 14px 28px 0; }

/* ---------- search ---------- */
.cmdk-bg { position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,.5); backdrop-filter: blur(2px); display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 0; }
.cmdk { width: min(660px, 100%); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); overflow: hidden; display: flex; flex-direction: column; max-height: 70vh; }
.cmdk-in { display: flex; align-items: center; gap: 10px; padding: 0 14px; height: 52px; border-bottom: 1px solid var(--line); color: var(--muted); }
.cmdk-in input { flex: 1; border: 0; background: transparent; outline: 0; color: var(--fg); font: 15px var(--font); }
.cmdk-list { overflow-y: auto; padding: 6px; }
.cmdk-row { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer; color: var(--muted); }
.cmdk-row.on { background: var(--surface-2); color: var(--fg); }
.cmdk-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cmdk-t b { font-weight: 550; color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-t small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-go { opacity: 0; width: 15px; height: 15px; }
.cmdk-row.on .cmdk-go { opacity: .7; }
.cmdk-foot { display: flex; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--muted); }
.cmdk-foot #cmdkNote { margin-left: auto; }
.chip { display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: .03em; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); min-width: 58px; text-align: center; }

/* ---------- small screens: the menu slides in, search becomes an icon ---------- */
.sb-scrim { display: none; }
@media (max-width: 900px) {
  .shell, .shell.collapsed { grid-template-columns: minmax(0, 1fr); }
  .sb { position: fixed; z-index: 40; left: 0; top: 0; width: min(84vw, 300px); transform: translateX(-102%); transition: transform .18s ease; box-shadow: var(--shadow-pop); }
  .sb.open { transform: none; }
  .sb.open ~ .sb-scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(0,0,0,.45); }
  .shell.collapsed .sb-name, .shell.collapsed .sb-l, .shell.collapsed .sb-sec-h span, .shell.collapsed .sb-sec-h .chev, .shell.collapsed .sb-foot { display: revert; }
  .sb-collapse { display: none; }
  .hamburger { display: inline-grid; }
  .tb { padding: 0 12px; gap: 8px; }
  .tb-search { width: 34px; padding: 0; justify-content: center; margin-left: 0; }
  .tb-search-t, .tb-search kbd { display: none; }
  .crumb-s, .crumb-sep { display: none; }
  .tenant-pill .tp-l { display: none; }
  .content { padding: 18px 14px 48px; }
  .tenant-banner { margin: 12px 14px 0; }
  .pagehead h1 { font-size: 20px; }
}
@media (max-width: 520px) { .tenant-pill button { max-width: 120px; } }
@media (prefers-reduced-motion: reduce) { .shell, .sb { transition: none; } }

/* ---------- polish found when looking at the real pages ---------- */
.dup-title { display: none; }
.panel .phead { flex-wrap: wrap; }
.badge { white-space: nowrap; }
.filterbar { align-items: flex-end; flex-wrap: wrap; gap: 12px; }
.filterbar .field { margin: 0; }
.filterbar .field select { height: 36px; }
@media (max-width: 900px) {
  .panel .phead .btn { padding: 6px 10px; }
  .tbar select.t-f { max-width: 100%; }
}

/* row actions: first as a button, the rest in a menu */
.rowactions { position: relative; align-items: center; }
.rowpop { z-index: 60; min-width: 170px; display: flex; flex-direction: column; gap: 2px; padding: 6px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--shadow-pop); }
.rowpop[hidden] { display: none; }
.rowpop .btn { border: 0; background: transparent; text-align: left; justify-content: flex-start; width: 100%; padding: 8px 10px; border-radius: var(--radius-sm); font-size: 13px; }
.rowpop .btn:hover { background: var(--surface-2); }
.rowpop .btn.danger { color: var(--err); }
.rowmore { padding: 5px 9px; letter-spacing: .1em; }

/* status is never colour alone: a dot and the word */
/* Status badges carry a glyph as well as a colour: check = fine, cross = broken, triangle = look at it. */
.badge.green::before, .badge.red::before, .badge.amber::before { content: ""; width: 12px; height: 12px; background: currentColor; flex: 0 0 auto;
  -webkit-mask: var(--bi) center / contain no-repeat; mask: var(--bi) center / contain no-repeat; }
.badge.green { --bi: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 8.5l3.2 3.2L13 4.8'/%3E%3C/svg%3E"); }
.badge.red { --bi: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M4 4l8 8M12 4l-8 8'/%3E%3C/svg%3E"); }
.badge.amber { --bi: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 2.2L14.4 13H1.6z'/%3E%3Cpath d='M8 6.6v3M8 11.6v.1'/%3E%3C/svg%3E"); }

/* A person's details open as a panel from the right, so the list stays in view beside it. */
.modal-bg:has(.modal.drawer) { place-items: stretch end; }
.modal.wide.drawer { width: min(100vw, 780px); max-height: none; height: 100vh; border-radius: 0; border-width: 0 0 0 1px; box-shadow: -18px 0 48px rgba(0,0,0,.35); animation: drawer-in .18s ease-out; }
@keyframes drawer-in { from { transform: translateX(32px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .modal.wide.drawer { animation: none; } }

/* The Calls page tables fit the page: cells wrap instead of the table scrolling sideways. */
#tc_run th, #tc_run td, #fc_table th, #fc_table td { white-space: normal; padding-left: 10px; padding-right: 10px; }
@media (min-width: 1100px) { #tc_run .tablewrap, #fc_table .tablewrap { overflow-x: visible; } }   /* narrower windows scroll the table, not the page */
