/* Phixly shell — ported from direct.html (rounds 18–27). Prism tokens come
   from /prism/tokens.css; only what the prototype added on top lives here. */

/* washes the prototype derived from the tokens, and the two states of
   everything on the canvas (round 17, kept whole): BLUE locked in — saved.
   AMBER unresolved — chosen, not settled. Grey dashes = a suggestion, which
   is neither, so it gets neither. */
:root {
  --prism-accent-wash: color-mix(in srgb, var(--prism-accent) 9%, transparent);
  --prism-accent-muted: color-mix(in srgb, var(--prism-accent) 76%, var(--prism-surface-1));
  --prism-good-wash: color-mix(in srgb, var(--prism-status-good) 11%, transparent);
  --lock-on: var(--prism-accent);
  --lock-off: var(--prism-status-warning);
  --lock-on-wash: color-mix(in srgb, var(--prism-accent) 11%, transparent);
  --lock-off-wash: color-mix(in srgb, var(--prism-status-warning) 13%, transparent);
  --lock-may: var(--prism-ink-muted);
  --ck-move: 300ms;
  --ck-ease: cubic-bezier(.4, 0, .2, 1);
}
/* the reset sits in a layer below Prism's (00-layers.css): it zeroes the
   browser's defaults without zeroing a Prism component's own spacing */
@layer reset {
  * { margin: 0; padding: 0; box-sizing: border-box; }
  button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
  button:focus-visible, a:focus-visible { outline: 2px solid var(--prism-focus-ring); outline-offset: 1px; }
}
/* round 17 found this the hard way: a class that sets display beats the
   browser's own [hidden] rule, and "hidden" things quietly stay on
   screen. Said once, with authority, so the whole class of bug is gone. */
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  font-family: var(--prism-font-sans);
  font-size: var(--prism-text-md);
  line-height: 1.45;
  color: var(--prism-ink-primary);
  background: var(--prism-surface-page);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* =================== the app bar =================================== */
.appbar {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  background: var(--prism-surface-2);
  border-bottom: 1px solid var(--prism-border);
  font-size: var(--prism-text-sm);
  flex: none;
}
.appbar .brand { font-weight: 650; letter-spacing: -0.01em; font-size: 20px; line-height: 1; margin-right: 8px; color: inherit; text-decoration: none; }
.appbar button {
  padding: 3px 10px; border-radius: var(--prism-radius-md);
  color: var(--prism-ink-secondary); border: 1px solid transparent;
}
.appbar button:hover { background: var(--prism-surface-hover); }
.appbar button.on { background: var(--prism-surface-1); border-color: var(--prism-border); color: var(--prism-ink-primary); font-weight: 500; }
.appbar .gap { flex: 1; }
/* A control about the chain map has nothing to say on the landing screen,
   where there is no map. Hidden rather than disabled: a dead button is a
   question the reader has to answer. */
body:not([data-screen="s2"]) .appbar .chain-only { display: none; }
/* the switch carries its own chevron, so it is a glyph and a word */
.appbar .chain-only { display: inline-flex; align-items: center; gap: 5px; }
.appbar .chain-only svg { color: currentColor; }
/* FOLDED, THIS BUTTON IS THE WAY BACK, so it stops reading as a label and
   starts reading as a control: the app bar's quiet text is right for a thing
   you may never need and wrong for the only exit on an empty screen. Tinted,
   not solid — the owner's rule — and the bench says the same thing in the
   middle of the page, because this is in the corner. */
.appbar .chain-only.folded {
  color: var(--prism-accent);
  border-color: var(--prism-accent-subtle);
  background: var(--prism-accent-tint);
}

/* =================== screens ======================================= */
.screen { display: none; flex: 1; min-height: 0; overflow: auto; position: relative; }
body[data-screen="s1"] #s1, body[data-screen="s2"] #s2 { display: block; }
body[data-screen="s2"] #s2 { display: flex; flex-direction: column; overflow: hidden; }

