/* ⛔ THE HIDDEN ATTRIBUTE MUST ACTUALLY HIDE. `[hidden] { display: none }`
 *    comes from the browser's own stylesheet, and ANY author rule beats it —
 *    so `.gate { display: grid }` meant `gate.hidden = true` did nothing at
 *    all. Sign-in worked every time, the workspace loaded fully behind it, and
 *    its owner sat looking at "Checking…" for weeks believing he had never
 *    once got in. `#desk[hidden]` further down public.css was an earlier
 *    one-off patch for this same bug; this is the general fix.
 *
 * ⚡ !important because the whole point is that it must outrank whatever
 *    display a component gives itself. */
[hidden] { display: none !important; }

/* Jim's owner workspace.
 * Calm, dense, and honest: state colour is reserved for things that are
 * actually true about his life, never for decoration. Green must mean verified.
 */

:root {
  --bg: #0b0d10;
  --panel: #111419;
  --panel-2: #161a21;
  --line: #232832;
  --line-soft: #1c212a;
  --ink: #e9edf3;
  --ink-dim: #97a1b0;
  --ink-faint: #6b7686;
  --good: #4ade80;
  --warn: #fbbf24;
  --bad: #f87171;
  --hands: #a78bfa;
  --accent: #c4894a;   /* the seal, same as his public page */
  --radius: 12px;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 620; letter-spacing: -0.01em; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.02rem; }
h4 { font-size: 0.9rem; }

.muted { color: var(--ink-dim); margin: 0.15rem 0 0; font-size: 0.9rem; }
.hint { color: var(--ink-faint); font-size: 0.85rem; margin: 0.2rem 0 0.9rem; max-width: 62ch; }
.empty { color: var(--ink-faint); font-size: 0.9rem; margin: 0; }
.status { color: var(--ink-dim); font-size: 0.85rem; margin: 0; min-height: 1.2em; }
.eyebrow { color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.7rem; margin: 0; }

.portrait { border-radius: 50%; object-fit: cover; }
.portrait.lg { width: 76px; height: 76px; }
.portrait.sm { width: 34px; height: 34px; }

button { font: inherit; cursor: pointer; border-radius: 9px; border: 1px solid var(--line); background: var(--panel-2); color: var(--ink); padding: 0.5rem 0.9rem; }
button:hover { border-color: #313846; }
button.primary { background: var(--accent); border-color: var(--accent); color: #17100a; font-weight: 620; }
button.primary:hover { filter: brightness(1.08); }
button.hands { background: transparent; border-color: var(--hands); color: var(--hands); font-weight: 600; }
button.hands:hover { background: color-mix(in srgb, var(--hands) 14%, transparent); }
button.quiet { background: transparent; color: var(--ink-dim); }
button.linkish { background: none; border: none; padding: 0; color: var(--accent); text-align: left; font-size: 0.85rem; text-decoration: underline; text-underline-offset: 3px; }

input, select, textarea {
  font: inherit; width: 100%;
  background: var(--bg); color: var(--ink);
  border: 1px solid var(--line); border-radius: 9px;
  padding: 0.55rem 0.7rem;
}
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 1px; }
label { display: block; font-size: 0.8rem; color: var(--ink-dim); margin: 0.9rem 0 0.3rem; }

/* ── the door ───────────────────────────────────────────────────────────── */

.gate { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem; }
.gate-card {
  width: min(380px, 100%);
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 18px; padding: 2rem 1.75rem; text-align: center;
}
.gate-card h1 { font-size: 1.8rem; margin: 0.4rem 0 0; }
.gate-card .lede { color: var(--ink-dim); font-size: 0.92rem; margin: 0.35rem 0 0.4rem; }
.gate-card label { text-align: left; }
.gate-card .primary { width: 100%; margin-top: 1rem; }
.gate-card .status { margin-top: 0.9rem; text-align: left; }
.fineprint { color: var(--ink-faint); font-size: 0.76rem; text-align: left; margin: 1.1rem 0 0; border-top: 1px solid var(--line-soft); padding-top: 0.9rem; }
#code { text-align: center; letter-spacing: 0.35em; font-size: 1.15rem; }

/* ── frame ──────────────────────────────────────────────────────────────── */

#app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }

.rail {
  background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 1.25rem; padding: 1.1rem 0.9rem;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 0.65rem; }
.brand strong { display: block; font-size: 0.98rem; }
.brand span { display: block; color: var(--ink-faint); font-size: 0.76rem; }

.views { display: flex; flex-direction: column; gap: 0.15rem; }
.view-tab {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  background: none; border: none; color: var(--ink-dim);
  padding: 0.5rem 0.65rem; border-radius: 9px; text-align: left; width: 100%;
}
.view-tab:hover { background: var(--panel-2); color: var(--ink); }
.view-tab.is-active { background: var(--panel-2); color: var(--ink); box-shadow: inset 2px 0 0 var(--accent); }
.badge { background: var(--warn); color: #2a1c00; border-radius: 999px; font-size: 0.7rem; font-weight: 700; padding: 0.05rem 0.42rem; }

.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 0.6rem; }
.vitals-mini { display: flex; align-items: center; gap: 0.45rem; color: var(--ink-faint); font-size: 0.78rem; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-faint); flex: none; }
.dot.good { background: var(--good); box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 18%, transparent); }
.dot.bad { background: var(--bad); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 18%, transparent); }

