/* =========================================================
   SCREENS — a2o-accurate
   Rules applied everywhere:
   · No shadow. No filled card. Structure = 1px hairline only.
   · Numerals are huge and extended (the a2o data voice).
   · Labels are 10px uppercase, tracked +0.12em.
   · Generous air: 40~72px between blocks, never 16px.
   ========================================================= */

/* ---------------- shared page header ---------------- */
.header-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 40px;
  padding-bottom: 44px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0;
}
.header-row > div:first-child {
  min-width: 0;
}
.header-row .h1 {
  font-size: clamp(40px, 5.4vw, 78px);
  font-weight: 900;
  line-height: 0.97;
  letter-spacing: 0.001em;
  color: var(--ink);
}
/* a2o is monochrome: the accent word stays ink, never green */
.header-row .h1 .hl {
  color: inherit;
}
.header-row .sub {
  margin-top: 18px;
  max-width: 62ch;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.65;
  color: var(--ink-3);
}
.header-row .sub b {
  color: var(--ink);
  font-weight: 800;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  padding-bottom: 4px;
}
.date-pick {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-3);
  white-space: nowrap;
}
.date-pick svg {
  width: 13px;
  height: 13px;
}
.date-pick b {
  color: var(--ink);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* =========================================================
   DIAGNOSE
   ========================================================= */
.work-grid {
  display: grid;
  grid-template-columns: 396px minmax(0, 1fr);
  gap: 0;
  align-items: start;
}
/* the left panel is a column fenced by a vertical rule — that IS the
   a2o 2-column device, not a floating box */
.panel {
  position: sticky;
  top: calc(var(--hdr) + 28px);
  max-height: calc(100vh - var(--hdr) - 56px);
  display: flex;
  flex-direction: column;
  padding-right: 40px;
  border-right: 1px solid var(--line);
}
.panel-head {
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line-2);
}
.panel-head-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
}
.panel-eyebrow {
  display: block;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 800;
  font-variation-settings: 'wdth' 122, 'wght' 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-4);
  margin-bottom: 8px;
}
.panel-title {
  font-size: 21px;
  font-weight: 900;
  letter-spacing: 0.004em;
  line-height: 1.15;
  color: var(--ink);
}
.panel-meta {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.panel-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 22px 0 8px;
  margin-right: -8px;
  padding-right: 8px;
}
.panel-foot {
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.meta-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-4);
  margin-bottom: 14px;
  letter-spacing: 0.01em;
}
.meta-line b {
  font-family: var(--font-display);
  font-variation-settings: 'wdth' 112, 'wght' 800;
  font-size: 13px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* progress = a 2px rule, a2o style */
.progress-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.progress-bar {
  position: relative;
  flex: 1 1 auto;
  height: 2px;
  background: var(--line);
  overflow: hidden;
}
.progress-bar > span {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--ink);
  transition: width 0.4s var(--ease);
}
.progress-txt {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  font-variation-settings: 'wdth' 112, 'wght' 800;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  letter-spacing: 0.02em;
  min-width: 30px;
  text-align: right;
}

/* category accordion — hairlines only */
.cat {
  border-bottom: 1px solid var(--line-2);
}
.cat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 18px 0;
  text-align: left;
  color: var(--ink);
}
.cat-name {
  flex: 1 1 auto;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.005em;
}
.cat-count {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  font-variation-settings: 'wdth' 112, 'wght' 800;
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
  letter-spacing: 0.02em;
}
.cat-count b {
  color: var(--ink-4);
  font-weight: 700;
}
.cat-chev {
  width: 14px;
  height: 14px;
  color: var(--ink-4);
  flex: 0 0 14px;
  transition: transform 0.24s var(--ease);
}
.cat.collapsed .cat-chev {
  transform: rotate(-90deg);
}
.cat.collapsed .cat-body {
  display: none;
}
.cat-body {
  padding-bottom: 8px;
}
.cat.done .cat-name::after {
  content: '';
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  margin-left: 7px;
  vertical-align: middle;
}

/* question */
.q {
  padding: 16px 0 18px;
  border-top: 1px solid var(--line-2);
}
.q-top {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-bottom: 12px;
}
.q-idx {
  flex: 0 0 auto;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 800;
  font-variation-settings: 'wdth' 112, 'wght' 800;
  font-variant-numeric: tabular-nums;
  color: var(--ink-4);
  padding-top: 2px;
  letter-spacing: 0.04em;
}
.q-text {
  flex: 1 1 auto;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.55;
  letter-spacing: -0.004em;
  color: var(--ink-2);
}
.q-hi {
  flex: 0 0 auto;
  height: 18px;
  padding: 0 7px;
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-full);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.05em;
  font-family: var(--font-display);
  font-variation-settings: 'wdth' 108, 'wght' 800;
}
.q-choices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 10px;
}
.choice {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--ink-3);
  transition: background 0.16s var(--ease), border-color 0.16s var(--ease),
    color 0.16s var(--ease);
}
.choice:hover {
  border-color: var(--ink);
  color: var(--ink);
}
.choice.on {
  color: #fff;
  border-color: transparent;
  font-weight: 800;
}
.choice.on[data-v='yes'] {
  background: var(--accent);
}
.choice.on[data-v='no'] {
  background: var(--danger);
}
.choice.on[data-v='na'] {
  background: var(--ink);
}
:root[data-theme='dark'] .choice.on[data-v='yes'] {
  color: #04120a;
}
:root[data-theme='dark'] .choice.on[data-v='na'] {
  color: #0a0a0a;
}
.q-note {
  height: 34px;
  font-size: 12px;
  border-radius: var(--radius-lg);
}

/* =========================================================
   RESULT
   ========================================================= */
