/* ============================================================
   Warehouse Radio — "Dispatch" design system
   Warehouse-native: concrete ground, safety-yellow, hazard
   stripes, freight-label cards. Committed single (light)
   industrial world by design. WCAG AA throughout.
   ============================================================ */

:root {
  /* Ground + surfaces (warm-biased neutrals, not pure grey) */
  --paper:      #EAE7E0;
  --paper-2:    #E1DED5;
  --card:       #F7F5F0;
  /* Ink + text */
  --ink:        #151309;
  --ink-2:      #2b2718;
  --dim:        #5c5849;
  --line:       #C9C6BB;
  /* Signal colours */
  --yellow:     #F2DE1E;
  --yellow-deep:#E6CF12;
  --red:        #CE2318;   /* blocked / explicit / failed */
  --ok:         #1C7A3A;   /* in rotation */
  /* Geometry */
  --tap:        52px;
  --radius:     4px;
  --edge:       2px;       /* freight-label border weight */
  /* Spacing scale (rem so it scales with the user's font size; identical to
     4/8/12/16/24/32/48px at the default 16px root) */
  --s1: 0.25rem; --s2: 0.5rem; --s3: 0.75rem; --s4: 1rem; --s5: 1.5rem; --s6: 2rem; --s7: 3rem;
  /* Depth + motion */
  --shadow: 0 1px 0 rgba(21,19,9,.03), 0 10px 24px -18px rgba(21,19,9,.45);
  --ease: cubic-bezier(.2,.6,.2,1);
  /* Safe-area gutters (notch / home indicator), min 18px */
  --gutter:  max(18px, env(safe-area-inset-left));
  --gutter-r: max(18px, env(safe-area-inset-right));
  /* Type */
  --display: "Saira Condensed", "Arial Narrow", system-ui, sans-serif;
  --body:    "Archivo", system-ui, -apple-system, sans-serif;
  --mono:    "Space Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
html, body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body { min-height: 100dvh; overflow-x: hidden; }

::selection { background: var(--yellow); color: var(--ink); }
* { -webkit-tap-highlight-color: transparent; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* Scrollbars — thin, on-brand (Firefox + WebKit). The thumb's border matches
   the surface so it reads as an inset pill with breathing room. */
* { scrollbar-width: thin; scrollbar-color: var(--dim) transparent; }
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--dim); border: 3px solid var(--paper);
  border-radius: 999px; background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--ink); }
::-webkit-scrollbar-corner { background: transparent; }
.app-side::-webkit-scrollbar-thumb,
.table-wrap::-webkit-scrollbar-thumb,
.import-box::-webkit-scrollbar-thumb { border-color: var(--card); }

/* Shared motifs -------------------------------------------------- */

.hazard {
  height: 12px;
  background: repeating-linear-gradient(-45deg,
    var(--ink) 0 14px, var(--yellow) 14px 28px);
}

.brand, .brand-sm {
  font-family: var(--display);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .01em;
  line-height: .88;
  margin: 0;
}
.brand { font-size: 2.75rem; }
.brand-sm { font-size: 1.5rem; }

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.live-dot {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  background: var(--red); box-shadow: 0 0 0 3px rgba(206,35,24,.18);
}

/* Buttons -------------------------------------------------------- */

.btn-go, .go, .add {
  font-family: var(--display);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  cursor: pointer;
  border: var(--edge) solid var(--ink);
  border-radius: var(--radius);
  transition: transform .05s ease, background .12s ease;
}
.btn-go:active, .go:active, .add:active { transform: translateY(1px); }

.btn-go {                       /* full-width primary (login) */
  width: 100%; min-height: var(--tap);
  background: var(--yellow); color: var(--ink);
  font-size: 1.125rem;
}
.btn-go:hover { background: var(--yellow-deep); }
.btn-go:disabled { opacity: .55; cursor: default; }

.link-btn {
  background: none; border: 0; color: var(--dim);
  font-family: var(--mono); font-size: 0.75rem; letter-spacing: .02em;
  cursor: pointer; padding: 8px; text-decoration: underline;
}
.link-btn:hover { color: var(--ink); }

/* Accessibility floors ------------------------------------------ */

