/* ==================================================================
   Wire Desk
   Built to fit one laptop screen with no page scrolling: a single
   toolbar, then a 2x2 grid that consumes exactly the space left.
   Each panel scrolls inside itself, so the page never does.

   Density rules used throughout:
     - vertical padding on a row never exceeds 5px
     - line-height 1.25 on headlines, 1.45 on prose
     - metadata is 10px mono; body text never below 12.5px
   No web fonts: this runs on a LAN with no internet.
   ================================================================== */

:root {
  --ink:      #0e131a;
  --panel:    #161d27;
  --panel-2:  #1c2530;
  --raised:   #222c39;
  --line:     #2b3644;
  --line-soft:#212b37;
  --text:     #e7ecf3;
  --text-dim: #b3bece;
  --muted:    #7d8b9e;
  --signal:   #ffb454;
  --signal-d: #c98428;
  --cool:     #7ec8e3;
  --good:     #79cf8e;
  --bad:      #ff8172;

  --bar-h: 40px;
  --gap: 6px;

  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, "JetBrains Mono", "Cascadia Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --r: 3px;
  --shadow: 0 10px 34px rgba(0,0,0,.45);
}

[data-theme="light"] {
  --ink:      #e9ecf1;
  --panel:    #ffffff;
  --panel-2:  #f4f6f9;
  --raised:   #e8ebf0;
  --line:     #d1d7df;
  --line-soft:#e3e7ec;
  --text:     #11161d;
  --text-dim: #39434f;
  --muted:    #69748590;
  --muted:    #697485;
  --signal:   #a86400;
  --signal-d: #814c00;
  --cool:     #1b6484;
  --good:     #1f7245;
  --bad:      #ad3125;
  --shadow: 0 10px 30px rgba(20,28,40,.14);
}

* { box-sizing: border-box; }

/* Components below set `display`, which would otherwise beat the `hidden`
   attribute and leave modals and scrims permanently on screen. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--ink);
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;               /* the page itself never scrolls */
}

a { color: var(--cool); }
button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible { outline: 2px solid var(--signal); outline-offset: 1px; border-radius: 2px; }

.eyebrow {
  font-family: var(--mono); font-size: 10px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted); margin: 0; font-weight: 600;
}

/* --- buttons ------------------------------------------------------ */

.btn {
  border: 1px solid var(--line);
  background: var(--raised);
  color: var(--text);
  padding: 4px 9px;
  border-radius: var(--r);
  cursor: pointer;
  font-size: 12px;
  font-weight: 550;
  white-space: nowrap;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--panel-2); border-color: var(--muted); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--signal); border-color: var(--signal); color: #171a1f; font-weight: 700; }
.btn-primary:hover { background: var(--signal-d); border-color: var(--signal-d); color: #fff; }
[data-theme="light"] .btn-primary { color: #fff; }
.btn-icon { padding: 4px 7px; }
.btn-danger { border-color: var(--bad); color: var(--bad); background: transparent; }
.btn-danger:hover { background: var(--bad); color: #fff; }

.linkbtn {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--cool); font-family: var(--mono); font-size: 10.5px;
}
.linkbtn:hover { color: var(--signal); }

.pill {
  font-family: var(--mono); font-size: 10px; color: var(--signal);
  background: var(--ink); border-radius: 8px; padding: 0 4px; margin-left: 3px;
}

/* --- toolbar ------------------------------------------------------ */

.bar {
  position: relative;
  height: var(--bar-h);
  display: flex; align-items: center; gap: 7px;
  padding: 0 8px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 6px; flex: none; }
.brand-mark { display: flex; align-items: flex-end; gap: 1.5px; height: 14px; }
.brand-mark i { width: 2.5px; background: var(--signal); display: block; border-radius: 1px; }
.brand-mark i:nth-child(1) { height: 4px;  opacity: .45; }
.brand-mark i:nth-child(2) { height: 7px;  opacity: .65; }
.brand-mark i:nth-child(3) { height: 10px; opacity: .85; }
.brand-mark i:nth-child(4) { height: 14px; }
.brand-name { font-weight: 800; letter-spacing: -.02em; font-size: 13px; }

.bar-search {
  flex: 1 1 150px; min-width: 90px; max-width: 320px;
  background: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 4px 8px;
  font-size: 12px;
}
.bar-search:focus { border-color: var(--signal); outline: none; }

.bar-sel {
  background: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 4px 5px;
  font-size: 12px;
  flex: none;
}

.tick {
  display: flex; align-items: center; gap: 4px; flex: none;
  font-size: 11.5px; color: var(--text-dim); cursor: pointer; white-space: nowrap;
}
.tick input { accent-color: var(--signal); width: 13px; height: 13px; margin: 0; }

.chip {
  display: flex; align-items: center; gap: 4px; flex: none;
  background: var(--panel-2); border: 1px solid var(--signal);
  border-radius: 10px; padding: 1px 3px 1px 8px;
  font-family: var(--mono); font-size: 10px;
  max-width: 150px;
}
.chip > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip button { background: none; border: 0; cursor: pointer; color: var(--muted); font-size: 13px; line-height: 1; padding: 0 3px; }
.chip button:hover { color: var(--bad); }

.bar-status {
  display: flex; align-items: center; gap: 5px;
  font-family: var(--mono); font-size: 10.5px; color: var(--muted);
  flex: 1 1 auto; min-width: 0; justify-content: flex-end;
  overflow: hidden;
}
.bar-status span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.live { background: var(--good); }
.dot.busy { background: var(--signal); animation: pulse 1.1s ease-in-out infinite; }
.dot.bad  { background: var(--bad); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .25; } }

.progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--line-soft); }
.progress-bar { height: 100%; width: 0%; background: var(--signal); transition: width .3s ease; }

