/* ============================================================
   Agentline — app-specific components.
   Loaded after app.css. Uses only the tokens defined there.
   Solid colours only: no gradients, no blur, no glow.
   1 shell extras · 2 agents · 3 playground + inspector
   4 workflows · 5 runs + traces · 6 tools · 7 guardrails · 8 responsive
   ============================================================ */

/* == 1. shell extras == */
.appfoot{
  border-top:1px solid var(--line);padding:14px var(--gutter);
  display:flex;gap:12px;flex-wrap:wrap;justify-content:space-between;align-items:center;
  font-size:12.5px;color:var(--faint);background:var(--surface-2);margin-top:auto;
}
.appfoot .mono{font-size:11px;letter-spacing:.04em}
.side-scrim{position:fixed;inset:0;background:rgba(23,24,26,.42);z-index:60}
@media (min-width:901px){ .side-scrim{display:none} }
/* footer rhythm: About, then the two paired rows, then the shortcuts button.
   Direct children only — as a descendant selector this also caught the second
   button inside .side__pair, which sits in a flex ROW: the 8px top margin
   pushed GitHub down and left it 8px shorter than nasvih.in beside it. */
.side__foot>.btn+.btn{margin-top:8px}
.side__foot>.side__pair,
.side__foot>.side__pair+.btn{margin-top:8px}
.side__ver{font-family:var(--mono);font-size:10px;letter-spacing:.08em;text-transform:uppercase;color:var(--faint);padding:8px 4px 0}

.kv{display:grid;grid-template-columns:auto 1fr;gap:6px 14px;font-size:13px}
.kv dt{font-family:var(--mono);font-size:10.5px;font-weight:600;letter-spacing:.1em;text-transform:uppercase;color:var(--faint);padding-top:2px}
.kv dd{color:var(--ink-2)}
.chiprow{display:flex;gap:6px;flex-wrap:wrap}
.tagm{display:inline-flex;align-items:center;gap:5px;font-family:var(--mono);font-size:10.5px;font-weight:500;letter-spacing:.04em;
  border:1px solid var(--line);border-radius:var(--r-xs);padding:2px 6px;color:var(--muted);background:var(--surface-2)}
.tagm--on{border-color:var(--amber-line);background:var(--amber-soft);color:var(--amber-deep)}
.tagm--off{border-color:var(--line-2);color:var(--faint);text-decoration:line-through}
.tagm svg{width:12px;height:12px}
.filters{display:flex;gap:8px;flex-wrap:wrap;align-items:center;margin-bottom:14px}
.backlink{display:inline-flex;align-items:center;gap:6px;font-size:13px;color:var(--muted);cursor:pointer;background:none;border:0;padding:4px 0;margin-bottom:10px}
.backlink:hover{color:var(--ink)}
.backlink svg{width:15px;height:15px;transform:rotate(180deg)}

/* == 2. agents == */
.agentgrid{display:grid;gap:var(--gutter);grid-template-columns:repeat(2,minmax(0,1fr))}
.agentcard{background:var(--surface);border:1px solid var(--line);border-radius:var(--r-lg);padding:18px;display:flex;flex-direction:column;gap:12px}
.agentcard:hover{border-color:var(--amber-line)}
.agentcard__top{display:flex;gap:12px;align-items:flex-start}
.tile{width:38px;height:38px;border-radius:var(--r);background:var(--amber-fill);color:var(--on-amber);
  display:grid;place-items:center;font-family:var(--mono);font-size:13px;font-weight:700;flex:none}
.tile--muted{background:var(--surface-2);border:1px solid var(--line);color:var(--muted)}
.agentcard h3{font-size:15.5px}
.agentcard__purpose{color:var(--muted);font-size:13px;min-height:38px}
.agentcard__stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;border-top:1px solid var(--line);padding-top:12px}
.agentcard__stat .label{margin-bottom:2px}
.agentcard__stat .num{font-size:15px}
.agentcard__foot{display:flex;gap:8px;flex-wrap:wrap;border-top:1px solid var(--line);padding-top:12px}