.result-col {
  padding-left: 40px;
  min-width: 0;
}
#result-content {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* placeholder */
.placeholder-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 60px 0 40px;
}
.ph-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  color: var(--ink-3);
  margin-bottom: 34px;
}
.ph-icon svg {
  width: 21px;
  height: 21px;
}
.ph-title {
  font-size: clamp(24px, 2.6vw, 34px);
  font-weight: 900;
  letter-spacing: 0.004em;
  line-height: 1.14;
  color: var(--ink);
  margin-bottom: 16px;
}
.ph-desc {
  font-size: 14.5px;
  font-weight: 500;
  line-height: 1.7;
  color: var(--ink-3);
  max-width: 52ch;
}
.ph-desc b {
  color: var(--ink);
  font-weight: 800;
}
.ph-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  width: 100%;
  margin-top: 52px;
  border-top: 1px solid var(--line);
}
.ph-step {
  padding: 26px 28px 0 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.ph-step + .ph-step {
  border-left: 1px solid var(--line);
  padding-left: 28px;
}
.ph-step .n {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  font-variation-settings: 'wdth' 122, 'wght' 800;
  letter-spacing: 0.16em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.ph-step b {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.005em;
  color: var(--ink);
}
.ph-step span {
  font-size: 12px;
  font-weight: 500;
  line-height: 1.6;
  color: var(--ink-4);
}

/* --------- KPI row: bare numerals split by hairlines --------- */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin-top: 64px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-bottom: 0;
}
.kpi {
  position: relative;
  padding: 42px 30px 40px 0;
  min-width: 0;
}
.kpi + .kpi {
  border-left: 1px solid var(--line);
  padding-left: 30px;
}
.kpi .label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 800;
  font-variation-settings: 'wdth' 112, 'wght' 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-4);
  margin-bottom: 16px;
  white-space: nowrap;
}
.kdot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ink-4);
  flex: 0 0 5px;
}
.kdot.danger {
  background: var(--danger);
}
.kdot.warn {
  background: var(--warn);
}
.kdot.info {
  background: var(--info);
}
.kpi .val {
  display: flex;
  align-items: baseline;
  gap: 5px;
  font-family: var(--font-display);
  font-size: clamp(42px, 4.4vw, 62px);
  font-weight: 800;
  font-variation-settings: 'wdth' 118, 'wght' 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  line-height: 1;
  color: var(--ink);
}
.kpi .val .unit {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--ink-4);
  font-variation-settings: normal;
}
.kpi .delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-top: 14px;
  height: 21px;
  padding: 0 8px;
  border-radius: var(--radius-full);
  font-family: var(--font-display);
  font-size: 10.5px;
  font-weight: 800;
  font-variation-settings: 'wdth' 108, 'wght' 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.kpi .delta svg {
  width: 10px;
  height: 10px;
}
.kpi .delta.up {
  background: var(--pos-soft);
  color: var(--accent-ink);
}
.kpi .delta.down {
  background: var(--danger-soft);
  color: var(--danger);
}
.kpi .compare {
  display: inline-block;
  margin-left: 7px;
  font-size: 10.5px;
  font-weight: 500;
  color: var(--ink-4);
  letter-spacing: 0;
}
.kpi .spark {
  position: absolute;
  right: 22px;
  bottom: 32px;
  opacity: 0.5;
  width: 74px;
  height: 26px;
}
.spark svg {
  width: 100%;
  height: 100%;
}

/* --------- summary bar --------- */
.summary-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 26px 0;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.sb-left {
  display: flex;
  align-items: center;
  gap: 26px;
  min-width: 0;
}
.sb-total {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding-right: 26px;
  border-right: 1px solid var(--line);
  flex: 0 0 auto;
}
.sb-total .n {
  font-family: var(--font-display);
  font-size: 42px;
  font-weight: 800;
  font-variation-settings: 'wdth' 116, 'wght' 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: var(--ink);
}
.sb-total .t {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-4);
  letter-spacing: 0.02em;
}
.sb-time {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  font-variation-settings: 'wdth' 108, 'wght' 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
  color: var(--ink-4);
}
.risk-box {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 11px 18px;
  border-radius: var(--radius-full);
  flex: 0 0 auto;
}
.risk-box svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}
.risk-box .txt {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.risk-box .txt b {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.risk-box .txt span {
  font-size: 10.5px;
  font-weight: 600;
  opacity: 0.78;
  white-space: nowrap;
}
.risk-box.high {
  background: var(--danger-soft);
  color: var(--danger);
}
.risk-box.mid {
  background: var(--warn-soft);
  color: var(--warn);
}
.risk-box.low {
  background: var(--pos-soft);
  color: var(--accent-ink);
}
.sb-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.sb-right .btn {
  border-color: var(--line);
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--ink-2);
}
.sb-right .btn:hover {
  border-color: var(--ink);
  color: var(--ink);
}

/* --------- toolbar --------- */
.result-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.filters {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.filters .chip {
  cursor: pointer;
  height: 32px;
  padding: 0 13px;
  font-size: 12px;
  font-weight: 700;
  background: transparent;
  transition: background 0.16s var(--ease), border-color 0.16s var(--ease),
    color 0.16s var(--ease);
}
.filters .chip .n {
  font-family: var(--font-display);
  font-size: 10.5px;
  font-weight: 800;
  font-variation-settings: 'wdth' 108, 'wght' 800;
  font-variant-numeric: tabular-nums;
  color: var(--ink-4);
}
.filters .chip:hover {
  border-color: var(--ink);
}
.filters .chip.on {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}
.filters .chip.on .n {
  color: var(--bg);
  opacity: 0.65;
}

/* --------- verdict marks --------- */
.mk {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  font-variation-settings: 'wdth' 108, 'wght' 800;
  letter-spacing: 0.02em;
  border-radius: 5px;
  font-variant-numeric: tabular-nums;
}
.mk.x,
.mk.tri,
.mk.o {
  min-width: 20px;
  height: 19px;
  padding: 0 5px;
}
.mk.x,
.mark-x {
  background: var(--danger-soft);
  color: var(--danger);
}
.mk.tri,
.mark-tri {
  background: var(--warn-soft);
  color: var(--warn);
}
.mk.o,
.mark-o {
  background: var(--pos-soft);
  color: var(--accent-ink);
}
.cell-counts {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* --------- result rows (table view) --------- */
.result-list {
  display: flex;
  flex-direction: column;
}
/* NOTE: the markup for a row is
     .ritem > .ritem-head( .ritem-mark | .ritem-main | .ritem-tags ) + .ritem-body
   so `.ritem` must NOT be a 2-column grid — that put the whole head
   (question + tag) into the 40px marker column and squeezed the Korean
   text into one character per line. The head owns the columns instead. */
.ritem {
  padding: 24px 0;
  border-bottom: 1px solid var(--line-2);
}
.ritem-head {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  column-gap: 18px;
  align-items: start;
}
.ritem-mark {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-lg);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 800;
  font-variation-settings: 'wdth' 108, 'wght' 800;
}
.ritem-main {
  min-width: 0;
}
.ritem-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 9px;
}
.ritem-q {
  font-size: 14.5px;
  font-weight: 800;
  line-height: 1.5;
  letter-spacing: -0.006em;
  color: var(--ink);
  flex: 1 1 auto;
}
.ritem-cat {
  display: block;
  font-family: var(--font-display);
  font-size: 9.5px;
  font-weight: 800;
  font-variation-settings: 'wdth' 112, 'wght' 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-4);
  margin-bottom: 6px;
}
.ritem-tags {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
}
.ritem-row {
  display: flex;
  gap: 10px;
  margin-top: 9px;
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--ink-3);
  font-weight: 500;
}
.ritem-row .k {
  flex: 0 0 52px;
  font-family: var(--font-display);
  font-size: 9.5px;
  font-weight: 800;
  font-variation-settings: 'wdth' 112, 'wght' 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-4);
  padding-top: 3px;
}
.ritem-row .v {
  flex: 1 1 auto;
  min-width: 0;
}
.ritem-body {
  margin-top: 14px;
  /* align the 근거/개선 block under the question text, not under the marker */
  padding-left: 52px;
}