/* --- the grid ----------------------------------------------------- */

.grid {
  height: calc(100vh - var(--bar-h));
  height: calc(100dvh - var(--bar-h));
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: var(--gap);
  padding: var(--gap);
}

/* Arrangements that tile without leaving a hole. Five is the awkward one:
   three across the top, two double-width below. */
.grid[data-n="2"] { grid-template-columns: 1fr 1fr;     grid-template-rows: 1fr; }
.grid[data-n="3"] { grid-template-columns: repeat(3,1fr); grid-template-rows: 1fr; }
.grid[data-n="4"] { grid-template-columns: 1fr 1fr;     grid-template-rows: 1fr 1fr; }
.grid[data-n="5"] { grid-template-columns: repeat(6,1fr); grid-template-rows: 1fr 1fr; }
.grid[data-n="5"] > .quad { grid-column: span 2; }
.grid[data-n="5"] > .quad:nth-child(4),
.grid[data-n="5"] > .quad:nth-child(5) { grid-column: span 3; }
.grid[data-n="6"] { grid-template-columns: repeat(3,1fr); grid-template-rows: 1fr 1fr; }

.quad {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  display: flex; flex-direction: column;
  min-height: 0;                  /* lets the list, not the panel, scroll */
  overflow: hidden;
}

.quad-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 4px 8px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
  flex: none;
}
.quad-head h2 {
  margin: 0; font-size: 10px; font-family: var(--mono);
  letter-spacing: .14em; text-transform: uppercase; font-weight: 700;
  color: var(--signal);
}
.quad-count { font-family: var(--mono); font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }

.quad-list {
  list-style: none; margin: 0; padding: 0;
  overflow-y: auto; overflow-x: hidden;
  flex: 1; min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.quad-list::-webkit-scrollbar { width: 7px; }
.quad-list::-webkit-scrollbar-track { background: transparent; }
.quad-list::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
.quad-list::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* An empty list still claims flex:1 and pushes the message to the bottom of
   the panel, which reads like a bug. Collapse it when there is nothing in it. */
.quad-list:empty { flex: 0 0 auto; }
.quad-empty { margin: 0; padding: 8px; color: var(--muted); font-size: 12px; }

/* --- a story ------------------------------------------------------ */

.story { padding: 4px 8px 5px; border-bottom: 1px solid var(--line-soft); }
.story:last-child { border-bottom: 0; }
.story:hover { background: var(--panel-2); }
.story.open { background: var(--panel-2); }

.story-title {
  margin: 0;
  font-size: 13px;
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -.008em;
  cursor: pointer;
}
.story-title:hover { color: var(--signal); }

/* meta and the toggle share one line: a second row would cost 16px a story */
.story-meta {
  display: flex; align-items: center; gap: 5px; flex-wrap: nowrap;
  margin-top: 2px;
  font-family: var(--mono); font-size: 10px; color: var(--muted);
  min-width: 0;
}
.dotsep { opacity: .45; }
.story-meta .raw { color: var(--bad); }
.story-meta .more {
  margin-left: auto;
  background: none; border: 0; padding: 0; cursor: pointer;
  font-family: var(--mono); font-size: 10px; color: var(--cool);
  white-space: nowrap;
}
.story-meta .more:hover { color: var(--signal); }

.pips { display: inline-flex; align-items: flex-end; gap: 1.5px; height: 8px; flex: none; }
.pips i { width: 2.5px; height: 8px; background: var(--signal); border-radius: 1px; display: block; }
.pips i:nth-child(1) { opacity: 1; }
.pips i:nth-child(2) { opacity: .85; }
.pips i:nth-child(3) { opacity: .7; }
.pips i:nth-child(4) { opacity: .55; }
.pips i:nth-child(5) { opacity: .4; }

.story-body { margin-top: 4px; }
.story-summary {
  margin: 0 0 4px;
  font-size: 12.5px; line-height: 1.45;
  color: var(--text-dim);
}

.story-sources { list-style: none; margin: 0; padding: 0; }
.story-sources li {
  padding: 3px 7px;
  background: var(--ink);
  border-left: 2px solid var(--line);
  border-radius: 0 var(--r) var(--r) 0;
  margin-bottom: 1px;
}
.story-sources li:hover { border-left-color: var(--signal); }
.story-sources a, .src-head {
  display: block; color: var(--text-dim); text-decoration: none;
  font-size: 12.5px; line-height: 1.3;
}
.story-sources a:hover { color: var(--text); text-decoration: underline; text-underline-offset: 2px; }
.src-meta { display: flex; align-items: center; gap: 4px; margin-top: 1px; }
.src-outlet { font-family: var(--mono); font-size: 9.5px; color: var(--signal); text-transform: uppercase; letter-spacing: .05em; }
.src-time { font-family: var(--mono); font-size: 9.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* --- placeholder -------------------------------------------------- */

.placeholder {
  position: absolute; inset: var(--bar-h) 0 0 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; color: var(--muted); background: var(--ink);
  padding: 20px;
}
.placeholder-art { display: flex; align-items: flex-end; justify-content: center; gap: 4px; height: 32px; margin-bottom: 14px; }
.placeholder-art i { width: 5px; background: var(--line); display: block; border-radius: 1px; animation: sweep 2.6s ease-in-out infinite; }
.placeholder-art i:nth-child(1) { height: 9px;  animation-delay: 0s; }
.placeholder-art i:nth-child(2) { height: 16px; animation-delay: .18s; }
.placeholder-art i:nth-child(3) { height: 26px; animation-delay: .36s; }
.placeholder-art i:nth-child(4) { height: 16px; animation-delay: .54s; }
.placeholder-art i:nth-child(5) { height: 9px;  animation-delay: .72s; }
@keyframes sweep { 0%, 100% { background: var(--line); } 45% { background: var(--signal); } }
.placeholder h2 { margin: 0 0 5px; font-size: 15px; color: var(--text); font-weight: 650; }
.placeholder p { margin: 0; max-width: 42ch; font-size: 12.5px; line-height: 1.5; }

/* --- activity log (floats, never displaces the grid) -------------- */

.log {
  position: fixed; right: 10px; bottom: 10px; z-index: 45;
  width: min(400px, calc(100vw - 20px));
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--shadow);
  overflow: hidden;
}
.log-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 4px 9px; border-bottom: 1px solid var(--line-soft); background: var(--panel-2);
}
.log-lines {
  margin: 0; padding: 5px 9px; list-style: none;
  font-family: var(--mono); font-size: 10.5px; line-height: 1.55;
  max-height: 150px; overflow-y: auto; color: var(--text-dim);
}
.log-lines li { display: flex; gap: 6px; }
.log-lines li::before { content: "›"; color: var(--muted); flex: none; }
.log-lines li.err { color: var(--bad); }
.log-lines li.err::before { content: "✕"; color: var(--bad); }
.log-lines li.warn { color: var(--signal); }
.log-lines li.warn::before { content: "!"; color: var(--signal); }
.log-lines li.ok::before { content: "✓"; color: var(--good); }
.log.collapsed .log-lines { display: none; }

/* --- modals ------------------------------------------------------- */

.modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-scrim { position: absolute; inset: 0; background: rgba(6,9,13,.72); }
.modal-card {
  position: relative;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 5px; box-shadow: var(--shadow);
  width: min(700px, 100%); max-height: 88vh;
  display: flex; flex-direction: column;
}
.modal-head, .modal-foot {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px; border-bottom: 1px solid var(--line);
  flex: none;
}
.modal-foot { border-bottom: 0; border-top: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 14px; flex: 1; font-weight: 700; }
.modal-body { padding: 14px; overflow-y: auto; }
.spacer { flex: 1; }

/* --- sources modal ------------------------------------------------ */

.addfeed { display: flex; gap: 6px; }
.addfeed input {
  flex: 1; background: var(--ink); border: 1px solid var(--line);
  border-radius: var(--r); padding: 6px 9px; font-family: var(--mono); font-size: 12px;
}
.addfeed input:focus { border-color: var(--signal); outline: none; }

.formnote { font-size: 11.5px; margin: 7px 0 0; line-height: 1.4; }
.formnote.ok { color: var(--good); }
.formnote.err { color: var(--bad); }

.rail-head { display: flex; align-items: baseline; justify-content: space-between; margin: 14px 0 5px; }

.feeds { list-style: none; margin: 0; padding: 0; }
.feed {
  display: grid;
  /* name at its natural width, URL takes the slack and truncates, tools last */
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 1px 8px;
  padding: 4px 7px; border-radius: var(--r); cursor: pointer;
  border: 1px solid transparent;
  align-items: baseline;
}
.feed:hover { background: var(--panel-2); }
.feed.selected { background: var(--panel-2); border-color: var(--signal); }
.feed.off { opacity: .45; }
.feed-name { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-url {
  font-family: var(--mono); font-size: 10.5px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  /* Plain LTR. `direction: rtl` looked tempting for keeping the path end
     visible, but bidi reordering moves a trailing slash to the front, so
     ".../latest-news-national/" rendered as "/https://...latest-news-national". */
}
.feed.selected .feed-url, .feed:hover .feed-url { color: var(--text-dim); }
.feed-meta {
  grid-column: 1 / -1; font-family: var(--mono); font-size: 10px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.feed-meta.err { color: var(--bad); }
.feed-tools { display: flex; gap: 5px; align-items: center; opacity: 0; transition: opacity .12s; }
.feed:hover .feed-tools, .feed:focus-within .feed-tools { opacity: 1; }
.feed-tools button { background: none; border: 0; cursor: pointer; padding: 1px 2px; color: var(--muted); font-family: var(--mono); font-size: 10.5px; }
.feed-tools button:hover { color: var(--signal); }
.feed-tools .rm:hover { color: var(--bad); }

.empty { color: var(--muted); font-size: 12px; margin: 8px 0 0; }

.statsrow {
  display: flex; gap: 14px; flex-wrap: wrap;
  margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line-soft);
  font-family: var(--mono); font-size: 10.5px; color: var(--muted);
}
.statsrow b { color: var(--text-dim); font-variant-numeric: tabular-nums; }

/* --- topic editor ------------------------------------------------- */

.topic-row {
  display: grid;
  grid-template-columns: 16px minmax(90px, 130px) minmax(0, 1fr) auto;
  gap: 6px; align-items: center; margin-bottom: 5px;
}
.topic-n { font-family: var(--mono); font-size: 10px; color: var(--muted); text-align: right; }
.topic-row input {
  background: var(--ink); border: 1px solid var(--line); border-radius: var(--r);
  padding: 4px 7px; font-size: 12px; width: 100%;
}
.topic-row input:focus { border-color: var(--signal); outline: none; }
.topic-hint { font-size: 11.5px !important; color: var(--text-dim); }
.topic-btns { display: flex; gap: 1px; }
.topic-btns button {
  background: none; border: 1px solid transparent; border-radius: var(--r);
  cursor: pointer; color: var(--muted); font-size: 11px; padding: 2px 5px; line-height: 1;
}
.topic-btns button:hover { color: var(--signal); border-color: var(--line); }
.topic-btns .tdel:hover { color: var(--bad); }
.topic-actions { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.topic-actions .hint { margin: 0; }

/* --- settings ----------------------------------------------------- */

.fset { padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--line-soft); }
.fset:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.fset .eyebrow { margin-bottom: 10px; }
.fset .hint { margin-bottom: 11px; }

.hint { color: var(--muted); font-size: 11.5px; line-height: 1.4; margin: 6px 0 0; }

.field { display: grid; gap: 3px; margin-bottom: 9px; }
.field > span { font-size: 11.5px; color: var(--muted); }
.field input, .field select {
  background: var(--ink); border: 1px solid var(--line); border-radius: var(--r);
  padding: 5px 8px; font-size: 12.5px; width: 100%;
}
.field input[type="text"], .field input[type="password"] { font-family: var(--mono); font-size: 11.5px; }
.field input:focus, .field select:focus { border-color: var(--signal); outline: none; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.check { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-dim); margin-bottom: 6px; cursor: pointer; }
.check input { accent-color: var(--signal); width: 14px; height: 14px; }

.test { display: flex; align-items: flex-start; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.testresult { font-family: var(--mono); font-size: 11px; color: var(--muted); line-height: 1.45; flex: 1 1 100%; }
.testresult.ok { color: var(--good); }
.testresult.err { color: var(--bad); }

.purge { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; }
.purge .field { margin-bottom: 0; }
.savenote { flex: 1; font-family: var(--mono); font-size: 11px; color: var(--muted); }

/* --- performance panel -------------------------------------------- */

.perf-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 6px; margin-bottom: 14px;
}
.perf-cell {
  background: var(--ink); border: 1px solid var(--line-soft);
  border-radius: var(--r); padding: 7px 9px;
}
.perf-cell b {
  display: block; font-family: var(--mono); font-size: 15px;
  color: var(--text); font-variant-numeric: tabular-nums; line-height: 1.2;
}
.perf-cell span {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted);
}

