/* CanWeReachIt styles. Plain CSS, no preprocessor.
   Two shells share one set of token names:
     [data-shell="everyday"]   light bento modules (design J)
     [data-shell="workbench"]  dense, engineer-first (design I)
   Light/dark follows the system unless [data-theme] is set. */

@layer reset, tokens, base, layout, components, everyday, workbench, utilities;

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  body, h1, h2, h3, h4, p, dl, dd, ol, ul, pre, figure { margin: 0; }
  ul, ol { padding: 0; list-style: none; }
  button, input, select, textarea { font: inherit; color: inherit; }
}

@layer tokens {
  :root {
    color-scheme: light dark;
    --display: 'Geist', system-ui, sans-serif;
    --mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    --radius: 24px;
    /* Everyday (default) */
    --bg: light-dark(#EDEFF2, #0F1114);
    --surface: light-dark(#FFFFFF, #181B20);
    --surface-2: light-dark(#F5F6F8, #20242A);
    --border: light-dark(#DDE0E6, #2C3139);
    --ink: light-dark(#15171A, #EDEFF2);
    --ink-inverse: light-dark(#FFFFFF, #0F1114);
    --text: var(--ink);
    --muted: light-dark(#5A6070, #A3AAB6);
    --accent: light-dark(#3046D6, #9FB0FF);
    --signal: light-dark(#F0532D, #FF7A55);
    --signal-text: light-dark(#B8320F, #FF9677);
    --ok: light-dark(#0E6B47, #6FD9A8);
    --warn: light-dark(#8A4B00, #E8B04B);
    --fail: var(--signal-text);
    --info: var(--muted);
    --band: #15171A;
    --band-text: #FFFFFF;
    --band-muted: #C7CBD3;
    --band-tile: #22262C;
    --lilac: light-dark(#ECE8FF, #2A2540);
    --warm: light-dark(#FFF4E2, #3A2E1A);
  }
  :root[data-shell="workbench"] {
    --radius: 10px;
    --bg: light-dark(#F7F7F8, #0B0B0C);
    --surface: light-dark(#FFFFFF, #111113);
    --surface-2: light-dark(#F1F1F3, #1C1C20);
    --border: light-dark(#E4E4E7, #232326);
    --ink: light-dark(#111113, #EDEDEF);
    --ink-inverse: light-dark(#FFFFFF, #0B0B0C);
    --muted: light-dark(#5C5C66, #8B8B92);
    --accent: light-dark(#2563EB, #7DD3FC);
    --signal: light-dark(#D9411E, #FF6A3D);
    --signal-text: light-dark(#B8320F, #FF8A66);
    --ok: light-dark(#15803D, #4ADE80);
    --warn: light-dark(#A16207, #FBBF24);
  }
  :root[data-theme="light"] { color-scheme: light; }
  :root[data-theme="dark"] { color-scheme: dark; }
}

@layer base {
  body { background: var(--bg); color: var(--text); font: 16px/1.5 var(--display); -webkit-font-smoothing: antialiased; }
  :root[data-shell="workbench"] body { font-size: 14px; }
  a { color: var(--accent); text-underline-offset: 3px; }
  h2 { font-size: clamp(1.6rem, 3.5vw, 2.4rem); font-weight: 600; letter-spacing: -0.03em; line-height: 1.08; margin-bottom: .4rem; }
  h3 { font-size: 1.05rem; font-weight: 650; letter-spacing: -0.01em; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
  h4 { font: 500 .72rem/1.4 var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin: .75rem 0 .35rem; }
  code, .mono, pre { font-family: var(--mono); font-size: .9em; }
  :focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
  input, select, textarea { background: var(--surface); border: 1.5px solid var(--border); border-radius: 12px; padding: .55rem .8rem; min-width: 0; min-height: 44px; }
  textarea { width: 100%; font: .88rem/1.5 var(--mono); resize: vertical; }
  input:focus, select:focus, textarea:focus { border-color: var(--ink); outline: none; }
  input[type="url"], input[type="text"], input[type="search"] { flex: 1 1 16rem; }
  [hidden] { display: none !important; }
  :root[data-mode="simple"] .eng { display: none; }
}

@layer layout {
  #app { max-width: 1400px; margin-inline: auto; padding: 0 16px 3rem; }
  @media (min-width: 720px) { #app { padding-inline: 28px; } }
  .top { display: flex; align-items: center; gap: .75rem 1.25rem; padding: 1rem 0; flex-wrap: wrap; }
  .brand { display: flex; align-items: center; gap: .6rem; color: var(--ink); text-decoration: none; }
  .wordmark { font-size: 1.2rem; font-weight: 700; letter-spacing: -0.02em; }
  .mark { color: var(--ink); .m1 { stroke: currentColor; } .m3 { stroke: var(--signal); } }
  .top-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-left: auto; }
  .ask { flex: 1 1 24rem; order: 3; display: flex; align-items: center; min-width: 0; background: var(--surface); border: 1.5px solid var(--border); border-radius: 999px; padding: 4px 4px 4px 16px;
    label { font: 500 .75rem var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding-right: .7rem; border-right: 1px solid var(--border); }
    input { border: 0; background: transparent; font: .95rem var(--mono); padding: .45rem .75rem; min-height: 38px; }
    input:focus { outline: none; } }
  .ask:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }
  @media (min-width: 1100px) { .ask { order: 0; } }
  .body { display: flex; gap: 1.5rem; align-items: flex-start; }
  main { flex: 1 1 0; min-width: 0; display: grid; gap: 1.25rem; container-type: inline-size; view-transition-name: main; }
  main:focus { outline: none; }
  .side { flex: 0 0 200px; position: sticky; top: 12px; display: grid; gap: 1rem; padding: .75rem .5rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    a { display: block; padding: .45rem .7rem; border-radius: 6px; color: var(--muted); text-decoration: none; }
    a:hover { color: var(--ink); background: var(--surface-2); }
    a[aria-current="page"] { color: var(--ink); background: var(--surface-2); box-shadow: inset 2px 0 0 var(--signal); font-weight: 500; } }
  .side-group { display: grid; gap: 2px; }
  .side-label { font: 500 .7rem var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 0 .7rem .25rem; }
  @media (max-width: 820px) { .body { flex-direction: column; align-items: stretch; } .side { position: static; flex-basis: auto; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); } }
  .page-head { display: flex; justify-content: space-between; align-items: end; gap: 1rem; flex-wrap: wrap; > div { flex: 1 1 32rem; } }
  .grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr)); }
  .two { display: grid; gap: 1rem; grid-template-columns: 1fr; }
  @container (min-width: 640px) { .two { grid-template-columns: 1fr 1fr; } }
  footer { margin-top: 3rem; padding-top: 1.25rem; border-top: 1px solid var(--border); text-align: center; display: grid; gap: .35rem; }
}

@layer components {
  .card, .wb-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.25rem; display: grid; gap: .65rem; align-content: start; min-width: 0; }
  .btn { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; cursor: pointer; border-radius: 999px; min-height: 44px; padding: .5rem 1.1rem; border: 1.5px solid var(--border); background: var(--surface); color: var(--ink); font-weight: 600; text-decoration: none;
    &:hover:not(:disabled) { border-color: var(--ink); }
    &:disabled { opacity: .55; cursor: progress; }
    &.primary { background: var(--ink); color: var(--ink-inverse); border-color: var(--ink); }
    &.invert { background: #FFFFFF; color: #15171A; border-color: #FFFFFF; }
    &.ghost { background: transparent; }
    &.small { min-height: 36px; padding: .25rem .8rem; font-size: .86rem; }
    &.danger { color: var(--fail); }
    &.file { position: relative; input { position: absolute; inset: 0; opacity: 0; cursor: pointer; } } }
  :root[data-shell="workbench"] .btn { border-radius: 8px; min-height: 36px; padding: .35rem .85rem; font-weight: 500; }
  .seg { display: inline-flex; background: var(--surface); border: 1.5px solid var(--border); border-radius: 999px; padding: 3px; gap: 2px;
    a, button { min-height: 34px; display: inline-flex; align-items: center; padding: 0 .9rem; border-radius: 999px; border: 0; background: transparent; color: var(--ink); text-decoration: none; font-weight: 600; font-size: .88rem; cursor: pointer; }
    [aria-current="true"], [aria-pressed="true"] { background: var(--ink); color: var(--ink-inverse); } }
  .toolbar { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; label { display: inline-flex; align-items: center; gap: .4rem; } }
  .w-num { inline-size: 6rem; }
  .chips { display: flex; flex-wrap: wrap; gap: .4rem; }
  .chip { border: 1.5px solid var(--border); background: var(--surface); border-radius: 999px; min-height: 36px; padding: .25rem .85rem; cursor: pointer; font: 500 .85rem var(--mono); &.on { background: var(--ink); color: var(--ink-inverse); border-color: var(--ink); } }
  .chip-static { font: .75rem var(--mono); border: 1px solid var(--border); border-radius: 999px; padding: .1rem .55rem; color: var(--muted); }
  .kicker { font: 500 .72rem var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

  .badge { display: inline-flex; align-items: center; gap: .4rem; font: 600 .74rem var(--mono); letter-spacing: .05em; text-transform: uppercase; }
  .badge .dot { display: grid; place-items: center; inline-size: 1.3rem; block-size: 1.3rem; border-radius: 50%; color: var(--surface); font-size: .7rem; }
  .badge.ok { color: var(--ok); .dot { background: var(--ok); } }
  .badge.warn { color: var(--warn); .dot { background: var(--warn); } }
  .badge.fail { color: var(--fail); .dot { background: var(--signal); } }
  .badge.info { color: var(--info); .dot { background: var(--info); } }
  .badge.pending { color: var(--muted); .dot { background: var(--border); animation: pulse 1s infinite alternate; } }
  @keyframes pulse { to { opacity: .35; } }
  .pill { font: 600 .68rem var(--mono); padding: .12rem .5rem; border-radius: 999px; margin-left: .35rem; text-transform: uppercase; border: 1.5px solid currentColor; }
  .pill.ok { color: var(--ok); } .pill.warn { color: var(--warn); } .pill.fail { color: var(--fail); }
  .kv { display: grid; grid-template-columns: minmax(8rem, max-content) 1fr; gap: .3rem 1rem; font-size: .94rem; dt { color: var(--muted); } dd { min-width: 0; overflow-wrap: anywhere; } .badge { white-space: normal; } }

  .verdict p { font-size: clamp(1.3rem, 3vw, 2rem); font-weight: 600; letter-spacing: -0.025em; line-height: 1.12; }
  .v-fail { color: var(--signal-text); }
  :root[data-shell="workbench"] .verdict p { font-size: 1.15rem; letter-spacing: -0.01em; }

  /* Diagnose (Workbench): stations along the path */
  .path { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1.25rem 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; }
  .station { display: flex; flex-direction: column; gap: .2rem; min-width: 0; padding-right: 1rem;
    .rail { display: flex; align-items: center; height: 30px; margin-bottom: .4rem; }
    .node { inline-size: 20px; block-size: 20px; border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 4px var(--surface), 0 0 0 6px var(--ink); flex: 0 0 auto; }
    .link { flex: 1; height: 2px; background: var(--ink); margin-left: 10px; }
    .kicker { font-size: .68rem; } strong { font-size: 1.1rem; font-weight: 650; }
    .fact { font: .8rem var(--mono); color: var(--muted); overflow-wrap: anywhere; }
    .state { font: 600 .7rem var(--mono); letter-spacing: .08em; text-transform: uppercase; margin-top: .3rem; color: var(--ok); }
    .why { font-size: .85rem; color: var(--muted); } }
  .station.pending .node { background: var(--surface); box-shadow: 0 0 0 4px var(--surface), 0 0 0 6px var(--border); animation: pulse 1s infinite alternate; }
  .station.warn .node, .station.fail .node { background: var(--surface); border: 5px solid var(--signal); box-shadow: 0 0 0 4px var(--surface), 0 0 0 6px var(--signal); }
  .station.info .node { background: var(--border); box-shadow: 0 0 0 4px var(--surface), 0 0 0 6px var(--border); }
  .station.next-warn .link, .station.next-fail .link { height: 5px; border-radius: 3px; background: repeating-linear-gradient(90deg, var(--signal) 0 10px, transparent 10px 15px); }
  .station.warn .state, .station.fail .state { color: var(--signal-text); }
  .station.pending .state, .station.info .state { color: var(--muted); }
  @container (max-width: 640px) {
    .path { grid-template-columns: 1fr; gap: 0; }
    .station { display: grid; grid-template-columns: 30px 1fr; column-gap: 12px; padding: 0 0 1rem; }
    .station > :not(.rail) { grid-column: 2; }
    .station .rail { grid-row: 1 / span 6; flex-direction: column; height: auto; margin: 4px 0 0; }
    .station .link { width: 2px; height: auto; min-height: 24px; margin: 10px 0 -1rem; }
  }
  .life { background: var(--band); color: var(--band-text); border-radius: var(--radius); padding: 1.5rem; display: grid; gap: .9rem; }
  .life .kicker { color: var(--band-muted); } .life h3 { font-size: 1.4rem; }
  .life-grid { display: grid; gap: .7rem; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
  .life .act { background: var(--band-tile); border-radius: 14px; padding: 1rem; display: grid; gap: .5rem; p { font-size: .92rem; color: var(--band-muted); } a { color: #9FB0FF; } }
  .pips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; span { height: 6px; border-radius: 3px; background: #33383F; } }
  .act.great .pips .on, .act.ok .pips .on { background: #6FD9A8; } .act.poor .pips .on { background: #FF7A55; }
  .checks { display: grid; border-top: 1px solid var(--border); }
  .check { display: grid; grid-template-columns: 8rem 1fr; gap: 1rem; align-items: start; padding: .9rem 0; border-bottom: 1px solid var(--border);
    strong { font-weight: 650; } p { margin-top: .2rem; }
    .why { color: var(--muted); font-size: .92rem; padding-left: .7rem; border-left: 2px solid var(--border); margin-top: .45rem; strong { color: var(--ink); font-weight: 600; } }
    .fix { font-size: .92rem; margin-top: .35rem; }
    summary { cursor: pointer; color: var(--muted); font: .8rem var(--mono); } }
  @container (max-width: 560px) { .check { grid-template-columns: 1fr; gap: .25rem; } }

  .table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
  table.data { inline-size: 100%; border-collapse: collapse; font-size: .9rem; font-variant-numeric: tabular-nums;
    th, td { text-align: left; padding: .55rem .8rem; border-bottom: 1px solid var(--border); vertical-align: top; }
    thead th { font: 500 .7rem var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .08em; background: var(--surface); }
    tr.group th { font: 600 .74rem var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); }
    tbody tr:last-child > * { border-bottom: 0; }
    &.compact th, &.compact td { padding: .32rem .55rem; } }
  .card table.data, .tile table.data { background: transparent; }
  .good { color: var(--ok); } .meh { color: var(--warn); } .bad { color: var(--signal-text); }
  .spark { inline-size: 160px; block-size: 32px; path { fill: none; stroke: var(--ink); stroke-width: 1.6; } .loss { stroke: var(--signal); stroke-width: 1.5; } }
  .bars li { display: grid; grid-template-columns: 5.5rem 1fr 4rem; gap: .5rem; align-items: center; font-size: .85rem; }
  .bar { block-size: .5rem; border-radius: 4px; background: var(--surface-2); position: relative; overflow: hidden; &::after { content: ''; position: absolute; inset: 0 auto 0 0; inline-size: var(--w); background: var(--ink); border-radius: 4px; } }
  .actions { display: flex; flex-wrap: wrap; gap: .4rem; }
  .pager { display: flex; gap: .75rem; align-items: center; justify-content: center; padding: .5rem; }
  .browser { display: grid; gap: .5rem; }
  .issues ul { display: grid; gap: .25rem; max-block-size: 20rem; overflow: auto; }
  .feeds { display: grid; gap: 1rem; }
  .geo-hit + .geo-hit { border-top: 1px solid var(--border); padding-top: .5rem; }
  .status-grid { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); }
  .status-tile { background: var(--surface); border: 1px solid var(--border); border-top: 5px solid var(--border); border-radius: var(--radius); padding: .9rem 1rem; display: grid; gap: .45rem; align-content: start;
    header { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
    h3 a { color: var(--ink); text-decoration: none; }
    &.ok { border-top-color: var(--ok); } &.warn { border-top-color: var(--warn); } &.fail { border-top-color: var(--signal); } &.info { border-top-color: var(--info); }
    .incidents { display: grid; gap: .3rem; font-size: .88rem; } summary { cursor: pointer; color: var(--muted); } }
  .reach { color: var(--muted); font-family: var(--mono); }
  .gauge { display: flex; align-items: baseline; justify-content: center; gap: .5rem; padding: 1.5rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    .num { font-size: clamp(3.5rem, 12vw, 6.5rem); font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.04em; line-height: 1; } .unit { color: var(--muted); font: 500 1.2rem var(--mono); } }
  .big { font-size: 1.9rem; font-weight: 600; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; line-height: 1.1; }
  dialog.report { inline-size: min(56rem, calc(100vw - 32px)); max-block-size: 85vh; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); padding: 1.25rem;
    &::backdrop { background: rgb(0 0 0 / .45); backdrop-filter: blur(2px); }
    form { display: grid; gap: .75rem; } header { display: flex; justify-content: space-between; align-items: center; }
    pre { background: var(--surface-2); padding: 1rem; border-radius: 12px; overflow: auto; max-block-size: 45vh; font-size: .8rem; white-space: pre-wrap; } }
  @starting-style { dialog.report[open] { opacity: 0; translate: 0 8px; } }
  dialog.report { transition: opacity .15s, translate .15s; }
  .offline-banner { background: var(--signal); color: #fff; padding: .6rem 1rem; border-radius: 12px; margin-bottom: .75rem; font-weight: 500; a { color: inherit; font-weight: 700; } }
  .skip { position: absolute; left: -999px; &:focus { left: 16px; top: 8px; z-index: 10; background: var(--surface); padding: .5rem; } }
  .principles { font-weight: 700; }
  .update-toast { position: fixed; inset-inline: 16px; bottom: 16px; margin-inline: auto; max-inline-size: 30rem; display: flex; gap: .75rem; align-items: center; justify-content: space-between; padding: .7rem 1rem; border-radius: 14px; background: var(--ink); color: var(--ink-inverse); box-shadow: 0 8px 30px rgb(0 0 0 / .25); z-index: 20; .btn { background: var(--ink-inverse); color: var(--ink); } }
  .notice { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; padding: .8rem 1rem; border-radius: 14px; background: var(--surface); border: 1.5px solid var(--ok); }

  /* Device tests */
  .device-grid { display: flex; flex-wrap: wrap; gap: 1.25rem; align-items: flex-start; > div { flex: 999 1 560px; min-width: 0; display: grid; gap: 1rem; } }
  .never { flex: 1 1 300px; background: var(--band); color: var(--band-text); border-radius: var(--radius); padding: 1.4rem; display: grid; gap: .8rem;
    ul { display: grid; gap: .5rem; } li { padding-left: 1.6rem; position: relative; }
    li::before { content: '✕'; position: absolute; left: 0; color: #FF7A55; font-weight: 700; }
    p { color: var(--band-muted); } strong { color: var(--band-text); } }
  .device-steps { display: grid; gap: 1rem; }
  .step { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem 1.3rem; display: grid; gap: .7rem; }
  .step-head { display: flex; justify-content: space-between; align-items: baseline; }
  .cmd { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; background: #15171A; color: #FFFFFF; border-radius: 14px; padding: .9rem 1rem;
    code { flex: 1 1 240px; font: 600 clamp(1.05rem, 2.4vw, 1.4rem) var(--mono); overflow-wrap: anywhere; } .btn { background: transparent; color: #FFFFFF; border-color: #5A6070; } }
  .parts { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; font-size: .92rem; dt code { font-weight: 600; } }
  .ticks { font: 500 .8rem var(--mono); color: var(--ok); }
  .device-results { display: grid; gap: 1rem; }

}

@layer everyday {
  /* Everyday home: the answer, then live watching, "can we reach", next steps, details. */
  [data-shell="everyday"] header.top .ask { display: none; } /* the page has its own "Can we reach" box */
  .ev { display: grid; gap: 18px; max-inline-size: 1040px; margin-inline: auto; }
  .ev > section, .ev-more { background: var(--surface); border-radius: 24px; padding: clamp(1.1rem, 3vw, 1.8rem); display: grid; gap: 1rem; min-width: 0; }
  .ev h2 { font-size: 1.15rem; letter-spacing: -0.01em; }

  .ev-state { font-size: clamp(2.3rem, 7vw, 4.6rem); line-height: .98; letter-spacing: -0.045em; font-weight: 700; text-wrap: balance;
    .ev-dot { display: inline-block; inline-size: .34em; block-size: .34em; border-radius: 50%; margin-inline-end: .2em; vertical-align: .13em; background: var(--muted); }
    &.ok .ev-dot { background: var(--ok); box-shadow: 0 0 0 .1em color-mix(in srgb, var(--ok) 22%, transparent); }
    &.warn .ev-dot { background: var(--warn); }
    &.fail .ev-dot { background: var(--signal); }
    &.checking .ev-dot { animation: ev-blink 1.2s infinite; } }
  .ev-state:not(.ok):not(.checking) { font-size: clamp(1.9rem, 5vw, 3.2rem); }
  @keyframes ev-blink { 50% { opacity: .3; } }
  .ev-sub { color: var(--muted); font-size: 1.08rem; max-inline-size: 64ch; }
  .ev-note { background: var(--surface-2); border-radius: 14px; padding: .7rem .9rem; font-size: .94rem; }
  .ev-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 148px), 1fr)); gap: 10px; }
  .ev-tile { background: var(--surface-2); border-radius: 16px; padding: .9rem 1rem; display: grid; gap: .2rem; align-content: start; min-width: 0;
    .k { font-size: .85rem; color: var(--muted); }
    .v { font-size: 1.2rem; font-weight: 650; letter-spacing: -0.01em; }
    .s { font-size: .86rem; color: var(--muted); }
    a.s { color: var(--accent); }
    &.great .v::before { content: "✓ "; color: var(--ok); }
    &.ok .v { color: var(--warn); } &.poor .v { color: var(--signal-text); } }
  .ev-actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
  .ev-link { color: var(--muted); font-size: .92rem; text-underline-offset: 3px; }
  .ev-hint { color: var(--muted); font-size: .86rem; flex: 1 1 260px; }

  .ev-watch { background: var(--band) !important; color: var(--band-text);
    p, .ev-hint { color: var(--band-muted); }
    .btn { background: transparent; color: var(--band-text); border-color: #3A3F47; }
    .btn:hover:not(:disabled) { border-color: var(--band-text); } }
  .ev-watch-head { display: flex; justify-content: space-between; align-items: end; gap: 1rem; flex-wrap: wrap; }
  .ev-word { font-size: clamp(2rem, 6vw, 3.4rem) !important; line-height: 1; letter-spacing: -0.04em !important; font-weight: 700;
    &.ok { color: #6FD9A8; } &.warn { color: #FFB86B; } }
  .ev-live { font: .75rem var(--mono); color: #6FD9A8; display: inline-flex; gap: .4rem; align-items: center;
    &::before { content: ""; inline-size: 8px; block-size: 8px; border-radius: 50%; background: currentColor; animation: ev-blink 1.6s infinite; }
    &.off { color: var(--band-muted); &::before { animation: none; } } }
  .ev-trace { inline-size: 100%; block-size: 130px; display: block;
    .g { stroke: #2A2E35; stroke-width: 1; vector-effect: non-scaling-stroke; }
    .l { fill: none; stroke: #6FD9A8; stroke-width: 2; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
    .drop { fill: #FF7A55; opacity: .35; } .p { fill: #FFFFFF; opacity: .08; }
    }
  .ev-axis { display: flex; justify-content: space-between; gap: 1rem; font: .75rem var(--mono); color: var(--band-muted); margin-block-start: -.4rem; white-space: nowrap; }
  @media (max-width: 560px) { .ev-axis .mid { display: none; } }
  .ev-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 130px), 1fr)); gap: 10px; }
  .ev-stat { border-block-start: 1px solid #2A2E35; padding-block-start: .5rem;
    b { display: block; font-size: 1.45rem; font-weight: 650; font-variant-numeric: tabular-nums; } span { font-size: .84rem; color: var(--band-muted); } }
  .ev-events { display: grid; gap: .45rem; font-size: .94rem;
    li { display: grid; grid-template-columns: 5.2rem 1fr; gap: .8rem; } .t { font-family: var(--mono); color: var(--band-muted); } }

  .ev-ask { display: flex; gap: .5rem; align-items: center; background: var(--surface-2); border-radius: 18px; padding: .45rem .45rem .45rem 1.1rem; flex-wrap: wrap;
    label { font-weight: 650; font-size: 1.05rem; white-space: nowrap; }
    input { flex: 1 1 12rem; min-width: 0; border: 0; background: transparent; font-size: 1.05rem; padding: .55rem .2rem; outline-offset: 4px; } }
  .ev-site { font-size: 1.02rem; &:empty { display: none; }
    &.ok { color: var(--ok); } &.warn { color: var(--warn); } &.fail { color: var(--signal-text); } &.checking { color: var(--muted); } }
  .ev-board-wrap { display: grid; gap: .8rem; }
  .ev-verdict { font-size: clamp(1.2rem, 2.6vw, 1.6rem); font-weight: 650; letter-spacing: -0.02em; text-wrap: balance; }
  .ev-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); gap: 8px; }
  .svc { background: var(--surface-2); border-radius: 14px; padding: .75rem .85rem; display: grid; gap: .1rem; align-content: start; min-width: 0; border: 1.5px solid transparent;
    &::before { content: ""; inline-size: 9px; block-size: 9px; border-radius: 50%; background: var(--muted); margin-block-end: .35rem; }
    b { font-weight: 650; } span { font-size: .84rem; color: var(--muted); overflow-wrap: anywhere; }
    &.ok::before { background: var(--ok); }
    &.theirs, &.down, &.warn { background: var(--warm); &::before { background: var(--warn); } }
    &.unreachable { border-color: color-mix(in srgb, var(--signal) 45%, transparent); &::before { background: var(--signal); } }
    &.pending::before { animation: ev-blink 1.2s infinite; }
    &.you { border-color: var(--ink); }
    .go { font-size: .8rem; color: var(--warn); font-weight: 600; } }
  .ev-board > li { display: grid; } /* tiles fill their cell */
  a.svc { color: inherit; text-decoration: none; &:hover { border-color: var(--ink); } &:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; } }
  .ev-legend { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; font-size: .84rem; color: var(--muted);
    span::before { content: ""; display: inline-block; inline-size: 8px; block-size: 8px; border-radius: 50%; margin-inline-end: .4rem; }
    .ok::before { background: var(--ok); } .theirs::before { background: var(--warn); } .unreachable::before { background: var(--signal); } }

  .ev-off .chip { font-family: var(--display); font-size: .92rem; &[aria-pressed="true"] { background: var(--ink); color: var(--ink-inverse); border-color: var(--ink); } }
  .ev-off-out { display: grid; gap: .7rem; &:empty { display: none; } p { color: var(--muted); max-inline-size: 70ch; } }
  .ev-more { summary { cursor: pointer; font-weight: 650; font-size: 1.05rem; min-block-size: 32px; } }
  .ev-dl { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1.2rem; font-size: .94rem;
    dt { color: var(--muted); } dd { font-family: var(--mono); overflow-wrap: anywhere; } }
  @media (max-width: 520px) { .ev-dl { grid-template-columns: 1fr; dd { margin-block-end: .4rem; } } }
  .ev-dns { display: grid; gap: .6rem; summary { font-size: .98rem; } p { color: var(--muted); } }
  @media (prefers-reduced-motion: reduce) { .ev-state.checking .ev-dot, .ev-live::before, .svc.pending::before { animation: none; } }
}

@layer workbench {
  .dns-matrix td { min-width: 180px; } .dns-matrix td.odd { background: color-mix(in srgb, var(--warn) 12%, transparent); box-shadow: inset 2px 0 0 var(--warn); }
  .answers { display: grid; gap: 2px; font: .82rem/1.45 var(--mono); overflow-wrap: anywhere; }
  .cell-meta { font: .72rem var(--mono); color: var(--muted); margin-top: .35rem; }
  .chain { display: grid; gap: .75rem; }
  .chain-step { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--border); border-radius: var(--radius); padding: .8rem 1rem; display: grid; gap: .5rem;
    &.ok { border-left-color: var(--ok); } &.warn { border-left-color: var(--warn); } &.fail { border-left-color: var(--signal); } }
  .chain-head { display: flex; flex-wrap: wrap; gap: .3rem 1rem; align-items: baseline; }
  .notice { font-size: .95rem; }
  .verdict-tag { font: 600 .72rem var(--mono); text-transform: uppercase; letter-spacing: .04em; padding: .2rem .55rem; border-radius: 999px; white-space: nowrap; border: 1.5px solid currentColor;
    &.ok { color: var(--ok); } &.warn { color: var(--warn); } &.fail { color: var(--signal-text); } &.info { color: var(--muted); } }
  table.ledger td:first-child { min-width: 170px; }
  .plain-list { display: grid; gap: .4rem; list-style: disc; padding-left: 1.2rem; }
  table.services td { min-width: 160px; }
  .answers.cols { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
  pre.raw { max-block-size: 22rem; overflow: auto; background: var(--surface-2); border-radius: 8px; padding: .6rem; }
  .wb-overview { display: grid; gap: 1rem; }
  .wb-fixes { display: grid; gap: .5rem; li { display: grid; grid-template-columns: 70px 1fr; gap: .75rem; align-items: start; padding: .6rem 0; border-top: 1px solid var(--border); } p { color: var(--muted); } }
  .impact { font: 600 .7rem var(--mono); text-transform: uppercase; padding: .15rem .5rem; border-radius: 4px; text-align: center; }
  .i3 { color: var(--signal-text); background: color-mix(in srgb, var(--signal) 15%, transparent); }
  .i2 { color: var(--warn); background: color-mix(in srgb, var(--warn) 15%, transparent); }
  .i1 { color: var(--muted); background: var(--surface-2); }
  .wb-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--border); gap: 1px; }
  .kpi { background: var(--surface); padding: .75rem .9rem; display: grid; gap: .2rem; }
  .kpi-v { font: 500 1.25rem var(--mono); letter-spacing: -0.01em; }
  .kpi.fail .kpi-v { color: var(--signal-text); } .kpi.warn .kpi-v { color: var(--warn); } .kpi.ok .kpi-v { color: var(--ok); }
  .prov { font: 500 .7rem var(--mono); padding: .1rem .45rem; border-radius: 999px; white-space: nowrap; }
  .prov.measured { background: var(--ink); color: var(--ink-inverse); }
  .prov.reported { border: 1.5px solid var(--accent); color: var(--accent); }
  .prov.inferred { border: 1.5px dashed var(--muted); color: var(--muted); }
  .dot { display: inline-block; inline-size: 8px; block-size: 8px; border-radius: 50%; background: var(--border); vertical-align: middle; }
  .dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.fail { background: var(--signal); } .dot.info { background: var(--muted); }
}

@layer utilities {
  .muted { color: var(--muted); }
  .small { font-size: .85rem; }
  .break { overflow-wrap: anywhere; word-break: break-all; }
  .sr-only { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}

::view-transition-old(main), ::view-transition-new(main) { animation-duration: .16s; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