/* =================== shared card language ========================== */
.fcard {
  display: flex; align-items: center; gap: 12px;
  width: 100%; text-align: left;
  padding: 9px 12px;
  background: var(--prism-surface-1);
  border: 1px solid var(--prism-border);
  border-radius: var(--prism-radius-md);
  cursor: pointer;
  position: relative;
  transition: border-color var(--prism-duration-base) var(--prism-ease),
              opacity var(--prism-duration-base) var(--prism-ease);
}
/* HOVER LIFTS THIS CARD'S OWN BORDER. NOTHING ELSE MOVES. (round 17b) */
.fcard:hover { border-color: var(--prism-border-strong); }
.fcard svg { flex: none; color: var(--prism-ink-muted); transition: color var(--prism-duration-base) var(--prism-ease); }
.fcard b { display: block; font-weight: 500; line-height: 1.3; }
.fcard .sub { display: block; font-size: var(--prism-text-xs); color: var(--prism-ink-muted); }
.fcard .n { color: var(--prism-ink-muted); font-weight: 400; }
.colhead {
  display: flex; align-items: center; gap: 8px;
  font-size: var(--prism-text-xs); font-weight: 600;
  letter-spacing: .09em; text-transform: uppercase;
  color: var(--prism-ink-muted);
  padding: 0 2px 4px;
}
.colhead .gap { flex: 1; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 3px 11px;
  border: 1px solid var(--prism-border);
  border-radius: var(--prism-radius-pill);
  font-size: var(--prism-text-sm);
  color: var(--prism-ink-secondary);
  background: var(--prism-surface-1);
  letter-spacing: normal; text-transform: none; font-weight: 400;
}
.chip:hover { border-color: var(--prism-border-strong); color: var(--prism-ink-primary); }
/* a chip's glyph is Prism's, a step down from the text it sits beside */
.chip svg { width: 14px; height: 14px; flex: none; }
/* a primary that does not shout: outline at rest, fill on hover (round 15) */
.chip.active { border-color: var(--prism-accent); color: var(--prism-accent); font-weight: 500; }
.chip.active:hover { background: var(--prism-accent-muted); border-color: var(--prism-accent-muted); color: var(--prism-ink-on-accent); }
.chip.busy { opacity: .6; cursor: progress; }

/* the zoom bar (zoombar.js): a corner by default; the report page (a strip under the page) and the chain map place it themselves */
.zoombar {
  position: absolute; right: 18px; bottom: 14px; z-index: 2;
  display: flex; align-items: center; gap: 4px; padding: 4px 6px;
  border: 1px solid var(--prism-border-strong); border-radius: 999px;
  background: var(--prism-surface-1); box-shadow: var(--prism-shadow-md, 0 2px 8px rgb(0 0 0 / .12));
  font-size: var(--prism-text-xs); color: var(--prism-ink-secondary);
}
.zoombar-step, .zoombar-pct {
  border: 0; background: transparent; color: inherit; font: inherit; cursor: pointer;
  border-radius: 999px; min-width: 24px; height: 24px; padding: 0 4px;
}
.zoombar-step { font-size: var(--prism-text-md); line-height: 1; }
.zoombar-step:hover:not(:disabled), .zoombar-pct:hover { background: var(--prism-accent-wash); color: var(--prism-ink-primary); }
.zoombar-step:disabled { opacity: .4; cursor: default; }
.zoombar-pct { min-width: 44px; font-variant-numeric: tabular-nums; }
.zoombar-slider { width: 110px; accent-color: var(--prism-accent); cursor: pointer; }

/* =================== s1 — the landing ============================== */
#s1 .wrap { max-width: 1200px; margin: 0 auto; padding: 34px 32px 60px; }
.hero { text-align: center; margin-bottom: 34px; }
.hero h1 { font-size: var(--prism-text-2xl); font-weight: 650; letter-spacing: -0.01em; }
.hero p { margin-top: 8px; color: var(--prism-ink-secondary); max-width: 620px; margin-left: auto; margin-right: auto; }
.flow {
  position: relative;
  display: grid;
  grid-template-columns: minmax(240px, 330px) 1fr minmax(240px, 330px);
  gap: 0 24px;
  align-items: start;
}
.fcol { display: flex; flex-direction: column; gap: 8px; position: relative; z-index: 1; }
.fcol.outs .colhead { justify-content: flex-end; }
#flowsvg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  overflow: visible;
  z-index: 0;
}
#flowsvg path {
  fill: none;
  stroke: var(--prism-border-strong);
  stroke-width: 1.5;
  opacity: .55;
  transition: stroke var(--prism-duration-base) var(--prism-ease),
              opacity var(--prism-duration-base) var(--prism-ease);
}
#flowsvg path.hot { stroke: var(--prism-accent); stroke-width: 2; opacity: 1; }
#flowsvg circle { fill: var(--prism-border-strong); opacity: .55; }
#flowsvg circle.hot { fill: var(--prism-accent); opacity: 1; }
.flow.lit .fcard { opacity: .45; }
.flow.lit .fcard.hot { opacity: 1; border-color: var(--prism-accent); }
.flow.lit .fcard.hot svg { color: var(--prism-accent); }
.flow.lit #flowsvg path:not(.hot) { opacity: .18; }
.flow.lit #flowsvg circle:not(.hot) { opacity: .18; }
/* the middle belongs to the wires — the ONE design claim of this file.
   Nothing sits on the path between a thing and what it becomes. */
