/* ==========================================================================
   Atlas — ZION skin (2026-09-23)
   Black-and-white "Zion ops" board wall with a planetary gear core.
   Everything here is scoped to html.zion, so ?skin=classic (or removing the
   <link>) restores the original look instantly. Light + dark via html.zion-light
   / html.zion-dark. Original UI tagged in git as biz-atlas-pre-zion-ui.
   ========================================================================== */

html.zion-light {
  --z-ink: #111413; --z-ground: #ECEEEC; --z-mid: #59615E; --z-dim: #8C9491;
  --z-glass: rgba(255,255,255,0.58); --z-line: rgba(17,20,19,0.26); --z-hair: rgba(17,20,19,0.10);
  --z-grid: rgba(17,20,19,0.045); --z-veil: rgba(236,238,236,0.94); --z-ink-soft: rgba(17,20,19,0.06);
  --z-machine: #999999; --z-panel: rgba(236,238,236,0.62);
}
html.zion-dark {
  --z-ink: #E9EDEB; --z-ground: #050606; --z-mid: #8E9794; --z-dim: #5F6865;
  --z-glass: rgba(233,237,235,0.045); --z-line: rgba(233,237,235,0.22); --z-hair: rgba(233,237,235,0.09);
  --z-grid: rgba(233,237,235,0.04); --z-veil: rgba(5,6,6,0.93); --z-ink-soft: rgba(233,237,235,0.06);
  --z-machine: #4F5553; --z-panel: rgba(5,6,6,0.62);
}
html.zion {
  --bg: var(--z-ground); --bg-elevated: var(--z-ground); --bg-card: var(--z-glass);
  --text-primary: var(--z-ink); --text-secondary: var(--z-mid); --text-dim: var(--z-dim); --text-bright: var(--z-ink);
  --accent: var(--z-ink); --accent-glow: transparent; --teal: var(--z-ink); --teal-glow: transparent;
  --success: var(--z-ink); --font: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --z-mono: 'JetBrains Mono', ui-monospace, Menlo, monospace; --z-display: 'Saira', 'IBM Plex Sans', sans-serif;
}
html.zion body {
  background-color: var(--z-ground);
  background-image: linear-gradient(var(--z-grid) 1px, transparent 1px), linear-gradient(90deg, var(--z-grid) 1px, transparent 1px);
  background-size: 48px 48px;
  color: var(--z-ink);
  font-family: var(--font);
}
html.zion ::-webkit-scrollbar-thumb { background: var(--z-line); }

/* ---- header: wordmark left, status after it, clock + toggles right ---- */
html.zion #dash-canvas { display: none; }
html.zion #dashboard { padding: 88px 40px 142px; justify-content: flex-start; }
html.zion #dashboard::before {
  content: ''; position: absolute; left: 0; right: 0; top: 64px; border-top: 1px solid var(--z-line); pointer-events: none;
}
html.zion #atlas-wordmark {
  position: absolute; left: 40px; top: 18px; margin: 0;
  font-family: var(--z-display); font-weight: 600; font-size: 22px; letter-spacing: 8px; color: var(--z-ink);
}
html.zion #atlas-wordmark span { color: var(--z-dim) !important; font-family: var(--z-mono); letter-spacing: 1px; }
html.zion #status-bar { left: 290px; top: 24px; max-width: calc(100% - 930px); overflow: hidden; }
html.zion #status-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html.zion #status-text { color: var(--z-mid); font-family: var(--z-mono); letter-spacing: 1.5px; text-transform: uppercase; font-size: 10px; }
html.zion .status-dot { border-radius: 0; width: 7px; height: 7px; }
html.zion .status-dot.active { background: var(--z-ink); box-shadow: none; }
html.zion #clock-section {
  position: absolute; right: 330px; top: 14px; margin: 0; display: flex; align-items: baseline; gap: 14px; text-align: right;
}
html.zion #time-display { font-family: var(--z-display); font-weight: 300; font-size: 30px; letter-spacing: 2px; animation: none; text-shadow: none; }
html.zion #date-display { font-family: var(--z-mono); font-size: 11px; letter-spacing: 2px; margin: 0; text-transform: uppercase; color: var(--z-mid); }
html.zion #ptt-toggle { top: 18px; right: 40px; border-radius: 0; border: 1px solid var(--z-line); background: transparent; }
html.zion #ptt-toggle .ptt-seg { border-radius: 0; font-family: var(--z-mono); }
html.zion #ptt-toggle.mode-listen .ptt-seg[data-mode="listen"],
html.zion #ptt-toggle.mode-touch .ptt-seg[data-mode="touch"] { background: var(--z-ink); color: var(--z-ground); }
#zion-theme-btn { display: none; }
html.zion #zion-theme-btn {
  display: block; position: absolute; top: 18px; right: 206px; z-index: 80;
  min-height: 28px; padding: 0 10px; border: 1px solid var(--z-line); background: transparent; color: var(--z-ink);
  font-family: var(--z-mono); font-size: 10px; letter-spacing: 2px; cursor: pointer;
}

/* ---- the board wall ---- */
.zion-only { display: none; }
html.zion .zion-only { display: flex; }
html.zion #dashboard-content {
  display: grid; max-width: none; width: 100%;
  grid-template-columns: 360px minmax(0, 1fr) 380px;
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: "agenda core money" "rem core sys";
  gap: 18px 32px;
}
html.zion #col-upcoming { grid-area: agenda; }
html.zion #col-reminders { grid-area: rem; }
html.zion #zion-money { grid-area: money; }
html.zion #zion-systems { grid-area: sys; }
html.zion #zion-center { grid-area: core; }
html.zion #col-upcoming, html.zion #col-reminders, html.zion #zion-money, html.zion #zion-systems {
  flex-direction: column; min-height: 0;
  background: var(--z-glass); border: 1px solid var(--z-line);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
@media (min-width: 1180px) {
  html.zion #col-upcoming, html.zion #col-reminders { transform: perspective(1800px) rotateY(7deg); transform-origin: left center; }
  html.zion #zion-money, html.zion #zion-systems { transform: perspective(1800px) rotateY(-7deg); transform-origin: right center; }
}
html.zion #col-upcoming { max-height: 300px; }
html.zion .dash-heading, html.zion .zion-heading {
  display: flex; justify-content: space-between; margin: 0; padding: 11px 16px;
  font-family: var(--z-mono); font-size: 11px; font-weight: 400; letter-spacing: 2px; text-transform: uppercase;
  color: var(--z-ink); border-bottom: 1px solid var(--z-hair);
}
html.zion #events-list, html.zion #reminders-list, html.zion #zion-sys-list { padding: 2px 16px 10px; }
html.zion .event-item, html.zion .reminder-item { padding: 9px 0; border-bottom: 1px solid var(--z-hair); gap: 14px; }
html.zion .event-time { font-family: var(--z-mono); font-size: 12px; font-weight: 400; color: var(--z-mid); min-width: 62px; }
html.zion .event-title, html.zion .reminder-text { font-size: 14px; color: var(--z-ink); }
html.zion .reminder-text span { color: var(--z-mid) !important; font-family: var(--z-mono); font-size: 11px !important; }
html.zion .reminder-icon { font-size: 0; width: 13px; height: 13px; margin-top: 3px; border: 1px solid var(--z-ink); flex-shrink: 0; }
html.zion .no-data { color: var(--z-dim); font-family: var(--z-mono); font-size: 11px; letter-spacing: 1px; }

/* money + systems boards */
#zion-money-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.z-label { font-family: var(--z-mono); font-size: 10px; letter-spacing: 2px; color: var(--z-mid); text-transform: uppercase; }
.z-big { font-family: var(--z-display); font-weight: 300; font-size: 42px; line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--z-ink); }
.z-sub { font-family: var(--z-mono); font-size: 11px; color: var(--z-mid); letter-spacing: .5px; }
.z-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; border-top: 1px solid var(--z-hair); padding-top: 10px; }
.z-mid { font-family: var(--z-display); font-size: 20px; color: var(--z-ink); }
#zion-sys-list { flex: 1; min-height: 0; overflow-y: auto; }
.z-sys { display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--z-hair); }
.z-chip { font-family: var(--z-mono); font-size: 10px; text-align: center; padding: 3px 0; border: 1px solid var(--z-ink); color: var(--z-ink); }
.z-chip.bad { background: var(--z-ink); color: var(--z-ground); }
.z-chip.quiet { border-color: var(--z-line); color: var(--z-dim); }
.z-sys-name { font-size: 13px; color: var(--z-ink); }
.z-sys-t { font-family: var(--z-mono); font-size: 10px; color: var(--z-mid); }