/* ── views ──────────────────────────────────────────────────────────────── */

.view { padding: 1.6rem 2rem 3rem; max-width: 980px; }
.viewhead { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.4rem; }
.block { margin-top: 2rem; }
.pill { display: inline-flex; align-items: center; gap: 0.4rem; border: 1px solid var(--line); border-radius: 999px; padding: 0.2rem 0.7rem; font-size: 0.78rem; color: var(--ink-dim); }
.pill .dot { background: var(--good); }

/* vitals */
.vitals { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0.7rem; }
.tile { background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--line); border-radius: var(--radius); padding: 0.85rem 0.95rem; display: flex; flex-direction: column; gap: 0.15rem; }
.tile.good { border-left-color: var(--good); }
.tile.warn { border-left-color: var(--warn); }
.tile.bad { border-left-color: var(--bad); background: color-mix(in srgb, var(--bad) 7%, var(--panel)); }
.tile-label { color: var(--ink-faint); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; }
.tile-value { font-size: 1.15rem; font-weight: 640; }
.tile-note { color: var(--ink-dim); font-size: 0.8rem; }

/* needs you */
.needs { display: flex; flex-direction: column; gap: 0.6rem; }
.need { background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--line); border-radius: var(--radius); padding: 0.8rem 0.95rem; display: flex; flex-direction: column; gap: 0.25rem; }
.need b { font-weight: 600; }
.need span { color: var(--ink-dim); font-size: 0.87rem; }
.need-critical { border-left-color: var(--bad); background: color-mix(in srgb, var(--bad) 8%, var(--panel)); }
.need-warn { border-left-color: var(--warn); }
.need-info { border-left-color: var(--accent); }

/* the stream */
.stream { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.event { display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; gap: 0.8rem; align-items: baseline; padding: 0.6rem 0.9rem; border-bottom: 1px solid var(--line-soft); background: var(--panel); }
.event:last-child { border-bottom: none; }
.event-type { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink-faint); }
.event-summary { color: var(--ink); font-size: 0.88rem; overflow-wrap: anywhere; }
.event-meta { color: var(--ink-faint); font-size: 0.74rem; white-space: nowrap; }
.event-failure { background: color-mix(in srgb, var(--bad) 9%, var(--panel)); }
.event-failure .event-type { color: var(--bad); }
.event-action .event-type { color: var(--good); }
.event-decision .event-type, .event-commitment .event-type { color: var(--hands); }
.event-observation .event-type { color: var(--warn); }

/* ── talk & work ────────────────────────────────────────────────────────── */

.lanes { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0.7rem; margin-bottom: 1.2rem; }
.lane { border: 1px solid var(--line); border-top: 2px solid var(--accent); border-radius: var(--radius); padding: 0.75rem 0.9rem; background: var(--panel); }
.lane b { display: block; margin-bottom: 0.2rem; }
.lane span { color: var(--ink-dim); font-size: 0.84rem; }
.lane-hands { border-top-color: var(--hands); }
.lane-hands b { color: var(--hands); }