/* --------- card view --------- */
.rcard {
  padding: 26px 0;
  border-bottom: 1px solid var(--line-2);
}
.rcard-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.rcard-cat {
  font-family: var(--font-display);
  font-size: 9.5px;
  font-weight: 800;
  font-variation-settings: 'wdth' 112, 'wght' 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-4);
}
.rcard-q {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.5;
  letter-spacing: -0.006em;
  color: var(--ink);
  margin-bottom: 16px;
}
.rcard-body {
  display: grid;
  gap: 11px;
}
#result-list.card-view {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 40px;
}
#result-list.card-view .rcard:nth-child(-n + 2) {
  border-top: 1px solid var(--line-2);
}

/* --------- ER banner: the one full-black moment --------- */
.er-banner {
  position: relative;
  overflow: hidden;
  margin-top: 64px;
  background: #000;
  color: #fff;
  border-radius: var(--radius-xl);
  padding: 52px 56px;
  display: flex;
  justify-content: space-between;
  gap: 48px;
  isolation: isolate;
  min-height: 260px;
  align-items: flex-end;
}
.er-banner::after {
  content: '';
  position: absolute;
  width: 900px;
  height: 900px;
  right: -300px;
  top: -420px;
  background: radial-gradient(
    circle at center,
    rgba(31, 138, 76, 0.46) 0%,
    rgba(31, 138, 76, 0.14) 44%,
    transparent 70%
  );
  z-index: -1;
  pointer-events: none;
}
.er-banner > div:first-child {
  min-width: 0;
  max-width: 66ch;
}
.er-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 26px;
}
.er-badge {
  display: inline-flex;
  align-items: center;
  height: 21px;
  padding: 0 10px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.3);
  font-family: var(--font-display);
  font-size: 9.5px;
  font-weight: 800;
  font-variation-settings: 'wdth' 118, 'wght' 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #fff;
}
.er-badge.dim {
  border-color: rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.42);
}
.er-banner h3 {
  font-size: clamp(22px, 2.4vw, 32px);
  font-weight: 900;
  line-height: 1.24;
  letter-spacing: 0.004em;
  color: #fff;
}
.er-banner h3 em {
  font-style: normal;
  color: #6ee7a2;
}
.er-banner p {
  margin-top: 20px;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.72;
  color: rgba(255, 255, 255, 0.6);
  max-width: 62ch;
}
.er-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 0 0 auto;
  align-items: flex-start;
}
.er-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 14px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: rgba(255, 255, 255, 0.88);
  white-space: nowrap;
}
.er-chip svg {
  width: 12px;
  height: 12px;
  opacity: 0.7;
}

/* =========================================================
   HISTORY
   ========================================================= */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 26px;
  margin-bottom: 0;
  flex-wrap: wrap;
}
.search-box {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 260px;
  max-width: 340px;
}
.search-box > svg {
  position: absolute;
  left: 15px;
  width: 14px;
  height: 14px;
  color: var(--ink-4);
  pointer-events: none;
}
.search-box .input {
  height: 40px;
  padding-left: 38px;
  border-radius: var(--radius-full);
  font-size: 13px;
}
.filter-bar .select {
  height: 40px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  width: auto;
  min-width: 132px;
  background-position: calc(100% - 18px) 17px, calc(100% - 12px) 17px;
  padding-left: 16px;
  padding-right: 34px;
}
.filter-bar .btn {
  height: 40px;
}
.row-link {
  cursor: pointer;
}
td.right,
th.right {
  text-align: right;
}
td.right .icon-btn {
  margin-left: auto;
}

/* =========================================================
   STATS
   ========================================================= */
.stat-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-top: 8px;
}
.stat-card {
  padding: 34px 32px 36px 0;
  min-width: 0;
}
.stat-card + .stat-card {
  border-left: 1px solid var(--line);
  padding-left: 32px;
}
.stat-card:last-child {
  padding-right: 0;
}
.stat-card h3 {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.005em;
  color: var(--ink);
}
.stat-card .card-head {
  margin-bottom: 26px;
  align-items: flex-start;
}
.stat-card-body {
  min-width: 0;
}

/* donut */
.donut-wrap {
  display: flex;
  align-items: center;
  gap: 30px;
  flex-wrap: wrap;
}
.donut {
  position: relative;
  width: 132px;
  height: 132px;
  flex: 0 0 132px;
}
.donut svg {
  transform: rotate(-90deg);
}
.donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.donut-center b {
  font-size: 30px;
  font-weight: 800;
  font-variation-settings: 'wdth' 116, 'wght' 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: var(--ink);
  letter-spacing: 0;
}
.donut-center span {
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 800;
  font-variation-settings: 'wdth' 112, 'wght' 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-4);
}
.legend {
  display: flex;
  flex-direction: column;
  gap: 11px;
  flex: 1 1 110px;
  min-width: 0;
}
.legend-item {
  display: grid;
  grid-template-columns: 7px 1fr auto auto;
  align-items: center;
  gap: 9px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-3);
}
.legend-item .sw {
  width: 7px;
  height: 7px;
  border-radius: 2px;
}
.legend-item .lb {
  color: var(--ink-2);
  font-weight: 700;
}
.legend-item .vl,
.legend-item .pc {
  font-family: var(--font-display);
  font-size: 11.5px;
  font-weight: 800;
  font-variation-settings: 'wdth' 108, 'wght' 800;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  letter-spacing: 0.02em;
  text-align: right;
  min-width: 26px;
}
.legend-item .pc {
  color: var(--ink-4);
  min-width: 34px;
}

/* horizontal bars */
.hbars {
  display: flex;
  flex-direction: column;
  gap: 17px;
}
.hbar-row {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.hbar-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.hbar-lb {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: -0.004em;
  color: var(--ink-2);
  min-width: 0;
}
.hbar-lb .rank {
  font-family: var(--font-display);
  font-size: 9.5px;
  font-weight: 800;
  font-variation-settings: 'wdth' 112, 'wght' 800;
  font-variant-numeric: tabular-nums;
  color: var(--ink-4);
  flex: 0 0 auto;
  letter-spacing: 0.06em;
}
.hbar-vl {
  flex: 0 0 auto;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 800;
  font-variation-settings: 'wdth' 112, 'wght' 800;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  letter-spacing: 0.02em;
}
.hbar-track {
  position: relative;
  height: 4px;
  background: var(--line-2);
  border-radius: 99px;
  overflow: hidden;
}
.hbar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--ink);
  border-radius: 99px;
  transition: width 0.6s var(--ease);
}
.hbar-row:nth-child(1) .hbar-fill {
  background: var(--danger);
}

