/* ============================================================================
   Meter Variance Control — "measurement instrument / control room"
   Deep petrol ink · brass-amber accent · graph-paper grid · mono data
   ========================================================================== */

:root {
  /* surfaces */
  --ink-900: #0a0e12;
  --ink-850: #0d131a;
  --ink-800: #111922;
  --ink-750: #15202b;
  --ink-700: #1b2935;
  --ink-650: #233444;
  --panel:   #0f1720;
  --raised:  #14202b;

  /* hairlines */
  --line:    rgba(150, 190, 220, 0.10);
  --line-2:  rgba(150, 190, 220, 0.18);
  --line-3:  rgba(150, 190, 220, 0.30);

  /* text */
  --fg:      #eaf1f7;
  --fg-dim:  #b3c6d6;
  --fg-mut:  #8598aa;
  --fg-faint:#637688;

  /* brass-amber accent (the gauge / lamp) */
  --amber:   #f0b132;
  --amber-2: #ffce6b;
  --amber-d: #b9821a;
  --amber-glow: rgba(240, 177, 50, 0.16);

  /* severity */
  --crit: #ff5d6c;
  --crit-bg: rgba(255, 93, 108, 0.12);
  --warn: #f0b132;
  --warn-bg: rgba(240, 177, 50, 0.12);
  --info: #58a6ff;
  --info-bg: rgba(88, 166, 255, 0.12);
  --ok:   #3ddc8f;

  --r-sm: 6px;
  --r:    10px;
  --r-lg: 16px;

  --font-sans: 'Archivo', system-ui, -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', monospace;

  --shadow: 0 18px 50px -24px rgba(0, 0, 0, 0.7);
  --shadow-lg: 0 30px 80px -30px rgba(0, 0, 0, 0.85);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* the `hidden` attribute must always win over component display rules */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  font-family: var(--font-sans);
  background: var(--ink-900);
  color: var(--fg);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ---- atmosphere: measurement grid + faint vignette + grain ---- */
.grid-bg {
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background-color: var(--ink-900);
  background-image:
    radial-gradient(1100px 640px at 82% -18%, rgba(240, 177, 50, 0.045), transparent 62%),
    radial-gradient(820px 560px at 4% 116%, rgba(40, 90, 130, 0.06), transparent 64%),
    linear-gradient(rgba(150, 190, 220, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(150, 190, 220, 0.028) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 46px 46px, 46px 46px;
}
.grid-bg::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(125% 85% at 50% 35%, transparent 58%, rgba(0,0,0,0.5) 100%);
}
.grain {
  position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* mark */
.markmark { display: flex; gap: 4px; align-items: flex-end; height: 38px; }
.markmark span {
  width: 7px; background: var(--amber); border-radius: 2px; display: block;
  box-shadow: 0 0 16px var(--amber-glow);
}
.markmark span:nth-child(1) { height: 16px; opacity: 0.55; }
.markmark span:nth-child(2) { height: 38px; }
.markmark span:nth-child(3) { height: 24px; opacity: 0.78; }
.markmark.sm { height: 22px; }
.markmark.sm span { width: 4px; }
.markmark.sm span:nth-child(1) { height: 9px; }
.markmark.sm span:nth-child(2) { height: 22px; }
.markmark.sm span:nth-child(3) { height: 14px; }

/* ============================ SHARED CONTROLS ============================ */
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--font-sans); font-weight: 600; font-size: 14px;
  padding: 12px 20px; border-radius: var(--r); border: 1px solid transparent;
  cursor: pointer; transition: transform .12s ease, background .18s, box-shadow .2s;
  letter-spacing: 0.01em; white-space: nowrap;
}
.btn .ico { width: 17px; height: 17px; }
.btn-accent {
  background: linear-gradient(180deg, var(--amber-2), var(--amber));
  color: #2a1c02; box-shadow: 0 10px 30px -10px var(--amber-glow), inset 0 1px 0 rgba(255,255,255,.3);
}
.btn-accent:hover { transform: translateY(-1px); box-shadow: 0 16px 36px -12px var(--amber-glow), inset 0 1px 0 rgba(255,255,255,.3); }
.btn-accent:active { transform: translateY(0) scale(.99); }
.btn-accent:disabled { opacity: .4; cursor: not-allowed; transform: none; filter: grayscale(.4); }
.btn-block { width: 100%; justify-content: center; padding: 14px; }
.btn-sm { padding: 9px 14px; font-size: 13px; }
.btn-run { padding: 13px 26px; }

.btn-ghost {
  background: transparent; border: 1px solid var(--line-2); color: var(--fg-dim);
  width: 34px; height: 34px; border-radius: var(--r-sm); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; transition: .15s;
}
.btn-ghost:hover { color: var(--fg); border-color: var(--line-3); background: var(--ink-750); }
.btn-ghost .ico { width: 16px; height: 16px; }

.btn-ghost-line {
  display: inline-flex; align-items: center; gap: 7px; background: transparent;
  border: 1px solid var(--line-2); color: var(--fg-dim); font-family: var(--font-sans);
  font-size: 13px; font-weight: 500; padding: 9px 14px; border-radius: var(--r-sm);
  cursor: pointer; transition: .15s;
}
.btn-ghost-line:hover { color: var(--fg); border-color: var(--line-3); background: var(--ink-750); }
.btn-ghost-line .ico { width: 15px; height: 15px; }

.ico, .ico-lg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ico-lg { width: 30px; height: 30px; }

.field { display: flex; flex-direction: column; gap: 7px; }
.field-label { font-size: 12px; font-weight: 600; color: var(--fg-mut); letter-spacing: .08em; text-transform: uppercase; }
input[type=email], input[type=password], input[type=text], input[type=search], input[type=number], select {
  font-family: var(--font-mono); font-size: 14px; color: var(--fg);
  background: var(--ink-850); border: 1px solid var(--line-2); border-radius: var(--r-sm);
  padding: 11px 13px; transition: border-color .15s, box-shadow .15s; width: 100%;
}
input:focus, select:focus { outline: none; border-color: var(--amber); box-shadow: 0 0 0 3px var(--amber-glow); }
input::placeholder { color: var(--fg-faint); }
select { cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%236d8295' stroke-width='2'%3E%3Cpath d='M3 5l3 3 3-3'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px;
}

/* ============================ SCREENS ============================ */
.screen { display: none; }
.screen.active { display: block; }

/* ---------------------------- SIGN IN ---------------------------- */
.signin {
  min-height: 100vh; grid-template-columns: 1.05fr 0.95fr;
  align-items: stretch;
}
.signin.active { display: grid; }
.signin-panel {
  display: flex; flex-direction: column; justify-content: center;
  padding: 7vh clamp(40px, 7vw, 120px); gap: 26px; max-width: 640px;
  animation: rise .7s cubic-bezier(.2,.7,.2,1) both;
}
.signin-brand { display: flex; gap: 20px; align-items: flex-start; }
.brand-kicker { font-family: var(--font-mono); font-size: 12px; letter-spacing: .22em; text-transform: uppercase; color: var(--amber); margin-bottom: 8px; }
.brand-title { font-size: clamp(38px, 5vw, 60px); font-weight: 800; line-height: .98; letter-spacing: -.02em; }
.signin-lede { color: var(--fg-dim); font-size: 16px; line-height: 1.65; max-width: 46ch; }
.signin-lede em { color: var(--amber-2); font-style: italic; }
.signin-form { display: flex; flex-direction: column; gap: 16px; max-width: 400px; margin-top: 8px; }
.signin-note { font-family: var(--font-mono); font-size: 11.5px; color: var(--fg-faint); text-align: center; letter-spacing: .03em; }

.signin-aside {
  position: relative; border-left: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(20,32,43,.5), rgba(10,14,18,.2));
  display: flex; flex-direction: column; justify-content: center; gap: 40px;
  padding: 7vh clamp(34px, 4vw, 70px);
  animation: fade 1s ease both .2s;
}
.gauge-wrap { position: relative; }
.gauge-readout { display: flex; align-items: baseline; gap: 14px; margin-bottom: 26px; }
.gauge-num { font-family: var(--font-mono); font-size: 92px; font-weight: 600; color: var(--amber); line-height: 1; text-shadow: 0 0 50px var(--amber-glow); }
.gauge-cap { font-family: var(--font-mono); font-size: 13px; letter-spacing: .18em; text-transform: uppercase; color: var(--fg-mut); }
.check-ticker { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.check-ticker li {
  font-family: var(--font-mono); font-size: 13px; color: var(--fg-dim);
  display: flex; gap: 12px; align-items: center; padding: 7px 0;
  border-top: 1px solid var(--line); opacity: 0; animation: slidein .5s ease forwards;
}
.check-ticker li b { color: var(--amber); font-weight: 600; width: 22px; }
.check-ticker li span { color: var(--fg-mut); margin-left: auto; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.aside-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; border-top: 1px solid var(--line); padding-top: 26px; }
.aside-stats dt { font-size: 11px; color: var(--fg-mut); letter-spacing: .06em; text-transform: uppercase; margin-bottom: 6px; }
.aside-stats dd { font-family: var(--font-mono); font-size: 15px; color: var(--fg); }

/* ============================ APP SHELL ============================ */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 28px;
  padding: 14px clamp(20px, 4vw, 46px);
  background: rgba(10, 14, 18, 0.82); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-2);
}
.topbar-brand { display: flex; align-items: center; gap: 13px; }
.topbar-name { display: flex; flex-direction: column; line-height: 1.15; }
.topbar-name strong { font-size: 14.5px; font-weight: 700; letter-spacing: -.01em; }
.topbar-name span { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--fg-mut); }

