/* Maps the shell's data hooks onto the colour system (design/c3: tokens.css + colour.css, strength "fuller").
   No colours are invented here: every value is a token. Load after colour.css. */
:root, [data-theme="dark"] { --on-stop: var(--ink); --on-dark: var(--ink); }
[data-theme="light"] { --on-stop: var(--panel); --on-dark: var(--panel); }
.btn.stopall { color: var(--on-stop); } .btn.stopall .sq { background: var(--on-stop); }
.btn.dark { color: var(--on-dark); }

/* WHO */
[data-who="owner"] { --who: var(--who-you); }
[data-who="lead"] { --who: var(--who-lead); }
[data-who="system"] { --who: var(--ink-3); }
[data-who^="app:"] { --who: var(--code-ink); }
[data-who^="agent:"] { --who: var(--ink-3); }
[data-hue="1"] { --who: var(--who-1); } [data-hue="2"] { --who: var(--who-2); }
[data-hue="3"] { --who: var(--who-3); } [data-hue="4"] { --who: var(--who-4); }
[data-hue="5"] { --who: var(--who-5); } [data-hue="6"] { --who: var(--who-6); }
[data-hue="7"] { --who: var(--who-7); } [data-hue="8"] { --who: var(--who-8); }
.ev[data-who="lead"].do > .g b, .ev.do > .g b { color: var(--ink-3); }      /* activity labels stay quiet */
.ev.do { --who: var(--rule-2); }
.bus i[data-who] { background: var(--who); }
.bus i.d[data-who] { background: var(--clear); }
.app-h .who { color: var(--who); }

/* KIND — the slot before an activity label carries the kind's tint as a small block until icons land */
.act .kind, .do-list .kind { display: inline-block; flex: none; width: 8px; height: 8px; margin: 0 6px 0 2px; background: var(--ink-3); }
[data-kind="read"] .kind, [data-kind="search"] .kind, [data-kind="web"] .kind,
li[data-kind="read"] .kind, li[data-kind="search"] .kind, li[data-kind="web"] .kind { background: var(--k-look); }
[data-kind="edit"] .kind, [data-kind="run"] .kind { background: var(--k-make); }
[data-kind="message"] .kind, [data-kind="agent"] .kind { background: var(--k-talk); }
[data-kind="read"] > .evb .act > svg.ic, [data-kind="search"] > .evb .act > svg.ic, [data-kind="web"] > .evb .act > svg.ic { color: var(--k-look); }
[data-kind="edit"] > .evb .act > svg.ic, [data-kind="run"] > .evb .act > svg.ic { color: var(--k-make); }
[data-kind="message"] > .evb .act > svg.ic, [data-kind="agent"] > .evb .act > svg.ic { color: var(--k-talk); }

/* PANES */
.pane:has(> .pane-h[data-panel="changes"]), .pane.chp { --pane: var(--code-ink); }
.pane:has(> .pane-h[data-panel="running"]), .pane.rp, .pane.board { --pane: var(--run); }
.pane:has([data-panel="question"]) { --pane: var(--hold); }
.app[data-surface] { border-top: 3px solid var(--who-you); }

/* STATE */
#now[data-state="idle"] .now-1 b, .now.idle .now-1 b { color: var(--ink-2); }
[data-diff="add"] { background: var(--add-bg); color: var(--add-ink); border-left-color: var(--add-ink); }
[data-diff="del"] { background: var(--del-bg); color: var(--del-ink); border-left-color: var(--del-ink); }
.tab[aria-selected="true"]::after { background: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* the status line in the bar is a state, not a link */
.sys a, .sys button { color: inherit; text-decoration: none; }
.sys .it.link, .sys .link { color: inherit; text-decoration: none; }
.sys .it.link.lost, .sys .lost { color: var(--stop); }

/* the look switcher (preview of themes) */
.look-pick { gap: 8px; }
.look-pick label { display: flex; align-items: center; gap: 6px; }
.look-pick .scheme-sw { font: inherit; color: var(--ink); background: var(--well); border: 1px solid var(--rule-2); border-radius: var(--r); height: 24px; padding: 0 8px; cursor: pointer; }
.look-pick select { font: inherit; color: var(--ink); background: var(--well); border: 1px solid var(--rule-2); border-radius: var(--r); height: 24px; padding: 0 4px; }
.phone .look-pick span { display: none; }

/* ── Design checks (design/foundations/charter/checks): fixes that hold for every look ── */
/* focus: every pressable thing shows it; fields show it on their frame */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lk-in:focus-within, .field:focus-within, .launch .q:focus-within, .tabs .find:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; border-color: var(--accent); }
.log:focus-visible { outline-offset: -2px; }
/* contrast: control outlines >= 3:1 on every surface; red text >= 4.5:1 on panels (values checked, see README of the checks) */
/* (--rule-2 dark/light and dark --stop were raised in tokens.css itself: #7C8795, #737D89, #F6787C) */
/* counts and times on tinted tiles, hover rows and tinted pane headers use the stronger text tone */
.strip .a em, .rw:hover .t, .cl-i.on .s em, .lr.on .h, .pane-h .m, .pane-h .r { color: var(--ink-2); }
/* the amber lamp is too pale on light surfaces: the darker amber, same diamond shape */
[data-theme="light"] .lamp.hold:not(.needs .lamp) { background: var(--hold-ink); }

/* ── the status bar: one fixed order of items in every look and state, whoever inserts them (status.js, winbar.js,
   look.js, update.js): brand · Preview · Windows · machine · working/Stop · needs you · connection | battery · date ·
   Look + scheme · Progress · clock. Held with the id so a look cannot reorder it. ── */
body:not(.phone) #sys > * { order: 4; }
body:not(.phone) #sys > .brand { order: 0; }
body:not(.phone) #sys > .preview-tag { order: 1; }
body:not(.phone) #sys > .sep { order: 2; }
body:not(.phone) #sys > .sep ~ .sep { display: none; }
body:not(.phone) #sys > .wins { order: 3; }
body:not(.phone) #sys > .pc-run, body:not(.phone) #sys > .pc-ag { order: 5; }
body:not(.phone) #sys > .need { order: 6; }
body:not(.phone) #sys > .link { order: 7; }
body:not(.phone) #sys > .upd { order: 8; }
body:not(.phone) #sys > .sp { order: 10; }
body:not(.phone) #sys > .pc-ask { order: 11; }
body:not(.phone) #sys > .net, body:not(.phone) #sys > .batt { order: 12; }
body:not(.phone) #sys > .date { order: 13; }
body:not(.phone) #sys > .look-pick { order: 14; }
body:not(.phone) #sys > .prog-open { order: 15; }
body:not(.phone) #sys > .clock { order: 16; flex: none; }
/* too tight: items give way whole, in this order (status.js fitWide); the clock is never cut */
#sys[data-tight~="date"] > .date { display: none; }
#sys[data-tight~="batt"] > .batt > span { display: none; }
#sys[data-tight~="look"] > .look-pick label > span { display: none; }
#sys[data-tight~="link"] > .link { display: none; }
#sys[data-tight~="verb"] > .pc-run > b, #sys[data-tight~="verb"] > .pc-ag > b { display: none; }      /* the lamp alone: never half a word */
/* the Preview pill: the word whole, or (tight) a dot with the same tooltip; held with the id in every look, phone too */
#sys > .preview-tag { flex: none; white-space: nowrap; }
#sys[data-tight~="tag"] > .preview-tag { width: 10px; height: 10px; min-width: 0; padding: 0; border: 0; border-radius: 50%; background: var(--accent); box-shadow: none; }
#sys[data-tight~="tag"] > .preview-tag > b { display: none; }
/* the Look picker is one styled control in every look: never the browser's own box and arrow */
#sys .look-pick select { -webkit-appearance: none; appearance: none; max-width: 160px; padding-right: 22px; cursor: pointer; text-overflow: ellipsis;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-repeat: no-repeat; background-size: 5px 5px; background-position: right 11px center, right 6px center; }

/* phone: the bar has no room for the picker; use ?theme=<name> there until the launcher carries it */
.phone .look-pick { display: none; }

.inj > summary { list-style: none; cursor: pointer; } .inj > summary::-webkit-details-marker { display: none; }

/* "Updated version ready — Reload" */
.sys .upd { font: inherit; font-weight: 700; color: var(--on-accent); background: var(--accent); border: 0; border-radius: var(--r); height: 24px; padding: 0 10px; cursor: pointer; }