/* division tiles */
.tiles {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.tile {
  padding: 13px 0;
  border-bottom: 1px solid var(--line-2);
}
.tile:last-child {
  border-bottom: 0;
}
.tile-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
}
.tile-name {
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: -0.004em;
  color: var(--ink);
}
.tile-pct {
  font-family: var(--font-display);
  font-size: 11.5px;
  font-weight: 800;
  font-variation-settings: 'wdth' 112, 'wght' 800;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  letter-spacing: 0.02em;
}
.tile-track {
  position: relative;
  height: 3px;
  background: var(--line-2);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 6px;
}
.tile-fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--accent);
  border-radius: 99px;
  transition: width 0.6s var(--ease);
}
.tile-sub {
  font-size: 10.5px;
  font-weight: 500;
  color: var(--ink-4);
  letter-spacing: 0.01em;
}

/* =========================================================
   HOME
   ========================================================= */
.chart-wrap {
  padding: 4px 0 0;
}
.chart-wrap svg {
  width: 100%;
  height: auto;
}
.chart-legend {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 18px;
  flex-wrap: wrap;
}
.lgnd {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-3);
}
.lgnd .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: 0 0 7px;
}

/* alert list */
.alert-list {
  display: flex;
  flex-direction: column;
}
.alert-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 0;
  border-bottom: 1px solid var(--line-2);
}
.alert-item:last-child {
  border-bottom: 0;
}
.ai-thumb {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-lg);
  background: var(--danger-soft);
  color: var(--danger);
  display: grid;
  place-items: center;
  flex: 0 0 32px;
}
.ai-thumb.mid {
  background: var(--warn-soft);
  color: var(--warn);
}
.ai-thumb svg {
  width: 14px;
  height: 14px;
}
.ai-main {
  flex: 1 1 auto;
  min-width: 0;
}
.ai-site {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: -0.005em;
  color: var(--ink);
  margin-bottom: 2px;
}
.ai-when {
  font-size: 10.5px;
  font-weight: 500;
  color: var(--ink-4);
  letter-spacing: 0.01em;
}
.ai-counts {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}
.ai-btn {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--ink-4);
  transition: background 0.16s var(--ease), color 0.16s var(--ease);
}
.ai-btn svg {
  width: 13px;
  height: 13px;
}
.ai-btn:hover {
  background: var(--line-2);
  color: var(--ink);
}

/* TOP5 list */
.tp-list {
  display: flex;
  flex-direction: column;
}
.tp {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line-2);
  min-width: 0;
}
.tp:last-child {
  border-bottom: 0;
}
.tp-rank {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 800;
  font-variation-settings: 'wdth' 112, 'wght' 800;
  letter-spacing: 0.06em;
  color: var(--ink-4);
  flex: 0 0 14px;
  font-variant-numeric: tabular-nums;
}
.tp-body {
  flex: 1 1 auto;
  min-width: 0;
}
.tp-name {
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.45;
  letter-spacing: -0.004em;
  color: var(--ink-2);
  margin-bottom: 6px;
}
.tp-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}
.tp-meta .sum-bar {
  flex: 1 1 auto;
}
.tp-amt {
  font-family: var(--font-display);
  font-size: 11.5px;
  font-weight: 800;
  font-variation-settings: 'wdth' 112, 'wght' 800;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  letter-spacing: 0.02em;
  flex: 0 0 auto;
  min-width: 32px;
  text-align: right;
}

/* coverage */
.cov-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0 20px;
  margin-bottom: 4px;
}
.cov-row {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-3);
}
.cov-row .sw {
  width: 7px;
  height: 7px;
  border-radius: 2px;
  flex: 0 0 7px;
}
.cov-foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding-top: 18px;
  border-top: 1px solid var(--line-2);
  margin-top: 16px;
  flex-wrap: wrap;
}
.cov-foot-l {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cov-foot-l .lb {
  font-family: var(--font-display);
  font-size: 9.5px;
  font-weight: 800;
  font-variation-settings: 'wdth' 112, 'wght' 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-4);
}
.cov-foot-l .vl {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  font-variation-settings: 'wdth' 116, 'wght' 800;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  line-height: 1.1;
}

/* summary widget */
.sum-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-2);
}
.sum-row:last-of-type {
  border-bottom: 0;
}
.sum-hint {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-4);
  line-height: 1.5;
}
.sum-big {
  font-size: clamp(40px, 4.4vw, 56px);
  font-weight: 800;
  font-variation-settings: 'wdth' 114, 'wght' 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  letter-spacing: 0;
  color: var(--ink);
}
.sum-break {
  display: flex;
  align-items: center;
  gap: 0;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line-2);
}
.sum-break > div {
  flex: 1 1 0;
  min-width: 0;
}
.sum-break > div + div {
  border-left: 1px solid var(--line-2);
  padding-left: 16px;
}
.sum-break .lb {
  display: block;
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 800;
  font-variation-settings: 'wdth' 112, 'wght' 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-4);
  margin-bottom: 5px;
}
.sum-break .vl {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 800;
  font-variation-settings: 'wdth' 112, 'wght' 800;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  line-height: 1.1;
}
.widget-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 16px;
  margin-top: 4px;
  border-top: 1px solid var(--line-2);
}
.row-act {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--ink);
}
.row-act svg {
  width: 12px;
  height: 12px;
}

/* =========================================================
   ADMIN
   ========================================================= */
.admin-grid {
  display: grid;
  grid-template-columns: 208px minmax(0, 1fr);
  gap: 0;
}
.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-right: 28px;
  border-right: 1px solid var(--line);
  position: sticky;
  top: calc(var(--hdr) + 28px);
  align-self: start;
}
.admin-nav button {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 38px;
  padding: 0 12px;
  border-radius: var(--radius-lg);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.005em;
  color: var(--ink-3);
  text-align: left;
  transition: background 0.16s var(--ease), color 0.16s var(--ease);
}
.admin-nav button svg {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
}
.admin-nav button:hover {
  background: var(--line-2);
  color: var(--ink);
}
.admin-nav button.active {
  background: var(--ink);
  color: var(--bg);
  font-weight: 800;
}
.admin-grid > div:last-child {
  padding-left: 36px;
  min-width: 0;
}
.admin-pane {
  display: none;
}
.admin-pane.active {
  display: block;
}

/* alert strip */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 13px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--line-2);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.6;
  color: var(--ink-3);
}
.alert svg {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  margin-top: 2px;
  color: var(--ink-4);
}
.alert b {
  color: var(--ink);
  font-weight: 800;
}
.alert.warn {
  background: var(--warn-soft);
  border-color: transparent;
  color: var(--warn);
}
.alert.warn svg {
  color: var(--warn);
}
.alert.warn b {
  color: var(--warn);
}