/* == 3. playground + inspector == */
.pg{display:grid;grid-template-columns:minmax(0,1fr) 340px;gap:var(--gutter);align-items:start}
.pg__chat{height:calc(100vh - var(--bar) - 250px);min-height:440px;border:1px solid var(--line);border-radius:var(--r-lg);overflow:hidden;background:var(--surface)}
.pg__chat .assist{height:100%}
.seg{display:flex;gap:6px;flex-wrap:wrap;margin-bottom:14px}
.seg__btn{display:flex;align-items:center;gap:8px;border:1px solid var(--line-2);background:var(--surface);border-radius:var(--r);
  padding:7px 11px;cursor:pointer;font-size:13px;font-weight:600;color:var(--ink-2)}
.seg__btn:hover{background:var(--hover);border-color:var(--amber-line)}
.seg__btn.is-on{background:var(--amber-soft);border-color:var(--amber-line);color:var(--ink)}
.seg__av{width:22px;height:22px;border-radius:var(--r-xs);background:var(--night);color:#fff;display:grid;place-items:center;
  font-family:var(--mono);font-size:10px;font-weight:700;flex:none}
.seg__btn.is-on .seg__av{background:var(--amber-fill);color:var(--on-amber)}

.rail{border:1px solid var(--line);border-radius:var(--r-lg);background:var(--surface);overflow:hidden;position:sticky;top:calc(var(--bar) + 12px)}
.rail__head{padding:12px 14px;border-bottom:1px solid var(--line);display:flex;align-items:center;gap:8px;background:var(--surface-2)}
.rail__head h3{font-size:13.5px;flex:1}
.rail__body{padding:12px 14px;max-height:min(52vh,520px);overflow-y:auto}
.rail__empty{color:var(--faint);font-size:12.5px;padding:8px 0 4px}
.ev{display:grid;grid-template-columns:16px minmax(0,1fr) auto;gap:8px;align-items:start;padding:7px 0;border-bottom:1px solid var(--line)}
.ev:last-child{border-bottom:0}
.ev__mark{width:9px;height:9px;border-radius:2px;margin-top:5px;background:var(--line-2)}
.ev__mark--ok{background:var(--ok)}
.ev__mark--failed,.ev__mark--blocked{background:var(--bad)}
.ev__mark--escalated{background:var(--warn)}
.ev__mark--redacted{background:var(--info)}
.ev__mark--skipped{background:var(--line-2)}
.ev__label{font-size:12.5px;font-weight:600;line-height:1.35}
.ev__detail{font-size:11.5px;color:var(--muted);word-break:break-word}
.ev__ms{font-family:var(--mono);font-size:10.5px;color:var(--faint);white-space:nowrap;padding-top:2px}
.rail__stats{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));border-top:1px solid var(--line)}
.rail__stat{padding:10px 14px;border-bottom:1px solid var(--line)}
.rail__stat:nth-child(odd){border-right:1px solid var(--line)}
.rail__stat .label{font-size:9.5px}
.rail__stat .num{font-size:15px}
.probes{border-top:1px solid var(--line);padding:12px 14px;background:var(--surface-2)}
.probes .label{margin-bottom:8px}

/* == 4. workflows == */
.wf{display:grid;grid-template-columns:240px minmax(0,1fr);gap:var(--gutter);align-items:start}
.wflist{border:1px solid var(--line);border-radius:var(--r-lg);overflow:hidden;background:var(--surface)}
.wflist__item{display:block;width:100%;text-align:left;border:0;border-bottom:1px solid var(--line);background:none;padding:12px 14px;cursor:pointer}
.wflist__item:last-child{border-bottom:0}
.wflist__item:hover{background:var(--hover)}
.wflist__item.is-on{background:var(--amber-soft)}
.wflist__item strong{display:block;font-size:13.5px}
.wflist__item span{font-family:var(--mono);font-size:10.5px;color:var(--faint);letter-spacing:.06em;text-transform:uppercase}

.flow{display:flex;flex-direction:column;gap:0}
.node{border:1px solid var(--line);border-radius:var(--r);background:var(--surface);padding:12px 14px;display:flex;gap:12px;align-items:center}
.node--trigger{border-color:var(--amber-line);background:var(--amber-soft)}
.node--output{background:var(--surface-2)}
.node--off{border-style:dashed;color:var(--muted)}
.node--off .node__name{text-decoration:line-through}
.node__idx{width:26px;height:26px;border-radius:var(--r-xs);background:var(--surface-2);border:1px solid var(--line);
  display:grid;place-items:center;font-family:var(--mono);font-size:11px;font-weight:600;color:var(--muted);flex:none}