.stepper { display: flex; gap: 6px; margin: 0 auto; background: var(--ink-850); padding: 5px; border-radius: var(--r); border: 1px solid var(--line); }
.step {
  display: flex; align-items: center; gap: 10px; padding: 8px 16px; border-radius: var(--r-sm);
  background: transparent; border: none; cursor: pointer; color: var(--fg-mut);
  font-family: var(--font-sans); font-size: 13.5px; font-weight: 600; transition: .18s;
}
.step i { font-family: var(--font-mono); font-style: normal; font-size: 11px; color: var(--fg-faint); transition: .18s; }
.step:not(:disabled):hover { color: var(--fg-dim); }
.step.active { background: var(--ink-700); color: var(--fg); box-shadow: inset 0 0 0 1px var(--line-2); }
.step.active i { color: var(--amber); }
.step.done i { color: var(--ok); }
.step:disabled { cursor: not-allowed; opacity: .5; }

.topbar-session { display: flex; align-items: center; gap: 11px; font-family: var(--font-mono); font-size: 12.5px; color: var(--fg-dim); }
.session-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 10px var(--ok); }

.content { flex: 1; padding: clamp(24px, 4vw, 48px); max-width: 1340px; margin: 0 auto; width: 100%; }
.pane { animation: rise .5s cubic-bezier(.2,.7,.2,1) both; }
.pane-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 28px; }
.pane-title { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.pane-sub { color: var(--fg-dim); font-size: 14.5px; max-width: 72ch; margin-top: 7px; line-height: 1.6; }
.pane-head-actions { display: flex; gap: 10px; flex-shrink: 0; }
.pane-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--line); gap: 16px; }
.source-line { font-family: var(--font-mono); font-size: 12.5px; color: var(--fg-mut); }