/* signup code block */
.code-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 0 0;
  flex-wrap: wrap;
}
.code-value {
  flex: 1 1 220px;
  min-width: 0;
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--ink);
  padding: 12px 16px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
  background: var(--line-2);
  overflow-wrap: anywhere;
}

/* pill states */
.pill.done {
  background: var(--pos-soft);
  color: var(--accent-ink);
}
.pill.prep {
  background: var(--warn-soft);
  color: var(--warn);
}
.pill.cancel {
  background: var(--danger-soft);
  color: var(--danger);
}
.pill.pay {
  background: var(--ink);
  color: var(--bg);
  height: 28px;
  padding: 0 13px;
  font-size: 11px;
  letter-spacing: 0.05em;
}
.tag.neutral {
  background: var(--line-2);
  color: var(--ink-3);
}
.tag.x {
  background: var(--danger-soft);
  color: var(--danger);
}
.tag.brand,
.tag.hi {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

/* toggle switch */
.switch {
  position: relative;
  width: 38px;
  height: 22px;
  border-radius: var(--radius-full);
  background: var(--line);
  transition: background 0.2s var(--ease);
  flex: 0 0 38px;
}
.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s var(--ease);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}
.switch.on {
  background: var(--accent);
}
.switch.on::after {
  transform: translateX(16px);
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 1400px) {
  .work-grid {
    grid-template-columns: 360px minmax(0, 1fr);
  }
  .panel {
    padding-right: 32px;
  }
  .result-col {
    padding-left: 32px;
  }
  .stat-card {
    padding-right: 24px;
  }
  .stat-card + .stat-card {
    padding-left: 24px;
  }
  .admin-grid {
    grid-template-columns: 184px minmax(0, 1fr);
  }
  .admin-grid > div:last-child {
    padding-left: 28px;
  }
}

@media (max-width: 1180px) {
  .work-grid {
    grid-template-columns: 320px minmax(0, 1fr);
  }
  .panel {
    padding-right: 24px;
  }
  .result-col {
    padding-left: 24px;
  }
  .kpi {
    padding: 24px 18px 24px 0;
  }
  .kpi + .kpi {
    padding-left: 18px;
  }
  .kpi .spark {
    display: none;
  }
  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .stat-card:nth-child(3) {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding-left: 0;
    grid-column: 1 / -1;
  }
  .stat-card:nth-child(2) {
    padding-right: 0;
  }
}

@media (max-width: 980px) {
  .header-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
    padding-bottom: 26px;
    margin-bottom: 0;
  }
  .header-actions {
    width: 100%;
    flex-wrap: wrap;
    padding-bottom: 0;
  }
  .header-row .h1 {
    font-size: clamp(30px, 7.4vw, 44px);
  }

  /* single column: the panel stops being sticky and loses its rule */
  .work-grid {
    grid-template-columns: 1fr;
  }
  .panel {
    position: static;
    max-height: none;
    padding-right: 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding-bottom: 28px;
    margin-bottom: 36px;
  }
  .panel-scroll {
    overflow: visible;
    max-height: none;
    padding-right: 0;
    margin-right: 0;
  }
  .result-col {
    padding-left: 0;
  }

  .kpi-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .kpi {
    padding: 22px 16px 22px 0;
    border-bottom: 1px solid var(--line-2);
  }
  .kpi:nth-child(odd) {
    padding-left: 0;
    border-left: 0;
  }
  .kpi:nth-child(even) {
    padding-left: 16px;
  }
  .kpi:nth-last-child(-n + 2) {
    border-bottom: 0;
  }
  .kpi .val {
    font-size: 34px;
  }

  .summary-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 18px;
  }
  .sb-left {
    flex-wrap: wrap;
    gap: 16px;
    width: 100%;
  }
  .sb-total {
    padding-right: 16px;
  }
  .sb-right {
    width: 100%;
  }
  .sb-right .btn {
    flex: 1 1 auto;
  }

  .ph-steps {
    grid-template-columns: 1fr;
  }
  .ph-step {
    padding: 20px 0 0;
  }
  .ph-step + .ph-step {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding-left: 0;
  }

  .er-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 28px;
    padding: 36px 28px;
    min-height: 0;
  }
  .er-list {
    width: 100%;
  }
  #result-list.card-view {
    grid-template-columns: 1fr;
  }

  .stat-grid {
    grid-template-columns: 1fr;
  }
  .stat-card,
  .stat-card + .stat-card,
  .stat-card:nth-child(3) {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding: 28px 0;
    grid-column: auto;
  }
  .stat-card:first-child {
    border-top: 0;
  }

  .admin-grid {
    grid-template-columns: 1fr;
  }
  .admin-nav {
    flex-direction: row;
    overflow-x: auto;
    padding-right: 0;
    padding-bottom: 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    position: static;
    gap: 6px;
    scrollbar-width: none;
  }
  .admin-nav::-webkit-scrollbar {
    display: none;
  }
  .admin-nav button {
    flex: 0 0 auto;
    white-space: nowrap;
  }
  .admin-grid > div:last-child {
    padding-left: 0;
    padding-top: 28px;
  }

  .filter-bar {
    gap: 8px;
  }
  .search-box {
    flex: 1 1 100%;
    max-width: none;
  }
  .filter-bar .select {
    flex: 1 1 0;
    min-width: 0;
  }
  .row-2 > * + *,
  .row-3 > * + * {
    margin-top: 28px;
    padding-top: 28px;
  }
  .section-head {
    margin-top: 64px;
  }
}

@media (max-width: 780px) {
  .header-row .sub {
    font-size: 13.5px;
  }
  .kpi-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .q-choices {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
  }
  .choice {
    font-size: 11px;
    height: 32px;
  }
  .ritem-head {
    grid-template-columns: 28px minmax(0, 1fr);
    column-gap: 12px;
  }
  .ritem-tags {
    grid-column: 2;
    margin-top: 8px;
  }
  .ritem-body {
    padding-left: 0;
  }
  .ritem-mark {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }
  .ritem-row {
    flex-direction: column;
    gap: 2px;
  }
  .ritem-row .k {
    flex: none;
    padding-top: 0;
  }
  .donut-wrap {
    gap: 20px;
  }
  .donut {
    width: 108px;
    height: 108px;
    flex: 0 0 108px;
  }
  .er-banner h3 {
    font-size: 20px;
  }
  .er-chip {
    font-size: 10.5px;
  }
  .code-value {
    font-size: 13px;
    letter-spacing: 0.06em;
  }
  .table-foot {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .sum-break .vl {
    font-size: 16px;
  }
  .section-head {
    margin-top: 52px;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}

/* =========================================================
   PRINT
   ========================================================= */
@media print {
  .hdr,
  .panel,
  .panel-foot,
  .result-toolbar,
  .filter-bar,
  .pager,
  .toast-wrap,
  .date-pick,
  .admin-nav,
  .auth-theme,
  .theme-btn,
  .header-actions,
  .sb-right,
  .er-list {
    display: none !important;
  }
  .app {
    padding-top: 0;
  }
  .main {
    max-width: none;
    padding: 0;
  }
  .work-grid {
    grid-template-columns: 1fr;
  }
  .result-col {
    padding-left: 0;
  }
  body {
    background: #fff;
    color: #000;
    font-size: 11pt;
  }
  .kpi-row,
  .stat-grid,
  .summary-card {
    break-inside: avoid;
  }
  .er-banner {
    background: #000 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .ritem,
  .rcard {
    break-inside: avoid;
  }
}

/* =========================================================
   a2o refinements
   Widgets sit under a section rule — no double top border.
   ========================================================= */
.row2-card {
  border-top: 0;
  border-bottom: 0;
}
.row-2 .row2-card + .row2-card,
.row-3 .row2-card + .row2-card {
  border-left: 1px solid var(--line);
}
/* home widgets lose the outer box entirely: hairlines only */
.row-2 > .card,
.row-3 > .card {
  padding-top: 4px;
  padding-bottom: 0;
}
/* the header underline must not clip against the fixed bar */
.nav a.active::after {
  bottom: -21px;
}
/* page-head alias used by home.tsx */
.page-head .eyebrow + .h1 {
  margin-top: 0;
}

/* =========================================================
   COLOR DISCIPLINE — the last a2o gap
   a2o is ~98% monochrome. Chroma appears only where it is a
   real signal, never as decoration. Every delta pill, kdot and
   sparkline below is stripped back to ink.
   ========================================================= */

/* kdots: only danger keeps hue; warn/info become ink */
.kdot.warn,
.kdot.info {
  background: var(--ink-4);
}

/* delta pills: ink by default, danger only when it is bad news */
.kpi .delta.up {
  background: var(--line-2);
  color: var(--ink-3);
}
.kpi .delta.down {
  background: var(--danger-soft);
  color: var(--danger);
}

/* decorative tags -> ink */
.tag.hi,
.tag.brand {
  background: var(--line-2);
  color: var(--ink-3);
}
.cov-row .sw {
  background: var(--ink-4) !important;
}
.cov-row .sw:nth-of-type(1) {
  background: var(--ink) !important;
}
.lgnd .dot {
  background: var(--ink-4) !important;
}

/* chart series: this-week = ink, last-week = light rule */
.chart-wrap polyline[stroke='var(--accent)'] {
  stroke: var(--ink);
}
#areaGrad stop:first-child {
  stop-color: var(--ink);
}

/* donut: ink ramp instead of 4 hues */
.donut circle[stroke='var(--accent)'] {
  stroke: var(--ink);
}
.donut circle[stroke='var(--info)'] {
  stroke: var(--ink-4);
}
.donut circle[stroke='var(--warn)'] {
  stroke: var(--n7);
}
.donut circle[stroke='var(--pos)'] {
  stroke: var(--n9);
}

/* ER banner keeps its single green field — that is the one moment */
.er-banner h3 em {
  color: #6ee7a2;
}

/* verdict marks stay semantic: X red is a real judgement, keep it.
   △ and ○ drop to ink so only failure carries colour. */
.mk.tri,
.mark-tri {
  background: var(--line-2);
  color: var(--ink-3);
}
.mk.o,
.mark-o,
.mark-o {
  background: var(--line-2);
  color: var(--ink-3);
}

/* risk grades remain the only tri-state colour system */
.risk-box.low {
  background: var(--line-2);
  color: var(--ink-2);
}
.tag.low {
  background: var(--line-2);
  color: var(--ink-3);
}

/* =========================================================
   Missing-class fill-ins (found by CSS audit)
   ========================================================= */
.ai-top {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 5px;
  flex-wrap: wrap;
  min-width: 0;
}
.cov-foot-v {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  font-variation-settings: 'wdth' 116, 'wght' 800;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  line-height: 1.1;
  letter-spacing: 0;
}
/* row action buttons in the recent-history table */
.row-act button {
  padding: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ink-4);
  transition: color 0.16s var(--ease);
}
.row-act button:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.row-act button.pri {
  color: var(--danger);
  font-weight: 800;
}
.row-act button.pri:hover {
  color: var(--danger);
}
.row-act button + button::before {
  content: '·';
  margin: 0 6px;
  color: var(--line);
  text-decoration: none;
}
/* card-view wrapper alias */
.result-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 40px;
}
@media (max-width: 980px) {
  .result-cards {
    grid-template-columns: 1fr;
  }
  .cov-foot-v {
    font-size: 18px;
  }
}

/* =========================================================
   LOBBY — full-bleed black hero (a2o's opening move)
   The dashboard no longer starts as a white admin page.
   It opens on a black cinematic band, numerals in white,
   then breaks to white content below.
   ========================================================= */
.lobby-hero {
  position: relative;
  /* true full-bleed: escape .main's max-width AND its gutters */
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  margin-top: calc(var(--main-top) * -1);
  padding: 56px 0 0;
  color: #fff;
  overflow: hidden;
  isolation: isolate;

  /* ---- background photo (candidate A) ----
     Three stacked layers, topmost first:
       1. bottom-up scrim  → keeps the KPI rail legible over lit windows
       2. left-to-right scrim → keeps the huge headline at full contrast
       3. the photo itself
     The photo's own left half is already near-black, so the scrims only
     need to darken, not flatten it. `#000` stays as the fallback colour
     so the band still reads as black before the image decodes. */
  background-color: #000;
  background-image:
    linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.5) 16%, rgba(0, 0, 0, 0) 40%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.92) 0%, rgba(0, 0, 0, 0.8) 34%, rgba(0, 0, 0, 0.5) 68%, rgba(0, 0, 0, 0.36) 100%),
    url('/static/bg/bg-a.jpg');
  background-size: cover, cover, cover;
  background-position: center center, center center, center right;
  background-repeat: no-repeat, no-repeat, no-repeat;
}
/* one radial green field, bottom-left */
.lobby-glow {
  position: absolute;
  width: 1400px;
  height: 1400px;
  left: -520px;
  bottom: -760px;
  background: radial-gradient(
    circle at center,
    rgba(31, 138, 76, 0.42) 0%,
    rgba(31, 138, 76, 0.14) 40%,
    transparent 68%
  );
  z-index: -1;
  pointer-events: none;
}
/* the a2o right-edge section dot rail */
.lobby-dots {
  position: absolute;
  right: 26px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 9px;
  z-index: 2;
}
.lobby-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.45);
  transition: background 0.2s;
}
.lobby-dots i.on {
  background: #fff;
  border-color: #fff;
}
.lobby-hero-in {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gut);
}

.lobby-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 72px;
}
.lobby-eyebrow {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 800;
  font-variation-settings: 'wdth' 122, 'wght' 800;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.42);
}
.lobby-tools {
  display: flex;
  align-items: center;
  gap: 18px;
  flex: 0 0 auto;
}
.lobby-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
  font-size: 9.5px;
  font-weight: 800;
  font-variation-settings: 'wdth' 118, 'wght' 800;
  letter-spacing: 0.18em;
  color: rgba(255, 255, 255, 0.55);
}
.lobby-live .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #3ddc84;
  animation: pulse 2.4s infinite;
}
.btn-hero {
  height: 40px;
  padding: 0 20px;
  border-radius: var(--radius-full);
  background: #fff;
  color: #000;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.btn-hero:hover {
  background: rgba(255, 255, 255, 0.86);
}

/* the giant opening line — much larger than a normal page title */
.lobby-h {
  font-family: var(--font-body);
  font-size: clamp(52px, 8.6vw, 132px);
  font-weight: 900;
  line-height: 0.9;
  letter-spacing: -0.012em;
  color: #fff;
  margin: 0 0 34px;
  max-width: 14ch;
}
.lobby-p {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 8px;
}
.lobby-p b {
  color: rgba(255, 255, 255, 0.9);
  font-weight: 800;
}

/* KPI on black */
.kpi-inv {
  margin-top: 76px;
  border-top-color: rgba(255, 255, 255, 0.2);
  border-bottom-color: rgba(255, 255, 255, 0.2);
  border-top-width: 1px;
  border-bottom-width: 1px;
}
.kpi-inv .kpi {
  padding: 36px 30px 38px 0;
}
.kpi-inv .kpi + .kpi {
  border-left-color: rgba(255, 255, 255, 0.2);
  padding-left: 30px;
}
.kpi-inv .kpi .label {
  color: rgba(255, 255, 255, 0.45);
}
.kpi-inv .kpi .val {
  color: #fff;
}
.kpi-inv .kpi .val .unit {
  color: rgba(255, 255, 255, 0.42);
}
.kpi-inv .kpi .compare {
  color: rgba(255, 255, 255, 0.38);
}
.kpi-inv .kdot {
  background: rgba(255, 255, 255, 0.4);
}
.kpi-inv .kdot.danger {
  background: #ff6b5e;
}
.kpi-inv .delta.up {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.72);
}
.kpi-inv .delta.down {
  background: rgba(255, 107, 94, 0.16);
  color: #ff8a80;
}
.kpi-inv .spark {
  opacity: 0.4;
  bottom: 40px;
}

/* white content break */
.lobby-body {
  padding-top: 64px;
}
.lobby-body-head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 26px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.lobby-sec-no {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 800;
  font-variation-settings: 'wdth' 122, 'wght' 800;
  letter-spacing: 0.16em;
  color: var(--accent);
  flex: 0 0 auto;
}
.lobby-sec-t {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.005em;
  color: var(--ink);
  flex: 0 0 auto;
}
.lobby-sec-rule {
  flex: 1 1 auto;
  height: 1px;
  background: var(--line);
  min-width: 20px;
}

@media (max-width: 1180px) {
  .lobby-h {
    font-size: clamp(46px, 8vw, 96px);
  }
  .lobby-top {
    padding-bottom: 56px;
  }
  .kpi-inv {
    margin-top: 60px;
  }
  .lobby-dots {
    display: none;
  }
}
@media (max-width: 980px) {
  .lobby-hero {
    padding-top: 40px;
  }
  .lobby-h {
    font-size: clamp(40px, 11vw, 68px);
    margin-bottom: 24px;
  }
  .lobby-top {
    padding-bottom: 40px;
  }
  .kpi-inv {
    margin-top: 44px;
  }
  .kpi-inv .kpi {
    padding: 24px 16px 24px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  }
  .kpi-inv .kpi:nth-child(odd) {
    padding-left: 0;
    border-left: 0;
  }
  .kpi-inv .kpi:nth-child(even) {
    padding-left: 16px;
  }
  .kpi-inv .kpi:nth-last-child(-n + 2) {
    border-bottom: 0;
  }
  .lobby-body {
    padding-top: 40px;
  }
  .lobby-body-head {
    gap: 10px;
  }
}
@media (max-width: 780px) {
  .lobby-eyebrow {
    display: none;
  }
  .lobby-tools {
    width: 100%;
    justify-content: space-between;
  }
  .lobby-h {
    font-size: clamp(36px, 12vw, 56px);
  }
  .kpi-inv .kpi .val {
    font-size: 36px;
  }
}

/* =========================================================
   LOBBY v2 — header floats ON the black band (a2o does this)
   + hero fills the viewport so it reads as a cinematic
     opening, not a page-top strip.
   ========================================================= */

