/* Scoreboard with the tank strip (SCOREBOARD_TAB_SPEC.md section 10.4). Every rule here is scoped to .sb-eq,
   .sb-eq-controls or .sbt, which exist only while the strip is shown, so every other Scoreboard keeps today's layout.
   Portal tokens only (styles.css :root). */

/* One screen: hold the page to the window on desktop-sized screens. Below that, the page scrolls as normal and
   nothing is hidden to avoid it. The sidebar already scrolls on its own. */
@media (min-width: 1280px) and (min-height: 860px) {
  .main:has(> .content.sb-eq) { height: 100vh; height: 100dvh; }
  .main > .content.sb-eq { flex: 1 1 auto; }
}
.content.sb-eq {
  max-width: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px 32px 14px;
}
.content.sb-eq .page-head { margin-bottom: 0; flex: none; }
.content.sb-eq .page-title-group h1 { margin-bottom: 2px; }

/* Site tabs, month bar, "day N of M" and the early- or prior-month note on one row (the accepted mockup). */
.sb-eq-controls { flex: none; display: flex; align-items: center; gap: 14px; }
.sb-eq-controls > .pd-head { display: contents; }
.sb-eq-controls > .pd-head > :first-child { order: 1; flex: none; }
.sb-eq-controls > .pd-head > div:not(.loc-pills) { display: none; }
.sb-eq-controls > .sb-month { order: 2; flex: 1 1 auto; min-width: 80px; margin-top: 0; }
.sb-eq-controls > .pd-head > :last-child { order: 3; flex: none; }
.sb-eq-controls > .sb-hold { order: 4; flex: none; margin-top: 0; }

/* Shorter tiles; every value, target, bar, status and sub line stays. */
.content.sb-eq .sb-grid { flex: none; margin-top: 0; gap: 12px; }
.content.sb-eq .sb-tile { padding: 12px 18px; gap: 6px; }
.content.sb-eq .sb-value { font-size: 34px; }
.content.sb-eq .sb-legend { flex: none; margin-top: 0; }
.sbt-foot { margin-left: auto; }

/* The strip */
.sbt { flex: 1 1 auto; display: flex; flex-direction: column; gap: 10px; }
.sbt-head { flex: none; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.sbt-title { display: flex; align-items: baseline; gap: 12px; }
.sbt-title h2 { margin: 0; font-family: var(--font-serif); font-size: 22px; font-weight: 500; line-height: 1.3; color: var(--ink); }
.sbt-sub { font-family: var(--font-mono); font-size: var(--fs-meta); color: var(--ink-3); }
.sbt-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 28px; padding: 0 12px; border-radius: 14px; font-size: var(--fs-meta); font-weight: 600; }
.sbt-chip::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; }
.sbt-chip-neg { background: var(--neg-soft); color: var(--neg-ink); }
.sbt-chip-neg::before { background: var(--neg); }
.sbt-chip-warn { background: var(--warn-soft); color: var(--warn-ink); }
.sbt-chip-warn::before { background: var(--warn); }
.sbt-chip-muted { background: var(--bg-sunken); color: var(--ink-2); }
.sbt-chip-muted::before { background: var(--ink-4); }
.sbt-head-right { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.sbt-cost { font-family: var(--font-mono); font-size: var(--fs-meta); color: var(--ink-3); }
.sbt-cost strong { font-size: 15px; font-weight: 600; color: var(--ink); }
.sbt-open { display: inline-flex; align-items: center; gap: 4px; min-height: 34px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); color: var(--ink); font-size: 14px; font-weight: 500; text-decoration: none; }
.sbt-open:hover { background: var(--bg-sunken); }
.sbt-status { margin: 0; padding: 14px 16px; border: 1px dashed var(--line-2); border-radius: var(--radius); color: var(--ink-3); font-size: 14px; }