/* center: gear core, last exchange, spark */
html.zion #zion-center { flex-direction: column; align-items: center; min-height: 0; gap: 10px; }
#zion-core-wrap { position: relative; flex: 1; width: 100%; min-height: 260px; }
#zion-core-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
#zion-last { width: 100%; max-width: 560px; text-align: center; min-height: 20px; }
#zion-last .you { font-size: 14px; color: var(--z-mid); }
#zion-last .atlas { font-size: 16px; font-weight: 300; line-height: 1.45; color: var(--z-ink);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
#zion-spark { width: 100%; max-width: 480px; box-sizing: border-box; padding: 11px 16px; background: var(--z-ink); color: var(--z-ground); display: flex; flex-direction: column; gap: 5px; }
#zion-spark .z-label { color: var(--z-ground); opacity: .7; }
#zion-spark-title { font-family: var(--z-display); font-weight: 500; font-size: 15px; }

/* calendar day headers are inline-styled white in the classic skin */
html.zion #events-list > div:not(.event-item):not(.no-data) { color: var(--z-mid) !important; font-family: var(--z-mono); }

/* ---- talk button + conversation view ---- */
html.zion #talk-button { border: 1px solid var(--z-ink); background: var(--z-ground); box-shadow: inset 0 0 0 40px var(--z-ink-soft); }
html.zion #talk-button:hover, html.zion #talk-button:active { background: var(--z-ground); }
html.zion #talk-button::before { background: var(--z-ink); border-radius: 0; width: 14px; height: 14px; }
html.zion #talk-label { font-family: var(--z-mono); letter-spacing: 2px; text-transform: uppercase; font-size: 10px; color: var(--z-mid); background: var(--z-ground); padding: 2px 6px; }
html.zion #conversation-view::before { background: var(--z-veil); }
html.zion #transcript-label { font-family: var(--z-mono); letter-spacing: 2.5px; text-transform: uppercase; color: var(--z-mid); }
html.zion #transcript-text { color: var(--z-ink); font-weight: 300; }
html.zion #guest-tab-button { border-color: var(--z-line); color: var(--z-mid); background: transparent; }
html.zion #atlas-attach-btn { background: transparent; border-color: var(--z-line); color: var(--z-ink); }

/* ---- tablets: drop the tilt, narrower sides ---- */
@media (min-width: 701px) and (max-width: 1179px) {
  html.zion #dashboard-content { grid-template-columns: 280px minmax(0, 1fr) 300px; gap: 14px 18px; }
  html.zion #clock-section { right: 300px; }
  html.zion #date-display { display: none; }
  html.zion #status-bar { max-width: calc(100% - 750px); }
}

/* ---- phones: one column that scrolls; gears on top ---- */
@media (max-width: 700px) {
  html.zion #dashboard { padding: 76px 16px 120px; overflow-y: auto; -webkit-overflow-scrolling: touch; display: block; }
  html.zion #dashboard::before { top: 58px; }
  html.zion #atlas-wordmark { left: 16px; top: 16px; font-size: 18px; letter-spacing: 6px; }
  html.zion #status-bar { display: none; }
  html.zion #clock-section { right: 16px; top: 12px; flex-direction: column; align-items: flex-end; gap: 0; }
  html.zion #time-display { font-size: 22px !important; }
  html.zion #date-display { font-size: 9px !important; }
  html.zion #ptt-toggle { display: flex; position: fixed; top: auto; bottom: 30px; right: 16px; background: var(--z-ground); }
  html.zion #ptt-toggle .ptt-seg { padding: 4px 8px; font-size: 9px; letter-spacing: 0.5px; }
  html.zion #zion-theme-btn { right: auto; left: 136px; top: 17px; min-height: 24px; padding: 0 8px; font-size: 9px; }
  html.zion #atlas-wordmark span { display: none; }
  html.zion #zion-last:empty { display: none; }
  html.zion #dashboard-content {
    display: flex; flex-direction: column; gap: 14px;
  }
  html.zion #zion-center { display: contents; }   /* its pieces join the column so the spark can sit lower */
  html.zion #zion-core-wrap { order: 0; }
  html.zion #zion-center #transcript-area, html.zion #zion-last { order: 1; }
  html.zion #col-upcoming { order: 2; max-height: none; }
  html.zion #col-reminders { order: 3; }
  html.zion #zion-money { order: 4; }
  html.zion #zion-spark { order: 5; }
  html.zion #zion-systems { order: 6; }
  html.zion #zion-center #transcript-area { max-height: 38vh; }
  html.zion #zion-core-wrap { min-height: 250px; height: 250px; flex: none; }
  html.zion #events-list, html.zion #reminders-list { max-height: 40vh; }
  html.zion #zion-sys-list { max-height: none; }
  html.zion .z-big { font-size: 36px; }
}