/* ── Raw view: the typing control. No look may hide, shrink or disable it (checked in every look review). ── */
html body .raw .rh .rt { display: inline-flex !important; visibility: visible !important; opacity: 1 !important; pointer-events: auto !important;
  height: 28px; min-height: 28px; min-width: 44px; position: relative; z-index: 2; align-items: center; gap: 6px; padding: 0 10px 0 8px; cursor: pointer;
  font: 600 13px/16px var(--sans); color: var(--ink); background: var(--panel); border: 1px solid var(--rule-2); border-radius: var(--r); white-space: nowrap; }
html body .raw .rh .rt[hidden] { display: none !important; }          /* only the shell hides it (look-only pages) */
html body .raw .rh .rt.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
html body .raw .rh .rt.on .sw { background: var(--on-accent); border-color: var(--on-accent); }
html body .raw .rh .rt.on .sw::after { background: var(--accent); }
html body .raw .rh .rt:disabled { opacity: .6 !important; cursor: default; }
.raw .rwrap { position: relative; }
/* typing is off and he clicked in the terminal: a small quiet hint at the top edge (the bottom line is where Claude's prompt is), once per visit */
html body .raw .rask { position: absolute; left: 10px; right: auto; top: 10px; bottom: auto; z-index: 3; display: inline-flex; flex-wrap: nowrap; align-items: center; gap: 8px; margin: 0;
  height: 28px; padding: 0 4px 0 10px; background: var(--panel); color: var(--ink-2); border: 1px solid var(--rule-2); border-radius: var(--r); box-shadow: none; font: 500 13px/16px var(--sans); white-space: nowrap; }
html body .raw .rask .rask-on { height: 22px; padding: 0 6px; border: 0; background: none; color: var(--accent); font: 600 13px/16px var(--sans); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
html body .raw .rask .rask-x { width: 22px; height: 22px; padding: 0; border: 0; background: none; color: var(--ink-3); font: 400 16px/20px var(--sans); cursor: pointer; }
/* the "typing is on" frame is drawn ABOVE the terminal (an outline under it showed on two edges only) */
body.raw-typing .raw .rwrap::after { content: ""; position: absolute; inset: 0; border: 2px solid var(--accent); border-radius: inherit; pointer-events: none; z-index: 2; }

/* ── Progress (the build of the OS, plain words) and the Preview marker ── */
.sys .prog-open { font: inherit; color: inherit; background: none; border: 1px solid var(--rule-2); border-radius: var(--r); height: 24px; padding: 0 8px; cursor: pointer; }
/* not amber: amber means "needs you" and nothing else */
.sys .preview-tag { background: var(--accent-bg); color: var(--ink); border: 1px solid var(--accent); border-radius: var(--r); padding: 1px 10px; font-weight: 600; }
.sys .preview-tag a { color: inherit; text-decoration: underline; }
.phone #sys:not([data-tight~="tag"]) > .preview-tag { padding: 1px 8px; }
.pg { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: color-mix(in srgb, var(--sys) 60%, transparent); }
.pg-p { width: min(720px, 100%); max-height: min(86vh, 900px); display: flex; flex-direction: column; background: var(--panel); color: var(--ink); border: 1px solid var(--rule-2); border-radius: var(--r-4, 12px); overflow: hidden; }
.pg-h { display: flex; align-items: baseline; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--rule); }
.pg-h b { font: var(--l1); } .pg-h span { flex: 1; font: var(--do); color: var(--ink-3); } .pg-h .btn { align-self: center; }
.pg-b { overflow: auto; padding: 8px 20px 20px; }
.pg-ch { display: flex; align-items: center; gap: 16px; padding: 12px 0 4px; }
.pg-ch p { flex: 1; margin: 0; font: var(--do); color: var(--ink-2); }
.pg-b h3 { font: var(--ui); margin: 20px 0 4px; } .pg-b h3 span { font: var(--do); color: var(--ink-3); }
.pg-b ul { list-style: none; margin: 0; padding: 0; }
.pg-b li { display: grid; gap: 2px; padding: 10px 0; border-top: 1px solid var(--rule); }
.pg-b li b { font: 600 16px/22px var(--sans); } .pg-b li span { font: var(--do); color: var(--ink-3); }
.pg-b li span.quiet { color: var(--ink-2); }

/* phone bar: no room for the Progress button (it is in the Open panel's list of versions for now); the
   connection words shorten with a real ellipsis instead of being cut */
.phone .sys .prog-open { display: none; }
.phone .sys .it.link { min-width: 0; overflow: hidden; white-space: nowrap; }