/* ---- header inverts while the lobby is the active screen ---- */
.app:has(#screen-home.active) .hdr {
  background: #000;
  border-bottom-color: rgba(255, 255, 255, 0.14);
}
.app:has(#screen-home.active) .brand-mark {
  background: #fff;
  color: #000;
}
.app:has(#screen-home.active) .brand-name {
  color: #fff;
}
.app:has(#screen-home.active) .brand-sub {
  color: rgba(255, 255, 255, 0.42);
}
.app:has(#screen-home.active) .nav a {
  color: rgba(255, 255, 255, 0.58);
}
.app:has(#screen-home.active) .nav a:hover,
.app:has(#screen-home.active) .nav a.active {
  color: #fff;
}
.app:has(#screen-home.active) .nav a.active::after {
  background: #fff;
}
.app:has(#screen-home.active) .nav a .count {
  color: rgba(255, 255, 255, 0.4);
}
.app:has(#screen-home.active) .presence {
  color: rgba(255, 255, 255, 0.5);
}
.app:has(#screen-home.active) .presence b {
  color: #fff;
}
.app:has(#screen-home.active) .icon-btn {
  color: rgba(255, 255, 255, 0.62);
}
.app:has(#screen-home.active) .icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}
.app:has(#screen-home.active) .icon-btn .bDot {
  border-color: #000;
}
.app:has(#screen-home.active) .user-stack {
  border-left-color: rgba(255, 255, 255, 0.16);
}
.app:has(#screen-home.active) .user-name {
  color: #fff;
}
.app:has(#screen-home.active) .user-role {
  color: rgba(255, 255, 255, 0.42);
}
.app:has(#screen-home.active) .avatar {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}
.app:has(#screen-home.active) .theme-btn {
  color: rgba(255, 255, 255, 0.58);
}
.app:has(#screen-home.active) .theme-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* ---- hero becomes viewport-height ---- */
.lobby-hero {
  display: flex;
  flex-direction: column;
  padding: calc(var(--hdr) + 52px) 0 0;
}
.lobby-hero-in {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  /* width:100% is REQUIRED. .lobby-hero is a column flex container and
     this item has `margin:0 auto`; with auto cross-axis margins the item
     stops stretching and shrinks to fit-content, which pushed the whole
     hero inward and broke left-alignment with .lobby-body. */
  width: 100%;
  min-height: calc(100svh - var(--hdr) - 96px);
}
.lobby-h {
  font-size: clamp(56px, 9.4vw, 148px);
  margin-bottom: 30px;
}
/* KPI rail sits flush on the viewport bottom edge */
.kpi-inv {
  margin-top: auto;
  margin-bottom: 0;
}
.lobby-body {
  padding-top: 72px;
}

@media (max-width: 1180px) {
  .lobby-hero-in {
    min-height: calc(100svh - var(--hdr) - 84px);
  }
  .lobby-hero {
    padding-top: calc(var(--hdr) + 44px);
  }
  .lobby-h {
    font-size: clamp(50px, 8.6vw, 104px);
  }
}
@media (max-width: 980px) {
  .lobby-hero {
    padding-top: calc(var(--hdr) + 34px);
  }
  .lobby-hero-in {
    min-height: calc(100svh - var(--hdr) - 62px);
  }
  .lobby-h {
    font-size: clamp(42px, 11vw, 74px);
  }
}
@media (max-width: 780px) {
  .lobby-hero-in {
    min-height: 0;
  }
  .lobby-h {
    font-size: clamp(38px, 12.4vw, 60px);
  }
  .lobby-body {
    padding-top: 48px;
  }
}

/* =========================================================
   LOBBY v3 — editorial body
   a2o's content area is not a widget board. It uses numbered
   sections, display-scale headings, hairline columns and very
   generous vertical rhythm. Scoped to #screen-home only so the
   other screens stay compact.
   ========================================================= */

/* ---- section marker: 01 / 이번 주 흐름 ---- */
#screen-home .lobby-body-head {
  gap: 22px;
  padding-bottom: 20px;
  margin-bottom: 0;
  border-bottom: 1px solid var(--line);
}
#screen-home .lobby-sec-no {
  font-size: 11px;
  letter-spacing: 0.2em;
}
#screen-home .lobby-sec-t {
  font-size: clamp(17px, 1.5vw, 21px);
  font-weight: 900;
  letter-spacing: -0.01em;
}

/* ---- breathing room between the three bands ---- */
#screen-home .row-2 {
  margin-top: 76px;
}
#screen-home .row-3 {
  margin-top: 88px;
}
#screen-home .section-head {
  margin-top: 128px;
  padding-bottom: 24px;
}

/* ---- cards become editorial columns, not boxes ----
   NOTE: longhand only. A `padding` shorthand here has higher
   specificity than .row-2/.row-3 > *, which would wipe the
   40px column gutters and make the three columns overlap. */
#screen-home .card {
  padding-top: 0;
  padding-bottom: 44px;
  border-top: 0;
  border-bottom: 1px solid var(--line);
}
#screen-home .row-2 .row2-card,
#screen-home .row-3 > .card {
  border-bottom: 0;
  padding-bottom: 0;
}
/* restate the vertical hairline gutters explicitly */
#screen-home .row-2 > *,
#screen-home .row-3 > * {
  padding-right: 40px;
}
#screen-home .row-2 > *:last-child,
#screen-home .row-3 > *:last-child {
  padding-right: 0;
}
#screen-home .row-2 > * + *,
#screen-home .row-3 > * + * {
  padding-left: 40px;
  border-left: 1px solid var(--line);
}
#screen-home .card-head {
  margin-bottom: 34px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  align-items: flex-start;
}
#screen-home .card-title {
  font-size: clamp(20px, 1.85vw, 26px);
  font-weight: 900;
  letter-spacing: -0.014em;
  line-height: 1.15;
}
#screen-home .card-sub {
  font-size: 13.5px;
  margin-top: 7px;
}
#screen-home .section-title {
  font-size: clamp(30px, 3.6vw, 52px);
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.02;
}
#screen-home .section-head .card-sub {
  font-size: 14px;
  margin-top: 10px;
}

/* ---- TOP5: big rank numerals, reader-scale question text ---- */
#screen-home .tp {
  gap: 18px;
  padding: 22px 0;
}
#screen-home .tp-rank {
  flex: 0 0 30px;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--ink-4);
}
#screen-home .tp-name {
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 9px;
}
#screen-home .tp-amt {
  font-size: 19px;
  min-width: 52px;
}

/* ---- summary figure on the right tile ---- */
#screen-home .sum-big {
  font-size: clamp(52px, 5vw, 76px);
  line-height: 1;
}

/* ---- recent table: more air between rows ---- */
#screen-home .data th {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-4);
  padding: 16px 18px;
}
#screen-home .data td {
  padding: 20px 18px;
  font-size: 13.5px;
}
#screen-home .card-flush {
  border-top: 1px solid var(--ink);
}

@media (max-width: 1180px) {
  #screen-home .row-2 {
    margin-top: 56px;
  }
  #screen-home .row-3 {
    margin-top: 64px;
  }
  #screen-home .section-head {
    margin-top: 88px;
  }
}
@media (max-width: 980px) {
  #screen-home .row-2,
  #screen-home .row-3 {
    margin-top: 0;
  }
  #screen-home .row-2 > *,
  #screen-home .row-3 > * {
    padding-right: 0;
    padding-left: 0;
  }
  #screen-home .row-2 > * + *,
  #screen-home .row-3 > * + * {
    padding-left: 0;
    border-left: 0;
    margin-top: 44px;
    padding-top: 44px;
    border-top: 1px solid var(--line);
  }
  #screen-home .card-head {
    padding-top: 18px;
  }
  #screen-home .section-head {
    margin-top: 64px;
  }
}

/* ---- balance the three editorial columns ----
   TOP5 is inherently taller than the donut / summary tiles, which
   left dangling vertical hairlines under columns 2 and 3. Make each
   column a flex stack and push its footer block to the baseline. */
#screen-home .row-3 > .card {
  display: flex;
  flex-direction: column;
}
#screen-home .cov-foot {
  margin-top: auto;
  padding-top: 26px;
}
#screen-home .row-3 .widget-foot {
  margin-top: auto;
  padding-top: 26px;
}
#screen-home .sum-hint {
  margin-top: auto;
  padding-top: 26px;
}
#screen-home .sum-bar {
  margin-top: 22px;
}
#screen-home .tp-list {
  flex: 1 1 auto;
}