/* ---- stay mode (2026-09-23): talking happens on the wall, no separate screen ---- */
html.zion #conversation-view { display: none; }
html.zion #app.state-listening #dashboard,
html.zion #app.state-responding #dashboard { transform: none; opacity: 1; pointer-events: auto; }
html.zion #zion-center #transcript-area { display: none; flex: none; height: auto; max-height: 30vh; max-width: 560px; width: 100%; }
html.zion #app.state-listening #zion-center #transcript-area,
html.zion #app.state-responding #zion-center #transcript-area { display: block; }
html.zion #app.state-listening #zion-last,
html.zion #app.state-responding #zion-last { display: none; }
@media (min-width: 701px) {
  html.zion #app.state-listening #zion-spark,
  html.zion #app.state-responding #zion-spark { display: none !important; }
}
html.zion #latex-block { background: var(--z-glass); border: 1px solid var(--z-line); border-radius: 0; color: var(--z-ink); }
#zion-last { transition: opacity 1s ease; }
#zion-last.z-faded { opacity: 0; }
/* images / graphs sit over the gear core, which fades behind them */
html.zion #zion-core-wrap #image-panel,
html.zion #zion-core-wrap #desmos-panel { width: 340px; height: 340px; max-width: 92%; max-height: 92%; border-radius: 0; border: 1px solid var(--z-ink); box-shadow: none; transform: translate(-50%, -50%); }
#zion-core-canvas { transition: opacity 1s ease; }
html.zion #zion-core-wrap:has(#image-panel.visible) #zion-core-canvas,
html.zion #zion-core-wrap:has(#desmos-panel.visible) #zion-core-canvas { opacity: 0.15; }

