/* App shell additions on top of tokens.css and components.css. */
.skip-link{border-radius:var(--radius-sm)}
.topbar__tools{display:flex;align-items:center;gap:var(--space-2);margin-left:auto}
.topbar__user{color:var(--text-muted);font-size:var(--fs-sm)}
.topbar__nav a{white-space:nowrap}
.page__lead{max-width:60ch;color:var(--text-muted);font-size:var(--fs-lg)}

/* Admin breadcrumb: the eyebrow type, ancestors as links. */
.crumbs ol{display:flex;flex-wrap:wrap;gap:var(--space-2);margin:0;padding:0;list-style:none}
.crumbs li+li::before{content:"/";margin-right:var(--space-2)}
.crumbs a{color:var(--text-muted);text-decoration:none}
.crumbs a:hover,.crumbs a:focus-visible{color:var(--accent-text);text-decoration:underline;text-underline-offset:3px}

/* Toasts: bottom right on wide screens, full width at phone size. */
.toasts{left:auto;max-width:100%}
.toast{border-radius:var(--radius-md);width:min(420px,100vw)}
.toast .ico{width:16px;height:16px}
@media (max-width:600px){
  .toasts{left:0;bottom:0;align-items:stretch}
  .toast{min-width:0;max-width:none;width:100%;border-radius:0}
}

/* Field errors sit under the field; the input underline turns danger. */
.input[aria-invalid="true"],.select[aria-invalid="true"]{border-bottom-color:var(--danger)}
.field__error{font-weight:var(--fw-medium)}

/* Demo page helpers (no inline styles allowed by the content security policy). */
.swatches{display:grid;grid-template-columns:repeat(auto-fit,minmax(110px,1fr));gap:var(--space-3)}
.swatch__chip--bg{background:var(--bg)}.swatch__chip--surface{background:var(--surface)}.swatch__chip--raised{background:var(--surface-raised)}
.swatch__chip--accent{background:var(--accent)}.swatch__chip--success{background:var(--success)}.swatch__chip--warning{background:var(--warning)}
.swatch__chip--danger{background:var(--danger)}.swatch__chip--info{background:var(--info)}
.swatch__chip{border:var(--border-width) solid var(--border);border-radius:var(--radius-sm)}
.form-demo{max-width:420px}

/* Reduced motion: no animation, no transitions, no transforms on hover. */
@media (prefers-reduced-motion: reduce){
  *,*::before,*::after{animation-duration:.001ms!important;animation-iteration-count:1!important;transition-duration:.001ms!important;scroll-behavior:auto!important}
  .navlink:hover span,.navlink:focus-visible span,.navlink:hover::after,.navlink:focus-visible::after{transform:none}
}

/* The topbar search stays on phones (the starter hides it): it drops to its own full-width line. */
@media (max-width:900px){.topbar__search{display:flex;order:6;width:100%}.topbar__search:focus-within{width:100%}}

/* Admin forms: a fieldset is a panel like any other .card. */
fieldset.card{margin:0;min-width:0}
fieldset.card>legend{padding:0;margin-bottom:var(--space-4)}
.tiles dd{margin:0}
.index-row__name{min-width:0}

/* The current page's link is indented for its marker; its rolling accent copy must line up with it. */
.navlink[aria-current="page"]::after{left:14px}

/* Author display rules (.hero, .grid, .lb__foot) would otherwise beat the hidden attribute. */
[hidden]{display:none!important}

/* A toggle inside a settings field sits at the left, not stretched across the column. */
.toggle--field{align-self:flex-start}

/* Long dotted names (EventSub types) wrap instead of pushing the other columns off a phone screen. */
.table--wrap code,.table--wrap td{overflow-wrap:anywhere}
.table--wrap td:not(:first-child):not(.subtle){white-space:nowrap}

/* Tab rows (the tabs component): a hairline-ruled row in the .seg type that wraps instead of scrolling, so every tab is
   always visible and none moves when another opens. The open tab is inverted like .seg. */