.messages { display: flex; flex-direction: column; gap: 0.9rem; min-height: 240px; max-height: 52vh; overflow-y: auto; padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.turn { display: flex; flex-direction: column; gap: 0.2rem; max-width: 82%; }
.turn-you { align-self: flex-end; align-items: flex-end; }
.who { color: var(--ink-faint); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.07em; }
.bubble { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 0.6rem 0.8rem; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.9rem; }
.turn-you .bubble { background: color-mix(in srgb, var(--accent) 15%, var(--panel-2)); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.is-hands .bubble { border-color: color-mix(in srgb, var(--hands) 45%, var(--line)); }
.is-fail .bubble { border-color: var(--bad); color: var(--bad); }

.composer { margin-top: 0.9rem; display: flex; flex-direction: column; gap: 0.6rem; }
.composer-actions { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.buttons { display: flex; gap: 0.5rem; flex: none; }

/* ── his mind ───────────────────────────────────────────────────────────── */

.goals { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0.7rem; }
.goal { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.8rem 0.95rem; display: flex; flex-direction: column; gap: 0.2rem; }
.goal-waiting { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
.goal-state { color: var(--ink-dim); font-size: 0.84rem; }
.goal-flag { color: var(--warn); font-size: 0.76rem; }
.goal-meta { color: var(--ink-faint); font-size: 0.74rem; }

.note { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.9rem; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.85rem; color: var(--ink-dim); margin: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; max-height: 340px; overflow-y: auto; }
.note-placeholder { color: var(--warn); }

/* ── continuity ─────────────────────────────────────────────────────────── */

#chain { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; }
.facts { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 0.35rem 1rem; margin: 0.9rem 0 0; }
.facts dt { color: var(--ink-faint); font-size: 0.8rem; }
.facts dd { margin: 0; font-size: 0.85rem; overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.errors { color: var(--bad); font-size: 0.85rem; }
a.quiet { color: var(--accent); font-size: 0.9rem; }

/* ── narrow screens ─────────────────────────────────────────────────────── */

@media (max-width: 820px) {
  #app { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 0.75rem; }
  .views { flex-direction: row; flex-wrap: wrap; }
  .rail-foot { margin: 0; flex-direction: row; align-items: center; }
  .view { padding: 1.2rem 1rem 2.5rem; }
  .event { grid-template-columns: 1fr; gap: 0.15rem; }
  .event-meta { white-space: normal; }
}

/* ── front desk (owner's view of what strangers said) ───────────────────── */
.desk-rows { display: flex; flex-direction: column; gap: 0.7rem; }
.desk-row { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.85rem 0.95rem; display: flex; flex-direction: column; gap: 0.4rem; }
.desk-meta { color: var(--ink-faint); font-size: 0.74rem; }
.desk-said { font-size: 0.9rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.desk-reply { color: var(--ink-dim); font-size: 0.87rem; white-space: pre-wrap; overflow-wrap: anywhere; border-left: 2px solid var(--line); padding-left: 0.7rem; }
.desk-flag { color: var(--warn); font-size: 0.78rem; }

/* His seal on the sign-in card: square, not a circular avatar — a seal is
   pressed into a page, it is not a face. */
.portrait.seal-mark {
  width: 108px; height: 108px; border-radius: 4px;
  border: 1px solid var(--line); object-fit: cover;
}

/* Links inside the sign-in card, which would otherwise land as browser blue. */
.fineprint a { color: var(--ink-dim); text-decoration: none; border-bottom: 1px solid var(--line); }
.fineprint a:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* The remember-this-device choice sits with the code it belongs to. */
.check { display: flex; align-items: center; gap: 0.5rem; margin: 0.9rem 0 0; font-size: 0.82rem; color: var(--ink-dim); }
.check input { width: auto; margin: 0; }

/* Which build this tab is actually running. */
.build { float: right; font-family: var(--mono); font-size: 0.68rem; color: var(--ink-faint); letter-spacing: 0.06em; }

/* How he knows — worn by the claim, not filed away from it. */
.prov { display: inline-block; margin-left: 0.5rem; padding: 0.02rem 0.4rem; border-radius: 2px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.66rem;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--warn);
  border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent); }
.unopened { display: flex; flex-direction: column; gap: 0.5rem; }
.unopened-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 0.7rem;
  align-items: baseline; background: var(--panel); border: 1px solid var(--line);
  border-left: 3px solid var(--warn); border-radius: var(--radius); padding: 0.6rem 0.9rem; }
.unopened-row .prov { margin-left: 0; }
.unopened-what { font-size: 0.88rem; overflow-wrap: anywhere; }

/* ── his brief ────────────────────────────────────────────────────────────────
   The first thing on the page, so it is styled to be read rather than scanned:
   one column, generous measure, and the staleness chip loud enough that a brief
   from yesterday can never pass for this morning's. */
.brief { background: var(--panel); border: 1px solid var(--line);
  border-left: 3px solid var(--good); border-radius: var(--radius); padding: 1rem 1.1rem; }
.brief-head { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: baseline;
  margin-bottom: 0.6rem; }
.brief-body { max-width: 68ch; }
.brief-body h4 { margin: 0.9rem 0 0.25rem; font-size: 0.82rem; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--ink-faint); }
.brief-body h4:first-child { margin-top: 0; }
.brief-body p { margin: 0.2rem 0; font-size: 0.95rem; line-height: 1.5; overflow-wrap: anywhere; }
.chip { font-size: 0.72rem; padding: 0.12rem 0.5rem; border-radius: 999px;
  border: 1px solid var(--line); color: var(--ink-faint); }
.chip.good { border-color: var(--good); color: var(--good); }
.chip.warn { border-color: var(--warn); color: var(--warn); }