/* ---- Files library (2026-09-23) — base styles work in both skins; Zion overrides below ---- */
#atlas-files-btn {
  position: fixed; left: 76px; bottom: 22px; z-index: 50; height: 46px; padding: 0 14px;
  border-radius: 23px; border: 1px solid rgba(255,255,255,0.18); background: rgba(255,255,255,0.08); color: #cdd3e0;
  font: 600 11px/1 ui-monospace, "JetBrains Mono", monospace; letter-spacing: 2px; cursor: pointer;
}
#atlas-files-modal { position: fixed; inset: 0; z-index: 220; display: none; align-items: center; justify-content: center; background: rgba(4,10,20,0.6); }
#atlas-files-modal.open { display: flex; }
#atlas-files-card { width: min(720px, calc(100vw - 32px)); max-height: 82vh; display: flex; flex-direction: column; background: #0b1220; color: #e6e9ef; border: 1px solid rgba(255,255,255,0.14); }
#atlas-files-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid rgba(255,255,255,0.1); }
#atlas-files-head .z-label { font: 600 11px ui-monospace, monospace; letter-spacing: 3px; }
#atlas-files-close { background: none; border: 0; color: inherit; font-size: 26px; line-height: 1; cursor: pointer; padding: 0 4px; }
#atlas-files-list { overflow-y: auto; padding: 6px 16px 16px; -webkit-overflow-scrolling: touch; user-select: text; -webkit-user-select: text; }
.af-group { font: 10px ui-monospace, monospace; letter-spacing: 2.5px; text-transform: uppercase; opacity: .6; margin: 16px 0 4px; }
.af-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid rgba(127,127,127,0.18); }
.af-left { flex: 1; min-width: 0; }
.af-name { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.af-meta { font: 10px ui-monospace, monospace; opacity: .65; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.af-acts { display: flex; gap: 6px; flex: none; }
.af-btn { font: 600 10px ui-monospace, monospace; letter-spacing: 1.5px; padding: 6px 9px; background: transparent; color: inherit; border: 1px solid rgba(127,127,127,0.5); cursor: pointer; }
.af-del { opacity: .6; }
.af-empty { padding: 28px 8px; text-align: center; opacity: .7; line-height: 1.5; }
#atlas-files-toast {
  position: fixed; left: 50%; bottom: 128px; transform: translate(-50%, 20px); z-index: 230; opacity: 0; pointer-events: none;
  display: flex; align-items: center; gap: 14px; padding: 10px 12px 10px 16px; background: #0b1220; color: #e6e9ef; border: 1px solid rgba(255,255,255,0.2);
  font: 11px ui-monospace, monospace; letter-spacing: 1.5px; transition: opacity .3s, transform .3s; max-width: calc(100vw - 32px);
}
#atlas-files-toast span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#atlas-files-toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }

html.zion #atlas-files-btn { border-radius: 0; border-color: var(--z-line); background: var(--z-ground); color: var(--z-ink); font-family: var(--z-mono); }
html.zion #atlas-files-modal { background: var(--z-veil); }
html.zion #atlas-files-card { background: var(--z-ground); color: var(--z-ink); border-color: var(--z-ink); }
html.zion #atlas-files-head { border-color: var(--z-line); }
html.zion #atlas-files-head .z-label, html.zion .af-group, html.zion .af-meta, html.zion .af-btn, html.zion #atlas-files-toast { font-family: var(--z-mono); }
html.zion .af-row { border-color: var(--z-hair); }
html.zion .af-btn { border-color: var(--z-ink); }
html.zion #atlas-files-toast { background: var(--z-ink); color: var(--z-ground); border-color: var(--z-ink); }
html.zion #atlas-files-toast .af-btn { border-color: var(--z-ground); }
@media (max-width: 700px) {
  #atlas-files-btn { left: 72px; height: 40px; bottom: 25px; padding: 0 10px; font-size: 10px; }
  .af-row { flex-wrap: wrap; }
  .af-acts { width: 100%; justify-content: flex-end; }
}

/* long answers: a see-through grid panel so text over the gears stays readable (grid lines up with the page) */
html.zion #zion-center #transcript-area {
  position: relative; z-index: 2; box-sizing: border-box; padding: 12px 18px;
  background-color: var(--z-panel);
  background-image: linear-gradient(var(--z-grid) 1px, transparent 1px), linear-gradient(90deg, var(--z-grid) 1px, transparent 1px);
  background-size: 48px 48px; background-attachment: fixed;
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  border: 1px solid var(--z-hair);
}

/* reminders: tap to select, then DELETE */
html.zion .reminder-item { cursor: pointer; user-select: none; -webkit-user-select: none; }
html.zion .reminder-item.z-sel .reminder-icon { background: var(--z-ink); box-shadow: inset 0 0 0 2px var(--z-ground); }
html.zion .reminder-item.z-sel .reminder-text { color: var(--z-mid); text-decoration: line-through; }
.z-rem-actions { display: none; gap: 6px; }
.z-rem-actions.show { display: flex; }
html.zion #col-reminders .dash-heading { display: flex; align-items: center; justify-content: space-between; }
.z-rem-btn { font: 600 10px var(--z-mono, ui-monospace, monospace); letter-spacing: 1.5px; padding: 4px 8px; background: transparent; color: inherit; border: 1px solid currentColor; cursor: pointer; }
.z-rem-btn.primary { background: var(--z-ink, #fff); color: var(--z-ground, #000); border-color: var(--z-ink, #fff); }

/* Sentinel group summary lines under the individual rows */
.z-sys.z-sys-group .z-sys-name { color: var(--z-mid); font-family: var(--z-mono); font-size: 11px; letter-spacing: 1px; text-transform: uppercase; }

/* pipeline split under the unsigned total */
#zion-pipe-split { display: flex; flex-direction: column; gap: 1px; margin-top: 4px; }
.z-split-row { display: flex; justify-content: space-between; gap: 10px; }
.z-split-row span:last-child { color: var(--z-ink); font-variant-numeric: tabular-nums; }