.finding {
  display: grid; grid-template-columns: 14px 1fr; gap: 7px;
  padding: 6px 0; border-top: 1px solid var(--line-soft);
  font-size: 12.5px; line-height: 1.5; color: var(--text-dim);
}
.finding i { font-style: normal; font-family: var(--mono); font-size: 11px; text-align: center; }
.finding.bad i  { color: var(--bad); }
.finding.warn i { color: var(--signal); }
.finding.ok i   { color: var(--good); }
.finding.info i { color: var(--muted); }

.perf-bar { display: flex; height: 14px; border-radius: 2px; overflow: hidden; margin: 4px 0 6px; }
.perf-bar i { display: block; }
.perf-bar .b-fetch { background: var(--cool); }
.perf-bar .b-match { background: var(--muted); }
.perf-bar .b-model { background: var(--signal); }
.perf-key { display: flex; gap: 12px; font-family: var(--mono); font-size: 10px; color: var(--muted); margin-bottom: 14px; }
.perf-key i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; }

.perf-errs { margin: 10px 0 0; padding: 0; list-style: none; font-size: 12px; }
.perf-errs li { display: flex; gap: 8px; padding: 3px 0; color: var(--bad); }
.perf-errs b { font-family: var(--mono); flex: none; }

/* --- toast -------------------------------------------------------- */

.toast {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 90;
  background: var(--raised); border: 1px solid var(--line); border-left: 3px solid var(--signal);
  color: var(--text); padding: 8px 14px; border-radius: var(--r);
  box-shadow: var(--shadow); font-size: 12.5px; max-width: min(500px, calc(100vw - 30px));
}
.toast.err { border-left-color: var(--bad); }
.toast.ok  { border-left-color: var(--good); }

/* --- narrow screens: allow scrolling, stack the panels ------------ */

@media (max-width: 1000px) {
  .brand-name { display: none; }
  .bar-status { display: none; }
}

@media (max-width: 760px) {
  html, body { overflow: auto; height: auto; }
  .bar { flex-wrap: wrap; height: auto; padding: 6px 8px; gap: 6px; }
  .bar-search { flex: 1 1 100%; max-width: none; order: -1; }
  .bar-sel { flex: 1 1 auto; min-width: 84px; }
  .grid,
  .grid[data-n="2"], .grid[data-n="3"], .grid[data-n="4"],
  .grid[data-n="5"], .grid[data-n="6"] {
    height: auto; display: grid;
    grid-template-columns: 1fr; grid-template-rows: none;
  }
  .grid > .quad, .grid[data-n="5"] > .quad { grid-column: auto; }
  .quad { max-height: none; }
  .quad-list { overflow: visible; }
  .placeholder { position: static; inset: auto; padding: 40px 20px; }
  .field-row { grid-template-columns: 1fr; gap: 0; }
  .modal { padding: 0; }
  .modal-card { max-height: 100vh; height: 100%; border-radius: 0; }
  .purge { grid-template-columns: 1fr; }
  .log { left: 8px; right: 8px; width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