.fmid { min-height: 40px; }

/* the drop dock — apart, below, a door and not a station */
.dropdock { margin: 44px auto 0; max-width: 560px; position: relative; z-index: 1; }
.dockbox {
  border: 1px dashed var(--prism-border-strong);
  border-radius: var(--prism-radius-lg);
  padding: 26px 20px 22px;
  text-align: center;
  background: var(--prism-surface-1);
  transition: border-color var(--prism-duration-base) var(--prism-ease),
              background var(--prism-duration-base) var(--prism-ease);
}
.dockbox.armed, .dockbox:hover { border-color: var(--prism-accent); }
.dockbox.armed { background: var(--prism-accent-wash); }
.dockbox .big { font-size: var(--prism-text-lg); font-weight: 600; }
.dockbox .sub { margin-top: 4px; font-size: var(--prism-text-sm); color: var(--prism-ink-muted); }
.dockbox .ways { margin-top: 14px; display: flex; gap: 8px; justify-content: center; }
.dockcap {
  margin-top: 10px; text-align: center;
  font-size: var(--prism-text-xs); color: var(--prism-ink-muted);
}
/* what a drop turns into: the AI's identification, beside the dock */
.idcard {
  margin: 14px auto 0; max-width: 560px;
  border: 1px solid var(--prism-accent);
  background: var(--prism-surface-1);
  border-radius: var(--prism-radius-lg);
  padding: 12px 16px;
  box-shadow: var(--prism-shadow-2);
  display: flex; align-items: center; gap: 12px;
}
.idcard .what b { font-weight: 600; }
.idcard .what .sub { display: block; font-size: var(--prism-text-xs); color: var(--prism-ink-muted); margin-top: 2px; }
.idcard .gap { flex: 1; }
.flowfoot { margin-top: 26px; text-align: center; font-size: var(--prism-text-sm); color: var(--prism-ink-muted); }

/* =================== toast ========================================= */
/* It FOLLOWS the theme rather than inverting it. Inverted, a dark theme gave
   a near-white pill with dark text on it, which reads as a window from the
   other theme having drifted in — and an inverted pill has no border, so
   against a light page there was nothing to tell it apart from the page. It
   is a small panel now, the app's own surface, with a border that is visible
   in both themes and an accent edge that says which end of the app is
   talking. */
#toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--prism-surface-1); color: var(--prism-ink);
  border: 1px solid var(--prism-border-strong, var(--prism-border));
  border-left: 3px solid var(--prism-accent);
  padding: 10px 18px; border-radius: var(--prism-radius-md);
  font-size: var(--prism-text-sm); line-height: 1.45;
  box-shadow: var(--prism-shadow-3, var(--prism-shadow-2));
  z-index: 60;
  max-width: min(720px, 92vw);
  cursor: default;
}
#toast .toast-act { margin-left: 10px; vertical-align: baseline; }

/* =================== the login page ================================ */
.login {
  margin: auto; width: min(360px, 92vw);
  background: var(--prism-surface-1);
  border: 1px solid var(--prism-border);
  border-radius: var(--prism-radius-lg);
  box-shadow: var(--prism-shadow-2);
  padding: 26px 24px 22px;
  display: flex; flex-direction: column; gap: 12px;
}
.login h1 { font-size: var(--prism-text-xl); font-weight: 650; letter-spacing: -0.01em; }
.login p { color: var(--prism-ink-secondary); font-size: var(--prism-text-sm); }
.login input {
  width: 100%; padding: 7px 10px; font: inherit;
  border: 1px solid var(--prism-border-strong);
  border-radius: var(--prism-radius-sm);
  background: var(--prism-surface-1); color: var(--prism-ink-primary);
}
.login input:focus { outline: 2px solid var(--prism-focus-ring); outline-offset: 1px; }
.login .err { color: var(--prism-status-critical); font-size: var(--prism-text-sm); min-height: 1.4em; }
/* the join page shows one of two boxes; display:flex would beat [hidden] */
.login[hidden], .login input[hidden] { display: none; }
/* the Assistant: the Phixly mark, which is every AI button, then its name */
#assistbtn { display: inline-flex; align-items: center; gap: 6px; }
/* Feedback: tinted, so a colleague can always find it (static/js/feedback.js) */
.appbar #feedbackbtn { display: inline-flex; align-items: center; gap: 6px; background: var(--prism-accent-tint); border-color: var(--prism-accent-subtle); color: var(--prism-accent); }
.appbar #feedbackbtn:hover { background: var(--prism-accent-subtle); }
.appbar #feedbackbtn[hidden] { display: none; }
/* Spend (staff only, static/js/site/spend.js): today's AI spend, tinted as Feedback */
.appbar #spendbtn { background: var(--prism-accent-tint); border-color: var(--prism-accent-subtle); color: var(--prism-accent);
  font-variant-numeric: tabular-nums; }