.sbt-cells { flex: 1 1 auto; display: grid; gap: 12px; }
.sbt-cell { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; container: sbt-cell / inline-size; }
.sbt-cell-head { flex: none; display: flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; border-bottom: 1px solid var(--line); font-size: 15px; line-height: 1.3; color: var(--ink); }
.sbt-cell-head b { font-weight: 700; }
.sbt-cell-head span { color: var(--ink-2); }
.sbt-cell-body { flex: 1 1 auto; display: flex; gap: 12px; padding: 12px 14px; background: var(--bg-sunken); }
.sbt-gauge { flex: none; width: 44px; min-height: 92px; position: relative; box-sizing: border-box; border: 2px solid var(--line-2); border-radius: 12px; background: var(--surface); overflow: hidden; }
.sbt-gauge-fill { position: absolute; left: 0; right: 0; bottom: 0; height: var(--sbt-fill, 0%); background: var(--pos); }
.sbt-gauge-tick { position: absolute; right: 0; width: 10px; height: 1px; background: var(--ink-4); opacity: 0.5; }
.sbt-q1 { bottom: 25%; } .sbt-q2 { bottom: 50%; width: 16px; } .sbt-q3 { bottom: 75%; }
.sbt-reading { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sbt-eyebrow { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.sbt-gal { display: flex; align-items: baseline; gap: 4px; color: var(--ink); }
.sbt-gal-num { font-family: var(--font-mono); font-size: 30px; font-weight: 600; line-height: 1.2; letter-spacing: -0.02em; }
.sbt-gal small { font-family: var(--font-mono); font-size: 14px; color: var(--ink-3); }
.sbt-pct { font-size: var(--fs-meta); line-height: 1.35; color: var(--ink-3); }
.sbt-quality { font-size: var(--fs-caption); line-height: 1.35; color: var(--ink-3); }
.sbt-tags { margin-top: auto; padding-top: 6px; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.sbt-tag { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: var(--radius-sm); font-size: var(--fs-caption); font-weight: 600; line-height: 1.3; }
.sbt-tag::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; }
.sbt-tag-warn { background: var(--warn-soft); color: var(--warn-ink); }
.sbt-tag-warn::before { background: var(--warn); }
.sbt-tag-neg { background: var(--surface); color: var(--neg-ink); border: 1px solid var(--neg); font-weight: 700; }
.sbt-tag-neg::before { background: var(--neg); }
.sbt-tag-muted { background: var(--surface); color: var(--ink-2); border: 1px solid var(--line-2); }
.sbt-tag-muted::before { background: var(--ink-4); }
.sbt-cell-foot { flex: none; margin: 0; padding: 8px 14px 10px; border-top: 1px solid var(--line); display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 8px; row-gap: 2px; font-size: var(--fs-meta); line-height: 1.5; }
.sbt-cell-foot dt { color: var(--ink-3); }
.sbt-cell-foot dd { margin: 0; text-align: right; font-family: var(--font-mono); color: var(--ink-2); }
.sbt-cell-foot .sbt-washes { font-size: 15px; font-weight: 600; color: var(--ink); }
.sbt-cell-foot .sbt-seven { color: var(--ink-3); }

/* Very low: static red, no blinking (mockup default). Low: amber gauge. Delayed or unknown: muted. */
.sbt-cell[data-severity="lowlow"] { border-color: var(--neg); }
.sbt-cell[data-severity="lowlow"] .sbt-cell-head { background: var(--neg-ink); border-bottom-color: var(--neg-ink); color: var(--surface); }
.sbt-cell[data-severity="lowlow"] .sbt-cell-head span { color: inherit; }
.sbt-cell[data-severity="lowlow"] .sbt-cell-body { background: var(--neg-soft); }
.sbt-cell[data-severity="lowlow"] .sbt-eyebrow,
.sbt-cell[data-severity="lowlow"] .sbt-gal,
.sbt-cell[data-severity="lowlow"] .sbt-gal small,
.sbt-cell[data-severity="lowlow"] .sbt-pct { color: var(--neg-ink); }
.sbt-cell[data-severity="lowlow"] .sbt-gauge { border-color: var(--neg); }
.sbt-cell[data-severity="lowlow"] .sbt-gauge-fill { background: var(--neg); }
.sbt-cell[data-severity="low"] .sbt-gauge-fill { background: var(--warn); }
.sbt-cell[data-severity="delayed"] .sbt-gal-num,
.sbt-cell[data-severity="unknown"] .sbt-gal-num { color: var(--ink-3); }
.sbt-cell[data-severity="delayed"] .sbt-gauge-fill,
.sbt-cell[data-severity="unknown"] .sbt-gauge-fill { background: var(--line-2); }
[data-theme="dark"] .sbt-cell[data-severity="lowlow"] .sbt-cell-head { background: var(--neg); border-bottom-color: var(--neg); color: var(--bg); }
[data-theme="dark"] .sbt-cell[data-severity="lowlow"] .sbt-eyebrow,
[data-theme="dark"] .sbt-cell[data-severity="lowlow"] .sbt-gal,
[data-theme="dark"] .sbt-cell[data-severity="lowlow"] .sbt-gal small,
[data-theme="dark"] .sbt-cell[data-severity="lowlow"] .sbt-pct,
[data-theme="dark"] .sbt-tag-neg,
[data-theme="dark"] .sbt-chip-neg { color: var(--neg); }
[data-theme="dark"] .sbt-chip-warn,
[data-theme="dark"] .sbt-tag-warn { color: var(--warn); }

/* Narrow cells (seven columns on a 1280 to 1535 px window): the gauge becomes a bar under the reading, so no number is cut off. */
@container sbt-cell (max-width: 209px) {
  .sbt-cell-head, .sbt-cell-foot { padding-left: 12px; padding-right: 12px; }
  .sbt-cell-body { flex-direction: column; gap: 8px; padding: 10px 12px; }
  .sbt-gauge { order: 2; width: 100%; min-height: 0; height: 12px; border-width: 1px; border-radius: 6px; }
  .sbt-gauge-fill { top: 0; right: auto; height: auto; width: var(--sbt-fill, 0%); }
  .sbt-gauge-tick { top: 0; bottom: auto; right: auto; width: 1px; height: 100%; }
  .sbt-q1 { left: 25%; } .sbt-q2 { left: 50%; width: 1px; } .sbt-q3 { left: 75%; }
  .sbt-gal-num { font-size: 26px; }
  .sbt-tags { padding-top: 2px; }
}

/* Narrow windows: fewer columns, normal page flow. */
@media (max-width: 1279px) {
  .sbt-cells { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
  .sb-eq-controls { flex-wrap: wrap; }
}
@media (max-width: 700px) {
  .sbt-cells { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}