:focus-visible { outline: 3px solid #0a58ff; outline-offset: 2px; }
button:focus-visible, .go:focus-visible, .add:focus-visible { outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ============================================================
   Gate (login)
   ============================================================ */

.gate { min-height: 100dvh; display: flex; flex-direction: column; }
.gate .hazard { flex: none; }
.gate-card {
  width: 100%; max-width: 420px;
  margin: auto; padding: 40px 26px;
}
.gate .brand { font-size: 3.25rem; margin-bottom: 6px; }
.gate-sub { color: var(--dim); font-size: 0.9375rem; margin: 0 0 30px; }

.field { display: block; margin-bottom: 18px; }
.field-l {
  display: block;
  font-family: var(--display); font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; font-size: 0.9375rem; margin-bottom: 7px;
}
.field-l .hint { font-family: var(--mono); font-weight: 400; text-transform: none; letter-spacing: 0; font-size: 0.6875rem; color: var(--dim); }

input {
  width: 100%; min-height: var(--tap);
  background: var(--card); color: var(--ink);
  border: var(--edge) solid var(--ink); border-radius: var(--radius);
  padding: 0 14px; font-family: var(--body); font-size: 1rem;
}
input::placeholder { color: #8c8878; }

.error {
  font-family: var(--mono); font-size: 0.8125rem; color: #fff;
  background: var(--red); border-radius: var(--radius);
  padding: 9px 12px; margin: 0 0 16px;
}

/* ============================================================
   App shell
   ============================================================ */

/* Sticky header keeps the brand + status pinned on long scrolls. */
.siteheader {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: 1px solid var(--line);
}
.siteheader .hazard { height: 10px; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  padding: 12px var(--gutter-r) 12px var(--gutter);
  padding-top: max(12px, env(safe-area-inset-top));
}
.topbar-right { display: flex; align-items: center; gap: var(--s3); }
.floor-tag {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--mono); font-size: 0.6875rem; letter-spacing: .1em;
  text-transform: uppercase;
  background: var(--ink); color: var(--yellow);
  padding: 6px 10px; border-radius: var(--radius);
}
.floor-tag .live-dot { background: var(--yellow); box-shadow: 0 0 0 3px rgba(242,222,30,.22); }
.who-strip {
  padding: 10px var(--gutter-r) 0 var(--gutter);
  font-family: var(--mono); font-size: 0.75rem; color: var(--dim);
}
#who-name { color: var(--ink); font-weight: 700; }

.stack {
  max-width: 620px; margin: 0 auto;
  padding: var(--s3) var(--gutter-r) calc(var(--s7) + env(safe-area-inset-bottom)) var(--gutter);
}

/* ============================================================
   Manifest (now playing) + waveform
   ============================================================ */

.manifest {
  background: var(--card);
  border: var(--edge) solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;               /* keep the yellow head within the rounded corners */
}
.mhead {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--yellow); border-bottom: var(--edge) solid var(--ink);
  padding: 9px 14px;
}
.mhead .l {
  font-family: var(--display); font-weight: 800; text-transform: uppercase;
  letter-spacing: .06em; font-size: 1rem;
}
.mhead .n { font-size: 0.75rem; font-weight: 700; }
.mbody { padding: 16px 14px 14px; }
.mbody .t {
  font-family: var(--display); font-weight: 800; text-transform: uppercase;
  font-size: clamp(1.75rem, 8vw, 2.125rem); line-height: .96; margin: 0;
  text-wrap: balance;
}
.mbody .a { font-weight: 600; font-size: 0.9375rem; color: var(--dim); margin: 5px 0 0; }
.consign {
  display: flex; justify-content: space-between; gap: 10px;
  font-family: var(--mono); font-size: 0.6875rem; color: var(--dim);
  border-top: 1px dashed var(--line); padding-top: 10px; margin-top: 4px;
}
.consign b, #np-consign b { color: var(--ink); }

/* Visualiser — a real Code 128 barcode of tidal.com/track/<id> rendered as a
   waveform: each bar keeps the barcode's true width (--w) but gets a waveform
   height (--h) and a "dance" delay (--d); spaces are transparent gaps. The
   played portion (progress) is ink; the rest is grey. */
.wave {
  display: flex; align-items: flex-end; gap: 0;
  height: 56px; margin: 16px 0 12px;
  background: #fff; padding: 7px 9px 6px;   /* a real black-on-white barcode label */
  border: 1px solid var(--ink); border-radius: 3px;
}
.wave i {
  flex: var(--w, 1) 0 0; min-width: 0;
  height: var(--h, 30%);
  background: #c7c7c7;               /* pending (not yet played) — light grey */
  transform-origin: bottom;
}
.wave i.gap { background: transparent; height: 0; }   /* barcode space (white) */
.wave i.played { background: #111; }                  /* elapsed portion — black */
/* On air: bars dance, staggered by --d so a wave travels across the barcode. */
.manifest[data-state="playing"] .wave i:not(.gap) {
  animation-name: wave-live; animation-duration: 1.1s;
  animation-timing-function: ease-in-out; animation-iteration-count: infinite;
  animation-delay: var(--d, 0s);
}
@keyframes wave-live {
  0%, 100% { transform: scaleY(.62); }
  50%      { transform: scaleY(1.18); }
}
/* Idle: a flat dead-signal line. */
.manifest[data-state="idle"] .wave i:not(.gap) { height: 2px !important; }

.locknote {
  font-family: var(--mono); font-size: 0.75rem; color: var(--dim);
  margin: 12px 2px 0; display: flex; gap: 8px; align-items: flex-start;
}
.locknote::before { content: "⏻"; color: var(--ink); font-size: 0.875rem; line-height: 1.2; }

.boot { padding: 44px 22px; font-family: var(--mono); color: var(--dim); font-size: 0.8125rem; }

/* --- Two-column layout: main + queue sidebar --- */
.app-grid {
  display: grid; grid-template-columns: 1fr; gap: var(--s5);
  max-width: 620px; margin: 0 auto;
  padding: var(--s5) var(--gutter-r) calc(var(--s7) + env(safe-area-inset-bottom)) var(--gutter);
}
.app-main { min-width: 0; }
.app-side { display: flex; flex-direction: column; gap: var(--s4); }
@media (min-width: 56.25em) {
  .app-grid {
    grid-template-columns: minmax(0, 1fr) 340px;
    max-width: 1060px; gap: var(--s6); align-items: start;
  }
  /* Sidebar tracks below the sticky header and scrolls internally if long. */
  .app-side {
    position: sticky; top: calc(var(--s5) + 40px);
    max-height: calc(100dvh - var(--s6) - 40px); overflow-y: auto;
  }
}

.side-block {
  background: var(--card); border: var(--edge) solid var(--ink);
  border-radius: var(--radius); padding: 14px 16px;
  box-shadow: var(--shadow);
}
.side-block > h2 {
  display: flex; align-items: center; gap: 9px;
  font-family: var(--display); font-weight: 800; text-transform: uppercase;
  letter-spacing: .05em; font-size: 1rem; margin: 0 0 10px;
  padding-bottom: 9px; border-bottom: var(--edge) solid var(--ink);
}
.side-note { font-family: var(--mono); font-size: 0.625rem; color: var(--dim); margin: 10px 0 0; line-height: 1.4; }

/* Coming-up queue (numbering encodes real position in the rotation) */
.queue { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.qrow { display: flex; align-items: center; gap: 11px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.qrow:last-child { border-bottom: 0; }
.qno {
  flex: none; width: 22px; text-align: center; font-size: 0.75rem; font-weight: 700;
  color: var(--dim); align-self: flex-start; padding-top: 2px;
}
.qrow:first-child .qno { background: var(--yellow); color: var(--ink); border-radius: 3px; }
.qrow .m { flex: 1; min-width: 0; }
.qt {
  font-family: var(--display); font-weight: 700; text-transform: uppercase; font-size: 1rem; line-height: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.qs { font-family: var(--mono); font-size: 0.6875rem; color: var(--dim); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ============================================================
   Search
   ============================================================ */

.search { margin-top: var(--s6); }
.search .l {
  display: flex; align-items: baseline; gap: var(--s2);
  font-family: var(--display); font-weight: 800; text-transform: uppercase;
  letter-spacing: .05em; font-size: 1rem; margin-bottom: var(--s2);
}
.search-ind {
  font-family: var(--mono); font-size: 0.6875rem; color: var(--dim);
  text-transform: none; letter-spacing: 0; opacity: 0; transition: opacity .15s var(--ease);
}
.search-ind.htmx-request { opacity: 1; }
.searchrow {
  display: flex; border: var(--edge) solid var(--ink);
  border-radius: var(--radius); overflow: hidden;
  transition: box-shadow .12s var(--ease);
}
.searchrow:focus-within { box-shadow: 0 0 0 3px rgba(10,88,255,.35); }
.searchrow .q {
  flex: 1; min-width: 0; border: 0; border-radius: 0;
  height: var(--tap); background: var(--card);
}
.searchrow .q:focus-visible { outline: none; }   /* the group shows focus */
.go {
  flex: none; height: var(--tap); padding: 0 18px;
  background: var(--ink); color: var(--yellow);
  border: 0; border-left: var(--edge) solid var(--ink); font-size: 1rem;
}
.go:hover { background: var(--ink-2); }

.results { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.results:empty { margin-top: 0; }

/* ============================================================
   Freight-label track rows (results + floor)
   ============================================================ */

.label {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: var(--edge) solid var(--ink);
  border-radius: var(--radius); padding: 11px 12px;
  transition: box-shadow .12s var(--ease), transform .12s var(--ease);
}
@media (hover: hover) {
  .label:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
}
.label .m { flex: 1; min-width: 0; }
.label .t {
  font-family: var(--display); font-weight: 700; text-transform: uppercase;
  font-size: 1.1875rem; line-height: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.label .s {
  font-family: var(--mono); font-size: 0.6875rem; color: var(--dim);
  margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.add {
  flex: none; min-height: 46px; padding: 0 16px;
  background: var(--yellow); color: var(--ink); font-size: 0.9375rem;
}
.add:hover { background: var(--yellow-deep); }
.add[disabled] { background: var(--ok); color: #fff; border-color: var(--ok); cursor: default; }

/* status + tags */
.ex, .pill {
  font-family: var(--mono); font-size: 0.5625rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  padding: 2px 5px; border-radius: 3px; vertical-align: 2px; margin-left: 6px;
}
.ex   { color: #fff; background: var(--red); }
.pill { flex: none; margin-left: 0; }
.pill.dl     { color: var(--ink); background: var(--yellow); }
.pill.ready  { color: #fff; background: var(--ok); }
.pill.failed { color: #fff; background: var(--red); }

.by {
  flex: none; font-family: var(--mono); font-size: 0.625rem; font-weight: 700;
  color: var(--ink); background: var(--yellow);
  padding: 4px 6px; border-radius: 3px; letter-spacing: .04em;
}

/* Floor list */
.floorlist { margin-top: 30px; }
.floorlist h2 {
  display: flex; align-items: center; gap: 9px;
  font-family: var(--display); font-weight: 800; text-transform: uppercase;
  letter-spacing: .05em; font-size: 1.0625rem; margin: 0 0 12px;
}
.floor-rows { display: flex; flex-direction: column; }
.frow {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 2px; border-bottom: 1px solid var(--line);
}
.frow .m { flex: 1; min-width: 0; }
.frow .t { font-weight: 700; font-size: 0.9375rem; }
.frow .s { font-family: var(--mono); font-size: 0.6875rem; color: var(--dim); margin-top: 2px; }

.empty {
  font-family: var(--mono); font-size: 0.8125rem; color: var(--dim);
  padding: 14px 0;
}

/* ============================================================
   Admin
   ============================================================ */

.admin-tag {
  font-family: var(--mono); font-size: 0.625rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; background: var(--ink); color: var(--yellow);
  padding: 3px 6px; border-radius: 3px; vertical-align: 3px; margin-left: 4px;
}
.admin-panel { margin-top: 30px; }
.admin-panel > h2 {
  font-family: var(--display); font-weight: 800; text-transform: uppercase;
  letter-spacing: .05em; font-size: 1.125rem; margin: 0 0 12px;
  padding-bottom: 8px; border-bottom: var(--edge) solid var(--ink);
}
.panel-hint { color: var(--dim); font-size: 0.8125rem; margin: 0 0 12px; }

/* Playback controls */
.admin-controls { display: flex; flex-direction: column; gap: 14px; }
.ctl-row {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 4px 2px;
}
.btn-ctl {
  min-height: 46px; padding: 0 20px;
  background: var(--ink); color: var(--yellow);
  border: var(--edge) solid var(--ink); border-radius: var(--radius);
  font-family: var(--display); font-weight: 800; text-transform: uppercase;
  letter-spacing: .06em; font-size: 0.9375rem; cursor: pointer;
}
.btn-ctl:hover { background: var(--ink-2); }
.vol { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 180px; }
.vol > span {
  font-family: var(--mono); font-size: 0.75rem; color: var(--dim);
  text-transform: uppercase; letter-spacing: .06em;
}
.vol output { color: var(--ink); font-weight: 700; }
.vol input[type=range] { width: 100%; accent-color: var(--ink); height: 28px; }

/* Data tables */
.table-wrap { overflow-x: auto; }
.dtable { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.dtable th {
  text-align: left; font-family: var(--mono); font-size: 0.625rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--dim); font-weight: 700;
  padding: 6px 10px 6px 0; border-bottom: 1px solid var(--line);
}
.dtable td { padding: 10px 10px 10px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
.dtable tr.is-banned { opacity: .6; }
.cell-title { font-family: var(--display); font-weight: 700; text-transform: uppercase; font-size: 1rem; line-height: 1; }
.cell-sub { font-family: var(--mono); font-size: 0.6875rem; color: var(--dim); margin-top: 3px; }
.cell-by { font-size: 0.8125rem; color: var(--dim); }
.num { text-align: right; }
.cell-actions { text-align: right; white-space: nowrap; }
.tbtn {
  min-height: 36px; padding: 0 11px; margin-left: 6px;
  background: var(--card); color: var(--ink);
  border: 1px solid var(--ink); border-radius: 3px;
  font-family: var(--body); font-weight: 600; font-size: 0.75rem; cursor: pointer;
}
.tbtn:hover { background: var(--paper-2); }
.tbtn.danger { border-color: var(--red); color: var(--red); }
.tbtn.danger:hover { background: var(--red); color: #fff; }
.tbtn.ok { border-color: var(--ok); color: var(--ok); }
.tbtn.ok:hover { background: var(--ok); color: #fff; }

/* Import + settings */
.import-box {
  width: 100%; min-height: 96px; resize: vertical;
  background: var(--card); border: var(--edge) solid var(--ink); border-radius: var(--radius);
  padding: 12px 14px; font-family: var(--mono); font-size: 0.8125rem; color: var(--ink);
  margin-bottom: 12px;
}
.import-result { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.check { display: flex; align-items: center; gap: 10px; font-size: 0.9375rem; margin-bottom: 16px; cursor: pointer; }
.check input { width: 22px; height: 22px; min-height: 0; accent-color: var(--ink); flex: none; }
.field-group { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 16px; }
.group-l {
  font-family: var(--display); font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; font-size: 0.875rem; margin-bottom: 12px;
}
.saved { font-family: var(--mono); font-size: 0.8125rem; color: var(--ok); margin: 0 0 14px; }
.env-note { font-family: var(--mono); font-size: 0.75rem; color: var(--dim); margin: 0 0 12px; line-height: 1.55; }
.env-note code { background: var(--paper-2); border: 1px solid var(--line); padding: 0 4px; border-radius: 3px; color: var(--ink); }
.env-note b { color: var(--ink); }
.env-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3);
  font-family: var(--mono); font-size: 0.8125rem; color: var(--dim);
  padding: 8px 0; border-top: 1px solid var(--line);
}
.env-row b { color: var(--ink); font-weight: 700; word-break: break-all; text-align: right; }
#settings-form .btn-go { width: auto; padding: 0 22px; }

/* ============================================================
   Crate monogram + search states
   ============================================================ */

.crate {
  flex: none; width: 46px; height: 46px; position: relative; padding-top: 6px;
  border: var(--edge) solid var(--ink); border-radius: 3px;
  background: var(--paper-2); display: grid; place-items: center; overflow: hidden;
}
.crate::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 5px;
  background: var(--yellow); border-bottom: 1px solid var(--ink);
}
.crate .mg { font-family: var(--display); font-weight: 800; font-size: 1.05rem; color: var(--ink); line-height: 1; }

.search-prompt {
  display: flex; gap: var(--s3); align-items: center;
  padding: var(--s5) var(--s4); border: var(--edge) dashed var(--line);
  border-radius: var(--radius); color: var(--dim);
}
.search-prompt .sp-mark { font-size: 1.75rem; color: var(--ink); line-height: 1; }
.search-prompt p { margin: 0; font-size: 0.9375rem; line-height: 1.45; }
.search-prompt .sp-sub { font-family: var(--mono); font-size: 0.75rem; }

/* ============================================================
   Admin — library management
   ============================================================ */

.lib-controls {
  display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; margin-bottom: var(--s4);
}
.lib-search { flex: 1; min-width: 190px; min-height: 42px; font-size: 0.875rem; }
.seg {
  display: inline-flex; border: var(--edge) solid var(--ink);
  border-radius: var(--radius); overflow: hidden;
}
.seg-opt input { position: absolute; opacity: 0; width: 0; pointer-events: none; }
.seg-opt span {
  display: block; padding: 9px 12px; font-family: var(--mono); font-size: 0.6875rem;
  text-transform: uppercase; letter-spacing: .06em; color: var(--dim); cursor: pointer;
  border-left: 1px solid var(--line); user-select: none; white-space: nowrap;
}
.seg-opt:first-child span { border-left: 0; }
.seg-opt input:checked + span { background: var(--ink); color: var(--yellow); }
.seg-opt input:focus-visible + span { outline: 3px solid #0a58ff; outline-offset: -3px; }
.lib-sort {
  min-height: 42px; border: var(--edge) solid var(--ink); border-radius: var(--radius);
  background: var(--card); color: var(--ink); font-family: var(--body); font-size: 0.875rem; padding: 0 10px;
}

.lib-summary { display: flex; flex-wrap: wrap; gap: var(--s2); margin-bottom: var(--s4); }
.sumchip {
  font-family: var(--mono); font-size: 0.6875rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--dim); background: var(--paper-2); border: 1px solid var(--line);
  padding: 5px 9px; border-radius: 3px;
}
.sumchip b { color: var(--ink); font-size: 0.8125rem; font-variant-numeric: tabular-nums; }
.sumchip.ok b   { color: var(--ok); }
.sumchip.dl b   { color: #8a7a00; }
.sumchip.fail b { color: var(--red); }

.lib-list { display: flex; flex-direction: column; gap: var(--s2); }
.libcard {
  display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap;
  background: var(--card); border: var(--edge) solid var(--ink);
  border-radius: var(--radius); padding: 11px 12px;
}
.libcard.is-banned { opacity: .62; }
.libcard .m { flex: 1; min-width: 55%; }
.libcard .t {
  font-family: var(--display); font-weight: 700; text-transform: uppercase;
  font-size: 1.125rem; line-height: 1.05;
}
.libcard .s { font-family: var(--mono); font-size: 0.6875rem; color: var(--dim); margin-top: 3px; }
.libmeta {
  display: flex; align-items: center; gap: var(--s2); margin-top: 6px;
  font-size: 0.6875rem; color: var(--dim); flex-wrap: wrap;
}
.acts { display: flex; gap: 6px; margin-left: auto; }

/* ============================================================
   Toast
   ============================================================ */

.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  max-width: 92vw;
  background: var(--ink); color: var(--paper);
  border: var(--edge) solid var(--ink); border-left: 6px solid var(--yellow);
  border-radius: var(--radius); padding: 13px 16px;
  font-family: var(--body); font-weight: 500; font-size: 0.875rem;
  box-shadow: 0 10px 30px -12px rgba(0,0,0,.5); z-index: 50;
  animation: toast-in .18s ease;
}
.toast.ok  { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--red); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }
