/* BIP Ops — mobile first; Traci reads it on an iPhone. */
:root {
  --bg: #f6f7f9; --surface: #ffffff; --text: #1b1f24; --muted: #5f6873;
  --border: #dde1e6; --accent: #2457c5; --accent-text: #ffffff;
  --ok: #1d7a46; --ok-bg: #e3f4ea; --warn: #8a5a00; --warn-bg: #fdf1d8;
  --bad: #b3261e; --bad-bg: #fbe4e2; --idle-bg: #eceff2;
  /* product lines: reference categorical slots 1-4, fixed order; gray = unmapped */
  --bip: #2a78d6; --bipbox: #eb6834; --hosting: #1baf7a; --shared: #eda100; --studio: #e87ba4; --dev: #5e2a7e; --unmapped: #9aa0a8;
  --grid: #e6e8eb;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121418; --surface: #1b1e24; --text: #e7e9ec; --muted: #9aa3ad;
    --border: #2d323a; --accent: #6f9bff; --accent-text: #0b1020;
    --ok: #6fd39a; --ok-bg: #173324; --warn: #f0c063; --warn-bg: #3a2d10;
    --bad: #ff8a80; --bad-bg: #3d1c1a; --idle-bg: #262a31;
    --bip: #3987e5; --bipbox: #d95926; --hosting: #199e70; --shared: #c98500; --studio: #d55181; --dev: #8a55b3; --unmapped: #6b7078;
    --grid: #2a2f36;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
h1 { font-size: 1.5rem; margin: 0 0 16px; }
h2 { font-size: 1.05rem; margin: 0 0 12px; }

.top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px;
  padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { font-weight: 700; color: var(--text); text-decoration: none; }
.top nav { display: flex; gap: 4px 14px; overflow-x: auto; order: 3; width: 100%;
  padding-bottom: 2px; scrollbar-width: none; }
.top nav a, .top nav .soon { white-space: nowrap; font-size: .95rem; text-decoration: none; padding: 4px 0; }
.top nav a[aria-current="page"] { font-weight: 600; border-bottom: 2px solid var(--accent); }
.top nav .soon { color: var(--muted); opacity: .6; }
.who { margin-left: auto; display: flex; gap: 10px; align-items: center; font-size: .9rem; color: var(--muted); }
@media (min-width: 760px) { .top nav { order: 0; width: auto; } }

.page { padding: 16px; max-width: 1100px; margin: 0 auto; }
.narrow { padding: 16px; max-width: 420px; margin: 8vh auto 0; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 16px; margin-bottom: 16px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack > p { margin: 0; }
.grid { display: grid; gap: 12px; grid-template-columns: 1fr; margin-bottom: 4px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, 1fr); } }
.tile .big { font-size: 1.8rem; font-weight: 650; margin: 0; }
.tile.pending .big { color: var(--muted); }
.row-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.row-head h2 { margin: 0; }

label { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; color: var(--muted); }
input, select { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px; min-height: 44px; width: 100%; }
button, .button { font: inherit; font-weight: 600; background: var(--accent); color: var(--accent-text);
  border: 0; border-radius: 8px; padding: 10px 16px; min-height: 44px; cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
button.small { min-height: 36px; padding: 6px 12px; font-size: .9rem; }
button.secondary { background: transparent; color: var(--accent); border: 1px solid var(--border); }
button.link { background: none; color: var(--accent); padding: 0; min-height: 0; font-weight: 400; }
button:disabled { opacity: .5; cursor: default; }
.inline-form { display: grid; gap: 10px; margin-top: 14px; grid-template-columns: 1fr 1fr; align-items: end; }
.inline-form .grow { grid-column: 1 / -1; }
@media (min-width: 760px) {
  .inline-form { grid-template-columns: 120px 2fr 120px 2fr auto; }
  .inline-form .grow { grid-column: auto; }
}

table.list { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.list th { text-align: left; color: var(--muted); font-weight: 500; font-size: .8rem;
  text-transform: uppercase; letter-spacing: .03em; }
table.list th, table.list td { padding: 8px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.list tr:last-child td { border-bottom: 0; }
table.small { font-size: .85rem; }
.wide-only { display: none; }
@media (min-width: 760px) { .wide-only { display: table-cell; } }

.pill { display: inline-block; font-size: .78rem; font-weight: 600; padding: 2px 8px; border-radius: 999px;
  background: var(--idle-bg); color: var(--muted); }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.running, .pill.skipped, .pill.partial { background: var(--warn-bg); color: var(--warn); }
.pill.failed { background: var(--bad-bg); color: var(--bad); }
.line { white-space: nowrap; }
.line::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px;
  margin-right: 6px; vertical-align: -1px; background: var(--unmapped); }
.line.bip::before { background: var(--bip); } .line.bipbox::before { background: var(--bipbox); }
.line.hosting::before { background: var(--hosting); } .line.shared::before { background: var(--shared); }
.line.studio::before { background: var(--studio); } .line.dev::before { background: var(--dev); }

/* stat tiles */
.tile .label { font-size: .85rem; color: var(--muted); margin: 0 0 4px; }
.tile .big { font-variant-numeric: proportional-nums; }
.delta { font-size: .85rem; margin: 4px 0 0; }
.delta.up { color: var(--ok); } .delta.down { color: var(--bad); }
.breakdown { list-style: none; margin: 10px 0 0; padding: 0; font-size: .88rem; }
.breakdown li { display: flex; justify-content: space-between; padding: 2px 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.list th.num { text-align: right; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin-bottom: 12px; }
.filters label { flex: 1 1 140px; }
.filters select { min-height: 40px; padding: 6px 10px; }
.table-scroll { overflow-x: auto; }
.nowrap { white-space: nowrap; }
.alert-list { list-style: none; margin: 0; padding: 0; }
.alert-list li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); align-items: baseline; }
.alert-list li:last-child { border-bottom: 0; }
.sev { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; min-width: 62px; }
.sev.critical { color: var(--bad); } .sev.warning { color: var(--warn); } .sev.info, .sev.lapsed { color: var(--muted); }
.assign { display: flex; gap: 6px; align-items: center; }
.assign select { min-height: 36px; padding: 4px 8px; width: auto; }

/* revenue chart */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: 260px; overflow: visible; }
.chart .tick { fill: var(--muted); font-size: 11px; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .band.on { fill: var(--grid); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0 0 10px; font-size: .88rem; padding: 0; list-style: none; }
.tooltip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px; font-size: .85rem; box-shadow: 0 4px 16px rgba(0,0,0,.12);
  min-width: 170px; z-index: 2; }
.tooltip[hidden] { display: none; }
.tooltip .row { display: flex; justify-content: space-between; gap: 14px; }
.tooltip .row.total { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 4px; font-weight: 600; }
.chart .band { fill: transparent; }

.flash { padding: 10px 12px; border-radius: 8px; margin: 0 0 14px; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.error { background: var(--bad-bg); color: var(--bad); }
.flash.info { background: var(--surface); border: 1px solid var(--border); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-all; }
.key { font-size: 1.05rem; letter-spacing: .04em; }
.qr { background: #fff; padding: 12px; width: max-content; border-radius: 8px; }
details.job { border-top: 1px solid var(--border); padding: 8px 0; }
details.job summary { cursor: pointer; }
.only-touch { display: none; }
@media (hover: none) and (pointer: coarse) {
  .only-touch { display: block; }
  .only-wide { display: none; }
}
label.check { flex-direction: row; align-items: center; gap: 8px; }
label.check input { width: auto; min-height: 0; }
.bars td { border-bottom: 0; padding: 3px 6px; }
.barcell { width: 70%; }
.bar { display: block; height: 12px; border-radius: 0 4px 4px 0; background: var(--bip); min-width: 2px; }
.bar.unknown { background: var(--unmapped); }
.bar.current { background: var(--ok); }
tr.sub td { border-bottom: 1px solid var(--border); padding-top: 0; }
tr.sub details summary { cursor: pointer; }
.meter { display: block; width: 120px; max-width: 100%; height: 6px; margin-top: 4px; border-radius: 3px; background: var(--idle-bg); overflow: hidden; }
.meter .bar { height: 6px; border-radius: 3px; background: var(--bipbox); }
.meter .bar.near { background: var(--warn); }
.meter .bar.over { background: var(--bad); }
th.sort { cursor: pointer; user-select: none; }
th.sort::after { content: ' ↕'; opacity: .35; font-size: .8em; }
th[aria-sort="ascending"]::after { content: ' ↑'; opacity: .9; }
th[aria-sort="descending"]::after { content: ' ↓'; opacity: .9; }
.form-grid { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .form-grid { grid-template-columns: repeat(3, 1fr); } .form-grid .grow { grid-column: span 2; } }
textarea { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; width: 100%; }
form.inline { display: inline; }
.card.danger { border-color: var(--bad); }
pre.json { font-size: .78rem; overflow: auto; max-height: 70vh; background: var(--bg); padding: 12px; border-radius: 8px; }
details > summary { cursor: pointer; }

/* digest preview: the email as mailed, in a frame */
.email-preview { width: 100%; height: 75vh; border: 1px solid var(--border); border-radius: 8px; background: #f4f4f6; }

/* refinements (Oct 2026): clickable tiles, negative figures, table and card controls */
a.card.tile.link { display: block; color: inherit; text-decoration: none; transition: border-color .15s, box-shadow .15s; }
a.card.tile.link:hover, a.card.tile.link:focus-visible { border-color: var(--accent); box-shadow: 0 1px 6px rgba(0, 0, 0, .08); }
a.card.tile.link .label::after { content: ' →'; color: var(--muted); }
.neg, .big.neg { color: var(--bad); }
table.list th { position: relative; }
.col-grip { position: absolute; top: 0; right: -4px; width: 9px; height: 100%; cursor: col-resize; z-index: 2; touch-action: none; }
.col-grip:hover, .col-grip.dragging { background: linear-gradient(to right, transparent 3px, var(--accent) 3px, var(--accent) 5px, transparent 5px); }
table.list.resized { table-layout: fixed; }
table.list.resized td, table.list.resized th { overflow: hidden; text-overflow: ellipsis; }
.collapse-toggle { background: none; border: 0; padding: 0 6px 0 0; margin: 0; color: var(--muted); font: inherit; font-weight: 400;
  cursor: pointer; line-height: 1; vertical-align: baseline; min-height: 0; display: inline; border-radius: 0; }
.collapse-toggle:hover { color: var(--text); background: none; }
.collapse-toggle::before { content: '▾'; display: inline-block; transition: transform .15s; }
.card.collapsed .collapse-toggle::before { transform: rotate(-90deg); }
.card.collapsed > *:not(h2):not(.row-head) { display: none; }
.card.collapsed .row-head > *:not(h2) { display: none; }
.alert-actions { display: inline-flex; gap: 4px; margin-left: 6px; vertical-align: baseline; }
.alert-actions button { font-size: .75rem; padding: 2px 8px; font-weight: 500; min-height: 26px; }