.appbar #spendbtn:hover { background: var(--prism-accent-subtle); }
.appbar #spendbtn[hidden] { display: none; }
.sp-panel { width: min(620px, calc(100vw - 32px)); padding: 0; display: flex; flex-direction: column; }
.sp-head, .sp-foot { display: flex; flex: none; align-items: center; gap: 10px; padding: 8px 12px; }
.sp-head { justify-content: space-between; border-bottom: 1px solid var(--prism-border-hairline); }
.sp-foot { border-top: 1px solid var(--prism-border-hairline); flex-wrap: wrap; }
.sp-sum, .sp-total { font-variant-numeric: tabular-nums; color: var(--prism-ink-secondary); }
.sp-total { color: var(--prism-ink-primary); font-weight: 600; }
.sp-gap { flex: 1; }
/* ONE HEIGHT whatever is shown (the owner, 19 Oct: a toggle must not make the log jump): about ten rows,
   clamped to the window; the list scrolls inside, the head and the toggles stay put. Its scrollbar is the
   cards' own (06-canvas.css), mixed from the ink so it is quiet in both themes, never the browser's white. */
.sp-rows { flex: none; height: min(300px, calc(100vh - 170px)); overflow: auto; padding: 4px 0;
  scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--prism-ink-primary) 22%, transparent) transparent; }
/* …except with nothing in it: "No AI calls" on one line, not a tall empty box over the card (audit F16, 20 Oct) */
.sp-rows:has(> .sp-empty:only-child) { height: auto; }
.sp-rows::-webkit-scrollbar { width: 9px; }
.sp-rows::-webkit-scrollbar-track { background: transparent; }
.sp-rows::-webkit-scrollbar-thumb { border: 2px solid transparent; border-radius: 6px; background-clip: content-box;
  background-color: color-mix(in srgb, var(--prism-ink-primary) 20%, transparent); }
.sp-rows::-webkit-scrollbar-thumb:hover { background-color: color-mix(in srgb, var(--prism-ink-primary) 34%, transparent); }
/* WHAT RAN gets the room (the owner, 19 Oct): the card narrow, the words up to two lines, never cut short of
   that; the whole of them on hover. Today's times are short, so their column is too. */
.sp-row { display: grid; grid-template-columns: 9.5em 6.5em 1fr auto; align-items: start; gap: 10px; width: 100%;
  padding: 5px 12px; border: 0; background: none; color: var(--prism-ink-primary); text-align: left; font: inherit;
  cursor: pointer; }
.sp-rows.is-today .sp-row { grid-template-columns: 3.6em 6.5em 1fr auto; }
.sp-row:hover, .sp-row[aria-expanded="true"] { background: var(--prism-surface-2); }
.sp-when, .sp-card { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-what { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
  overflow-wrap: anywhere; }
.sp-when, .sp-card { color: var(--prism-ink-secondary); }
.sp-cost { font-variant-numeric: tabular-nums; }
.sp-detail { padding: 2px 12px 8px; color: var(--prism-ink-secondary); font-size: var(--prism-text-sm);
  background: var(--prism-surface-2); }
.sp-group { display: flex; justify-content: space-between; padding: 8px 12px 3px; font-weight: 600;
  border-top: 1px solid var(--prism-border-hairline); }
.sp-group:first-child { border-top: 0; }
.sp-group-sum { font-variant-numeric: tabular-nums; color: var(--prism-ink-secondary); font-weight: 400; }
.sp-empty { padding: 16px 12px; color: var(--prism-ink-secondary); }
@media (max-width: 560px) { .sp-row, .sp-rows.is-today .sp-row { grid-template-columns: 4.5em 1fr auto; }
  .sp-row .sp-card { display: none; } }