.tab-row{display:flex;flex-wrap:wrap;border-bottom:var(--border-width) solid var(--border)}
.tab-row__tab{appearance:none;border:0;background:none;min-height:44px;padding:0 var(--space-4);display:inline-flex;align-items:center;gap:var(--space-2);cursor:pointer;font:var(--fw-bold) var(--fs-xs) var(--font-mono);letter-spacing:var(--tracking-caps);text-transform:uppercase;color:var(--text-muted);text-align:left;transition:color var(--dur-base) var(--ease-expo),background var(--dur-base) var(--ease-expo)}
.tab-row__tab:hover{color:var(--text)}
.tab-row__tab[aria-selected="true"]{background:var(--text);color:var(--bg)}

/* The viewer's own balance beside their name; realtime.js counts it up. */
.topbar__balance{color:var(--text);font-size:var(--fs-sm);white-space:nowrap}
.topbar__balance-n{font-weight:var(--fw-bold)}

/* The viewer's own row in a recap table. */
.table tr.is-you td{background:var(--surface-sunken);font-weight:var(--fw-bold)}
.table td small{margin-left:2px;color:var(--text-subtle)}

/* ----- Modal: the starter overlay, as a centred window on a native dialog (profile and buy confirmation) ----- */
dialog.modal{inset:0;margin:auto;display:block;width:min(760px,calc(100% - 2 * var(--space-4)));height:fit-content;max-width:none;max-height:calc(100vh - 2 * var(--space-4));padding:0;overflow:auto;color:var(--text);background:var(--bg);border:var(--border-width) solid var(--border-strong);box-shadow:var(--shadow-lg)}
dialog.modal:not([open]){display:none}
dialog.modal::backdrop{background:var(--overlay)}
dialog.modal .modal__dialog{width:auto;padding:var(--space-5) var(--space-6) var(--space-8)}
.modal__head{align-items:center}

/* On phones the main links wrap onto a second line instead of scrolling sideways, so none is cut off or hidden (same rule as the tab rows). */
@media (max-width:900px){.topbar__nav{flex-wrap:wrap;overflow-x:visible;gap:var(--space-1) var(--space-4)}}

/* My Stats "Where it went": the label on the left, the points flush right. */
.spend-row{justify-content:space-between;flex-wrap:nowrap}
.spend-row dd{margin:0;text-align:right}

/* The red strip admins see on every page while a health check is failing. Solid colour, no radius, no accent edge. */
.health-banner{padding:var(--space-3) var(--space-6);background:var(--danger);color:var(--bg);font-size:var(--fs-sm);font-weight:var(--fw-bold)}
.health-banner p{margin:0;max-width:var(--content-max);margin-inline:auto}
.health-banner a{color:inherit;text-decoration:underline;text-underline-offset:3px;white-space:nowrap}
@media (max-width:900px){.health-banner{padding:var(--space-3) var(--space-4)}}

/* One health check: its name and badge, then the sentence, then whatever detail it carries. */
.health-check{padding:var(--space-4) 0;border-top:var(--border-width) solid var(--border)}
.health-check:first-of-type{border-top:0;padding-top:0}
.health-check__head{display:flex;align-items:baseline;gap:var(--space-3);flex-wrap:wrap}
.health-check details{margin-top:var(--space-2)}
.health-check summary{cursor:pointer;color:var(--text-muted);font-size:var(--fs-sm)}
.status-list{list-style:none;margin:0;padding:0}
.status-list__row{display:flex;flex-wrap:wrap;align-items:baseline;justify-content:space-between;gap:var(--space-3);padding:var(--space-3) 0;border-top:var(--border-width) solid var(--border)}
.status-list__row:first-child{border-top:0;padding-top:0}
.prose-list{margin:0;padding-left:var(--space-5);display:flex;flex-direction:column;gap:var(--space-2)}
.shell>.footer{padding:var(--space-6);display:flex;justify-content:center;font-size:var(--fs-sm)}
.shell>.footer nav{display:flex;gap:var(--space-4)}
.shell>.footer a{color:var(--text-muted)}.shell>.footer a:hover{color:var(--text)}