.node--trigger .node__idx{background:var(--amber-fill);border-color:var(--amber-fill);color:var(--on-amber)}
.node__main{flex:1;min-width:0}
.node__name{font-weight:600;font-size:13.5px}
.node__detail{font-size:12px;color:var(--muted)}
.node__acts{display:flex;gap:4px;align-items:center;flex:none}
.node__acts .btn--icon{width:30px;height:30px;padding:6px}
.flowline{width:1px;height:14px;background:var(--line-2);margin-left:27px}

.runlog{border:1px solid var(--line);border-radius:var(--r);background:var(--night);color:var(--night-ink);
  font-family:var(--mono);font-size:12px;padding:12px 14px;max-height:300px;overflow-y:auto}
.runlog__line{display:flex;gap:10px;padding:3px 0;border-bottom:1px solid var(--night-line)}
.runlog__line:last-child{border-bottom:0}
.runlog__t{color:var(--night-muted);white-space:nowrap}
.runlog__msg{flex:1;min-width:0;word-break:break-word}
.runlog__st{white-space:nowrap}
.runlog__st--ok{color:#7FD3A4}
.runlog__st--failed,.runlog__st--blocked{color:#F09B95}
.runlog__st--skipped{color:var(--night-muted)}

/* == 5. runs + traces == */
.trace{border-left:1px solid var(--line);padding-left:18px;position:relative;margin-top:6px}
.trace__item{position:relative;padding:0 0 16px}
.trace__item::before{content:"";position:absolute;left:-22px;top:5px;width:7px;height:7px;border-radius:2px;background:var(--line-2);border:2px solid var(--surface)}
.trace__item--ok::before{background:var(--ok)}
.trace__item--failed::before,.trace__item--blocked::before{background:var(--bad)}
.trace__item--escalated::before{background:var(--warn)}
.trace__item--redacted::before{background:var(--info)}
.trace__head{display:flex;gap:10px;align-items:baseline;flex-wrap:wrap}
.trace__name{font-weight:600;font-size:13.5px}
.trace__detail{font-size:12.5px;color:var(--muted)}
.runid{font-family:var(--mono);font-size:12px;color:var(--ink-2)}

/* == 6. tools == */
.toolcard{border:1px solid var(--line);border-radius:var(--r-lg);background:var(--surface);padding:16px;display:flex;flex-direction:column;gap:10px}
.toolcard__top{display:flex;gap:12px;align-items:flex-start}
.toolcard__icon{width:34px;height:34px;border-radius:var(--r);border:1px solid var(--line);background:var(--surface-2);
  display:grid;place-items:center;color:var(--muted);flex:none}
.toolcard__icon svg{width:18px;height:18px}
.toolcard.is-on .toolcard__icon{background:var(--amber-soft);border-color:var(--amber-line);color:var(--amber-deep)}
.toolcard p{font-size:13px;color:var(--muted)}
.toolcard__ops{display:flex;gap:6px;flex-wrap:wrap}
.toolcard__foot{display:flex;align-items:center;justify-content:space-between;gap:10px;border-top:1px solid var(--line);padding-top:10px;margin-top:auto}

/* == 7. guardrails == */
.grcard{border:1px solid var(--line);border-radius:var(--r-lg);background:var(--surface);padding:16px}
.grcard.is-off{background:var(--surface-2)}
.grcard__top{display:flex;gap:12px;align-items:flex-start;margin-bottom:10px}
.grcard__top h3{flex:1}
.grcard p{font-size:13px;color:var(--muted)}
.grcard__cfg{border-top:1px solid var(--line);margin-top:12px;padding-top:12px}
.tryout{border:1px solid var(--line);border-radius:var(--r);background:var(--surface-2);padding:12px;margin-top:12px}
.tryout__out{font-family:var(--mono);font-size:12.5px;background:var(--surface);border:1px solid var(--line);
  border-radius:var(--r-sm);padding:9px 11px;margin-top:8px;word-break:break-word}
.topicchip{display:inline-flex;align-items:center;gap:6px;border:1px solid var(--line-2);border-radius:var(--r-sm);
  padding:3px 6px 3px 9px;font-size:12.5px;background:var(--surface)}
.topicchip button{border:0;background:none;cursor:pointer;color:var(--faint);display:grid;place-items:center;padding:2px}
.topicchip button:hover{color:var(--bad)}
.topicchip svg{width:12px;height:12px}

/* == 7b. stored reports (Settings) == */
.stored{display:flex;gap:12px;align-items:center;border:1px solid var(--line);border-radius:var(--r);padding:10px 12px;background:var(--surface-2)}
.stored__title{font-weight:600;font-size:13.5px}
.stored__body{white-space:pre-wrap;font-size:13.5px;line-height:1.6;color:var(--ink-2);
  border:1px solid var(--line);border-radius:var(--r);background:var(--surface-2);padding:12px 14px;max-height:46vh;overflow-y:auto}

/* == 8. responsive == */
@media (max-width:1180px){ .pg{grid-template-columns:minmax(0,1fr)} .rail{position:static} .pg__chat{height:520px} }
@media (max-width:900px){
  .wf{grid-template-columns:minmax(0,1fr)}
  .agentgrid{grid-template-columns:minmax(0,1fr)}
}
@media (max-width:640px){
  .pg__chat{height:calc(100vh - 260px);min-height:380px}
  /* the shared sheet turns the floating panel full-screen at this width; the
     docked one is a page element, so it keeps the width of its column instead
     of running 100vw past the view padding */
  .pg__chat .assist{position:static;width:auto;height:100%;border-radius:var(--r-lg)}
  .agentcard__stats{grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}
  .node{flex-wrap:wrap}
  .node__acts{width:100%;justify-content:flex-end}
  .appfoot{flex-direction:column;align-items:flex-start;gap:6px}
}
@media (max-width:400px){
  .agentcard__stats{grid-template-columns:minmax(0,1fr)}
  .rail__stats{grid-template-columns:minmax(0,1fr)}
  .rail__stat:nth-child(odd){border-right:0}
}

/* == 9. icon sizing for inline svg dropped into custom blocks == */
.node__idx svg,.rail__head svg,.grcard__top svg,.tagm svg,.runsum svg{width:15px;height:15px}
.rail__head svg,.grcard__top svg{color:var(--faint)}
.runsum{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:var(--gutter)}
@media (max-width:900px){ .runsum{grid-template-columns:repeat(2,minmax(0,1fr))} }
@media (max-width:400px){ .runsum{grid-template-columns:minmax(0,1fr)} }

/* == 10. demo disclosure == */
.pill--btn{cursor:pointer;font-family:var(--mono)}
.pill--btn:hover{background:var(--amber-fill);color:var(--on-amber);border-color:var(--amber-fill)}
.aboutblock+.aboutblock{margin-top:14px;border-top:1px solid var(--line);padding-top:14px}
.aboutblock h4{font-size:13.5px;margin-bottom:5px}
.aboutblock p{font-size:13px;color:var(--muted)}
.aboutblock p+p{margin-top:8px}
.aboutlist{margin:0;padding-left:17px;font-size:13px;color:var(--muted)}
.aboutlist li{margin-top:5px}
.aboutlist li::marker{color:var(--amber-deep)}
/* the repository line: amber text on white has to be --amber-deep, never the fill */
.aboutsrc{font-family:var(--mono);font-size:12.5px;color:var(--amber-deep);text-decoration:none;border-bottom:1px solid var(--amber-line);word-break:break-all}
.aboutsrc:hover{border-bottom-color:var(--amber-deep)}
/* the action list in the About modal: three columns of prose do not fit
   at phone width, so it scrolls sideways inside its wrapper instead of
   squashing into one word per line */
.actiontable{min-width:520px}
.actiontable td:first-child{font-weight:600}
.simnote{font-size:12px;color:var(--muted);background:var(--amber-soft);border:1px solid var(--amber-line);
  border-radius:var(--r-sm);padding:8px 11px;line-height:1.5}
.rail .simnote{border:0;border-bottom:1px solid var(--line);border-radius:0;background:var(--amber-soft)}
.simnote--top{margin-bottom:10px}

/* == 11. one chat affordance at a time ==
   The Playground is a product screen with its own docked composer, so the
   floating console launcher steps aside there. Cmd K still opens it. */
body.is-playground .assist-fab{display:none}

/* == 12. sidebar rail + tone: app-level tidy-ups == */
.shell.is-rail .side__ver{display:none}
.shell.is-rail .side__brand{gap:0}
/* same contrast rule as the shared sheet: quiet text on yellow is ink-2, not
   --amber-darker, which falls under AA against the fill */
.side[data-tone="amber"] .side__ver{color:var(--ink-2)}
/* The brand-row controls carry no visible text, so a pressed one has to be
   readable and not only announced. On the yellow sidebar that is an ink
   outline, not an ink fill — the link out to nasvih.in is the only solid dark
   block in the sidebar. */
.side[data-tone="amber"] .side__brandbtns .btn[aria-pressed="true"]{background:rgba(23,24,26,.10);border-color:rgba(23,24,26,.5);color:var(--ink)}
.side[data-tone="amber"] .side__brandbtns .btn[aria-pressed="true"]:hover{background:rgba(23,24,26,.16)}
.side__brandbtns .btn[aria-pressed="true"]{background:var(--amber-soft);border-color:var(--amber-line);color:var(--amber-deep)}

/* link out to the author's site: the one dark element in the sidebar, so it
   reads the same against the yellow default and the white alternative */
.side__site{background:var(--night);border-color:var(--night);color:#fff;text-decoration:none}
.side__site:hover{background:var(--night-2);border-color:var(--night-2);color:#fff}
.side[data-tone="amber"] .side__site{background:var(--night);border-color:var(--night);color:#fff}
.side[data-tone="amber"] .side__site:hover{background:var(--night-2);border-color:var(--night-2)}

/* == 13. topbar controls ==
   Three icon-only controls sit between the page title and the About
   button: notifications, device preview, dark mode. They keep the 34px
   button box of the kit so the row stays on one baseline. */
.topbar__crumb{min-width:0}
.topbar__tools{display:flex;align-items:center;gap:4px;flex:none}
.topbar__tools .btn--icon{width:34px;height:34px}
.devgroup{display:flex;gap:2px;border:1px solid var(--line);border-radius:var(--r);padding:2px}
.devgroup .btn{width:30px;height:30px;padding:0}
.devgroup .btn[aria-pressed="true"]{background:var(--amber-soft);border-color:var(--amber-line);color:var(--amber-deep)}

/* notifications */
.notifwrap{position:relative;display:flex}
.notif__badge{position:absolute;top:-1px;right:-1px;min-width:16px;height:16px;padding:0 4px;border-radius:var(--r-pill);
  background:var(--bad);color:#fff;border:1px solid var(--surface);
  font-family:var(--mono);font-size:9.5px;font-weight:600;line-height:14px;text-align:center;letter-spacing:0}
.notifpanel{position:absolute;top:calc(100% + 8px);right:0;width:min(380px,calc(100vw - 32px));z-index:70;
  background:var(--surface);border:1px solid var(--line);border-radius:var(--r-lg);box-shadow:var(--shadow-3);overflow:hidden}
.notifpanel__head{display:flex;align-items:center;gap:8px;padding:10px 12px;border-bottom:1px solid var(--line);background:var(--surface-2)}
.notifpanel__head h3{font-size:14px;flex:1}
.notifpanel__body{max-height:min(58vh,460px);overflow-y:auto}
.notifpanel__foot{padding:8px 12px;border-top:1px solid var(--line);background:var(--surface-2);
  font-family:var(--mono);font-size:9.5px;letter-spacing:.06em;text-transform:uppercase;color:var(--faint)}
.note{display:flex;align-items:flex-start;gap:6px;border-bottom:1px solid var(--line);padding:2px 6px 2px 0}
.note:last-child{border-bottom:0}
.note__main{flex:1;min-width:0;display:flex;flex-direction:column;gap:3px;text-align:left;
  background:none;border:0;cursor:pointer;padding:10px 8px 10px 12px;color:inherit}
.note__main:hover{background:var(--hover)}
.note__top{display:flex;align-items:center;gap:8px}
.note__when{font-size:10.5px;color:var(--faint);margin-left:auto}
.note__title{font-size:13px;font-weight:600;line-height:1.35}
.note__detail{font-size:12px;color:var(--muted);line-height:1.4}
.note__mark{width:28px;height:28px;padding:6px;flex:none;margin-top:10px}
.note__read{flex:none;margin-top:14px;padding-right:4px}
.note.is-read .note__title{font-weight:500;color:var(--muted)}
.notifempty{padding:26px 18px;text-align:center}
.notifempty h4{margin-bottom:6px}
.notifempty p{font-size:12.5px;color:var(--muted)}
.notifempty p+p{margin-top:8px}

/* == 14. device preview ==
   A yellow surround, a dark bezel and an iframe of this same app at
   390x844 — real breakpoints, not a scaled screenshot. */
.devframe{position:fixed;inset:0;z-index:90;background:var(--amber-fill);color:var(--on-amber);
  display:flex;flex-direction:column;align-items:center;padding:14px;overflow:auto;
  /* the surround is yellow in both themes, so the ink on it stays ink */
  --ink:#17181A;--ink-2:#2E3033;--muted:#4A4E54;--faint:#4A4E54;--line:rgba(23,24,26,.2)}
.devframe__bar{width:min(720px,100%);display:flex;align-items:center;gap:12px;justify-content:space-between;
  padding-bottom:12px;border-bottom:1px solid rgba(23,24,26,.2);flex:none}
.devframe__name{font-weight:700;font-size:17px;letter-spacing:-.02em}
.devframe__sub{color:var(--ink-2)}
.devframe__stage{flex:1;width:100%;min-height:0;display:flex;align-items:center;justify-content:center;padding:14px 0}
.devframe__slot{position:relative;flex:none}
.devframe__phone{position:absolute;top:0;left:0;width:414px;height:892px;background:#17181A;border-radius:46px;
  padding:24px 12px;transform-origin:top left;box-shadow:var(--shadow-3)}
.devframe__view{width:390px;height:844px;border:0;border-radius:26px;background:#fff;display:block}
.devframe__note{width:min(720px,100%);font-size:12.5px;color:var(--ink-2);flex:none;padding-bottom:4px}
body.is-phoneframe .assist-fab{display:none}
/* inside the frame the app must not offer the frame again */
body.is-framed .devgroup{display:none}

/* == 15. topbar at small widths ==
   Four controls, a title and two buttons do not fit at 390px. The
   sub-label goes first, then the topbar reset (the sidebar footer keeps
   one), then the device button that is already active. */
@media (max-width:900px){
  .topbar{gap:8px}
  .topbar__sub{display:none}
  .topbar__title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
}
@media (max-width:760px){ #resetbtn{display:none} }
@media (max-width:640px){
  .devgroup .btn[aria-pressed="true"]{display:none}
  .devgroup{border:0;padding:0}
  .notifpanel{position:fixed;top:calc(var(--bar) + 8px);left:12px;right:12px;width:auto}
  .devframe__bar{flex-wrap:wrap}
}

/* == 16. dark mode ==
   The kit ships the palette; these are the app-level places where a
   token alone is not enough. Yellow always keeps ink text on it. */
[data-theme="dark"]{color-scheme:dark}
/* the yellow sidebar is a light surface whatever the theme, so inside it
   the ink tokens go back to their light values rather than inverting */
[data-theme="dark"] .side[data-tone="amber"]{
  --ink:#17181A;--ink-2:#2E3033;--muted:#4A4E54;--faint:#4A4E54;
  --bg:#FFFFFF;--surface:#FFFFFF;--hover:#FEFBEA;
  --amber-deep:#8A6D00;--amber-darker:#6B5400;--amber-soft:#FEF9DA;--amber-line:#F0DE8C;
}
[data-theme="dark"] .side[data-tone="amber"] .side__site{background:#17181A;border-color:#17181A;color:#fff}
[data-theme="dark"] .side[data-tone="amber"] .side__site:hover{background:#2E3033;border-color:#2E3033}
/* the kit's select arrow is drawn in the light muted grey */
[data-theme="dark"] .select{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23A2A8B0' stroke-width='1.7'%3E%3Cpath d='M6 8l4 4 4-4'/%3E%3C/svg%3E")}
/* the switch knob is white on both tracks; on a dark ground the off
   track needs to stay visibly lighter than the surface it sits on */
[data-theme="dark"] .switch__track{background:#4A4E54}
[data-theme="dark"] .switch__track::after{background:#F2F2F0}
[data-theme="dark"] .switch input:checked+.switch__track::after{background:#17181A}
/* run log and code blocks sit on --night, which is darker than the page
   in dark mode — a hairline keeps them from melting into it */
[data-theme="dark"] .runlog,[data-theme="dark"] .code{border-color:var(--line-2)}
[data-theme="dark"] .notif__badge{border-color:var(--surface)}
[data-theme="dark"] .seg__av{background:#3A3D42;color:#F2F2F0}
[data-theme="dark"] .msg--me .msg__av{background:#3A3D42;color:#F2F2F0}
[data-theme="dark"] .msg--me .msg__body{background:#0F1012;border-color:var(--line-2);color:var(--ink)}
[data-theme="dark"] .toast{border:1px solid var(--line-2)}
[data-theme="dark"] .tile--muted{background:var(--surface-2)}

/* == 17. overlay stacking ==
   The kit gives .scrim z-index 60, but under 900px the sidebar drawer sits at
   65 and the assistant panel at 75 — so a modal opened while either was open
   rendered behind it and its buttons could not be reached. A modal is always
   the topmost surface except for toasts (80) and the device frame (90). */
.scrim{z-index:78}
/* on a short viewport the modal body scrolls, so the actions have to stay put
   rather than sitting below the fold of the scroll */
@media (max-width:640px){ .modal__foot{position:sticky;bottom:0} }

/* == 18. topbar fit at phone width ==
   The About pill is the widest thing in the bar. Left alone it wrapped onto
   two lines inside a 60px bar and squeezed the page title to one letter. */
#aboutbtn{white-space:nowrap}
@media (max-width:640px){ .aboutbtn__rest{display:none} }
@media (max-width:480px){
  /* previewing a 390px phone from a phone shows the same view twice */
  .devgroup{display:none}
  .topbar{padding:0 14px}
}
/* the notifications header held a title, a count, a bulk action and a close
   button on one line; below this width the close button was pushed out of
   the panel, so the bulk action takes a row of its own instead */
@media (max-width:420px){
  .notifpanel__head{flex-wrap:wrap}
  .notifpanel__head h3{flex:1 1 auto;min-width:0}
  .notifpanel__head .label{white-space:nowrap}
  .notifpanel__head .btn--sm{order:4;flex:1 0 100%}
}

/* == 19. touch targets ==
   Only where the sidebar is a drawer — the pointer layout above 900px keeps
   the tighter kit sizing. Nothing here changes colour, border or radius. */
@media (max-width:900px){
  .btn{padding:10px 14px}
  .btn--sm{padding:10px 12px}
  .btn--icon,.btn--sm.btn--icon,.topbar__tools .btn--icon{width:40px;height:40px;padding:9px}
  .chip{padding:10px 11px}
  .navlink{padding:11px 10px}
  .seg__btn{padding:10px 11px}
  .backlink{padding:10px 0}
  #aboutbtn{padding:11px 10px}
  .devgroup .btn{width:40px;height:40px}
  .side__brandbtns .btn{width:40px;height:40px}
  .side__brandbtns .btn svg{width:18px;height:18px}
  .node__acts .btn--icon{width:40px;height:40px;padding:9px}
  .note__mark{width:38px;height:38px;padding:9px;margin-top:6px}
  /* the remove control on a topic chip was a 16px box */
  .topicchip{padding:2px 4px 2px 10px}
  .topicchip button{padding:11px}
}

/* Under 900px the sidebar is a drawer, so the rail must not claim a grid
   column or strip the labels the drawer needs. Overrides the shared rules. */
@media (max-width:900px){
  .shell.is-rail{grid-template-columns:minmax(0,1fr)}
  .shell.is-rail .side{width:var(--sidebar)}
  .shell.is-rail .side__name,
  .shell.is-rail .side__tag,
  .shell.is-rail .navgroup__label,
  .shell.is-rail .side__ver{display:block}
  .shell.is-rail .navlink span,
  .shell.is-rail .navlink__count,
  .shell.is-rail .side__foot .btn span{display:inline}
  .shell.is-rail .navlink__count{margin-left:auto}
  .shell.is-rail .side__brand{flex-direction:row;justify-content:flex-start;height:var(--bar);padding:0 18px;gap:10px}
  .shell.is-rail .side__brandbtns{margin-left:auto;flex-direction:row}
  .shell.is-rail .side__nav{padding:14px 12px}
  .shell.is-rail .navlink{justify-content:flex-start;padding:8px 10px}
  .shell.is-rail .navgroup+.navgroup{margin-top:18px;border-top:0;padding-top:0}
  .shell.is-rail .side__foot{padding:12px}
  .shell.is-rail .side__foot .btn{padding:8px 14px}
  .shell.is-rail .side__pair{flex-direction:row}
  /* the sidebar is a drawer at this width, so there is nothing to collapse */
  .side__brandbtns [data-chrome="rail"]{display:none}
}