/* ---------------------------- UPLOAD ---------------------------- */
.sample-bar { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 18px; margin-bottom: 22px; }
.sample-bar-label { display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 600; color: var(--fg-dim); }
.sample-bar-label .ico { width: 16px; height: 16px; color: var(--amber); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips-empty { font-family: var(--font-mono); font-size: 12px; color: var(--fg-faint); }
.chip {
  font-family: var(--font-mono); font-size: 12.5px; color: var(--fg-dim);
  background: var(--ink-800); border: 1px solid var(--line-2); border-radius: 100px;
  padding: 6px 14px; cursor: pointer; transition: .15s;
}
.chip:hover { border-color: var(--amber); color: var(--fg); }
.chip.active { background: var(--amber); color: #2a1c02; border-color: var(--amber); font-weight: 600; }
.chip.partial { opacity: .5; }

.dropzones { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.dropzone { background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r-lg); padding: 22px; display: flex; flex-direction: column; gap: 12px; transition: border-color .18s, transform .18s; position: relative; overflow: hidden; }
.dropzone::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 2px; background: linear-gradient(90deg, transparent, var(--line-2), transparent); }
.dropzone.loaded { border-color: rgba(61, 220, 143, 0.4); }
.dropzone.loaded::before { background: linear-gradient(90deg, transparent, var(--ok), transparent); }
.dz-top { display: flex; justify-content: space-between; align-items: center; }
.dz-tag { font-family: var(--font-mono); font-size: 11px; font-weight: 600; letter-spacing: .05em; padding: 4px 10px; border-radius: 5px; }
.tag-tm { background: var(--info-bg); color: var(--info); }
.tag-bat { background: rgba(125, 211, 252, 0.1); color: #7dd3fc; }
.tag-pl { background: var(--warn-bg); color: var(--amber); }
.dz-gran { font-family: var(--font-mono); font-size: 11px; color: var(--fg-faint); letter-spacing: .04em; }
.dz-name { font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.dz-role { font-size: 13px; color: var(--fg-mut); margin-top: -6px; }
.dz-drop {
  margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 26px 16px; border: 1.5px dashed var(--line-2); border-radius: var(--r);
  cursor: pointer; transition: .18s; color: var(--fg-mut);
}
.dz-drop:hover, .dz-drop.drag { border-color: var(--amber); color: var(--amber); background: var(--amber-glow); }
.dz-hint { font-family: var(--font-mono); font-size: 12px; letter-spacing: .02em; }
.dz-file { font-family: var(--font-mono); font-size: 11.5px; color: var(--ok); word-break: break-all; min-height: 16px; }

/* ---------------------------- CONFIGURE ---------------------------- */
.run-settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; margin-bottom: 22px; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 18px; }
.check-card { background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r-lg); padding: 20px; display: flex; flex-direction: column; gap: 14px; transition: border-color .18s, opacity .18s; position: relative; }
.check-card.disabled { opacity: .52; }
.cc-head { display: flex; align-items: flex-start; gap: 14px; }
.cc-num { font-family: var(--font-mono); font-size: 13px; font-weight: 600; color: #2a1c02; background: var(--amber); width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.cc-card-disabled .cc-num { background: var(--ink-650); color: var(--fg-mut); }
.cc-titles { flex: 1; min-width: 0; }
.cc-name { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.cc-src { font-family: var(--font-mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--fg-mut); }
.cc-purpose { font-size: 13px; color: var(--fg-dim); line-height: 1.55; }
.cc-params { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding-top: 14px; border-top: 1px solid var(--line); }
.cc-param { display: flex; flex-direction: column; gap: 5px; }
.cc-param.full { grid-column: 1 / -1; }
.cc-param label { font-size: 11.5px; color: var(--fg-mut); font-weight: 500; }
.cc-param input, .cc-param select { padding: 8px 10px; font-size: 13px; }

/* toggle */
.toggle { position: relative; width: 42px; height: 24px; flex-shrink: 0; cursor: pointer; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-track { position: absolute; inset: 0; background: var(--ink-650); border-radius: 100px; transition: .2s; border: 1px solid var(--line-2); }
.toggle-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: var(--fg-mut); transition: .2s; }
.toggle input:checked + .toggle-track { background: var(--amber); border-color: var(--amber); }
.toggle input:checked + .toggle-track::after { transform: translateX(18px); background: #2a1c02; }

/* ---------------------------- RESULTS ---------------------------- */
.pop-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(125px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; margin-bottom: 18px; }
.pop-cell { background: var(--panel); padding: 15px 18px; }
.pop-cell .v { font-family: var(--font-mono); font-size: 24px; font-weight: 600; color: var(--fg); letter-spacing: -.01em; }
.pop-cell .k { font-size: 11px; color: var(--fg-mut); margin-top: 3px; letter-spacing: .03em; }

.warnings { background: var(--warn-bg); border: 1px solid rgba(240, 177, 50, 0.3); border-radius: var(--r); padding: 14px 18px; margin-bottom: 18px; display: flex; flex-direction: column; gap: 7px; }
.warnings .w-item { font-family: var(--font-mono); font-size: 12.5px; color: var(--amber-2); display: flex; gap: 9px; align-items: flex-start; line-height: 1.5; }
.warnings .w-item::before { content: "▲"; font-size: 9px; margin-top: 4px; }

.results-body { display: grid; grid-template-columns: 230px 1fr; gap: 20px; align-items: start; }
.check-tiles { display: flex; flex-direction: column; gap: 10px; position: sticky; top: 84px; }
.check-tile { background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r); padding: 13px 15px; cursor: pointer; transition: .15s; text-align: left; display: flex; align-items: center; gap: 13px; }
.check-tile:hover { border-color: var(--line-3); background: var(--raised); }
.check-tile.active { border-color: var(--amber); box-shadow: 0 0 0 1px var(--amber-glow); }
.check-tile.zero { background: var(--ink-850); }
.ct-count { font-family: var(--font-mono); font-size: 22px; font-weight: 600; min-width: 44px; text-align: center; flex-shrink: 0; }
.ct-count.has { color: var(--amber); }
.ct-count.none { color: var(--fg-mut); }
.ct-meta { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ct-name { font-size: 13.5px; font-weight: 600; line-height: 1.25; color: var(--fg); }
.check-tile.zero .ct-name { color: var(--fg-dim); }
.ct-src { font-family: var(--font-mono); font-size: 10px; color: var(--fg-mut); letter-spacing: .07em; text-transform: uppercase; }
.check-tile.all-tile { border-style: dashed; }

.flags-panel { background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r-lg); overflow: hidden; }
/* (superseded: the toolbar is a stacked column — see .flags-toolbar below) */
.seg { display: flex; background: var(--ink-850); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 3px; }
.seg button { display: flex; align-items: center; gap: 7px; background: transparent; border: none; color: var(--fg-mut); font-family: var(--font-sans); font-size: 12.5px; font-weight: 500; padding: 6px 12px; border-radius: 5px; cursor: pointer; transition: .15s; }
.seg button:hover { color: var(--fg-dim); }
.seg button.active { background: var(--ink-700); color: var(--fg); }
.sev-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.sev-dot.crit { background: var(--crit); } .sev-dot.warn { background: var(--warn); } .sev-dot.info { background: var(--info); }
.search { position: relative; flex: 1 1 260px; min-width: 220px; display: flex; align-items: center; }
.search .ico { position: absolute; left: 13px; width: 16px; height: 16px; color: var(--fg-mut); }
.search input { padding-left: 39px; height: 40px; font-size: 13.5px; }
.flags-count { font-family: var(--font-mono); font-size: 12.5px; color: var(--fg-mut); white-space: nowrap; }

.flags-table-wrap { max-height: 62vh; overflow-y: auto; overflow-x: auto; }
.flags-table { min-width: 760px; }
.flags-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.flags-table thead th { position: sticky; top: 0; z-index: 2; background: var(--ink-800); text-align: left; font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--fg-mut); padding: 11px 14px; border-bottom: 1px solid var(--line-2); }
/* No background transition: the sticky Review cell repaints instantly while a
   transitioned row fades, so the two backgrounds visibly disagreed for ~120ms
   as the pointer moved between rows. Both now change in the same frame. */
.flags-table tbody tr { border-bottom: 1px solid var(--line); cursor: pointer; }
.flags-table tbody tr, .flags-table tbody td { transition: none; }
.flags-table tbody tr:hover { background: var(--raised); }
.flags-table td { padding: 11px 14px; vertical-align: top; }
.c-sev { width: 30px; }
.td-sev { display: flex; padding-top: 14px !important; }
.flags-table .mono { font-family: var(--font-mono); font-size: 12px; }
.td-check { font-weight: 600; white-space: nowrap; }
.td-check .badge-src { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .08em; color: var(--fg-mut); display: block; font-weight: 400; margin-top: 2px; }
.td-fac { color: var(--fg-dim); max-width: 200px; }
.td-uwi { font-family: var(--font-mono); font-size: 12px; color: var(--amber-2); white-space: nowrap; }
.td-date { font-family: var(--font-mono); font-size: 12px; color: var(--fg-mut); white-space: nowrap; }
.td-msg { color: var(--fg-dim); max-width: 380px; }
.row-pl { display: inline-block; font-family: var(--font-mono); font-size: 9px; padding: 1px 5px; border-radius: 3px; background: var(--warn-bg); color: var(--amber); margin-left: 7px; vertical-align: middle; }
.flags-empty { padding: 50px; text-align: center; color: var(--fg-mut); font-family: var(--font-mono); font-size: 13px; }

/* ============================ DRAWER ============================ */
.drawer { position: fixed; inset: 0; z-index: 60; }
.drawer-scrim { position: absolute; inset: 0; background: rgba(5, 8, 11, 0.6); backdrop-filter: blur(3px); animation: fade .25s ease; }
.drawer-panel { position: absolute; top: 0; right: 0; height: 100%; width: min(460px, 92vw); background: var(--ink-850); border-left: 1px solid var(--line-2); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slidedrawer .3s cubic-bezier(.2,.7,.2,1); }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 22px 24px; border-bottom: 1px solid var(--line); }
.drawer-kicker { font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--amber); }
.drawer-title { font-size: 18px; font-weight: 700; margin-top: 5px; }
.drawer-body { padding: 22px 24px; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; }
.dr-block { display: flex; flex-direction: column; gap: 9px; }
.dr-block h4 { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--fg-mut); }
.dr-kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 14px; font-size: 13px; }
.dr-kv dt { color: var(--fg-mut); font-size: 12px; }
.dr-kv dd { font-family: var(--font-mono); font-size: 12.5px; color: var(--fg); word-break: break-all; }
.dr-json { font-family: var(--font-mono); font-size: 12px; background: var(--ink-900); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 13px; color: var(--fg-dim); white-space: pre-wrap; line-height: 1.6; }
.dr-msg { font-size: 14px; color: var(--fg); line-height: 1.6; background: var(--raised); padding: 14px; border-radius: var(--r-sm); border-left: 2px solid var(--amber); }
.dr-sev { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 6px; width: fit-content; }
.dr-sev.Critical { background: var(--crit-bg); color: var(--crit); }
.dr-sev.Warning { background: var(--warn-bg); color: var(--amber); }
.dr-sev.Info { background: var(--info-bg); color: var(--info); }

/* ============================ OVERLAY / TOAST ============================ */
.run-overlay { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; background: rgba(7, 10, 14, 0.78); backdrop-filter: blur(6px); animation: fade .2s; }
.run-overlay-card { background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r-lg); padding: 38px 52px; text-align: center; position: relative; overflow: hidden; box-shadow: var(--shadow-lg); }
.scanline { position: absolute; top: 0; left: 0; right: 0; height: 2px; background: linear-gradient(90deg, transparent, var(--amber), transparent); animation: scan 1.3s ease-in-out infinite; }
.run-overlay-title { font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.run-overlay-sub { font-family: var(--font-mono); font-size: 12.5px; color: var(--amber); letter-spacing: .02em; }

.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); z-index: 90; background: var(--ink-700); border: 1px solid var(--line-3); border-radius: var(--r); padding: 13px 20px; font-size: 13.5px; box-shadow: var(--shadow); animation: toastin .3s ease; max-width: 90vw; }
.toast.err { border-color: var(--crit); color: var(--crit); }
.toast.ok { border-color: var(--ok); color: var(--ok); }

/* ============================ ANIMATIONS ============================ */
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slidein { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: none; } }
@keyframes slidedrawer { from { transform: translateX(100%); } to { transform: none; } }
@keyframes scan { 0%,100% { transform: translateX(-100%); } 50% { transform: translateX(100%); } }
@keyframes toastin { from { opacity: 0; transform: translate(-50%, 14px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes spin { to { transform: rotate(360deg); } }
.spinning { animation: spin 1s linear infinite; }

/* ============================ TRIAGE + FILTERS ============================ */
.flags-toolbar { display: flex; flex-direction: column; align-items: stretch; gap: 0; padding: 0; }
/* align-items MUST be stretch: an inherited `center` from the old single-row
   rule shrink-wrapped every row to its content and centred it, which is what
   produced the stray gaps and made the rows wrap far too early. */
.tb-row { display: flex; align-items: center; gap: 12px 16px; padding: 11px 16px; flex-wrap: wrap; }
.tb-row2 { border-top: 1px solid var(--line); }
.tb-select { width: auto; font-family: var(--font-sans); font-size: 12.5px; padding: 8px 30px 8px 12px; color: var(--fg-dim); background-color: var(--ink-850); }
.tb-check { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--fg-dim); cursor: pointer; user-select: none; }
.tb-check input { width: 15px; height: 15px; accent-color: var(--amber); cursor: pointer; }
.seg.sm button { padding: 5px 10px; font-size: 12px; }
.review-progress { margin-left: auto; font-family: var(--font-mono); font-size: 12px; color: var(--fg-mut); white-space: nowrap; }
.review-progress b { color: var(--fg); font-weight: 600; }
.rep-n { font-family: var(--font-mono); }

.c-review { width: 98px; }
.td-review, .flags-table th.c-review { padding: 8px 16px 8px 14px !important; }
.rev-actions { display: inline-flex; gap: 4px; }
.rev-btn { width: 24px; height: 24px; border-radius: 5px; border: 1px solid var(--line-2); background: var(--ink-850); color: var(--fg-mut); font-size: 12px; cursor: pointer; transition: .12s; display: inline-flex; align-items: center; justify-content: center; line-height: 1; }
.rev-btn:hover { border-color: var(--line-3); color: var(--fg); }
.rev-btn.approved.on { background: rgba(61, 220, 143, .18); border-color: var(--ok); color: var(--ok); }
.rev-btn.investigate.on { background: var(--warn-bg); border-color: var(--amber); color: var(--amber); }
.rev-btn.rejected.on { background: rgba(255, 93, 108, .16); border-color: var(--crit); color: var(--crit); }

.flags-table tbody tr.rev-approved { background: rgba(61, 220, 143, .05); }
.flags-table tbody tr.rev-approved td.c-sev { box-shadow: inset 3px 0 0 var(--ok); }
.flags-table tbody tr.rev-rejected { opacity: .48; }
.flags-table tbody tr.rev-rejected td.c-sev { box-shadow: inset 3px 0 0 var(--crit); }
.flags-table tbody tr.rev-investigate td.c-sev { box-shadow: inset 3px 0 0 var(--amber); }

.dr-review { background: var(--raised); padding: 14px; border-radius: var(--r-sm); border-left: 2px solid var(--amber); }
.dr-rev-btns { display: flex; gap: 8px; }
.dr-rev-btn { flex: 1; padding: 9px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--ink-850); color: var(--fg-dim); font-family: var(--font-sans); font-size: 13px; font-weight: 600; cursor: pointer; transition: .14s; }
.dr-rev-btn:hover { border-color: var(--line-3); color: var(--fg); }
.dr-rev-btn.approved.on { background: rgba(61, 220, 143, .16); border-color: var(--ok); color: var(--ok); }
.dr-rev-btn.investigate.on { background: var(--warn-bg); border-color: var(--amber); color: var(--amber); }
.dr-rev-btn.rejected.on { background: rgba(255, 93, 108, .14); border-color: var(--crit); color: var(--crit); }
.dr-note { width: 100%; margin-top: 10px; min-height: 54px; resize: vertical; font-family: var(--font-sans); font-size: 13px; color: var(--fg); background: var(--ink-850); border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 9px 11px; }
.dr-note:focus { outline: none; border-color: var(--amber); box-shadow: 0 0 0 3px var(--amber-glow); }
.dr-rev-meta { margin-top: 8px; font-family: var(--font-mono); font-size: 10.5px; color: var(--fg-mut); }

.spark { width: 100%; height: 64px; display: block; background: var(--ink-900); border: 1px solid var(--line); border-radius: var(--r-sm); }
.spark-line { fill: none; stroke: var(--amber); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.spark-zero { stroke: var(--line-2); stroke-width: 1; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.spark-mark { fill: var(--amber); stroke: var(--ink-900); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.spark-cap { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 10px; color: var(--fg-mut); margin-top: 4px; }

/* ============================ TILES (records/days) ============================ */
.check-tile { flex-direction: column; align-items: stretch; gap: 6px; }
.ct-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.ct-name { font-size: 12.5px; font-weight: 600; line-height: 1.3; color: var(--fg); }
.check-tile.zero .ct-name { color: var(--fg-dim); }
.ct-src { font-family: var(--font-mono); font-size: 9.5px; color: var(--fg-mut); letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; }
.ct-stats { font-family: var(--font-mono); font-size: 12px; color: var(--fg-dim); }
.ct-stats b { color: var(--amber); font-weight: 600; }
.check-tile.zero .ct-stats b { color: var(--fg-mut); }

/* ============================ BY-RECORD VIEW ============================ */
.view-switch { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.view-switch .sort-group { margin-left: auto; }      /* right-hand cluster, away from the view buttons */
.view-switch .flags-count { margin-left: 14px; }
.view-switch button { background: var(--ink-850); border: 1px solid var(--line); color: var(--fg-mut); font-family: var(--font-sans); font-size: 13px; font-weight: 600; padding: 8px 16px; border-radius: var(--r-sm); cursor: pointer; transition: .15s; }
.view-switch button:hover { color: var(--fg-dim); }
.view-switch button.active { background: var(--amber); color: #2a1c02; border-color: var(--amber); }

.br-intro { font-size: 12.5px; color: var(--fg-mut); padding: 13px 16px; border-bottom: 1px solid var(--line); line-height: 1.5; }
.br-bucket { border-bottom: 1px solid var(--line); }
.br-bar { width: 100%; display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: transparent; border: none; cursor: pointer; color: var(--fg); text-align: left; transition: background .12s; }
.br-bar:hover { background: var(--raised); }
.br-caret { font-size: 10px; color: var(--fg-mut); transition: transform .15s; flex-shrink: 0; width: 10px; display: inline-block; }
.br-bucket.open > .br-bar .br-caret, .br-comp.open > .br-comp-head .br-caret { transform: rotate(90deg); }
.br-bar-label { font-size: 14px; white-space: nowrap; }
.br-bar-label b { color: var(--amber); font-weight: 700; }
.br-bar-track { flex: 1; height: 8px; background: var(--ink-850); border-radius: 100px; overflow: hidden; min-width: 50px; }
.br-bar-fill { display: block; height: 100%; background: var(--amber); border-radius: 100px; }
.br-bar-stat { font-family: var(--font-mono); font-size: 12.5px; color: var(--fg-dim); white-space: nowrap; }
.br-bar-stat b { color: var(--fg); font-weight: 600; }
.br-bucket-body { background: var(--ink-900); }

.br-comp { border-top: 1px solid var(--line); }
.br-comp-head { display: flex; align-items: center; gap: 12px; padding: 10px 16px 10px 30px; cursor: pointer; transition: background .12s; }
.br-comp-head:hover { background: var(--raised); }
.br-uwi { font-family: var(--font-mono); font-size: 12.5px; color: var(--amber-2); white-space: nowrap; }
.br-fac { font-size: 12px; color: var(--fg-mut); flex: 1; min-width: 40px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.br-badges { display: inline-flex; gap: 3px; flex-shrink: 0; }
.br-badge { width: 17px; height: 17px; border-radius: 4px; font-family: var(--font-mono); font-size: 10px; display: inline-flex; align-items: center; justify-content: center; background: var(--ink-700); color: var(--fg-faint); }
.br-badge.on { background: var(--warn-bg); color: var(--amber); font-weight: 600; }
.br-days { font-family: var(--font-mono); font-size: 11.5px; color: var(--fg-mut); white-space: nowrap; flex-shrink: 0; }
.br-rev { font-family: var(--font-mono); font-size: 11px; color: var(--fg-mut); background: var(--ink-800); padding: 2px 8px; border-radius: 100px; flex-shrink: 0; }
.br-rev.done { color: var(--ok); background: rgba(61, 220, 143, .12); }

.br-days-detail { background: var(--ink-850); padding: 2px 16px 10px 30px; }
.br-day { display: flex; gap: 12px; padding: 7px 0; border-top: 1px solid var(--line); }
.br-day-date { font-family: var(--font-mono); font-size: 11.5px; color: var(--fg-mut); width: 84px; flex-shrink: 0; padding-top: 6px; }
.br-day-flags { flex: 1; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.br-flag { display: flex; align-items: center; gap: 10px; padding: 5px 9px; border-radius: var(--r-sm); background: var(--panel); border: 1px solid var(--line); }
.br-flag.rev-approved { border-color: rgba(61, 220, 143, .4); }
.br-flag.rev-rejected { opacity: .5; }
.br-flag.rev-investigate { border-color: rgba(240, 177, 50, .4); }
.br-flag-chk { font-size: 11.5px; font-weight: 600; color: var(--fg-dim); width: 210px; flex-shrink: 0; }
.br-flag-msg { font-size: 11.5px; color: var(--fg-mut); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.br-flag-actions { display: inline-flex; gap: 4px; flex-shrink: 0; align-items: center; }
.br-open { width: 22px; height: 22px; border-radius: 5px; border: 1px solid var(--line-2); background: var(--ink-850); color: var(--fg-mut); cursor: pointer; font-size: 13px; line-height: 1; }
.br-open:hover { color: var(--fg); border-color: var(--line-3); }

.cfg-empty { grid-column: 1 / -1; background: var(--panel); border: 1px solid var(--line-2);
  border-radius: var(--r-lg); padding: 28px; text-align: center; color: var(--fg-dim); font-size: 14px; }
.cfg-empty b { color: var(--fg); }
.cfg-empty p { margin-bottom: 10px; }

/* ---- flag→row tint palette (day view): one hue per flag, cycled ---- */
.hl-0 { --hl: 240, 177, 50; }    /* amber  */
.hl-1 { --hl: 255, 93, 108; }    /* coral  */
.hl-2 { --hl: 88, 166, 255; }    /* blue   */
.hl-3 { --hl: 61, 220, 143; }    /* green  */
.hl-4 { --hl: 167, 139, 250; }   /* violet */
.wd-table tr.wd-hl { background: rgba(var(--hl), .10); }
.wd-table tr.wd-hl .wd-col { box-shadow: inset 3px 0 0 rgba(var(--hl), .85); font-weight: 500; color: var(--fg); }
.wd-table tr.wd-hl .wd-val { color: rgb(var(--hl)); font-weight: 600; }
.wd-chip { display: inline-block; width: 7px; height: 7px; border-radius: 2px; margin-right: 7px;
  background: rgb(var(--hl)); vertical-align: middle; }
.wv-flag[class*="hl-"] { border-left: 3px solid rgb(var(--hl)); }

/* ---- immateriality cutoff (client-side, applied without a re-run) ---- */
.tb-dust { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.tb-dust .tb-check { white-space: nowrap; }
.tb-hint { font-family: var(--font-mono); font-size: 11px; color: var(--fg-mut); white-space: nowrap; }
.tb-hint.active { color: var(--amber); }
/* `input[type=number]` is a type+attribute selector and outranks a bare class,
   so the global width:100% was stretching this box across the row. */
input[type=number].tb-num { width: 86px; font-family: var(--font-mono); font-size: 12px; padding: 6px 8px; }
.tb-unit { font-family: var(--font-mono); font-size: 11px; color: var(--fg-mut); }

/* ---- carried-over review decisions notice ---- */
.carryover {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: var(--info-bg); border: 1px solid rgba(88, 166, 255, .3);
  border-radius: var(--r); padding: 12px 16px; margin-bottom: 18px;
}
.co-text { font-size: 12.5px; color: var(--fg-dim); line-height: 1.55; flex: 1; min-width: 240px; }
.co-text b { color: var(--info); font-weight: 600; }
.carryover .btn-ghost-line { flex-shrink: 0; }

/* ============================ TABLE DENSITY ============================
   Rows were growing to 8 lines tall because Facility and Finding wrapped, which
   pushed the Review actions out of view and forced a horizontal scroll. Fixed
   column widths + single-line truncation keep every row one or two lines, so
   Review is always reachable. Full text stays available via title tooltips and
   the detail drawer. */
.flags-table { table-layout: fixed; min-width: 900px; }
.flags-table th, .flags-table td { overflow: hidden; }
.c-sev    { width: 30px; }
.c-check  { width: 142px; }
.c-fac    { width: 142px; }
.c-uwi    { width: 268px; }   /* full UWI + PL badge + copy + open-well button */
.c-date   { width: 104px; }   /* must fit a full YYYY-MM-DD without clipping */
.c-review { width: 114px; }   /* 3 x 24px buttons + gaps + real side padding */
.flags-table.hide-check .c-check, .flags-table.hide-check .td-check { display: none; }

/* Text columns WRAP rather than truncate: the facility name and the finding
   must both be fully readable, and a taller row is an acceptable trade. Only
   the identifier and date columns stay on one line (they are fixed-width and
   sized never to clip). */
.td-check, .td-fac, .td-msg { max-width: none; white-space: normal; overflow-wrap: anywhere; }
.td-date { white-space: nowrap; }
/* The severity dot needs real content width — with table-layout:fixed the
   default 14px side padding left only 2px and clipped it entirely. */
.flags-table td.c-sev, .flags-table th.c-sev { padding: 11px 0 11px 12px; }

/* Identifier cell: UWI (+ PL badge) on the left, actions pinned to the RIGHT
   edge with margin-left:auto so the open-well button sits at the same x on
   every row. No ellipsis here — an ellipsis was swallowing the button on rows
   whose UWI carried a PL badge. */
.td-uwi { white-space: nowrap; text-overflow: clip; display: flex; align-items: center; gap: 4px; }
.td-uwi .uwi { flex: 0 0 auto; }
.td-acts { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; flex: 0 0 auto; }
/* Review actions pinned to the right edge so they survive any narrow viewport.
   The sticky cell needs an OPAQUE background (otherwise scrolled-under text
   bleeds through), which would clip the row-state tint at the column edge — so
   each row state re-composites its own tint over that opaque base. */
.c-review, .td-review { position: sticky; right: 0; background: var(--panel); }
.flags-table thead th.c-review { background: var(--ink-800); z-index: 3; }
.flags-table tbody tr.rev-approved .td-review {
  background: linear-gradient(rgba(61, 220, 143, .05), rgba(61, 220, 143, .05)), var(--panel);
}
.flags-table tbody tr:hover .td-review { background: var(--raised); }
.flags-table tbody tr.rev-approved:hover .td-review {
  background: linear-gradient(rgba(61, 220, 143, .05), rgba(61, 220, 143, .05)), var(--raised);
}

/* ============================ UWI EMPHASIS ============================ */
.uwi-dim  { color: var(--fg-faint); }
.uwi-core { color: var(--amber-2); }
.uwi-sig  { color: var(--amber); font-weight: 600; }   /* non-default LE / event = distinguishing */

/* ============================ COPY / INLINE BUTTONS ============================ */
.copy-btn, .open-well-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 4px; flex-shrink: 0;
  border: 1px solid transparent; background: transparent; color: var(--fg-faint);
  cursor: pointer; transition: .12s; vertical-align: middle; margin-left: 5px; padding: 0;
}
.copy-btn .ico, .open-well-btn .ico { width: 12px; height: 12px; }
.copy-btn:hover { color: var(--amber); border-color: var(--line-2); background: var(--ink-800); }
.copy-btn.copied { color: var(--ok); border-color: var(--ok); }
.copy-btn.copy-failed { color: var(--crit); border-color: var(--crit); }
/* The well-view jump is a primary action, so it stays visible and amber rather
   than hiding until hover like the copy buttons do. */
.open-well-btn { color: var(--amber); border-color: rgba(240, 177, 50, .35); background: var(--amber-glow); }
.open-well-btn .ico { width: 13px; height: 13px; }
.open-well-btn:hover { background: var(--amber); border-color: var(--amber); color: #2a1c02; }
.td-inline-btns, .br-inline-btns { display: inline-flex; opacity: 0; transition: opacity .12s; }
.flags-table tbody tr:hover .td-inline-btns, .br-comp-head:hover .br-inline-btns,
.td-inline-btns:focus-within, .br-inline-btns:focus-within { opacity: 1; }
.sort-label { font-size: 12px; color: var(--fg-mut); white-space: nowrap; }
.td-fac .copy-btn { opacity: 0; }
.flags-table tbody tr:hover .td-fac .copy-btn { opacity: 1; }
.dr-kv dd { display: flex; align-items: center; gap: 2px; }

/* ============================ SORT CONTROLS ============================ */
.sort-group { display: inline-flex; align-items: center; gap: 5px; }
.sort-dir { width: 30px; height: 34px; font-family: var(--font-mono); font-size: 13px; }
.sort-dir:disabled { opacity: .35; cursor: not-allowed; }
.flags-table thead th[data-sort] { cursor: pointer; user-select: none; }
.th-or { color: var(--fg-faint); font-weight: 400; text-transform: lowercase; letter-spacing: 0; }
.flags-table thead th[data-sort]:hover { color: var(--fg-dim); }
.flags-table thead th.sorted { color: var(--amber); }
.flags-table thead th.sorted::after { content: " ↑"; font-family: var(--font-mono); }
.flags-table thead th.sorted[data-dir="desc"]::after { content: " ↓"; }
.search-lg { min-width: 320px; }
.search-lg input { height: 44px; font-size: 14px; }
.br-toolbar { display: flex; align-items: center; gap: 16px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.br-toolbar .br-intro { padding: 0; border: none; flex: 1; min-width: 240px; }
.br-intro b { color: var(--fg-dim); }
.br-why { display: block; margin-top: 5px; font-size: 11.5px; color: var(--fg-faint); line-height: 1.5; }
.br-why b { color: var(--fg-mut); }
.br-sort { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--fg-mut); white-space: nowrap; }

/* ============================ WELL VIEW ============================ */
.well-find { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.well-find .search { flex: 1; min-width: 300px; }
.well-count { font-family: var(--font-mono); font-size: 12px; color: var(--fg-mut); }
.well-layout { display: grid; grid-template-columns: 288px minmax(0, 1fr); gap: 18px; align-items: start; }
.well-list { background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r-lg); overflow: hidden; max-height: 74vh; overflow-y: auto; }
/* Completion picker: the flag count is the scannable signal, so it sits on the
   right as a red pill; rows with no flags recede rather than competing. */
.wl-item { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 12px 9px 14px; background: transparent; border: none; border-bottom: 1px solid var(--line); cursor: pointer; text-align: left; }
.wl-item:hover { background: var(--raised); }
.wl-item.on { background: var(--amber-glow); box-shadow: inset 3px 0 0 var(--amber); }
.wl-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.wl-uwi { font-family: var(--font-mono); font-size: 12px; color: var(--amber-2); }
.wl-fac { font-size: 11px; color: var(--fg-mut); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.wl-flags { font-family: var(--font-mono); font-size: 10px; color: var(--fg-faint); flex-shrink: 0;
  min-width: 22px; text-align: center; }
.wl-flags.has { font-size: 11.5px; font-weight: 600; color: var(--crit); background: var(--crit-bg);
  border: 1px solid rgba(255, 93, 108, .35); border-radius: 100px; padding: 2px 8px; }
/* clean completions: present but deliberately quiet */
.wl-item.clean .wl-uwi { color: var(--fg-mut); }
.wl-item.clean .wl-uwi .uwi-core { color: var(--fg-dim); }
.wl-item.clean .wl-uwi .uwi-dim, .wl-item.clean .wl-uwi .uwi-sig { color: var(--fg-faint); font-weight: 400; }
.wl-item.clean .wl-fac { color: var(--fg-faint); }
.wl-empty, .wl-hint { padding: 22px 16px; font-size: 13px; color: var(--fg-mut); line-height: 1.6; }
.well-main { background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r-lg); min-height: 320px; }

.wv-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 18px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.wv-uwi { font-family: var(--font-mono); font-size: 17px; color: var(--amber-2); display: flex; align-items: center; }
.wv-fac { font-size: 13px; color: var(--fg-mut); margin-top: 4px; display: flex; align-items: center; }
.wv-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.wv-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 1px; background: var(--line); border-bottom: 1px solid var(--line); }
.wv-stats > div { background: var(--panel); padding: 12px 16px; }
.wv-stats b { display: block; font-family: var(--font-mono); font-size: 19px; color: var(--fg); }
.wv-stats b.warn { color: var(--amber); } .wv-stats b.ok { color: var(--ok); }
.wv-stats span { font-size: 10.5px; color: var(--fg-mut); }
/* Two columns x two rows for the four month charts, a little taller. */
.wv-charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 22px; padding: 18px 20px; }
.wv-chart .spark { height: 108px; cursor: crosshair; }
.hv-cursor { stroke: var(--amber-2); stroke-width: 1; vector-effect: non-scaling-stroke; opacity: .9; pointer-events: none; }
.wv-cv.live { color: var(--amber-2); }
.wv-flag { cursor: default; }
.wv-chart h4 { font-size: 11.5px; color: var(--fg-dim); margin-bottom: 7px; display: flex; justify-content: space-between; }
.wv-chart h4 span { font-family: var(--font-mono); color: var(--fg-mut); font-weight: 400; }
.wv-note { padding: 0 20px 16px; font-size: 12px; color: var(--fg-mut); }
.wv-note b { color: var(--fg-dim); }

.wv-flags { padding: 16px 20px; border-top: 1px solid var(--line); }
.wv-flags h4 { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--fg-mut); margin-bottom: 10px; }
.wv-flags h4 span { color: var(--amber); font-family: var(--font-mono); }
.wv-flag { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--r-sm); background: var(--ink-850); border: 1px solid var(--line); margin-bottom: 5px; flex-wrap: wrap; }
.wv-flag.rev-approved { border-color: rgba(61, 220, 143, .4); }
.wv-flag.rev-rejected { opacity: .5; }
.wv-flag.rev-investigate { border-color: rgba(240, 177, 50, .4); }
.wv-f-chk { font-size: 11.5px; font-weight: 600; color: var(--fg-dim); min-width: 190px; }
.wv-f-msg { font-size: 11.5px; color: var(--fg-mut); flex: 1; min-width: 120px; }
.wv-f-date { font-family: var(--font-mono); font-size: 11px; color: var(--fg-mut); }
.wv-f-act { display: inline-flex; gap: 4px; align-items: center; margin-left: auto; }
.wd-jump { font-family: var(--font-mono); font-size: 11px; color: var(--amber-2); background: var(--ink-800); border: 1px solid var(--line-2); border-radius: 4px; padding: 2px 7px; cursor: pointer; white-space: nowrap; }
.wd-jump:hover { border-color: var(--amber); background: var(--amber-glow); color: var(--amber); }
.dr-open-well { width: 100%; justify-content: center; margin-top: 10px; }

.wd-nav { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.wd-nav .tb-select { width: auto; }
.wd-pos { font-family: var(--font-mono); font-size: 11.5px; color: var(--fg-mut); }
.wd-badge { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--fg-mut); background: var(--ink-800); padding: 3px 10px; border-radius: 100px; }
.wd-badge.has { color: var(--amber); background: var(--warn-bg); }
.wd-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0; }
.wd-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.wd-table td { padding: 6px 20px; border-bottom: 1px solid var(--line); }
.wd-col { color: var(--fg-mut); }
.wd-val { font-family: var(--font-mono); text-align: right; color: var(--fg); }
.wd-val.neg { color: var(--crit); }
.wd-val.blank { color: var(--fg-faint); }
.wd-side { border-left: 1px solid var(--line); }
.wd-side .wv-flags { border-top: none; }
.spark-cursor { stroke: var(--amber); stroke-width: 1; stroke-dasharray: 2 2; opacity: .6; vector-effect: non-scaling-stroke; }

/* ============================ RESPONSIVE ============================ */
@media (max-width: 860px) { .wv-charts { grid-template-columns: 1fr; } }
@media (max-width: 980px) {
  .signin { grid-template-columns: 1fr; }
  .signin-aside { display: none; }
  .dropzones { grid-template-columns: 1fr; }
  .results-body { grid-template-columns: 1fr; }
  .check-tiles { position: static; flex-direction: row; overflow-x: auto; padding-bottom: 6px; }
  .check-tile { flex-shrink: 0; min-width: 200px; }
  .stepper { display: none; }
  .well-layout { grid-template-columns: 1fr; }
  .well-list { max-height: 240px; }
  .wd-grid { grid-template-columns: 1fr; }
  .wd-side { border-left: none; border-top: 1px solid var(--line); }
}
@media (max-width: 620px) {
  .pane-head { flex-direction: column; align-items: flex-start; }
  .td-fac, .td-msg { max-width: 140px; }
}
