/* UCCL Asset Allocation Analyzer — mobile-first | DRAFT_NOT_TO_SEND */
:root {
  --navy: #1A3566;
  --navy-deep: #0f1a2e;
  --red: #C0122C;
  --red-soft: #e85a6c;
  --bg: #f4f6fa;
  --card: #ffffff;
  --text: #1a1a1a;
  --muted: #5a6472;
  --line: #e2e8f0;
  --ok: #0d7a4f;
  --warn: #b45309;
  --over: #C0122C;
  --under: #1A3566;
  --radius: 14px;
  --radius-sm: 10px;
  --tap: 48px;
  --shadow: 0 2px 12px rgba(26, 53, 102, 0.08);
  --shadow-lg: 0 8px 28px rgba(26, 53, 102, 0.14);
  --focus: 0 0 0 3px rgba(192, 18, 44, 0.45);
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  font-size: 16px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1220;
    --card: #152038;
    --text: #e8eef8;
    --muted: #9aa8bc;
    --line: #243352;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 8px 28px rgba(0, 0, 0, 0.45);
    --focus: 0 0 0 3px rgba(248, 113, 113, 0.55);
  }
  .field input, .field select, .alloc-row input {
    background: #0f1a2e;
    color: var(--text);
    border-color: var(--line);
  }
  .chip { background: #0f1a2e; color: #c5d4ef; }
  .chip.active { background: var(--navy); color: #fff; border-color: #6b8fc4; }
  .model-blurb, .kpi { background: #1a2a48; color: #c5d4ef; }
  .track { background: #243352; }
  .sticky-actions { background: rgba(15, 26, 46, 0.96); }
  .btn-ghost { background: transparent; }
  .modal { background: #152038; }
  .banner-warn { background: #3d3200; border-color: #c9a227; color: #ffe9a0; }
  .gap-tag.over { background: #3a1520; }
  .gap-tag.under { background: #1a2a48; }
  .gap-tag.ok { background: #0f2e22; }
  .report-doc th { background: #1a2a48; }
  .disclaimer { background: #3d3200; color: #ffe9a0; }
  .stack-bar.cur { background: #7b8da6; }
  code { background: #1a2a48; }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
}

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--red); color: #fff; padding: 8px 12px; z-index: 200;
  border-radius: 0 0 8px 0; font-weight: 700;
}
.skip-link:focus { left: 0; }

.app-header {
  position: sticky; top: 0; z-index: 40;
  background: linear-gradient(135deg, var(--navy-deep), var(--navy));
  color: #fff;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 14px;
  padding-left: calc(16px + env(safe-area-inset-left, 0px));
  padding-right: calc(16px + env(safe-area-inset-right, 0px));
  box-shadow: 0 2px 16px rgba(0,0,0,.25);
}
.app-header .brand { display: flex; align-items: center; gap: 10px; }
.app-header .badge {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--red); color: #fff;
  display: grid; place-items: center;
  font-size: 10px; font-weight: 800; letter-spacing: .02em;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(192,18,44,.4);
}
.app-header h1 { margin: 0; font-size: 1.05rem; font-weight: 700; letter-spacing: .01em; }
.app-header .sub { margin: 2px 0 0; font-size: .72rem; opacity: .85; }
.draft-tag {
  display: inline-block; margin-top: 8px;
  background: rgba(192,18,44,.95); color: #fff;
  font-size: .68rem; font-weight: 700;
  padding: 3px 8px; border-radius: 999px;
  letter-spacing: .04em;
}

.banner-warn {
  margin: 12px 12px 0;
  background: #fff3cd;
  border: 2px solid #e6b800;
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: .92rem; font-weight: 700;
  color: #5c4500;
  text-align: center;
  line-height: 1.4;
}
.banner-sub { font-weight: 600; font-size: .8rem; }

main { padding: 12px; max-width: 720px; margin: 0 auto; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: var(--space-4);
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}
.card h2 {
  margin: 0 0 12px;
  font-size: 1rem;
  color: var(--navy);
  display: flex; align-items: center; gap: 8px;
}
@media (prefers-color-scheme: dark) {
  .card h2 { color: #9eb6e0; }
}
.card h2 .step {
  background: var(--navy); color: #fff;
  width: 24px; height: 24px; border-radius: 50%;
  font-size: .75rem; display: grid; place-items: center;
  flex-shrink: 0;
}
.subhead {
  font-size: .9rem; color: var(--navy); margin: 8px 0;
}
.hint-muted {
  margin: 8px 0 0; font-size: .78rem; color: var(--muted);
}
.sleeve-intro { margin: 0 0 12px; font-size: .84rem; }
.model-title {
  margin: 0 0 6px; font-size: .85rem; font-weight: 700; color: var(--navy);
}
code {
  font-size: .78rem; padding: 1px 5px; border-radius: 4px;
  background: #eef2f8; color: var(--navy);
}

.field { margin-bottom: 12px; }
.field label {
  display: block; font-size: .82rem; font-weight: 600;
  color: var(--muted); margin-bottom: 6px;
}
.field input, .field select, .field textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 12px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  background: #fff;
  color: var(--text);
  -webkit-appearance: none;
  appearance: none;
}
.field input[type="date"] { font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.field input:focus, .field select:focus, .alloc-row input:focus, .chip:focus-visible, .btn:focus-visible, .btn-text:focus-visible, .lang-btn:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
  box-shadow: var(--focus);
  border-color: var(--navy);
}
.lang-btn:focus-visible {
  outline-color: #fff;
}
.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tool-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip {
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: #fff;
  font-size: .88rem; font-weight: 600;
  color: var(--navy);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background .15s, color .15s, transform .1s;
}
.chip.active {
  background: var(--navy); color: #fff; border-color: var(--navy);
}
.chip.preset { border-style: dashed; font-size: .8rem; }
.chip.tool {
  border-color: var(--navy);
  background: #eef2f8;
  font-size: .8rem;
}
.chip:active { transform: scale(.97); }

.draft-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: 8px; margin-top: 4px; flex-wrap: wrap;
}
.draft-hint { font-size: .75rem; color: var(--muted); }
.btn-text {
  background: none; border: none; color: var(--red);
  font-size: .78rem; font-weight: 700; cursor: pointer;
  min-height: 36px; padding: 4px 8px; border-radius: 6px;
}
.input-errors {
  margin-top: 10px; padding: 10px 12px;
  background: #fde8eb; color: var(--red);
  border-radius: var(--radius-sm);
  font-size: .82rem; font-weight: 700;
}
@media (prefers-color-scheme: dark) {
  .input-errors { background: #3a1520; }
  .chip.tool { background: #1a2a48; color: #c5d4ef; }
}

.alloc-row {
  display: grid;
  grid-template-columns: minmax(72px, 1fr) minmax(140px, 1.6fr) 72px;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}
.alloc-row .name { font-size: .86rem; font-weight: 600; }
.alloc-row .name-en { font-weight: 500; color: var(--muted); font-size: .72rem; }
.weight-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.alloc-row input.w-num,
.alloc-row input[type="number"] {
  min-height: 44px;
  width: 72px;
  flex: 0 0 72px;
  padding: 8px 6px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  font-size: 1rem;
  text-align: right;
  background: #fff;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.alloc-row .w-unit {
  font-size: .78rem;
  color: var(--muted);
  font-weight: 600;
  flex: 0 0 auto;
}
.alloc-row .w-slider {
  flex: 1 1 auto;
  min-width: 0;
  height: 28px;
  accent-color: var(--navy);
  cursor: pointer;
}
body.sliders-off .weight-controls { justify-content: flex-end; }
body.sliders-off .alloc-row {
  grid-template-columns: 1fr 100px 72px;
}
.alloc-row .amt {
  font-size: .75rem; color: var(--muted); text-align: right;
  font-variant-numeric: tabular-nums;
  display: flex; flex-direction: column; align-items: flex-end; gap: 2px;
}
.baseline-badge {
  font-size: .68rem; color: var(--navy);
  background: rgba(26,53,102,.09); border-radius: 999px;
  padding: 1px 7px; white-space: nowrap;
  font-variant-numeric: tabular-nums; line-height: 1.4;
}
.baseline-badge[data-dir="up"] { color: #0d7a4f; background: rgba(13,122,79,.1); }
.baseline-badge[data-dir="down"] { color: var(--red); background: rgba(192,18,44,.09); }
.rpt-logo-svg { display: block; }
.sum-bar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 8px; flex-wrap: wrap;
  margin-top: 8px; padding-top: 10px;
  border-top: 1px dashed var(--line);
  font-weight: 700; font-size: .9rem;
  transition: color .2s;
}
.sum-bar .sum-hint { font-size: .75rem; font-weight: 600; }
.sum-bar.bad { color: var(--red); }
.sum-bar.ok { color: var(--ok); }

.model-blurb {
  background: #eef2f8;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: .88rem;
  color: var(--navy);
  margin-bottom: 12px;
}

/* Gap overview stacked compare */
.gap-overview { margin-bottom: 14px; }
.stack-legend {
  display: flex; flex-wrap: wrap; gap: 10px;
  font-size: .72rem; color: var(--muted); margin-bottom: 8px;
}
.stack-legend i {
  display: inline-block; width: 12px; height: 8px; border-radius: 2px;
  margin-right: 4px; vertical-align: middle;
}
.stack-legend i.cur { background: #475569; }
.stack-legend i.tgt { background: var(--navy); }
.stack-legend i.over { background: var(--over); }
.stack-legend i.under { background: var(--under); }
.stack-chart { display: grid; gap: 6px; }
.stack-row {
  display: grid;
  grid-template-columns: 72px 1fr 44px;
  gap: 6px; align-items: center;
}
.stack-lab { font-size: .68rem; font-weight: 600; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stack-bars {
  position: relative; height: 18px;
  background: #e8edf5; border-radius: 6px; overflow: hidden;
}
@media (prefers-color-scheme: dark) {
  .stack-bars { background: #243352; }
}
.stack-bar {
  position: absolute; left: 0; top: 0; height: 100%;
  border-radius: 6px; opacity: .92;
}
.stack-bar.cur { background: #475569; z-index: 1; }
.stack-bar.tgt {
  background: transparent;
  border: 2px solid var(--navy);
  box-sizing: border-box;
  z-index: 2;
  opacity: 1;
}
.stack-tag { font-size: .65rem; text-align: center; padding: 2px 0; }

.bar-compare { margin-bottom: 14px; }
.bar-compare .lab {
  display: flex; justify-content: space-between; align-items: center; gap: 6px;
  font-size: .8rem; font-weight: 600; margin-bottom: 4px; flex-wrap: wrap;
}
.tracks { display: grid; gap: 3px; }
.track {
  height: 10px; border-radius: 5px; background: #e8edf5; overflow: hidden;
}
.track > span { display: block; height: 100%; border-radius: 5px; transition: width .25s ease; }
.track.current > span { background: #475569; }
.track.target > span { background: var(--navy); }
.gap-tag {
  font-size: .72rem; font-weight: 700;
  padding: 2px 8px; border-radius: 999px;
  border: 1px solid transparent;
}
/* colorblind-friendly: shape + text, not only hue */
.gap-tag.over { background: #fde8eb; color: var(--over); border-color: #f5b0ba; }
.gap-tag.under { background: #e8eef8; color: var(--under); border-color: #a8bddf; }
.gap-tag.ok { background: #e6f6ee; color: var(--ok); border-color: #9fd4b8; }
.gap-tag.over::before { content: "▲ "; font-size: .65rem; }
.gap-tag.under::before { content: "▼ "; font-size: .65rem; }
.gap-tag.ok::before { content: "● "; font-size: .65rem; }

@media (prefers-color-scheme: dark) {
  .sleeve.alpha { background: linear-gradient(180deg, #2a1520, #152038); }
}
.sleeve h3 { margin: 0 0 6px; font-size: .92rem; color: var(--navy); }
.sleeve.alpha h3 { color: var(--red); }
.sleeve p { margin: 0; font-size: .84rem; color: var(--muted); }
.sleeve .alpha-note {
  margin-top: 8px; padding: 8px 10px;
  background: rgba(192,18,44,.06);
  border-left: 3px solid var(--red);
  border-radius: 0 8px 8px 0;
  font-size: .8rem; font-weight: 600; color: var(--navy);
}
@media (prefers-color-scheme: dark) {
  .sleeve .alpha-note { color: #e8c0c6; background: rgba(192,18,44,.15); }
}
.sleeve .band {
  margin-top: 8px; font-size: .8rem; font-weight: 700; color: var(--navy);
}

.sticky-actions {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
  padding: 10px calc(12px + env(safe-area-inset-right, 0px)) calc(10px + env(safe-area-inset-bottom, 0px)) calc(12px + env(safe-area-inset-left, 0px));
  display: flex; gap: 8px;
  max-width: 720px; margin: 0 auto;
}
.btn {
  flex: 1;
  min-height: var(--tap);
  border: none; border-radius: 12px;
  font-size: .95rem; font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .1s, opacity .15s;
}
.btn-primary { background: var(--red); color: #fff; }
.btn-secondary { background: var(--navy); color: #fff; }
.btn-ghost {
  background: #fff; color: var(--navy);
  border: 1.5px solid var(--navy);
}
.btn-close { flex: 0; min-width: 72px; min-height: 40px; padding: 0 12px; }
.btn:active { transform: scale(.98); }
.btn:disabled, .btn[aria-disabled='true'] {
  opacity: .45;
  cursor: not-allowed;
  pointer-events: none;
  box-shadow: none !important;
  filter: grayscale(.15);
}

.kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.kpi {
  background: linear-gradient(160deg, #eef2f8 0%, #f7f9fc 100%);
  border-radius: var(--radius-sm);
  padding: 12px 10px;
  text-align: center;
  border: 1px solid rgba(26, 53, 102, 0.08);
  box-shadow: 0 1px 0 rgba(255,255,255,.7) inset;
  position: relative;
  overflow: hidden;
}
.kpi::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--navy);
  opacity: .55;
}
.kpi-total::before { background: var(--navy); opacity: 1; }
.kpi-risk::before { background: #3b6bb5; }
.kpi-eq::before { background: #5b7fa6; }
.kpi-liq::before { background: var(--red); opacity: .7; }
.kpi .v {
  font-size: 1.22rem; font-weight: 800; color: var(--navy);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
  line-height: 1.2;
}
.kpi .l { font-size: .72rem; color: var(--muted); margin-top: 4px; font-weight: 600; }

.questions li { margin-bottom: 6px; font-size: .9rem; }

/* Report modal */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(15,26,46,.55);
  display: none; align-items: flex-end; justify-content: center;
}
.modal-backdrop.open { display: flex !important; }
.modal {
  background: #fff;
  width: 100%; max-width: 720px;
  max-height: 92vh;
  border-radius: 18px 18px 0 0;
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.modal-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
  gap: 8px;
}
.modal-head h2 { margin: 0; font-size: 1rem; color: var(--navy); }
.modal-body {
  padding: 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
}
.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 10px 12px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
}
.modal-actions .btn { font-size: .82rem; min-height: 44px; }
.modal-actions .btn-primary { grid-column: 1 / -1; }
@media (min-width: 560px) {
  .modal-actions {
    grid-template-columns: repeat(5, 1fr);
  }
  .modal-actions .btn-primary { grid-column: auto; }
}

.report-doc { font-size: .92rem; }
.report-doc h1 { font-size: 1.2rem; color: var(--navy); margin: 0 0 8px; }
.report-doc .meta {
  font-size: .84rem; color: var(--muted); margin-bottom: 12px;
  display: grid; gap: 4px;
}
.report-doc h2 {
  font-size: .95rem; color: var(--navy);
  border-bottom: 2px solid var(--red);
  padding-bottom: 4px; margin: 18px 0 8px;
}
.report-doc table {
  width: 100%; border-collapse: collapse;
  margin: 8px 0 12px;
}
.report-doc th, .report-doc td {
  border: 1px solid var(--line); padding: 6px 8px; text-align: left;
}
.report-doc .disclaimer {
  margin-top: 16px; padding: 12px;
  background: #fff3cd; border-radius: 10px;
  font-size: .82rem; font-weight: 600;
}
.rpt-cover {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  background: linear-gradient(165deg, #f8fafc 0%, #fff 55%, #fff5f6 100%);
}
@media (prefers-color-scheme: dark) {
  .rpt-cover { background: linear-gradient(165deg, #1a2a48, #152038); }
}
.rpt-brand { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.rpt-badge {
  display: inline-grid; place-items: center;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--red); color: #fff; font-size: 10px; font-weight: 800;
  flex-shrink: 0;
}
.rpt-co { font-weight: 700; color: var(--navy); font-size: .9rem; }
.rpt-co-en { font-size: .72rem; color: var(--muted); }
.rpt-draft { color: var(--red); font-weight: 800; font-size: .78rem; margin: 0 0 8px; }
.rpt-sleeve h3 { font-size: .9rem; margin: 0 0 4px; color: var(--navy); }
.rpt-sleeve.alpha h3 { color: var(--red); }
.rpt-footer {
  margin-top: 20px; padding-top: 10px;
  border-top: 1px dashed var(--line);
  font-size: .72rem; color: var(--muted); text-align: center;
}

.toast {
  position: fixed; left: 50%; bottom: 88px; transform: translateX(-50%);
  background: var(--navy-deep); color: #fff;
  padding: 10px 16px; border-radius: 999px;
  font-size: .85rem; z-index: 120;
  opacity: 0; pointer-events: none; transition: opacity .25s;
  max-width: 90vw; text-align: center;
  box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; }

footer.note {
  text-align: center; font-size: .72rem; color: var(--muted);
  padding: 8px 16px 24px;
}

@media (min-width: 640px) {
  .modal-backdrop { align-items: center; }
  .modal { border-radius: 18px; max-height: 88vh; }
  .sticky-actions { left: 50%; transform: translateX(-50%); width: 100%; }
}

/* —— Round 2: ~390px mobile polish —— */
@media (max-width: 400px) {
  :root { font-size: 15px; }
  .app-header { padding: 10px 12px 12px; }
  .app-header h1 { font-size: .95rem; }
  .app-header .sub { font-size: .68rem; }
  .banner-warn { margin: 10px 10px 0; padding: 10px 12px; font-size: .86rem; }
  main { padding: 10px; }
  .card { padding: 14px 12px; border-radius: 12px; }
  .row-2 { grid-template-columns: 1fr; gap: 0; }
  .alloc-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .alloc-row .name { font-size: .8rem; }
  .weight-controls { width: 100%; }
  .alloc-row input.w-num,
  .alloc-row input[type="number"] { min-height: 44px; font-size: .95rem; flex: 0 0 68px; width: 68px; }
  .alloc-row .amt { text-align: left; padding-left: 2px; }
  body.sliders-off .alloc-row {
    grid-template-columns: 1fr 88px 64px;
  }
  body.sliders-off .alloc-row .amt { text-align: right; }
  .stack-row { grid-template-columns: 56px 1fr 40px; gap: 4px; }
  .stack-lab { font-size: .62rem; }
  .chip { min-height: 44px; padding: 8px 12px; font-size: .82rem; }
  .kpi .v { font-size: 1.05rem; }
  .sticky-actions {
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    gap: 6px;
    box-shadow: 0 -6px 24px rgba(15, 26, 46, 0.12);
  }
  .btn { min-height: 48px; font-size: .9rem; border-radius: 12px; }
  .modal { max-height: 94vh; border-radius: 16px 16px 0 0; }
  .modal-body { padding: 12px; }
  .modal-actions { grid-template-columns: 1fr 1fr; }
  .modal-actions .btn-primary { grid-column: 1 / -1; }
  .toast { bottom: 96px; font-size: .8rem; padding: 10px 14px; white-space: normal; }
  .report-doc table { font-size: .72rem; }
  .report-doc th, .report-doc td { padding: 4px 5px; }
}

/* touch: prevent double-tap zoom on controls */
.chip, .btn, .btn-text { touch-action: manipulation; }

/* micro: sum bar pulse when bad */
@keyframes sumPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .72; }
}
.sum-bar.bad { animation: sumPulse 1.6s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) {
  .sum-bar.bad, .track > span, .chip, .btn, .toast { animation: none !important; transition: none !important; }
}

/* micro: sleeve hover/press */
.sleeve:active { box-shadow: var(--shadow); }
.sleeve.alpha { position: relative; }
.sleeve.alpha::after {
  content: "SATELLITE";
  position: absolute; top: 10px; right: 10px;
  font-size: .62rem; font-weight: 800; letter-spacing: .06em;
  color: var(--red); opacity: .55;
}

/* report cover accent */
.rpt-cover {
  border-top: 4px solid var(--red);
  position: relative;
}
.rpt-cover .meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
  background: rgba(26, 53, 102, 0.04);
  padding: 10px 12px;
  border-radius: 8px;
}
@media (max-width: 400px) {
  .rpt-cover .meta { grid-template-columns: 1fr; }
}
.report-doc td.num, .report-doc th.num { text-align: right; font-variant-numeric: tabular-nums; }
.rpt-print-banner {
  display: none;
  font-size: .75rem; font-weight: 800;
  color: var(--red);
  border: 1.5px solid var(--red);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 12px;
  text-align: center;
}

/* body scroll lock when modal open */
body.modal-open { overflow: hidden; overscroll-behavior: none; }

@media print {
  body * { visibility: hidden; }
  .modal-backdrop, .modal-backdrop * { visibility: visible; }
  .modal-backdrop {
    position: static; display: block !important;
    background: #fff;
  }
  .modal {
    max-height: none; box-shadow: none; border-radius: 0;
    width: 100%; max-width: none;
  }
  .modal-head, .modal-actions, .sticky-actions, .app-header, .banner-warn,
  main, footer, .toast, .skip-link { display: none !important; }
  .modal-body { padding: 0; overflow: visible; }
  .report-doc {
    font-size: 10.5pt;
    color: #111 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .rpt-print-banner { display: block !important; }
  .rpt-cover {
    border: 1px solid #c5ced9;
    border-top: 5px solid #C0122C;
    padding: 14pt 12pt;
    margin-bottom: 10pt;
    background: #fff !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .rpt-cover .meta {
    background: #f4f6fa !important;
    grid-template-columns: 1fr 1fr;
  }
  .rpt-sleeve, .report-doc table, .disclaimer {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .report-doc h2 {
    break-after: avoid;
    page-break-after: avoid;
    margin-top: 14pt;
  }
  .report-doc thead { display: table-header-group; }
  .report-doc tr { break-inside: avoid; page-break-inside: avoid; }
  .report-doc table {
    font-size: 9pt;
    width: 100%;
  }
  .report-doc th {
    background: #eef2f8 !important;
  }
  .disclaimer {
    background: #fff8dc !important;
    border: 1px solid #e6b800;
  }
  .rpt-footer {
    margin-top: 16pt;
    padding-top: 8pt;
    font-size: 8pt;
  }
}

/* Print page numbers — top-level @page (many engines ignore @page nested only in @media print) */
@page {
  margin: 14mm 12mm 16mm;
  @bottom-right {
    content: counter(page) " / " counter(pages);
    font-family: "PingFang TC", "Noto Sans TC", sans-serif;
    font-size: 8pt;
    color: #5a6472;
  }
}

/* —— Round 3: empty states · sliders · report/KPI depth —— */
.empty-state {
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1.5px dashed rgba(26, 53, 102, 0.28);
  background: rgba(26, 53, 102, 0.04);
  color: var(--text);
}
.empty-state.soft {
  border-style: solid;
  border-color: rgba(26, 53, 102, 0.12);
  background: #f7f9fc;
}
.empty-state strong {
  display: block;
  color: var(--navy);
  font-size: .9rem;
  margin-bottom: 4px;
}
.empty-state p {
  margin: 0;
  font-size: .82rem;
  color: var(--muted);
  line-height: 1.45;
}
@media (prefers-color-scheme: dark) {
  .empty-state { background: rgba(197, 212, 239, 0.06); border-color: rgba(197, 212, 239, 0.25); }
  .empty-state.soft { background: #1a2a48; }
  .kpi { background: linear-gradient(160deg, #1a2a48, #152038); border-color: #243352; }
  .kpi .v { color: #e8eef8; }
}

/* gap overview contrast */
.gap-overview {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(26, 53, 102, 0.03);
  border: 1px solid rgba(26, 53, 102, 0.08);
}
.stack-bar.cur { box-shadow: 0 0 0 1px rgba(15,26,46,.08); }
.stack-bar.tgt { outline: 1.5px solid var(--navy); outline-offset: -1px; }

/* on-screen sleeve cards hierarchy */
.sleeve {
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-left-color: var(--navy);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
  background: #fff;
  transition: box-shadow .15s, transform .12s;
}
.sleeve.alpha {
  border-left-color: var(--red);
  border-color: rgba(192,18,44,.22);
  background: linear-gradient(135deg, rgba(192,18,44,.05), #fff 40%);
  box-shadow: 0 2px 10px rgba(192,18,44,.06);
}
@media (prefers-color-scheme: dark) {
  .sleeve { background: #152038; }
  .sleeve.alpha { background: linear-gradient(135deg, rgba(192,18,44,.12), #152038 45%); }
}

/* report cover deepen */
.rpt-kicker {
  margin: 0 0 4px;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.rpt-h1-sub {
  display: block;
  font-size: .72rem;
  font-weight: 600;
  color: var(--muted);
  margin-top: 4px;
  letter-spacing: 0;
}
.rpt-cover h1 {
  font-size: 1.28rem;
  line-height: 1.25;
  margin: 0 0 12px;
  color: var(--navy);
}
.rpt-cover .meta-grid .meta-l {
  display: block;
  font-size: .65rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 2px;
}
.rpt-cover .meta-grid .meta-v {
  font-size: .88rem;
  font-weight: 700;
  color: var(--navy);
}
.rpt-kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 12px;
}
.rpt-kpi {
  text-align: center;
  padding: 10px 6px;
  border-radius: 8px;
  background: rgba(26, 53, 102, 0.06);
  border: 1px solid rgba(26, 53, 102, 0.08);
}
.rpt-kpi.accent {
  background: rgba(192, 18, 44, 0.06);
  border-color: rgba(192, 18, 44, 0.18);
}
.rpt-kpi-v {
  font-size: .95rem;
  font-weight: 800;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.rpt-kpi.accent .rpt-kpi-v { color: var(--red); }
.rpt-kpi-l {
  font-size: .62rem;
  color: var(--muted);
  font-weight: 600;
  margin-top: 3px;
}
@media (max-width: 400px) {
  .rpt-kpi-strip { grid-template-columns: 1fr 1fr; }
  .empty-state { padding: 10px 12px; }
  .w-slider { min-height: 36px; }
}

/* report table hierarchy */
.report-doc table.rpt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .84rem;
  margin: 8px 0 12px;
}
.report-doc table.rpt-table th {
  background: #e8eef8;
  color: var(--navy);
  font-weight: 700;
  border-bottom: 2px solid var(--navy);
}
.report-doc table.rpt-table tr.tag-over td:last-child { color: var(--over); font-weight: 700; }
.report-doc table.rpt-table tr.tag-under td:last-child { color: var(--under); font-weight: 700; }
.report-doc table.rpt-table tbody tr:nth-child(even) { background: rgba(26,53,102,.03); }
.rpt-empty-note, .empty-inline {
  color: var(--red);
  font-size: .82rem;
  font-weight: 600;
}

/* report sleeve cards */
.rpt-sleeve {
  margin: 12px 0;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--navy);
  background: #fafbfd;
  break-inside: avoid;
}
.rpt-sleeve.core { border-left-color: var(--navy); }
.rpt-sleeve.alpha {
  border-left-color: var(--red);
  border-color: rgba(192,18,44,.25);
  background: linear-gradient(135deg, rgba(192,18,44,.07), #fff 42%);
  box-shadow: 0 2px 8px rgba(192,18,44,.06);
}
.rpt-sleeve-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
}
.rpt-sleeve-head h3 { margin: 0; flex: 1; }
.rpt-sleeve-pill {
  flex-shrink: 0;
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .04em;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(192,18,44,.1);
  color: var(--red);
}
.rpt-sleeve-pill.muted {
  background: rgba(26,53,102,.08);
  color: var(--navy);
}
.rpt-sleeve-note { font-size: .84rem; }
.rpt-sleeve-band { font-size: .78rem; color: var(--muted); margin-bottom: 0; }

@media print {
  .rpt-kpi-strip { grid-template-columns: repeat(4, 1fr); }
  .rpt-kpi {
    background: #eef2f8 !important;
    border: 1.5px solid #1A3566 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .rpt-kpi-v { color: #1A3566 !important; }
  .rpt-kpi-l { color: #334155 !important; }
  .rpt-kpi.accent {
    background: #fff5f6 !important;
    border-color: #C0122C !important;
  }
  .rpt-kpi.accent .rpt-kpi-v { color: #C0122C !important; }
  .rpt-sleeve { background: #fff !important; }
  .rpt-sleeve.alpha { background: #fff8f8 !important; border-left: 3px solid #C0122C; }
  .empty-state { display: none !important; }
}

.sleeve-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 8px;
  margin-bottom: 6px;
}
.sleeve-head h3 { margin: 0; flex: 1; }
.sleeve-pill {
  flex-shrink: 0; font-size: .62rem; font-weight: 800; letter-spacing: .05em;
  padding: 3px 8px; border-radius: 999px;
  background: rgba(192,18,44,.1); color: var(--red);
}
.sleeve-pill.muted { background: rgba(26,53,102,.08); color: var(--navy); }
.sleeve.alpha::after { display: none; } /* pill replaces corner stamp */

/* ——— Lang switch + charts (overnight boss add-ons) ——— */
.brand-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 999px;
  padding: 3px 4px 3px 10px;
  flex-shrink: 0;
}
.lang-switch-label {
  font-size: .65rem;
  opacity: .8;
  margin-right: 2px;
  white-space: nowrap;
}
.lang-btn {
  min-width: 36px;
  min-height: 32px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #dce6f5;
  font-weight: 700;
  font-size: .78rem;
  cursor: pointer;
  padding: 4px 10px;
}
.lang-btn.active {
  background: #fff;
  color: var(--navy);
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}

/* Report donut charts */
.rpt-charts { margin: 14px 0 18px; }
.rpt-charts h3 {
  margin: 12px 0 8px;
  font-size: .95rem;
  color: var(--navy);
}
.donut-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 8px;
}
.donut-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.donut-card h4 {
  margin: 0 0 8px;
  font-size: .88rem;
  color: var(--navy);
  font-weight: 700;
}
.donut-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.donut-svg { max-width: 100%; height: auto; }
.donut-track { stroke: #e2e8f0; }
.donut-center-label { font-size: 11px; fill: var(--muted); }
.donut-center-pct { font-size: 13px; font-weight: 700; fill: var(--navy); }
.donut-legend { width: 100%; font-size: 11px; }
.donut-leg {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 2px 0;
}
.donut-leg i {
  width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0;
}
.donut-leg-name { flex: 1; line-height: 1.3; }
.donut-leg-pct {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--navy);
}

.rpt-cmp { margin: 8px 0 16px; }
.rpt-cmp-legend {
  display: flex; gap: 14px; font-size: 12px; margin-bottom: 8px; color: var(--muted);
}
.rpt-cmp-legend i {
  display: inline-block; width: 12px; height: 8px; border-radius: 2px;
  margin-right: 4px; vertical-align: middle;
}
.rpt-cmp-legend i.cur { background: #475569; }
.rpt-cmp-legend i.tgt { background: var(--navy); }
.rpt-cmp-row {
  display: grid;
  grid-template-columns: minmax(72px, 100px) 1fr 64px;
  gap: 6px;
  align-items: center;
  margin: 5px 0;
  font-size: 12px;
}
.rpt-cmp-lab { font-weight: 600; color: var(--text); line-height: 1.25; }
.rpt-cmp-bars { display: flex; flex-direction: column; gap: 3px; }
.rpt-cmp-track {
  height: 9px; background: #eef2f8; border-radius: 4px; overflow: hidden;
}
.rpt-cmp-track span { display: block; height: 100%; border-radius: 4px; }
.rpt-cmp-track span.cur { background: #475569; }
.rpt-cmp-track span.tgt { background: var(--navy); box-shadow: inset 0 0 0 1px rgba(26,53,102,.15); }
.rpt-cmp-nums {
  display: flex; flex-direction: column;
  font-variant-numeric: tabular-nums; font-size: 11px;
  color: var(--muted); text-align: right; gap: 2px;
}

@media (max-width: 560px) {
  .donut-grid { grid-template-columns: 1fr; }
  .donut-wrap { flex-direction: row; align-items: flex-start; gap: 10px; }
  .donut-svg { width: 120px; height: 120px; flex-shrink: 0; }
  .donut-legend { font-size: 10.5px; min-width: 0; flex: 1; }
  .donut-leg { align-items: flex-start; }
  .donut-leg-name {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  .donut-leg-pct { flex-shrink: 0; }
  .rpt-cmp-row { grid-template-columns: 1fr; gap: 2px; }
  .rpt-cmp-lab { font-size: 11px; }
  .rpt-cmp-nums { flex-direction: row; justify-content: flex-end; gap: 10px; }
  .lang-switch-label { display: none; }
  .app-header h1 { font-size: .98rem; }
  .modal { max-height: 100dvh; }
  .modal-body { max-height: calc(100dvh - 140px); }
}

@media print {
  .donut-card, .rpt-cmp, .rpt-charts, .donut-grid, .rpt-cover, table.rpt-table { break-inside: avoid; page-break-inside: avoid; }
  .donut-grid { display: grid !important; grid-template-columns: 1fr 1fr !important; gap: 8px; }
  .donut-wrap { overflow: visible; flex-direction: column; align-items: center; gap: 6px; }
  .donut-svg { overflow: visible; max-width: 140px; width: 140px; height: auto; }
  .donut-legend { font-size: 9pt; }
  .donut-card { overflow: visible; box-shadow: none; }
  .rpt-cmp-track { height: 10px; }
  .lang-switch, .sticky-actions, .skip-link, .app-header .lang-switch, .modal-actions, .btn-close { display: none !important; }
  .modal-backdrop, .modal { position: static !important; inset: auto !important; background: #fff !important; box-shadow: none !important; max-width: none !important; width: auto !important; height: auto !important; overflow: visible !important; }
  .modal-body { max-height: none !important; overflow: visible !important; }
  .report-doc { padding: 0; }
}

/* Design polish tweaks */
.card {
  position: relative;
}
.card::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 3px;
  border-radius: var(--radius) var(--radius) 0 0;
  background: linear-gradient(90deg, var(--red), var(--navy));
  pointer-events: none;
}
.card h2 .step {
  box-shadow: 0 2px 6px rgba(192, 18, 44, 0.28);
}
.btn-primary {
  letter-spacing: .02em;
  box-shadow: 0 4px 14px rgba(192, 18, 44, 0.28);
}
.btn-primary:hover { filter: brightness(1.05); }
.draft-tag {
  border: 1px solid rgba(255,255,255,.35);
}
.modal { border-top: 4px solid var(--red); }


/* —— Round5 overnight_self_optimize —— */
.offline-banner {
  display: none;
  margin: 8px 12px 0;
  background: #1a2a48;
  color: #e8eef8;
  border: 1.5px solid #3b6bb5;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: .82rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.4;
}
.offline-banner[hidden] { display: none !important; }
.offline-banner:not([hidden]) { display: block; }
body.is-offline .offline-banner:not([hidden]) { display: block; }
@media (prefers-color-scheme: dark) {
  .offline-banner { background: #0f1a2e; border-color: #6b8fc4; }
}

.chip.active {
  box-shadow: 0 0 0 2px rgba(192, 18, 44, 0.28);
}
.chip.risk.active, .chip.preset.active {
  border-color: var(--red);
}
.lang-btn {
  letter-spacing: 0.02em;
  min-width: 36px;
  min-height: 32px;
}
.lang-btn[aria-pressed="true"], .lang-btn.active {
  outline: 1px solid rgba(255,255,255,.55);
}

/* Donut legend readability */
.donut-leg-pct {
  min-width: 3.6em;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}
.donut-leg-name {
  letter-spacing: 0.01em;
}
html[lang="en"] body { letter-spacing: 0; }
html[lang="zh-Hans"] .app-header h1,
html[lang="zh-Hant"] .app-header h1 { letter-spacing: 0.02em; }

/* Compare nums alignment */
.rpt-cmp-row {
  grid-template-columns: minmax(76px, 110px) 1fr minmax(56px, 72px);
}
.rpt-cmp-nums {
  min-width: 56px;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
  align-items: flex-end;
}
.rpt-cmp-nums span {
  display: block;
  min-width: 4.2em;
  text-align: right;
  line-height: 1.25;
}
.report-doc td.num, .report-doc th.num {
  font-feature-settings: "tnum";
  white-space: nowrap;
}

/* Print polish layer */
@page {
  margin: 14mm 12mm 18mm;
  @top-left {
    content: "UCCL Allocation Toolkit · DRAFT_NOT_TO_SEND";
    font-family: "PingFang TC", "Noto Sans TC", sans-serif;
    font-size: 7.5pt;
    color: #C0122C;
  }
  @bottom-right {
    content: counter(page) " / " counter(pages);
    font-family: "PingFang TC", "Noto Sans TC", sans-serif;
    font-size: 8pt;
    color: #5a6472;
  }
  @bottom-left {
    content: "非投資建議 · Not investment advice";
    font-family: "PingFang TC", "Noto Sans TC", sans-serif;
    font-size: 7pt;
    color: #5a6472;
  }
}

@media print {
  .offline-banner { display: none !important; }
  .rpt-footer {
    border-top: 1px solid #c5ced9 !important;
    color: #334155 !important;
    font-size: 8pt !important;
    margin-top: 14pt !important;
    padding-top: 8pt !important;
  }
  .rpt-print-banner {
    border-width: 2px !important;
    margin-bottom: 10pt !important;
  }
  .donut-leg-pct { min-width: 3.2em; font-size: 8.5pt; }
  .donut-leg-name { font-size: 8.5pt; line-height: 1.25; }
  .rpt-cmp-row {
    grid-template-columns: 88px 1fr 64px !important;
    font-size: 9pt;
  }
  .rpt-cmp-nums {
    flex-direction: column !important;
    align-items: flex-end !important;
    gap: 1px !important;
  }
  .rpt-cmp-nums span { min-width: 4em; }
  .report-doc table { font-size: 8.5pt; }
  .report-doc th.num, .report-doc td.num { text-align: right !important; }
  .rpt-cover { border-top-width: 5px !important; }
}

@media (max-width: 390px) {
  .app-header { padding: 10px 12px 12px; }
  .app-header h1 { font-size: .92rem; }
  .lang-btn { padding: 4px 8px; font-size: .72rem; min-width: 32px; }
  .banner-warn { margin: 8px 8px 0; padding: 10px; font-size: .86rem; }
  .offline-banner { margin: 6px 8px 0; font-size: .78rem; }
  main { padding: 8px; }
  .card { padding: 12px; }
  .sticky-actions { gap: 6px; padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); }
  .btn { font-size: .88rem; }
  .donut-svg { width: 108px; height: 108px; }
  .rpt-cmp-row { grid-template-columns: 1fr; }
}

/* Modal focus ring for keyboard users */
.modal:focus { outline: none; }
.modal-head .btn-close:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}


/* —— Round6 overnight_self_optimize —— */
:root { --toast-clearance: 108px; --sticky-cta-h: 72px; }
@media (max-width: 400px) {
  :root { --toast-clearance: 118px; }
}

/* Toast never covers sticky CTA */
.toast {
  bottom: max(var(--toast-clearance), calc(var(--sticky-cta-h) + env(safe-area-inset-bottom, 0px) + 16px)) !important;
  z-index: 90;
  max-width: min(92vw, 420px);
}
body.modal-open .toast {
  bottom: max(24px, env(safe-area-inset-bottom, 0px) + 16px) !important;
}

/* Chip keyboard nav affordance */
.chips[role="group"] { outline: none; }
.chip:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
  box-shadow: var(--focus);
}
.chip.preset.active {
  background: var(--navy);
  color: #fff;
  border-style: solid;
  border-color: var(--red);
}

/* Stronger zebra + print long-table pagination */
.report-doc table.rpt-table tbody tr:nth-child(even) {
  background: rgba(26, 53, 102, 0.055);
}
.report-doc table.rpt-table tbody tr:nth-child(odd) {
  background: transparent;
}
.report-doc table.rpt-table tbody tr:hover {
  background: rgba(192, 18, 44, 0.04);
}
@media print {
  /* Allow long tables to paginate; keep header repeating */
  .report-doc table.rpt-table {
    break-inside: auto !important;
    page-break-inside: auto !important;
  }
  .report-doc table.rpt-table thead {
    display: table-header-group !important;
  }
  .report-doc table.rpt-table tbody tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .report-doc table.rpt-table tbody tr:nth-child(even) {
    background: #eef2f8 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .report-doc table.rpt-table tbody tr:nth-child(odd) {
    background: #fff !important;
  }
  /* Sleeve print contrast */
  .rpt-sleeve {
    background: #fff !important;
    border: 1.5px solid #1A3566 !important;
    border-left-width: 4px !important;
    box-shadow: none !important;
    color: #111 !important;
  }
  .rpt-sleeve.core {
    border-left-color: #1A3566 !important;
  }
  .rpt-sleeve.alpha {
    background: #fff5f6 !important;
    border-color: #C0122C !important;
    border-left-color: #C0122C !important;
  }
  .rpt-sleeve h3, .rpt-sleeve-head h3 { color: #1A3566 !important; }
  .rpt-sleeve.alpha h3, .rpt-sleeve.alpha .rpt-sleeve-head h3 { color: #C0122C !important; }
  .rpt-sleeve-pill {
    border: 1px solid currentColor;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .rpt-sleeve-note { color: #1a1a1a !important; }
  .rpt-sleeve-band { color: #334155 !important; }
  .sleeve {
    background: #fff !important;
    border: 1.5px solid #1A3566 !important;
    color: #111 !important;
  }
  .sleeve.alpha {
    background: #fff5f6 !important;
    border-color: #C0122C !important;
  }
}

/* Live donut in Step 3 */
.live-donut { margin: 10px 0 4px; }
.live-donut .donut-card h4 { font-size: .82rem; }

/* Dark mode: donut centre readable on dark cards */
@media (prefers-color-scheme: dark) {
  .donut-center-pct { fill: #e8eef8 !important; }
  .donut-center-label { fill: #9aa8bc !important; }
  .donut-leg-pct { color: #e8eef8; }
  .donut-card { background: #152038; }
  .donut-track { stroke: #243352 !important; }
  .report-doc table.rpt-table tbody tr:nth-child(even) {
    background: rgba(197, 212, 239, 0.06);
  }
}

/* PWA install / update strip */
.pwa-strip {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: max(var(--toast-clearance), calc(var(--sticky-cta-h) + env(safe-area-inset-bottom, 0px) + 8px));
  z-index: 95;
  display: none;
  align-items: center;
  gap: 10px;
  max-width: min(92vw, 440px);
  width: max-content;
  background: var(--navy-deep);
  color: #fff;
  padding: 10px 12px 10px 14px;
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  font-size: .82rem;
  font-weight: 600;
  line-height: 1.35;
}
.pwa-strip.show { display: flex; }
.pwa-strip .pwa-msg { flex: 1; min-width: 0; }
.pwa-strip .pwa-actions { display: flex; gap: 6px; flex-shrink: 0; }
.pwa-strip button {
  border: none;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: .78rem;
  font-weight: 800;
  cursor: pointer;
  min-height: 36px;
}
.pwa-strip .pwa-primary { background: var(--red); color: #fff; }
.pwa-strip .pwa-ghost { background: transparent; color: #c5d4ef; border: 1px solid #6b8fc4; }
body.modal-open .pwa-strip { display: none !important; }
@media print { .pwa-strip { display: none !important; } }


/* —— Round6 quick-guide —— */
.quick-guide {
  margin: 8px 12px 0;
  background: #f0f4ff;
  border: 1px solid #c8d6f0;
  border-radius: var(--radius-sm, 10px);
  font-size: .84rem;
}
.quick-guide summary {
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 600;
  color: var(--navy);
  list-style: none;
  user-select: none;
  border-radius: 9px;
}
.quick-guide summary:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}
.quick-guide summary::-webkit-details-marker { display: none; }
.quick-guide summary::after {
  content: "";
  float: right;
  width: 0; height: 0;
  margin-top: 7px;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--navy);
  opacity: .7;
}
.quick-guide[open] summary::after {
  border-top: none;
  border-bottom: 6px solid var(--navy);
}
.quick-guide ol {
  margin: 0;
  padding: 4px 14px 10px 30px;
  color: #2a3a5c;
  line-height: 1.75;
}
.quick-guide p {
  margin: 0 14px 10px;
  color: var(--muted);
  font-size: .8rem;
}
@media (prefers-color-scheme: dark) {
  .quick-guide { background: #1e2d4a; border-color: #2d4070; }
  .quick-guide ol { color: #c8d8f8; }
  .quick-guide summary { color: #e8eef8; }
  .quick-guide summary::after { border-top-color: #e8eef8; }
  .quick-guide[open] summary::after { border-bottom-color: #e8eef8; border-top: none; }
}
@media (max-width: 400px) {
  .quick-guide { margin-left: 10px; margin-right: 10px; }
}
@media (max-width: 390px) {
  .quick-guide { margin-left: 8px; margin-right: 8px; font-size: .8rem; }
}
@media print {
  .quick-guide { display: none !important; }
}


/* —— Round7 overnight_self_optimize —— */
:root { --header-safe-top: env(safe-area-inset-top, 0px); }

/* Cover KPI print colour fidelity (brand navy / red) */
@media print {
  .rpt-cover {
    border-top: 5px solid #C0122C !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .rpt-badge {
    background: #C0122C !important;
    color: #fff !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .rpt-kpi-strip {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .rpt-kpi {
    background: #eef2f8 !important;
    border: 1.5px solid #1A3566 !important;
  }
  .rpt-kpi-v { color: #1A3566 !important; font-weight: 800 !important; }
  .rpt-kpi-l { color: #334155 !important; }
  .rpt-kpi.accent {
    background: #fff0f2 !important;
    border: 1.5px solid #C0122C !important;
  }
  .rpt-kpi.accent .rpt-kpi-v { color: #C0122C !important; }
  .rpt-draft, .rpt-print-banner { color: #C0122C !important; }
  .rpt-co, .rpt-cover h1 { color: #1A3566 !important; }
}

/* Sticky safe zones — notch / home indicator */
@supports (padding: max(0px)) {
  .app-header {
    padding-top: max(12px, env(safe-area-inset-top, 0px));
  }
  .sticky-actions {
    padding-bottom: max(10px, env(safe-area-inset-bottom, 0px));
  }
  .modal-actions {
    padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
  }
  body.standalone-display .app-header {
    padding-top: max(14px, env(safe-area-inset-top, 0px));
  }
}

/* Error box affordance — clickable scroll target */
.input-errors {
  scroll-margin-top: calc(72px + env(safe-area-inset-top, 0px));
  cursor: pointer;
}
.input-errors:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}
.field.field-error input,
.alloc-row.field-error input {
  border-color: var(--red) !important;
  box-shadow: 0 0 0 2px rgba(192, 18, 44, 0.2);
}
.alloc-row, .field {
  scroll-margin-top: calc(80px + env(safe-area-inset-top, 0px));
}

/* Standalone / installed display */
@media (display-mode: standalone), (display-mode: fullscreen) {
  body { padding-bottom: calc(104px + env(safe-area-inset-bottom, 0px)); }
}
body.standalone-display .draft-tag::after {
  content: " · APP";
  font-weight: 600;
  opacity: .85;
}

/* Keep lang switch from jumping layout */
.lang-switch { flex-shrink: 0; }


/* —— Round8 overnight_self_optimize —— */
:root { --pwa-strip-h: 0px; }

/* Toast stacks above PWA strip when both could compete with sticky CTA */
.toast {
  bottom: max(
    var(--toast-clearance),
    calc(var(--sticky-cta-h) + var(--pwa-strip-h) + env(safe-area-inset-bottom, 0px) + 20px)
  ) !important;
}
body.pwa-strip-visible .toast {
  bottom: max(
    var(--toast-clearance),
    calc(var(--sticky-cta-h) + var(--pwa-strip-h) + env(safe-area-inset-bottom, 0px) + 24px)
  ) !important;
}

/* PWA strip sits just above sticky CTA; toast lifts further when strip visible */
.pwa-strip {
  bottom: calc(var(--sticky-cta-h) + env(safe-area-inset-bottom, 0px) + 10px) !important;
  z-index: 96;
}
body.pwa-strip-visible .pwa-strip {
  /* keep strip clear of sticky CTA */
  bottom: calc(var(--sticky-cta-h) + env(safe-area-inset-bottom, 0px) + 10px) !important;
}

/* Quick Start a11y */
.quick-guide summary {
  cursor: pointer;
  list-style: none;
}
.quick-guide summary:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
  border-radius: 6px;
}
.quick-guide[open] summary {
  margin-bottom: 4px;
}

/* Empty-state micro polish */
.empty-state {
  border-left: 3px solid var(--navy);
}
.empty-state.soft {
  border-left-color: #6b8fc4;
}
.empty-state strong {
  color: var(--navy);
  display: block;
  margin-bottom: 4px;
}
.empty-state p {
  margin: 0;
  color: var(--muted, #5a6472);
  font-size: .86rem;
  line-height: 1.45;
}

/* Safari / Firefox print colour fidelity (color-adjust for older Firefox) */
@media print {
  html, body, .report-doc, .rpt-cover, .rpt-kpi, .rpt-kpi-strip, .rpt-badge,
  .disclaimer, .rpt-print-banner, .rpt-sleeve, .sleeve,
  table.rpt-table tbody tr:nth-child(even) {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
  }
  /* Narrow cover meta: compress on small printable widths */
  .rpt-cover .meta,
  .rpt-cover .meta-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 4px 10px !important;
    font-size: 10pt !important;
    padding: 8px 10px !important;
  }
  .rpt-cover .meta-l { font-size: 8.5pt !important; }
  .rpt-cover .meta-v { font-size: 9.5pt !important; }
  .rpt-kpi-strip { gap: 6px !important; }
  .rpt-kpi { padding: 6px 4px !important; }
}

@media (max-width: 420px) {
  .rpt-cover .meta,
  .rpt-cover .meta-grid {
    grid-template-columns: 1fr !important;
    gap: 4px 8px;
    font-size: 12px;
  }
}


/* —— Round9 overnight_self_optimize —— */
.skip-link:focus,
.skip-link:focus-visible {
  left: 0;
  top: 0;
  outline: 3px solid #fff;
  outline-offset: 2px;
  box-shadow: 0 0 0 5px #C0122C;
}
#main:focus {
  outline: none;
}
#main:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 4px;
  border-radius: 8px;
}

/* Toast / errors already aria-live; keep visible focus for screen-reader follow-ups */
.toast[aria-live] {
  /* ensure toast stays readable above chrome */
  z-index: 120;
}
.input-errors[aria-live="assertive"] {
  border-left: 3px solid var(--red);
}

/* PWA platform hint strip under offline banner */
.pwa-hint {
  margin: 0 16px 10px;
  padding: 8px 12px;
  border-radius: 8px;
  background: #eef3fb;
  border: 1px solid #c5d3ea;
  color: #1A3566;
  font-size: .78rem;
  line-height: 1.45;
}
.pwa-hint[data-kind="ios"] {
  border-color: #c5d3ea;
}
.pwa-hint[data-kind="standalone"] {
  background: #e8f5ee;
  border-color: #9fd0b2;
  color: #14532d;
}
.pwa-hint[data-kind="offline"] {
  background: #fff7ed;
  border-color: #fdba74;
  color: #9a3412;
}
@media (prefers-color-scheme: dark) {
  .pwa-hint { background: #1e2d4a; border-color: #2d4070; color: #dbe7ff; }
  .pwa-hint[data-kind="standalone"] { background: #143528; border-color: #2f6b4a; color: #bbf7d0; }
  .pwa-hint[data-kind="offline"] { background: #3b2614; border-color: #9a5b22; color: #fed7aa; }
}
@media (max-width: 400px) {
  .pwa-hint { margin-left: 10px; margin-right: 10px; font-size: .74rem; }
}
@media print {
  .pwa-hint { display: none !important; }
}
body.standalone-display .pwa-hint[data-kind="standalone"] {
  display: block;
}


/* —— Round10 overnight_self_optimize —— */
.empty-state {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 12px;
  align-items: start;
}
.empty-state .empty-art {
  grid-row: 1 / span 2;
  width: 40px;
  height: 40px;
  margin-top: 2px;
  opacity: 0.92;
}
.empty-state .empty-art svg { display: block; }
.empty-state strong { grid-column: 2; }
.empty-state p { grid-column: 2; }
@media (max-width: 400px) {
  .empty-state { grid-template-columns: 32px 1fr; gap: 8px 10px; }
  .empty-state .empty-art { width: 32px; height: 32px; }
  .empty-state .empty-art svg { width: 32px; height: 32px; }
}
@media (prefers-reduced-motion: reduce) {
  .empty-art { opacity: 1; }
}
@media print {
  .empty-art { display: none !important; }
}

/* Cover / report KPI compress on narrow meeting phones */
@media (max-width: 390px) {
  .rpt-kpi-strip { gap: 5px; }
  .rpt-kpi { padding: 5px 3px; }
  .rpt-kpi-v { font-size: 0.8rem; letter-spacing: -0.01em; }
  .rpt-kpi-l { font-size: 10px; line-height: 1.25; }
  .rpt-cover h1 { font-size: 1.12rem; }
  .kpi-grid .kpi .v { font-size: 1.05rem; }
}

/* Errors stay clear of sticky CTA when scrolled into view; toast lifts via --toast-clearance */
.input-errors {
  scroll-margin-bottom: calc(var(--sticky-cta-h, 72px) + env(safe-area-inset-bottom, 0px) + 28px);
  scroll-margin-top: calc(var(--header-h, 56px) + 12px);
}
body.has-input-errors .toast {
  /* clearance already bumped in JS; keep readable max width */
  max-width: min(92vw, 400px);
}

/* Focus order polish: sticky CTAs + draft clear */
.sticky-actions .btn:focus-visible,
#btnClearDraft:focus-visible,
.draft-row .btn-text:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
  box-shadow: var(--focus);
}

/* PWA three-layer pressure: hide duplicate top iOS hint while bottom strip shows */
body.pwa-strip-visible .pwa-hint[data-kind="ios"] {
  display: none !important;
}
body.standalone-display .pwa-hint[data-kind="ios"] {
  display: none !important;
}

/* Download/print colour fidelity extras (WebKit + Firefox color-adjust) */
@media print {
  .rpt-kpi-v { font-size: 9.5pt !important; }
  .rpt-kpi-l { font-size: 8pt !important; }
  .rpt-kpi.accent, .rpt-badge, .rpt-print-banner, .disclaimer {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
  }
}


/* —— Round11 overnight_self_optimize —— */
/* Update strip × offline: keep top banner + bottom strip; hide duplicate offline hint */
body.is-offline.pwa-strip-visible .offline-banner {
  margin-bottom: 8px;
  position: relative;
  z-index: 5;
}
body.is-offline.pwa-strip-visible,
body.pwa-update-offline {
  padding-bottom: calc(
    var(--sticky-cta-h, 72px) + var(--pwa-strip-h, 48px) + env(safe-area-inset-bottom, 0px) + 32px
  );
}
body.pwa-update-offline .pwa-hint[data-kind="offline"],
body.is-offline.pwa-strip-visible .pwa-hint[data-kind="offline"] {
  display: none !important;
}
body.pwa-update-offline .pwa-strip,
body.is-offline.pwa-strip-visible .pwa-strip {
  /* stay above sticky CTA; never cover offline banner (top flow) */
  z-index: 96;
  bottom: calc(var(--sticky-cta-h) + env(safe-area-inset-bottom, 0px) + 10px) !important;
}
body.pwa-update-offline .toast,
body.is-offline.pwa-strip-visible .toast {
  bottom: max(
    var(--toast-clearance),
    calc(var(--sticky-cta-h) + var(--pwa-strip-h) + env(safe-area-inset-bottom, 0px) + 28px)
  ) !important;
}

/* Full-page Tab order: ensure sticky CTAs and modal close stay in natural order with visible focus */
.sticky-actions .btn:focus-visible,
#btnCloseReport:focus-visible,
.modal-actions .btn:focus-visible,
.lang-btn:focus-visible,
.chip:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
  box-shadow: var(--focus);
}
.modal-backdrop.open .modal {
  /* keep dialog in tab cycle only while open (already focus-trapped in JS) */
  isolation: isolate;
}


/* —— Round12 overnight_self_optimize —— */
/* Sleeve cards + compare bars: compress on ≤390 meeting phones — no overflow */
@media (max-width: 390px) {
  .sleeve {
    padding: 8px 10px;
    margin-bottom: 8px;
    border-radius: 8px;
  }
  .sleeve-intro { font-size: .78rem; margin-bottom: 8px; line-height: 1.4; }
  .sleeve-head { gap: 6px; margin-bottom: 4px; align-items: center; }
  .sleeve-head h3,
  .sleeve h3 {
    font-size: .82rem;
    line-height: 1.3;
    overflow-wrap: anywhere;
    word-break: break-word;
    min-width: 0;
  }
  .sleeve p { font-size: .76rem; line-height: 1.4; }
  .sleeve .alpha-note { font-size: .74rem; padding: 6px 8px; line-height: 1.35; }
  .sleeve .band { font-size: .7rem; line-height: 1.35; }
  .sleeve-pill {
    font-size: .55rem;
    padding: 2px 6px;
    letter-spacing: .03em;
    max-width: 42%;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .rpt-sleeve {
    margin: 8px 0;
    padding: 8px 10px;
    border-radius: 8px;
  }
  .rpt-sleeve-head {
    gap: 6px;
    margin-bottom: 4px;
    flex-wrap: wrap;
    align-items: center;
  }
  .rpt-sleeve-head h3,
  .rpt-sleeve h3 {
    font-size: .82rem;
    line-height: 1.3;
    overflow-wrap: anywhere;
    word-break: break-word;
    min-width: 0;
  }
  .rpt-sleeve-pill {
    font-size: .55rem;
    padding: 2px 6px;
    letter-spacing: .02em;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .rpt-sleeve-note { font-size: .76rem; line-height: 1.4; overflow-wrap: anywhere; }
  .rpt-sleeve-band { font-size: .7rem; line-height: 1.35; overflow-wrap: anywhere; }

  /* Compare / overview bars: stack cleanly, no horizontal spill */
  .rpt-cmp { margin: 6px 0 12px; }
  .rpt-cmp-legend { gap: 10px; font-size: 11px; flex-wrap: wrap; }
  .rpt-cmp-row {
    grid-template-columns: 1fr;
    gap: 2px;
    margin: 4px 0;
    font-size: 11px;
  }
  .rpt-cmp-lab {
    font-size: 10.5px;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  .rpt-cmp-bars { min-width: 0; width: 100%; }
  .rpt-cmp-track { height: 7px; max-width: 100%; }
  .rpt-cmp-nums {
    flex-direction: row;
    justify-content: flex-end;
    gap: 8px;
    font-size: 10px;
    min-width: 0;
  }
  .rpt-cmp-nums span { min-width: 0; }

  .gap-overview { padding: 8px 10px; }
  .stack-bar { min-width: 0; }
}

/* Download HTML parity helpers mirrored in screen CSS (print/dark already Round6+) */
@media (prefers-color-scheme: dark) {
  .rpt-sleeve { background: #152038; border-color: #243352; }
  .rpt-sleeve.alpha {
    background: linear-gradient(135deg, rgba(192,18,44,.14), #152038 45%);
    border-color: rgba(192,18,44,.35);
  }
  .rpt-sleeve-band { color: #9aa8bc; }
  .rpt-cmp-track { background: #243352; }
  .rpt-cmp-lab { color: #e8eef8; }
  .rpt-cmp-nums { color: #9aa8bc; }
  .rpt-cover .meta,
  .rpt-cover .meta-grid { background: #1a2a48; }
  .rpt-cmp-legend { color: #c5d4ef; }
  .rpt-cmp-legend i.cur {
    background: #94a3b8;
    box-shadow: 0 0 0 1px rgba(232, 238, 248, 0.35);
  }
  .rpt-cmp-legend i.tgt {
    background: #6b8fc4;
    box-shadow: 0 0 0 1px rgba(197, 212, 239, 0.4);
  }
}

/* —— Round13 overnight_self_optimize —— */
/* Cover meta: ultra-narrow meeting phones (≤360 / ≤320) */
@media (max-width: 360px) {
  .rpt-cover .meta,
  .rpt-cover .meta-grid {
    grid-template-columns: 1fr !important;
    gap: 3px 6px;
    padding: 6px 8px;
    font-size: 10.5px;
  }
  .rpt-cover .meta-grid .meta-l,
  .rpt-cover .meta .meta-l {
    font-size: 9px;
    letter-spacing: .02em;
  }
  .rpt-cover .meta-grid .meta-v,
  .rpt-cover .meta .meta-v {
    font-size: .78rem;
    line-height: 1.25;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  .rpt-cover h1 { font-size: 1.05rem; }
  .rpt-kicker { font-size: .6rem; }
  .rpt-h1-sub { font-size: .65rem; }
}
@media (max-width: 320px) {
  .rpt-cover .meta,
  .rpt-cover .meta-grid {
    padding: 5px 6px;
    font-size: 10px;
    gap: 2px 4px;
  }
  .rpt-cover .meta-grid .meta-v,
  .rpt-cover .meta .meta-v { font-size: .72rem; }
  .rpt-cover h1 { font-size: .98rem; line-height: 1.2; }
}

/* Round13 legend dark — Compare legend: dark-mode contrast (swatch + label) */
@media (prefers-color-scheme: dark) {
  .rpt-cmp-legend {
    color: #c5d4ef;
  }
  .rpt-cmp-legend i.cur {
    background: #94a3b8;
    box-shadow: 0 0 0 1px rgba(232, 238, 248, 0.35);
  }
  .rpt-cmp-legend i.tgt {
    background: #6b8fc4;
    box-shadow: 0 0 0 1px rgba(197, 212, 239, 0.4);
  }
  .gap-overview .legend,
  .gap-overview .ov-legend {
    color: #c5d4ef;
  }
}

/* Print: Chromium-first color fidelity; FF/WebKit use color-adjust / -webkit fallbacks (no FF/WebKit runtime this box) */
@media print {
  .rpt-cmp-legend { color: #334155 !important; }
  .rpt-cmp-legend i.cur { background: #475569 !important; }
  .rpt-cmp-legend i.tgt { background: #1A3566 !important; }
}

/* Sticky + modal Tab focus: keep CTAs and dialog chrome clearly ringed */
.sticky-actions .btn:focus-visible,
.modal-actions .btn:focus-visible,
#btnCloseReport:focus-visible {
  outline: 2px solid #C0122C;
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.25);
}
body.modal-open .sticky-actions {
  /* While report open, sticky is covered; keep non-interactive affordance for escape-focus pullback */
  pointer-events: none;
}

/* Empty-art labelled (role=img) — keep compact */
.empty-state .empty-art[role="img"] {
  flex-shrink: 0;
}

/* PWA: when install/ios/update strip shows, force-hide any leftover top iOS hint */
body.pwa-strip-visible .pwa-hint[data-kind="ios"],
body.pwa-strip-visible .pwa-hint[data-kind="install"] {
  display: none !important;
}


/* —— Round14 overnight_self_optimize —— */
/* Ultra-narrow KPI + donut (≤360 / ≤320) — meeting phones */
@media (max-width: 360px) {
  .rpt-kpi-strip {
    grid-template-columns: 1fr 1fr;
    gap: 4px;
  }
  .rpt-kpi { padding: 4px 2px; border-radius: 7px; }
  .rpt-kpi-v { font-size: .72rem; letter-spacing: -0.015em; }
  .rpt-kpi-l { font-size: 9px; line-height: 1.2; }
  .donut-grid { gap: 8px; }
  .donut-svg { width: 96px; height: 96px; }
  .donut-legend { font-size: 10px; }
  .donut-leg { gap: 4px; margin: 1px 0; }
  .donut-leg-pct { min-width: 3em; font-size: 10px; }
  .rpt-sleeve-band { font-size: .66rem; line-height: 1.3; }
  .sleeve .band { font-size: .66rem; line-height: 1.3; }
  .rpt-engine-note { font-size: 9px; line-height: 1.35; }
}
@media (max-width: 320px) {
  .rpt-kpi-strip { gap: 3px; }
  .rpt-kpi { padding: 3px 2px; border-radius: 6px; }
  .rpt-kpi-v { font-size: .66rem; letter-spacing: -0.02em; }
  .rpt-kpi-l { font-size: 8.5px; }
  .donut-svg { width: 84px; height: 84px; }
  .donut-legend { font-size: 9px; }
  .donut-leg-pct { min-width: 2.8em; font-size: 9px; }
  .rpt-sleeve-band { font-size: .62rem; }
  .sleeve .band { font-size: .62rem; }
}

/* Legend high contrast: prefers-contrast + forced-colors */
@media (prefers-contrast: more) {
  .rpt-cmp-legend { color: #0f172a; font-weight: 700; }
  .rpt-cmp-legend i.cur {
    background: #334155;
    box-shadow: 0 0 0 2px #0f172a;
  }
  .rpt-cmp-legend i.tgt {
    background: #1A3566;
    box-shadow: 0 0 0 2px #0f172a;
  }
  .stack-legend { color: #0f172a; font-weight: 700; }
  .stack-legend i.cur { background: #334155; outline: 2px solid #0f172a; }
  .stack-legend i.tgt { background: #1A3566; outline: 2px solid #0f172a; }
  .donut-leg-name { font-weight: 600; color: #0f172a; }
}
@media (forced-colors: active) {
  .rpt-cmp-legend i.cur,
  .rpt-cmp-legend i.tgt,
  .stack-legend i.cur,
  .stack-legend i.tgt,
  .donut-leg i {
    forced-color-adjust: none;
    border: 1px solid CanvasText;
  }
  .rpt-cmp-legend i.cur { background: GrayText; }
  .rpt-cmp-legend i.tgt { background: Highlight; }
  .rpt-cmp-legend { color: CanvasText; }
  .modal-focus-first:focus-visible,
  .modal-focus-last:focus-visible {
    outline: 3px solid Highlight;
    outline-offset: 3px;
  }
}

/* Modal first / last focusable — stronger visible ring */
.modal-backdrop.open .modal-focus-first:focus-visible,
.modal-backdrop.open .modal-focus-last:focus-visible {
  outline: 3px solid #C0122C;
  outline-offset: 3px;
  box-shadow: 0 0 0 4px rgba(192, 18, 44, 0.28), 0 0 0 1px #1A3566;
  border-radius: 6px;
}

/* Error linkage: pulse err box + flash target field */
.input-errors.err-pulse {
  animation: uccl-err-pulse 0.85s ease;
}
/* @keyframes uccl-err-pulse redefined in Round15 block below */
.field.field-error-flash input,
.alloc-row.field-error-flash input {
  border-color: #C0122C !important;
  box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.35);
  transition: box-shadow 0.2s ease;
}
@media (prefers-reduced-motion: reduce) {
  .input-errors.err-pulse { animation: none; box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.3); }
}

/* PWA update × offline: slightly more strip clearance */
body.pwa-update-offline,
body.is-offline.pwa-strip-visible {
  padding-bottom: calc(
    var(--sticky-cta-h, 72px) + var(--pwa-strip-h, 48px) + env(safe-area-inset-bottom, 0px) + 40px
  );
}
body.pwa-update-offline .pwa-strip,
body.is-offline.pwa-strip-visible .pwa-strip {
  bottom: calc(var(--sticky-cta-h) + env(safe-area-inset-bottom, 0px) + 14px) !important;
  gap: 8px;
}
body.pwa-update-offline .offline-banner,
body.is-offline.pwa-strip-visible .offline-banner {
  margin-bottom: 12px;
}
body.pwa-update-offline .toast,
body.is-offline.pwa-strip-visible .toast {
  bottom: max(
    var(--toast-clearance),
    calc(var(--sticky-cta-h) + var(--pwa-strip-h) + env(safe-area-inset-bottom, 0px) + 36px)
  ) !important;
}

/* Print / download: Chromium-first engine note */
.rpt-engine-note {
  margin: 6px 0 0;
  text-align: center;
  font-size: 10px;
  color: #64748b;
  line-height: 1.4;
}
@media print {
  .rpt-engine-note {
    color: #5a6472 !important;
    font-size: 8pt !important;
  }
}
@media (prefers-color-scheme: dark) {
  .rpt-engine-note { color: #9aa8bc; }
}

/* —— Round15 overnight_self_optimize —— */
/* Ultra-narrow: sleeves + compare + engine note further (≤360 / ≤320) */
@media (max-width: 360px) {
  .rpt-sleeve { margin: 6px 0; padding: 7px 8px; border-radius: 7px; }
  .rpt-sleeve-head { gap: 4px; margin-bottom: 3px; }
  .rpt-sleeve-head h3, .rpt-sleeve h3 { font-size: .78rem; line-height: 1.25; }
  .rpt-sleeve-pill { font-size: .52rem; padding: 1px 5px; }
  .rpt-sleeve-note { font-size: .72rem; line-height: 1.35; }
  .rpt-cmp { margin: 5px 0 10px; }
  .rpt-cmp-legend { gap: 8px; font-size: 10px; }
  .rpt-cmp-row { margin: 3px 0; font-size: 10.5px; gap: 2px; }
  .rpt-cmp-lab { font-size: 10px; }
  .rpt-cmp-track { height: 6px; }
  .rpt-cmp-nums { gap: 6px; font-size: 9.5px; }
  .rpt-engine-note { font-size: 9px; line-height: 1.35; margin-top: 4px; }
  .gap-overview { padding: 6px 8px; }
}
@media (max-width: 320px) {
  .rpt-sleeve { padding: 6px 7px; }
  .rpt-sleeve-head h3, .rpt-sleeve h3 { font-size: .72rem; }
  .rpt-sleeve-note { font-size: .68rem; }
  .rpt-cmp-legend { font-size: 9.5px; gap: 6px; }
  .rpt-cmp-row { font-size: 10px; margin: 2px 0; }
  .rpt-cmp-track { height: 5px; }
  .rpt-cmp-nums { font-size: 9px; gap: 5px; }
  .rpt-engine-note { font-size: 8.5px; line-height: 1.3; }
}

/* forced-colors / prefers-contrast: broaden to KPI + stack + sleeve pills */
@media (prefers-contrast: more) {
  .rpt-kpi { border-width: 2px; }
  .rpt-kpi-v { font-weight: 700; }
  .rpt-sleeve-pill { outline: 1px solid #0f172a; }
  .donut-leg i { outline: 2px solid #0f172a; }
  .input-errors { border-width: 2px; font-weight: 600; }
}
@media (forced-colors: active) {
  .rpt-kpi { border: 2px solid CanvasText; background: Canvas; }
  .rpt-kpi-v { color: CanvasText; font-weight: 700; }
  .stack-legend i.cur { background: GrayText; border: 1px solid CanvasText; }
  .stack-legend i.tgt { background: Highlight; border: 1px solid CanvasText; }
  .donut-leg i { border: 1px solid CanvasText; forced-color-adjust: none; }
  .rpt-sleeve { border: 2px solid CanvasText; }
  .rpt-sleeve.alpha { border-color: Highlight; }
  .rpt-sleeve-pill { border: 1px solid CanvasText; forced-color-adjust: none; }
  .input-errors { border: 2px solid Highlight; color: CanvasText; }
  .field.field-error-flash input,
  .alloc-row.field-error-flash input {
    outline: 3px solid Highlight;
    border-color: Highlight !important;
  }
}

/* Error pulse polish + sticky clearance */
.input-errors {
  scroll-margin-top: calc(var(--sticky-cta-h, 72px) + 12px);
  scroll-margin-bottom: 24px;
}
.input-errors.err-pulse-strong {
  border-color: #C0122C;
  box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.28), 0 0 0 1px rgba(26, 53, 102, 0.2);
}
.field.field-error-flash,
.alloc-row.field-error-flash {
  scroll-margin-top: calc(var(--sticky-cta-h, 72px) + 16px);
}
@keyframes uccl-err-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(192, 18, 44, 0); }
  25% { box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.4); }
  55% { box-shadow: 0 0 0 5px rgba(192, 18, 44, 0.22); }
}

/* PWA update × offline: extra strip clearance (Round15) */
body.pwa-update-offline,
body.is-offline.pwa-strip-visible {
  padding-bottom: calc(
    var(--sticky-cta-h, 72px) + var(--pwa-strip-h, 48px) + env(safe-area-inset-bottom, 0px) + 48px
  );
}
body.pwa-update-offline .pwa-strip,
body.is-offline.pwa-strip-visible .pwa-strip {
  bottom: calc(var(--sticky-cta-h) + env(safe-area-inset-bottom, 0px) + 18px) !important;
  gap: 10px;
}
body.pwa-update-offline .offline-banner,
body.is-offline.pwa-strip-visible .offline-banner {
  margin-bottom: 14px;
}
body.pwa-update-offline .toast,
body.is-offline.pwa-strip-visible .toast {
  bottom: max(
    var(--toast-clearance),
    calc(var(--sticky-cta-h) + var(--pwa-strip-h) + env(safe-area-inset-bottom, 0px) + 42px)
  ) !important;
}

/* Standalone cold-start cache-miss: soft hint tint (toast carries copy) */
body.standalone-display.pwa-cache-miss .pwa-hint[data-kind="standalone"] {
  border-color: #b45309;
  background: #fff7ed;
  color: #9a3412;
}
@media (prefers-color-scheme: dark) {
  body.standalone-display.pwa-cache-miss .pwa-hint[data-kind="standalone"] {
    background: #3a2710;
    border-color: #b45309;
    color: #fdba74;
  }
}

/* —— Round16 overnight_self_optimize —— */
/* Harden forced-colors for KPI + accent + labels (R15 flake fix + broaden) */
@media (forced-colors: active) {
  .rpt-kpi { border: 2px solid CanvasText; background: Canvas; color: CanvasText; }
  .rpt-kpi-v { color: CanvasText; font-weight: 700; }
  .rpt-kpi-l { color: CanvasText; }
  .rpt-kpi.accent { border: 2px solid Highlight; background: Canvas; }
  .rpt-kpi.accent .rpt-kpi-v { color: CanvasText; font-weight: 800; }
  .rpt-kpi-strip { gap: 6px; }
  .stack-legend { color: CanvasText; }
  .donut-leg-name, .donut-leg-pct { color: CanvasText; }
  .rpt-sleeve { border: 2px solid CanvasText; background: Canvas; }
  .rpt-sleeve.alpha { border-color: Highlight; }
  .rpt-sleeve-head h3, .rpt-sleeve h3 { color: CanvasText; }
  .rpt-engine-note { color: CanvasText; }
  .modal-backdrop.open #btnCloseReport:focus,
  .modal-backdrop.open #btnCloseReport:focus-visible,
  .modal-backdrop.open .modal-focus-first:focus,
  .modal-backdrop.open .modal-focus-first:focus-visible {
    outline: 3px solid Highlight;
    outline-offset: 3px;
  }
}

/* Ultra-narrow ≤300: sleeve / KPI / donut / engine */
@media (max-width: 300px) {
  .rpt-kpi-strip { gap: 2px; grid-template-columns: 1fr 1fr; }
  .rpt-kpi { padding: 2px 1px; border-radius: 5px; }
  .rpt-kpi-v { font-size: .6rem; letter-spacing: -0.025em; }
  .rpt-kpi-l { font-size: 8px; line-height: 1.15; }
  .donut-svg { width: 76px; height: 76px; }
  .donut-legend { font-size: 8.5px; }
  .donut-leg { gap: 3px; margin: 0; }
  .donut-leg-pct { min-width: 2.4em; font-size: 8.5px; }
  .rpt-sleeve { margin: 5px 0; padding: 5px 6px; border-radius: 6px; }
  .rpt-sleeve-head { gap: 3px; margin-bottom: 2px; }
  .rpt-sleeve-head h3, .rpt-sleeve h3 { font-size: .68rem; line-height: 1.2; }
  .rpt-sleeve-pill { font-size: .48rem; padding: 1px 4px; }
  .rpt-sleeve-note { font-size: .64rem; line-height: 1.3; }
  .rpt-sleeve-band { font-size: .58rem; }
  .rpt-cmp { margin: 4px 0 8px; }
  .rpt-cmp-legend { font-size: 9px; gap: 5px; }
  .rpt-cmp-row { font-size: 9.5px; margin: 2px 0; }
  .rpt-cmp-track { height: 4px; }
  .rpt-cmp-nums { font-size: 8.5px; gap: 4px; }
  .rpt-engine-note { font-size: 8px; line-height: 1.25; }
  .rpt-cover h1 { font-size: .92rem; }
}

/* Screen sleeve list at ≤300 (live #sleeveList, not only report) */
@media (max-width: 300px) {
  .sleeve { padding: 6px 7px; margin: 6px 0; }
  .sleeve h3 { font-size: .72rem; }
  .sleeve .band { font-size: .58rem; }
  .sleeve .note { font-size: .7rem; }
}

/* PWA update × offline: Round16 measured clearance + isolate banner */
body.pwa-update-offline,
body.is-offline.pwa-strip-visible {
  padding-bottom: calc(
    var(--sticky-cta-h, 72px) + var(--pwa-strip-h, 48px) + env(safe-area-inset-bottom, 0px) + 56px
  );
}
body.pwa-update-offline .pwa-strip,
body.is-offline.pwa-strip-visible .pwa-strip {
  bottom: calc(var(--sticky-cta-h) + env(safe-area-inset-bottom, 0px) + 22px) !important;
  gap: 10px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.18);
}
body.pwa-update-offline .offline-banner,
body.is-offline.pwa-strip-visible .offline-banner {
  margin-bottom: 16px;
  position: relative;
  z-index: 3;
}
body.pwa-update-offline .toast,
body.is-offline.pwa-strip-visible .toast {
  bottom: max(
    var(--toast-clearance),
    calc(var(--sticky-cta-h) + var(--pwa-strip-h) + env(safe-area-inset-bottom, 0px) + 48px)
  ) !important;
}

/* Cold-start cache-miss: slightly longer tint window styling */
body.standalone-display.pwa-cache-miss .pwa-hint[data-kind="standalone"] {
  font-weight: 600;
}


/* —— Round17 overnight_self_optimize —— */
/* Ultra-narrow ≤280: KPI / donut / sleeve / cmp / engine */
@media (max-width: 280px) {
  .rpt-kpi-strip { gap: 2px; grid-template-columns: 1fr 1fr; }
  .rpt-kpi { padding: 2px 1px; border-radius: 4px; }
  .rpt-kpi-v { font-size: .55rem; letter-spacing: -0.03em; }
  .rpt-kpi-l { font-size: 7.5px; line-height: 1.1; }
  .donut-svg { width: 68px; height: 68px; }
  .donut-legend { font-size: 8px; }
  .donut-leg { gap: 2px; margin: 0; }
  .donut-leg-pct { min-width: 2.2em; font-size: 8px; }
  .rpt-sleeve { margin: 4px 0; padding: 4px 5px; border-radius: 5px; }
  .rpt-sleeve-head { gap: 2px; margin-bottom: 2px; }
  .rpt-sleeve-head h3, .rpt-sleeve h3 { font-size: .62rem; line-height: 1.15; }
  .rpt-sleeve-pill { font-size: .44rem; padding: 1px 3px; }
  .rpt-sleeve-note { font-size: .58rem; line-height: 1.25; }
  .rpt-sleeve-band { font-size: .52rem; }
  .rpt-cmp { margin: 3px 0 6px; }
  .rpt-cmp-legend { font-size: 8.5px; gap: 4px; color: #334155; }
  .rpt-cmp-legend i.cur { background: #475569; }
  .rpt-cmp-legend i.tgt { background: #1A3566; }
  .rpt-cmp-row { font-size: 9px; margin: 1px 0; }
  .rpt-cmp-track { height: 3px; }
  .rpt-cmp-nums { font-size: 8px; gap: 3px; }
  .rpt-engine-note { font-size: 7.5px; line-height: 1.2; color: #64748b; }
  .rpt-cover h1 { font-size: .86rem; }
  .sleeve { padding: 5px 6px; margin: 5px 0; }
  .sleeve h3 { font-size: .66rem; }
  .sleeve .band { font-size: .52rem; }
  .sleeve .note { font-size: .64rem; }
}

/* Optional foldable sleeves: ≤280 collapse note/band behind <details>; ≥281 always show */
.rpt-sleeve-fold {
  margin: 2px 0 0;
  border: 0;
  padding: 0;
  background: transparent;
}
.rpt-sleeve-fold > summary {
  cursor: pointer;
  list-style: none;
  font-size: .7rem;
  font-weight: 700;
  color: #1A3566;
  padding: 2px 0;
  user-select: none;
}
.rpt-sleeve-fold > summary::-webkit-details-marker { display: none; }
.rpt-sleeve-fold > summary::before {
  content: "▸ ";
  color: #C0122C;
  font-weight: 800;
}
.rpt-sleeve-fold[open] > summary::before { content: "▾ "; }
@media (min-width: 281px) {
  .rpt-sleeve-fold > summary { display: none !important; }
  .rpt-sleeve-fold > *:not(summary) { display: block !important; }
}
@media (max-width: 280px) {
  .rpt-sleeve-fold:not([open]) > *:not(summary) { /* UA hides; keep summary visible */ }
  .rpt-sleeve > p.rpt-sleeve-body {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
  }
  .rpt-sleeve-fold[open] ~ .rpt-sleeve-body,
  .rpt-sleeve:has(.rpt-sleeve-fold[open]) > p.rpt-sleeve-body {
    -webkit-line-clamp: unset;
    display: block;
    overflow: visible;
  }
}

/* Print preview: force light bg even when OS dark (Chromium-only fidelity note) */
@media print {
  html {
    color-scheme: light only !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
  }
  body {
    background: #fff !important;
    color: #111 !important;
    color-scheme: light only !important;
  }
  .rpt-cmp-legend { color: #334155 !important; font-weight: 600; }
  .rpt-cmp-legend i.cur { background: #475569 !important; box-shadow: none !important; }
  .rpt-cmp-legend i.tgt { background: #1A3566 !important; box-shadow: none !important; }
  .rpt-engine-note { color: #5a6472 !important; }
  .donut-leg-name { color: #1a1a1a !important; }
  .donut-leg-pct { color: #1A3566 !important; }
  /* Override any dark-scheme screen rules that leak into print preview */
  .rpt-cover, .donut-card, .rpt-sleeve, .disclaimer, .rpt-kpi {
    color-scheme: light only;
  }
}

/* Forced-colors + error flash polish (Round17) */
@media (forced-colors: active) {
  .rpt-cmp-legend { color: CanvasText; font-weight: 700; }
  .rpt-cmp-legend i.cur,
  .rpt-cmp-legend i.tgt,
  .donut-leg i {
    forced-color-adjust: none;
    border: 1px solid CanvasText;
  }
  .rpt-engine-note { color: CanvasText; border-top: 1px solid CanvasText; padding-top: 4px; }
  .field.field-error-flash input,
  .alloc-row.field-error-flash input {
    outline: 3px solid Highlight;
    outline-offset: 2px;
    border-color: Highlight;
  }
  .input-errors.err-pulse-strong {
    border: 2px solid Highlight;
    color: CanvasText;
    background: Canvas;
  }
}
.field.field-error-flash input,
.alloc-row.field-error-flash input {
  animation: uccl-field-flash 1.1s ease-out 1;
  box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.28);
}
@keyframes uccl-field-flash {
  0% { box-shadow: 0 0 0 4px rgba(192, 18, 44, 0.45); }
  100% { box-shadow: 0 0 0 0 rgba(192, 18, 44, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .field.field-error-flash input,
  .alloc-row.field-error-flash input {
    animation: none;
    box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.35);
  }
}

/* PWA update×offline: Round17 measured clearance (+4 vs R16) + race-safe isolation */
body.pwa-update-offline,
body.is-offline.pwa-strip-visible {
  padding-bottom: calc(
    var(--sticky-cta-h, 72px) + var(--pwa-strip-h, 48px) + env(safe-area-inset-bottom, 0px) + 60px
  );
}
body.pwa-update-offline .pwa-strip,
body.is-offline.pwa-strip-visible .pwa-strip {
  bottom: calc(var(--sticky-cta-h) + env(safe-area-inset-bottom, 0px) + 26px) !important;
  gap: 12px;
  z-index: 45;
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.2);
}
body.pwa-update-offline .offline-banner,
body.is-offline.pwa-strip-visible .offline-banner {
  margin-bottom: 18px;
  position: relative;
  z-index: 4;
}
body.pwa-update-offline .toast,
body.is-offline.pwa-strip-visible .toast {
  bottom: max(
    var(--toast-clearance),
    calc(var(--sticky-cta-h) + var(--pwa-strip-h) + env(safe-area-inset-bottom, 0px) + 52px)
  ) !important;
}
/* When offline + update pending: never stack duplicate top offline hint under strip */
body.pwa-update-offline .pwa-hint[data-kind="offline"] {
  display: none !important;
}


/* —— Round18 overnight_self_optimize —— */
/* Ultra-narrow ≤260: KPI / donut / sleeve fold tighter / cover meta overflow */
@media (max-width: 260px) {
  .rpt-kpi-strip { gap: 1px; grid-template-columns: 1fr 1fr; }
  .rpt-kpi { padding: 1px; border-radius: 3px; }
  .rpt-kpi-v { font-size: .5rem; letter-spacing: -0.035em; }
  .rpt-kpi-l { font-size: 7px; line-height: 1.05; }
  .donut-svg { width: 60px; height: 60px; }
  .donut-legend { font-size: 7.5px; }
  .donut-leg { gap: 2px; margin: 0; }
  .donut-leg-pct { min-width: 2em; font-size: 7.5px; }
  .rpt-sleeve { margin: 3px 0; padding: 3px 4px; border-radius: 4px; }
  .rpt-sleeve-head { gap: 2px; margin-bottom: 1px; }
  .rpt-sleeve-head h3, .rpt-sleeve h3 { font-size: .56rem; line-height: 1.1; }
  .rpt-sleeve-pill { font-size: .4rem; padding: 1px 2px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .rpt-sleeve-note { font-size: .52rem; line-height: 1.2; }
  .rpt-sleeve-band { font-size: .48rem; }
  .rpt-cmp { margin: 2px 0 5px; }
  .rpt-cmp-legend { font-size: 8px; gap: 3px; color: #334155; }
  .rpt-cmp-row { font-size: 8.5px; margin: 1px 0; }
  .rpt-cmp-track { height: 2.5px; }
  .rpt-cmp-nums { font-size: 7.5px; gap: 2px; }
  .rpt-engine-note { font-size: 7px; line-height: 1.15; color: #64748b; }
  .rpt-cover h1 { font-size: .78rem; overflow-wrap: anywhere; }
  .rpt-cover .meta, .rpt-cover .meta-grid {
    gap: 2px 3px; padding: 4px 5px; font-size: 9px;
    overflow: hidden; max-width: 100%;
  }
  .rpt-cover .meta-grid .meta-l, .rpt-cover .meta .meta-l { font-size: 8px; }
  .rpt-cover .meta-grid .meta-v, .rpt-cover .meta .meta-v {
    font-size: .66rem; line-height: 1.2;
    overflow-wrap: anywhere; word-break: break-word;
    max-width: 100%; display: -webkit-box; -webkit-box-orient: vertical;
    -webkit-line-clamp: 2; overflow: hidden;
  }
  .rpt-sleeve-fold > summary { font-size: .55rem; padding: 1px 0; }
  .rpt-sleeve > p.rpt-sleeve-body {
    display: -webkit-box; -webkit-box-orient: vertical;
    -webkit-line-clamp: 1; overflow: hidden;
  }
  .sleeve { padding: 4px 5px; margin: 4px 0; }
  .sleeve h3 { font-size: .6rem; }
  .sleeve .band { font-size: .48rem; }
  .sleeve .note { font-size: .58rem; }
}

/* Light prefs: expose modal focus strategy (no heavy prefs system) */
.light-prefs {
  margin: 8px 0 4px;
  border: 1px solid rgba(26, 53, 102, 0.18);
  border-radius: 10px;
  background: #f7f9fc;
  padding: 0 10px 8px;
}
.light-prefs > summary {
  cursor: pointer;
  list-style: none;
  font-size: .82rem;
  font-weight: 700;
  color: #1A3566;
  padding: 8px 0 4px;
  user-select: none;
}
.light-prefs > summary::-webkit-details-marker { display: none; }
.light-prefs > summary::before { content: "▸ "; color: #C0122C; font-weight: 800; }
.light-prefs[open] > summary::before { content: "▾ "; }
.light-prefs .field.compact { margin: 4px 0 0; }
.light-prefs .field.compact label { font-size: .75rem; color: #334155; margin-bottom: 4px; }
.light-prefs .chips { flex-wrap: wrap; gap: 6px; }
.light-prefs .chip.tool.active {
  background: #1A3566;
  color: #fff;
  border-color: #1A3566;
}
@media (prefers-color-scheme: dark) {
  .light-prefs { background: #152038; border-color: #243352; }
  .light-prefs > summary { color: #c5d4ef; }
  .light-prefs .field.compact label { color: #9aa8bc; }
}
@media (forced-colors: active) {
  .light-prefs { border: 2px solid CanvasText; background: Canvas; }
  .light-prefs > summary { color: CanvasText; }
  .light-prefs .chip.tool.active {
    forced-color-adjust: none;
    outline: 2px solid Highlight;
    border: 2px solid Highlight;
  }
}

/* empty-art contrast polish */
.empty-state .empty-art[role="img"] {
  opacity: 1;
  filter: contrast(1.08);
}
@media (prefers-contrast: more) {
  .empty-state .empty-art[role="img"] {
    opacity: 1;
    filter: contrast(1.25) saturate(1.05);
  }
  .empty-state { border-color: #1A3566; }
}
@media (forced-colors: active) {
  .empty-state .empty-art[role="img"] {
    forced-color-adjust: none;
    outline: 1px solid CanvasText;
    opacity: 1;
    filter: none;
  }
}

/* Error flash + forced-colors Round18 */
.field.field-error-flash,
.alloc-row.field-error-flash {
  outline: 2px solid rgba(192, 18, 44, 0.45);
  outline-offset: 2px;
  border-radius: 8px;
}
.field.field-error-flash input,
.alloc-row.field-error-flash input {
  animation: uccl-field-flash-r18 1.05s ease-out 1;
  box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.32);
  border-color: #C0122C;
}
@keyframes uccl-field-flash-r18 {
  0% { box-shadow: 0 0 0 5px rgba(192, 18, 44, 0.5); background: rgba(192,18,44,.06); }
  100% { box-shadow: 0 0 0 0 rgba(192, 18, 44, 0); background: transparent; }
}
@media (prefers-reduced-motion: reduce) {
  .field.field-error-flash input,
  .alloc-row.field-error-flash input {
    animation: none;
    box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.4);
  }
}
@media (forced-colors: active) {
  .field.field-error-flash,
  .alloc-row.field-error-flash {
    outline: 3px solid Highlight;
  }
  .field.field-error-flash input,
  .alloc-row.field-error-flash input {
    outline: 3px solid Highlight;
    outline-offset: 2px;
    border-color: Highlight;
    forced-color-adjust: none;
  }
  .input-errors.err-pulse-strong {
    border: 2px solid Highlight;
    outline: 2px solid Highlight;
    color: CanvasText;
    background: Canvas;
  }
  .rpt-cmp-legend i.cur,
  .rpt-cmp-legend i.tgt,
  .donut-leg i {
    forced-color-adjust: none;
    border: 1px solid CanvasText;
  }
}

/* Download / print shallow light: screen preview when html.rpt-dl */
html.rpt-dl,
html.rpt-dl body {
  color-scheme: light only;
  background: #fff;
  color: #111;
}
@media print {
  html.rpt-dl, html.rpt-dl body {
    color-scheme: light only !important;
    background: #fff !important;
    color: #111 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
    forced-color-adjust: none;
  }
  .rpt-cmp-legend { color: #334155 !important; background: transparent !important; }
  .rpt-cmp-legend i.cur { background: #475569 !important; }
  .rpt-cmp-legend i.tgt { background: #1A3566 !important; }
  .rpt-engine-note { color: #5a6472 !important; background: transparent !important; }
  .donut-leg-name { color: #1a1a1a !important; }
  .donut-leg-pct { color: #1A3566 !important; }
}

/* PWA update×offline: Round18 clearance (+4 vs R17) + race isolation */
body.pwa-update-offline,
body.is-offline.pwa-strip-visible {
  padding-bottom: calc(
    var(--sticky-cta-h, 72px) + var(--pwa-strip-h, 48px) + env(safe-area-inset-bottom, 0px) + 64px
  );
}
body.pwa-update-offline .pwa-strip,
body.is-offline.pwa-strip-visible .pwa-strip {
  bottom: calc(var(--sticky-cta-h) + env(safe-area-inset-bottom, 0px) + 30px) !important;
  gap: 12px;
  z-index: 45;
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.22);
}
body.pwa-update-offline .offline-banner,
body.is-offline.pwa-strip-visible .offline-banner {
  margin-bottom: 20px;
  position: relative;
  z-index: 5;
}
body.pwa-update-offline .toast,
body.is-offline.pwa-strip-visible .toast {
  bottom: max(
    var(--toast-clearance),
    calc(var(--sticky-cta-h) + var(--pwa-strip-h) + env(safe-area-inset-bottom, 0px) + 56px)
  ) !important;
}
/* Race: when offline + update pending, never stack duplicate offline hint */
body.pwa-update-offline .pwa-hint[data-kind="offline"],
body.is-offline.pwa-strip-visible .pwa-hint[data-kind="offline"] {
  display: none !important;
}
body.pwa-cache-miss {
  --pwa-cache-miss-tint: rgba(192, 18, 44, 0.06);
}
body.pwa-cache-miss .offline-banner,
body.pwa-cache-miss #pwaHint {
  box-shadow: inset 0 0 0 9999px var(--pwa-cache-miss-tint);
}


/* —— Round19 overnight_self_optimize —— */
/* Ultra-narrow ≤240: sleeve fold / KPI / donut / cover meta further crush */
@media (max-width: 240px) {
  .rpt-kpi-strip { gap: 0; grid-template-columns: 1fr 1fr; }
  .rpt-kpi { padding: 0; border-radius: 2px; border-width: 1px; }
  .rpt-kpi-v { font-size: .46rem; letter-spacing: -0.04em; }
  .rpt-kpi-l { font-size: 6.5px; line-height: 1.02; }
  .donut-svg { width: 52px; height: 52px; }
  .donut-legend { font-size: 7px; }
  .donut-leg { gap: 1px; margin: 0; }
  .donut-leg-pct { min-width: 1.8em; font-size: 7px; }
  .rpt-sleeve { margin: 2px 0; padding: 2px 3px; border-radius: 3px; }
  .rpt-sleeve-head { gap: 1px; margin-bottom: 0; }
  .rpt-sleeve-head h3, .rpt-sleeve h3 { font-size: .5rem; line-height: 1.08; }
  .rpt-sleeve-pill { font-size: .36rem; padding: 0 2px; }
  .rpt-sleeve-note { font-size: .48rem; line-height: 1.15; }
  .rpt-sleeve-band { font-size: .44rem; }
  .rpt-cmp { margin: 1px 0 4px; }
  .rpt-cmp-legend { font-size: 7.5px; gap: 2px; color: #334155; }
  .rpt-cmp-row { font-size: 8px; margin: 0; }
  .rpt-cmp-track { height: 2px; }
  .rpt-cmp-nums { font-size: 7px; gap: 1px; }
  .rpt-engine-note { font-size: 6.5px; line-height: 1.1; color: #64748b; }
  .rpt-cover h1 { font-size: .7rem; overflow-wrap: anywhere; }
  .rpt-cover .meta, .rpt-cover .meta-grid {
    gap: 1px 2px; padding: 3px 4px; font-size: 8px;
    overflow: hidden; max-width: 100%;
  }
  .rpt-cover .meta-grid .meta-l, .rpt-cover .meta .meta-l { font-size: 7px; }
  .rpt-cover .meta-grid .meta-v, .rpt-cover .meta .meta-v {
    font-size: .6rem; line-height: 1.15;
    overflow-wrap: anywhere; word-break: break-word;
    max-width: 100%; display: -webkit-box; -webkit-box-orient: vertical;
    -webkit-line-clamp: 2; overflow: hidden;
  }
  .rpt-sleeve-fold > summary { font-size: .5rem; padding: 0; }
  .rpt-sleeve > p.rpt-sleeve-body {
    display: -webkit-box; -webkit-box-orient: vertical;
    -webkit-line-clamp: 1; overflow: hidden;
  }
  .sleeve { padding: 3px 4px; margin: 3px 0; }
  .sleeve h3 { font-size: .55rem; }
  .sleeve .band { font-size: .44rem; }
  .sleeve .note { font-size: .52rem; }
}

/* Light prefs: keyboard polish (focus-visible ring + chip nav affordance) */
.light-prefs > summary:focus-visible {
  outline: 2px solid #C0122C;
  outline-offset: 2px;
  border-radius: 6px;
}
.light-prefs .chip.tool:focus-visible {
  outline: 2px solid #C0122C;
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.22);
}
.light-prefs .chips[role="radiogroup"] {
  outline: none;
}
/* Round20: arrow hint moved to #modalFocusArrowHint (i18n) */
.light-prefs .kb-hint,
#modalFocusArrowHint.kb-hint {
  font-weight: 500;
  color: #64748b;
  font-size: .7rem;
  margin-left: 2px;
  white-space: nowrap;
}
@media (prefers-color-scheme: dark) {
  .light-prefs .kb-hint,
  #modalFocusArrowHint.kb-hint { color: #9aa8bc; }
}
@media (forced-colors: active) {
  .light-prefs > summary:focus-visible,
  .light-prefs .chip.tool:focus-visible {
    outline: 3px solid Highlight;
  }
}

/* empty-art contrast Round19 */
.empty-state .empty-art[role="img"] {
  opacity: 1;
  filter: contrast(1.12) saturate(1.02);
  border-radius: 8px;
}
@media (prefers-contrast: more) {
  .empty-state .empty-art[role="img"] {
    filter: contrast(1.3) saturate(1.08);
    box-shadow: 0 0 0 1px #1A3566;
  }
  .empty-state { border-color: #1A3566; border-width: 2px; }
}
@media (forced-colors: active) {
  .empty-state .empty-art[role="img"] {
    forced-color-adjust: none;
    outline: 2px solid CanvasText;
    filter: none;
  }
}

/* Error flash Round19 */
.field.field-error-flash,
.alloc-row.field-error-flash {
  outline: 2px solid rgba(192, 18, 44, 0.55);
  outline-offset: 2px;
  border-radius: 8px;
  animation: uccl-field-flash-r19-wrap 1.15s ease-out 1;
}
.field.field-error-flash input,
.alloc-row.field-error-flash input {
  animation: uccl-field-flash-r19 1.1s ease-out 1;
  box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.36);
  border-color: #C0122C;
}
@keyframes uccl-field-flash-r19 {
  0% { box-shadow: 0 0 0 6px rgba(192, 18, 44, 0.55); background: rgba(192,18,44,.08); }
  55% { box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.28); }
  100% { box-shadow: 0 0 0 0 rgba(192, 18, 44, 0); background: transparent; }
}
@keyframes uccl-field-flash-r19-wrap {
  0% { outline-color: rgba(192, 18, 44, 0.85); }
  100% { outline-color: rgba(192, 18, 44, 0.55); }
}
@media (prefers-reduced-motion: reduce) {
  .field.field-error-flash,
  .alloc-row.field-error-flash,
  .field.field-error-flash input,
  .alloc-row.field-error-flash input {
    animation: none;
  }
  .field.field-error-flash input,
  .alloc-row.field-error-flash input {
    box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.45);
  }
}

/* Download / print shallow light — Round19 legend/engine reinforce */
html.rpt-dl .rpt-cmp-legend { color: #334155; font-weight: 600; background: transparent; }
html.rpt-dl .rpt-cmp-legend i.cur { background: #475569; }
html.rpt-dl .rpt-cmp-legend i.tgt { background: #1A3566; }
html.rpt-dl .rpt-engine-note { color: #64748b; background: transparent; }
html.rpt-dl .donut-leg-name { color: #1a1a1a; }
html.rpt-dl .donut-leg-pct { color: #1A3566; }
@media print {
  html.rpt-dl .rpt-cmp-legend { color: #334155 !important; background: #fff !important; }
  html.rpt-dl .rpt-engine-note { color: #5a6472 !important; background: #fff !important; }
  html.rpt-dl .rpt-cover .meta,
  html.rpt-dl .rpt-cover .meta-grid { background: #f4f6fa !important; color: #111 !important; }
}

/* PWA update×offline: Round19 clearance (+4 vs R18) + race isolation */
body.pwa-update-offline,
body.is-offline.pwa-strip-visible {
  padding-bottom: calc(
    var(--sticky-cta-h, 72px) + var(--pwa-strip-h, 48px) + env(safe-area-inset-bottom, 0px) + 68px
  );
}
body.pwa-update-offline .pwa-strip,
body.is-offline.pwa-strip-visible .pwa-strip {
  bottom: calc(var(--sticky-cta-h) + env(safe-area-inset-bottom, 0px) + 34px) !important;
  gap: 12px;
  z-index: 45;
  box-shadow: 0 4px 22px rgba(15, 23, 42, 0.24);
}
body.pwa-update-offline .toast,
body.is-offline.pwa-strip-visible .toast {
  bottom: max(
    var(--toast-clearance),
    calc(var(--sticky-cta-h) + var(--pwa-strip-h) + env(safe-area-inset-bottom, 0px) + 60px)
  ) !important;
}
body.pwa-update-offline .offline-banner,
body.is-offline.pwa-strip-visible .offline-banner {
  margin-bottom: 22px;
  position: relative;
  z-index: 5;
}
/* Race: when offline + update pending, never stack duplicate offline hint */
body.pwa-update-offline .pwa-hint[data-kind="offline"],
body.is-offline.pwa-strip-visible .pwa-hint[data-kind="offline"] {
  display: none !important;
}


/* —— Round20 overnight_self_optimize —— */
/* Ultra-narrow ≤220: sleeve fold / KPI / donut / cover meta further crush */
@media (max-width: 220px) {
  .rpt-kpi-strip { gap: 0; grid-template-columns: 1fr 1fr; }
  .rpt-kpi { padding: 0; border-radius: 2px; border-width: 1px; }
  .rpt-kpi-v { font-size: .42rem; letter-spacing: -0.045em; }
  .rpt-kpi-l { font-size: 6px; line-height: 1.0; }
  .donut-svg { width: 46px; height: 46px; }
  .donut-legend { font-size: 6.5px; }
  .donut-leg { gap: 0; margin: 0; }
  .donut-leg-pct { min-width: 1.6em; font-size: 6.5px; }
  .rpt-sleeve { margin: 1px 0; padding: 1px 2px; border-radius: 2px; }
  .rpt-sleeve-head { gap: 0; margin-bottom: 0; }
  .rpt-sleeve-head h3, .rpt-sleeve h3 { font-size: .46rem; line-height: 1.05; }
  .rpt-sleeve-pill { font-size: .32rem; padding: 0 1px; }
  .rpt-sleeve-note { font-size: .44rem; line-height: 1.1; }
  .rpt-sleeve-band { font-size: .4rem; }
  .rpt-cmp { margin: 0 0 3px; }
  .rpt-cmp-legend { font-size: 7px; gap: 1px; color: #334155; }
  .rpt-cmp-row { font-size: 7.5px; margin: 0; }
  .rpt-cmp-track { height: 1.5px; }
  .rpt-cmp-nums { font-size: 6.5px; gap: 0; }
  .rpt-engine-note { font-size: 6px; line-height: 1.05; color: #64748b; }
  .rpt-cover h1 { font-size: .64rem; overflow-wrap: anywhere; }
  .rpt-cover .meta, .rpt-cover .meta-grid {
    gap: 0 1px; padding: 2px 3px; font-size: 7.5px;
    overflow: hidden; max-width: 100%;
  }
  .rpt-cover .meta-grid .meta-l, .rpt-cover .meta .meta-l { font-size: 6.5px; }
  .rpt-cover .meta-grid .meta-v, .rpt-cover .meta .meta-v {
    font-size: .55rem; line-height: 1.1;
    overflow-wrap: anywhere; word-break: break-word;
    max-width: 100%; display: -webkit-box; -webkit-box-orient: vertical;
    -webkit-line-clamp: 2; overflow: hidden;
  }
  .rpt-sleeve-fold > summary { font-size: .46rem; padding: 0; }
  .rpt-sleeve > p.rpt-sleeve-body {
    display: -webkit-box; -webkit-box-orient: vertical;
    -webkit-line-clamp: 1; overflow: hidden;
  }
  .sleeve { padding: 2px 3px; margin: 2px 0; }
  .sleeve h3 { font-size: .5rem; }
  .sleeve .band { font-size: .4rem; }
  .sleeve .note { font-size: .48rem; }
}

/* Light prefs: Escape closes + Home/End chip affordance polish */
.light-prefs > summary:focus-visible {
  outline: 2px solid #C0122C;
  outline-offset: 2px;
  border-radius: 6px;
  box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.18);
}
.light-prefs .chip.tool:focus-visible {
  outline: 2px solid #C0122C;
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.28);
}
/* Round20: Home End moved into #modalFocusArrowHint i18n (was dead label#lblModalFocus::after) */
@media (forced-colors: active) {
  .light-prefs > summary:focus-visible,
  .light-prefs .chip.tool:focus-visible {
    outline: 3px solid Highlight;
    box-shadow: none;
  }
}

/* empty-art contrast Round20 */
.empty-state .empty-art[role="img"] {
  opacity: 1;
  filter: contrast(1.15) saturate(1.04);
  border-radius: 8px;
}
@media (prefers-contrast: more) {
  .empty-state .empty-art[role="img"] {
    filter: contrast(1.35) saturate(1.1);
    box-shadow: 0 0 0 1.5px #1A3566;
  }
  .empty-state { border-color: #1A3566; border-width: 2px; }
}
@media (forced-colors: active) {
  .empty-state .empty-art[role="img"] {
    forced-color-adjust: none;
    outline: 2px solid CanvasText;
    filter: none;
  }
}

/* Error flash Round20 (slightly stronger wrap ring) */
.field.field-error-flash,
.alloc-row.field-error-flash {
  outline: 2px solid rgba(192, 18, 44, 0.6);
  outline-offset: 2px;
  border-radius: 8px;
  animation: uccl-field-flash-r20-wrap 1.2s ease-out 1;
}
.field.field-error-flash input,
.alloc-row.field-error-flash input {
  animation: uccl-field-flash-r20 1.15s ease-out 1;
  box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.38);
  border-color: #C0122C;
}
@keyframes uccl-field-flash-r20 {
  0% { box-shadow: 0 0 0 6px rgba(192, 18, 44, 0.58); background: rgba(192,18,44,.09); }
  55% { box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.3); }
  100% { box-shadow: 0 0 0 0 rgba(192, 18, 44, 0); background: transparent; }
}
@keyframes uccl-field-flash-r20-wrap {
  0% { outline-color: rgba(192, 18, 44, 0.9); }
  100% { outline-color: rgba(192, 18, 44, 0.6); }
}
@media (prefers-reduced-motion: reduce) {
  .field.field-error-flash,
  .alloc-row.field-error-flash,
  .field.field-error-flash input,
  .alloc-row.field-error-flash input {
    animation: none;
  }
  .field.field-error-flash input,
  .alloc-row.field-error-flash input {
    box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.48);
  }
}

/* Download / print shallow light — Round20 legend/engine reinforce */
html.rpt-dl .rpt-cmp-legend { color: #334155; font-weight: 600; background: transparent; }
html.rpt-dl .rpt-cmp-legend i.cur { background: #475569; }
html.rpt-dl .rpt-cmp-legend i.tgt { background: #1A3566; }
html.rpt-dl .rpt-engine-note { color: #64748b; background: transparent; }
html.rpt-dl .donut-leg-name { color: #1a1a1a; }
html.rpt-dl .donut-leg-pct { color: #1A3566; }
html.rpt-dl .rpt-cover .meta,
html.rpt-dl .rpt-cover .meta-grid { background: #f4f6fa; color: #111; }
@media print {
  html.rpt-dl .rpt-cmp-legend { color: #334155 !important; background: #fff !important; }
  html.rpt-dl .rpt-engine-note { color: #5a6472 !important; background: #fff !important; }
  html.rpt-dl .rpt-cover .meta,
  html.rpt-dl .rpt-cover .meta-grid { background: #f4f6fa !important; color: #111 !important; }
  html.rpt-dl .donut-leg-name { color: #1a1a1a !important; }
  html.rpt-dl .donut-leg-pct { color: #1A3566 !important; }
}

/* PWA update×offline: Round20 clearance (+4 vs R19) + race isolation */
body.pwa-update-offline,
body.is-offline.pwa-strip-visible {
  padding-bottom: calc(
    var(--sticky-cta-h, 72px) + var(--pwa-strip-h, 48px) + env(safe-area-inset-bottom, 0px) + 72px
  );
}
body.pwa-update-offline .pwa-strip,
body.is-offline.pwa-strip-visible .pwa-strip {
  bottom: calc(var(--sticky-cta-h) + env(safe-area-inset-bottom, 0px) + 38px) !important;
  gap: 12px;
  z-index: 45;
  box-shadow: 0 4px 24px rgba(15, 23, 42, 0.26);
}
body.pwa-update-offline .toast,
body.is-offline.pwa-strip-visible .toast {
  bottom: max(
    var(--toast-clearance),
    calc(var(--sticky-cta-h) + var(--pwa-strip-h) + env(safe-area-inset-bottom, 0px) + 64px)
  ) !important;
}
body.pwa-update-offline .offline-banner,
body.is-offline.pwa-strip-visible .offline-banner {
  margin-bottom: 24px;
  position: relative;
  z-index: 5;
}
/* Race: when offline + update pending, never stack duplicate offline hint */
body.pwa-update-offline .pwa-hint[data-kind="offline"],
body.is-offline.pwa-strip-visible .pwa-hint[data-kind="offline"] {
  display: none !important;
}


/* —— Round21 overnight_self_optimize —— */
/* Ultra-narrow ≤200: sleeve fold / KPI / donut / cover meta further crush */
@media (max-width: 200px) {
  .rpt-kpi-strip { gap: 0; grid-template-columns: 1fr 1fr; }
  .rpt-kpi { padding: 0; border-radius: 2px; border-width: 1px; }
  .rpt-kpi-v { font-size: .38rem; letter-spacing: -0.05em; }
  .rpt-kpi-l { font-size: 5.5px; line-height: 1.0; }
  .donut-svg { width: 40px; height: 40px; }
  .donut-legend { font-size: 6px; }
  .donut-leg { gap: 0; margin: 0; }
  .donut-leg-pct { min-width: 1.4em; font-size: 6px; }
  .rpt-sleeve { margin: 0; padding: 1px; border-radius: 2px; }
  .rpt-sleeve-head { gap: 0; margin-bottom: 0; }
  .rpt-sleeve-head h3, .rpt-sleeve h3 { font-size: .42rem; line-height: 1.02; }
  .rpt-sleeve-pill { font-size: .28rem; padding: 0 1px; }
  .rpt-sleeve-note { font-size: .4rem; line-height: 1.05; }
  .rpt-sleeve-band { font-size: .36rem; }
  .rpt-cmp { margin: 0 0 2px; }
  .rpt-cmp-legend { font-size: 6.5px; gap: 1px; color: #334155; }
  .rpt-cmp-row { font-size: 7px; margin: 0; }
  .rpt-cmp-track { height: 1.5px; }
  .rpt-cmp-nums { font-size: 6px; gap: 0; }
  .rpt-engine-note { font-size: 5.5px; line-height: 1.0; color: #64748b; }
  .rpt-cover h1 { font-size: .58rem; overflow-wrap: anywhere; }
  .rpt-cover .meta, .rpt-cover .meta-grid {
    gap: 0; padding: 1px 2px; font-size: 7px;
    overflow: hidden; max-width: 100%;
  }
  .rpt-cover .meta-grid .meta-l, .rpt-cover .meta .meta-l { font-size: 6px; }
  .rpt-cover .meta-grid .meta-v, .rpt-cover .meta .meta-v {
    font-size: .5rem; line-height: 1.05;
    overflow-wrap: anywhere; word-break: break-word;
    max-width: 100%; display: -webkit-box; -webkit-box-orient: vertical;
    -webkit-line-clamp: 2; overflow: hidden;
  }
  .rpt-sleeve-fold > summary { font-size: .42rem; padding: 0; }
  .rpt-sleeve > p.rpt-sleeve-body {
    display: -webkit-box; -webkit-box-orient: vertical;
    -webkit-line-clamp: 1; overflow: hidden;
  }
  .sleeve { padding: 1px 2px; margin: 1px 0; }
  .sleeve h3 { font-size: .46rem; }
  .sleeve .band { font-size: .36rem; }
  .sleeve .note { font-size: .44rem; }
}

/* Light prefs: Round21 keyboard / focus polish */
.light-prefs[open] > summary {
  box-shadow: inset 0 -2px 0 #C0122C;
}
.light-prefs > summary:focus-visible {
  outline: 2px solid #C0122C;
  outline-offset: 2px;
  border-radius: 6px;
  box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.22);
}
.light-prefs .chip.tool:focus-visible {
  outline: 2px solid #C0122C;
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.32);
}
.light-prefs .chip.tool[aria-checked="true"]:focus-visible {
  box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.4), inset 0 0 0 1px #C0122C;
}
@media (forced-colors: active) {
  .light-prefs > summary:focus-visible,
  .light-prefs .chip.tool:focus-visible {
    outline: 3px solid Highlight;
    box-shadow: none;
  }
}

/* empty-art contrast Round21 */
.empty-state .empty-art[role="img"] {
  opacity: 1;
  filter: contrast(1.18) saturate(1.05);
  border-radius: 8px;
}
@media (prefers-contrast: more) {
  .empty-state .empty-art[role="img"] {
    filter: contrast(1.4) saturate(1.12);
    box-shadow: 0 0 0 1.5px #1A3566;
  }
  .empty-state { border-color: #1A3566; border-width: 2px; }
}
@media (forced-colors: active) {
  .empty-state .empty-art[role="img"] {
    forced-color-adjust: none;
    outline: 2px solid CanvasText;
    filter: none;
  }
}

/* Error flash Round21 (slightly stronger wrap ring) */
.field.field-error-flash,
.alloc-row.field-error-flash {
  outline: 2px solid rgba(192, 18, 44, 0.65);
  outline-offset: 2px;
  border-radius: 8px;
  animation: uccl-field-flash-r21-wrap 1.2s ease-out 1;
}
.field.field-error-flash input,
.alloc-row.field-error-flash input {
  animation: uccl-field-flash-r21 1.15s ease-out 1;
  box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.4);
  border-color: #C0122C;
}
@keyframes uccl-field-flash-r21 {
  0% { box-shadow: 0 0 0 6px rgba(192, 18, 44, 0.6); background: rgba(192,18,44,.1); }
  55% { box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.32); }
  100% { box-shadow: 0 0 0 0 rgba(192, 18, 44, 0); background: transparent; }
}
@keyframes uccl-field-flash-r21-wrap {
  0% { outline-color: rgba(192, 18, 44, 0.95); }
  100% { outline-color: rgba(192, 18, 44, 0.65); }
}
@media (prefers-reduced-motion: reduce) {
  .field.field-error-flash,
  .alloc-row.field-error-flash,
  .field.field-error-flash input,
  .alloc-row.field-error-flash input {
    animation: none;
  }
  .field.field-error-flash input,
  .alloc-row.field-error-flash input {
    box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.5);
  }
}

/* Download / print shallow light — Round21 legend/engine reinforce */
html.rpt-dl .rpt-cmp-legend { color: #334155; font-weight: 600; background: transparent; }
html.rpt-dl .rpt-cmp-legend i.cur { background: #475569; }
html.rpt-dl .rpt-cmp-legend i.tgt { background: #1A3566; }
html.rpt-dl .rpt-engine-note { color: #64748b; background: transparent; }
html.rpt-dl .donut-leg-name { color: #1a1a1a; }
html.rpt-dl .donut-leg-pct { color: #1A3566; }
html.rpt-dl .rpt-cover .meta,
html.rpt-dl .rpt-cover .meta-grid { background: #f4f6fa; color: #111; }
@media print {
  html.rpt-dl .rpt-cmp-legend { color: #334155 !important; background: #fff !important; }
  html.rpt-dl .rpt-engine-note { color: #5a6472 !important; background: #fff !important; }
  html.rpt-dl .rpt-cover .meta,
  html.rpt-dl .rpt-cover .meta-grid { background: #f4f6fa !important; color: #111 !important; }
  html.rpt-dl .donut-leg-name { color: #1a1a1a !important; }
  html.rpt-dl .donut-leg-pct { color: #1A3566 !important; }
}

/* PWA update×offline: Round21 clearance (+4 vs R20) + race isolation — kept; Round22 bumps below */
body.pwa-update-offline,
body.is-offline.pwa-strip-visible {
  padding-bottom: calc(
    var(--sticky-cta-h, 72px) + var(--pwa-strip-h, 48px) + env(safe-area-inset-bottom, 0px) + 76px
  );
}
body.pwa-update-offline .pwa-strip,
body.is-offline.pwa-strip-visible .pwa-strip {
  bottom: calc(var(--sticky-cta-h) + env(safe-area-inset-bottom, 0px) + 42px) !important;
  gap: 12px;
  z-index: 45;
  box-shadow: 0 4px 24px rgba(15, 23, 42, 0.28);
}
body.pwa-update-offline .toast,
body.is-offline.pwa-strip-visible .toast {
  bottom: max(
    var(--toast-clearance),
    calc(var(--sticky-cta-h) + var(--pwa-strip-h) + env(safe-area-inset-bottom, 0px) + 68px)
  ) !important;
}
body.pwa-update-offline .offline-banner,
body.is-offline.pwa-strip-visible .offline-banner {
  margin-bottom: 26px;
  position: relative;
  z-index: 5;
}
/* Race: when offline + update pending, never stack duplicate offline hint */
body.pwa-update-offline .pwa-hint[data-kind="offline"],
body.is-offline.pwa-strip-visible .pwa-hint[data-kind="offline"] {
  display: none !important;
}

/* —— Round22 overnight_self_optimize —— */
/* ≤200 retained (no ≤180 — R21 viewport had no spill; 唔為窄而窄) */
/* Light prefs: Round22 Escape modal-wins polish + open ring */
.light-prefs[open] > summary {
  box-shadow: inset 0 -2px 0 #C0122C;
}
.light-prefs > summary:focus-visible {
  outline: 2px solid #C0122C;
  outline-offset: 2px;
  border-radius: 6px;
  box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.24);
}
.light-prefs .chip.tool:focus-visible {
  outline: 2px solid #C0122C;
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.34);
}
.light-prefs .chip.tool[aria-checked="true"]:focus-visible {
  box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.42), inset 0 0 0 1px #C0122C;
}
#modalFocusArrowHint.kb-hint {
  letter-spacing: 0.01em;
}
@media (forced-colors: active) {
  .light-prefs > summary:focus-visible,
  .light-prefs .chip.tool:focus-visible {
    outline: 3px solid Highlight;
    box-shadow: none;
  }
}

/* empty-art contrast Round22 */
.empty-state .empty-art[role="img"] {
  opacity: 1;
  filter: contrast(1.2) saturate(1.06);
  border-radius: 8px;
}
@media (prefers-contrast: more) {
  .empty-state .empty-art[role="img"] {
    filter: contrast(1.42) saturate(1.12);
    box-shadow: 0 0 0 1.5px #1A3566;
  }
  .empty-state { border-color: #1A3566; border-width: 2px; }
}
@media (forced-colors: active) {
  .empty-state .empty-art[role="img"] {
    forced-color-adjust: none;
    outline: 2px solid CanvasText;
    filter: none;
  }
}

/* Error flash Round22 */
.field.field-error-flash,
.alloc-row.field-error-flash {
  outline: 2px solid rgba(192, 18, 44, 0.7);
  outline-offset: 2px;
  border-radius: 8px;
  animation: uccl-field-flash-r22-wrap 1.2s ease-out 1;
}
.field.field-error-flash input,
.alloc-row.field-error-flash input {
  animation: uccl-field-flash-r22 1.15s ease-out 1;
  box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.42);
  border-color: #C0122C;
}
@keyframes uccl-field-flash-r22 {
  0% { box-shadow: 0 0 0 6px rgba(192, 18, 44, 0.62); background: rgba(192,18,44,.11); }
  55% { box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.34); }
  100% { box-shadow: 0 0 0 0 rgba(192, 18, 44, 0); background: transparent; }
}
@keyframes uccl-field-flash-r22-wrap {
  0% { outline-color: rgba(192, 18, 44, 0.98); }
  100% { outline-color: rgba(192, 18, 44, 0.7); }
}
@media (prefers-reduced-motion: reduce) {
  .field.field-error-flash,
  .alloc-row.field-error-flash,
  .field.field-error-flash input,
  .alloc-row.field-error-flash input {
    animation: none;
  }
  .field.field-error-flash input,
  .alloc-row.field-error-flash input {
    box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.52);
  }
}

/* Download / print shallow light — Round22 legend/engine reinforce */
html.rpt-dl .rpt-cmp-legend { color: #334155; font-weight: 600; background: transparent; }
html.rpt-dl .rpt-cmp-legend i.cur { background: #475569; }
html.rpt-dl .rpt-cmp-legend i.tgt { background: #1A3566; }
html.rpt-dl .rpt-engine-note { color: #64748b; background: transparent; }
html.rpt-dl .donut-leg-name { color: #1a1a1a; }
html.rpt-dl .donut-leg-pct { color: #1A3566; }
html.rpt-dl .rpt-cover .meta,
html.rpt-dl .rpt-cover .meta-grid { background: #f4f6fa; color: #111; }
@media print {
  html.rpt-dl .rpt-cmp-legend { color: #334155 !important; background: #fff !important; }
  html.rpt-dl .rpt-engine-note { color: #5a6472 !important; background: #fff !important; }
  html.rpt-dl .rpt-cover .meta,
  html.rpt-dl .rpt-cover .meta-grid { background: #f4f6fa !important; color: #111 !important; }
  html.rpt-dl .donut-leg-name { color: #1a1a1a !important; }
  html.rpt-dl .donut-leg-pct { color: #1A3566 !important; }
}

/* PWA update×offline: Round22 clearance (+4 vs R21) + race isolation */
body.pwa-update-offline,
body.is-offline.pwa-strip-visible {
  padding-bottom: calc(
    var(--sticky-cta-h, 72px) + var(--pwa-strip-h, 48px) + env(safe-area-inset-bottom, 0px) + 80px
  );
}
body.pwa-update-offline .pwa-strip,
body.is-offline.pwa-strip-visible .pwa-strip {
  bottom: calc(var(--sticky-cta-h) + env(safe-area-inset-bottom, 0px) + 46px) !important;
  gap: 12px;
  z-index: 45;
  box-shadow: 0 4px 24px rgba(15, 23, 42, 0.3);
}
body.pwa-update-offline .toast,
body.is-offline.pwa-strip-visible .toast {
  bottom: max(
    var(--toast-clearance),
    calc(var(--sticky-cta-h) + var(--pwa-strip-h) + env(safe-area-inset-bottom, 0px) + 72px)
  ) !important;
}
body.pwa-update-offline .offline-banner,
body.is-offline.pwa-strip-visible .offline-banner {
  margin-bottom: 28px;
  position: relative;
  z-index: 5;
}
/* Race Round22: when offline + update pending, never stack duplicate offline hint */
body.pwa-update-offline .pwa-hint[data-kind="offline"],
body.is-offline.pwa-strip-visible .pwa-hint[data-kind="offline"] {
  display: none !important;
}

/* —— Round23 overnight_self_optimize —— */
/* ≤200 retained (no ≤180 — R22 confirmed no spill; 唔為窄而窄) */
/* Light prefs: Round23 Escape modal-wins + focus ring polish */
.light-prefs[open] > summary {
  box-shadow: inset 0 -2px 0 #C0122C;
}
.light-prefs > summary:focus-visible {
  outline: 2px solid #C0122C;
  outline-offset: 2px;
  border-radius: 6px;
  box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.26);
}
.light-prefs .chip.tool:focus-visible {
  outline: 2px solid #C0122C;
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.36);
}
.light-prefs .chip.tool[aria-checked="true"]:focus-visible {
  box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.44), inset 0 0 0 1px #C0122C;
}
#modalFocusArrowHint.kb-hint {
  letter-spacing: 0.01em;
}
@media (forced-colors: active) {
  .light-prefs > summary:focus-visible,
  .light-prefs .chip.tool:focus-visible {
    outline: 3px solid Highlight;
    box-shadow: none;
  }
}

/* empty-art contrast Round23 */
.empty-state .empty-art[role="img"] {
  opacity: 1;
  filter: contrast(1.25) saturate(1.07);
  border-radius: 8px;
}
@media (prefers-contrast: more) {
  .empty-state .empty-art[role="img"] {
    filter: contrast(1.45) saturate(1.14);
    box-shadow: 0 0 0 1.5px #1A3566;
  }
  .empty-state { border-color: #1A3566; border-width: 2px; }
}
@media (forced-colors: active) {
  .empty-state .empty-art[role="img"] {
    forced-color-adjust: none;
    outline: 2px solid CanvasText;
    filter: none;
  }
}

/* Error flash Round23 */
.field.field-error-flash,
.alloc-row.field-error-flash {
  outline: 2px solid rgba(192, 18, 44, 0.72);
  outline-offset: 2px;
  border-radius: 8px;
  animation: uccl-field-flash-r23-wrap 1.2s ease-out 1;
}
.field.field-error-flash input,
.alloc-row.field-error-flash input {
  animation: uccl-field-flash-r23 1.15s ease-out 1;
  box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.44);
  border-color: #C0122C;
}
@keyframes uccl-field-flash-r23 {
  0% { box-shadow: 0 0 0 6px rgba(192, 18, 44, 0.64); background: rgba(192,18,44,.12); }
  55% { box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.36); }
  100% { box-shadow: 0 0 0 0 rgba(192, 18, 44, 0); background: transparent; }
}
@keyframes uccl-field-flash-r23-wrap {
  0% { outline-color: rgba(192, 18, 44, 0.98); }
  100% { outline-color: rgba(192, 18, 44, 0.72); }
}
@media (prefers-reduced-motion: reduce) {
  .field.field-error-flash,
  .alloc-row.field-error-flash,
  .field.field-error-flash input,
  .alloc-row.field-error-flash input {
    animation: none;
  }
  .field.field-error-flash input,
  .alloc-row.field-error-flash input {
    box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.54);
  }
}

/* Download / print shallow light — Round23 legend/engine reinforce */
html.rpt-dl .rpt-cmp-legend { color: #334155; font-weight: 600; background: transparent; }
html.rpt-dl .rpt-cmp-legend i.cur { background: #475569; }
html.rpt-dl .rpt-cmp-legend i.tgt { background: #1A3566; }
html.rpt-dl .rpt-engine-note { color: #64748b; background: transparent; }
html.rpt-dl .donut-leg-name { color: #1a1a1a; }
html.rpt-dl .donut-leg-pct { color: #1A3566; }
html.rpt-dl .rpt-cover .meta,
html.rpt-dl .rpt-cover .meta-grid { background: #f4f6fa; color: #111; }
@media print {
  html.rpt-dl .rpt-cmp-legend { color: #334155 !important; background: #fff !important; }
  html.rpt-dl .rpt-engine-note { color: #5a6472 !important; background: #fff !important; }
  html.rpt-dl .rpt-cover .meta,
  html.rpt-dl .rpt-cover .meta-grid { background: #f4f6fa !important; color: #111 !important; }
  html.rpt-dl .donut-leg-name { color: #1a1a1a !important; }
  html.rpt-dl .donut-leg-pct { color: #1A3566 !important; }
}

/* PWA update×offline: Round23 clearance (+4 vs R22) + race isolation */
body.pwa-update-offline,
body.is-offline.pwa-strip-visible {
  padding-bottom: calc(
    var(--sticky-cta-h, 72px) + var(--pwa-strip-h, 48px) + env(safe-area-inset-bottom, 0px) + 84px
  );
}
body.pwa-update-offline .pwa-strip,
body.is-offline.pwa-strip-visible .pwa-strip {
  bottom: calc(var(--sticky-cta-h) + env(safe-area-inset-bottom, 0px) + 50px) !important;
  gap: 12px;
  z-index: 45;
  box-shadow: 0 4px 24px rgba(15, 23, 42, 0.32);
}
body.pwa-update-offline .toast,
body.is-offline.pwa-strip-visible .toast {
  bottom: max(
    var(--toast-clearance),
    calc(var(--sticky-cta-h) + var(--pwa-strip-h) + env(safe-area-inset-bottom, 0px) + 76px)
  ) !important;
}
body.pwa-update-offline .offline-banner,
body.is-offline.pwa-strip-visible .offline-banner {
  margin-bottom: 30px;
  position: relative;
  z-index: 5;
}
/* Race Round23: when offline + update pending, never stack duplicate offline hint */
body.pwa-update-offline .pwa-hint[data-kind="offline"],
body.is-offline.pwa-strip-visible .pwa-hint[data-kind="offline"] {
  display: none !important;
}


/* —— Round24 overnight_self_optimize —— */
/* ≤200 retained (no ≤180 — R23 confirmed no spill; 唔為窄而窄) */
/* Light prefs: Round24 Escape modal-wins + synthetic key polish */
.light-prefs[open] > summary {
  box-shadow: inset 0 -2px 0 #C0122C;
}
.light-prefs > summary:focus-visible {
  outline: 2px solid #C0122C;
  outline-offset: 2px;
  border-radius: 6px;
  box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.28);
}
.light-prefs .chip.tool:focus-visible {
  outline: 2px solid #C0122C;
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.38);
}
.light-prefs .chip.tool[aria-checked="true"]:focus-visible {
  box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.46), inset 0 0 0 1px #C0122C;
}
#modalFocusArrowHint.kb-hint {
  letter-spacing: 0.012em;
}
@media (forced-colors: active) {
  .light-prefs > summary:focus-visible,
  .light-prefs .chip.tool:focus-visible {
    outline: 3px solid Highlight;
    box-shadow: none;
  }
}

/* empty-art contrast Round24 */
.empty-state .empty-art[role="img"] {
  opacity: 1;
  filter: contrast(1.3) saturate(1.08);
  border-radius: 8px;
}
@media (prefers-contrast: more) {
  .empty-state .empty-art[role="img"] {
    filter: contrast(1.5) saturate(1.16);
    box-shadow: 0 0 0 1.5px #1A3566;
  }
  .empty-state { border-color: #1A3566; border-width: 2px; }
}
@media (forced-colors: active) {
  .empty-state .empty-art[role="img"] {
    forced-color-adjust: none;
    outline: 2px solid CanvasText;
    filter: none;
  }
}

/* Error flash Round24 */
.field.field-error-flash,
.alloc-row.field-error-flash {
  outline: 2px solid rgba(192, 18, 44, 0.74);
  outline-offset: 2px;
  border-radius: 8px;
  animation: uccl-field-flash-r24-wrap 1.2s ease-out 1;
}
.field.field-error-flash input,
.alloc-row.field-error-flash input {
  animation: uccl-field-flash-r24 1.15s ease-out 1;
  box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.46);
  border-color: #C0122C;
}
@keyframes uccl-field-flash-r24 {
  0% { box-shadow: 0 0 0 6px rgba(192, 18, 44, 0.66); background: rgba(192,18,44,.13); }
  55% { box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.38); }
  100% { box-shadow: 0 0 0 0 rgba(192, 18, 44, 0); background: transparent; }
}
@keyframes uccl-field-flash-r24-wrap {
  0% { outline-color: rgba(192, 18, 44, 0.99); }
  100% { outline-color: rgba(192, 18, 44, 0.74); }
}
@media (prefers-reduced-motion: reduce) {
  .field.field-error-flash,
  .alloc-row.field-error-flash,
  .field.field-error-flash input,
  .alloc-row.field-error-flash input {
    animation: none;
  }
  .field.field-error-flash input,
  .alloc-row.field-error-flash input {
    box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.56);
  }
}

/* Download / print shallow light — Round24 legend/engine reinforce */
html.rpt-dl .rpt-cmp-legend { color: #334155; font-weight: 600; background: transparent; }
html.rpt-dl .rpt-cmp-legend i.cur { background: #475569; }
html.rpt-dl .rpt-cmp-legend i.tgt { background: #1A3566; }
html.rpt-dl .rpt-engine-note { color: #64748b; background: transparent; }
html.rpt-dl .donut-leg-name { color: #1a1a1a; }
html.rpt-dl .donut-leg-pct { color: #1A3566; }
html.rpt-dl .rpt-cover .meta,
html.rpt-dl .rpt-cover .meta-grid { background: #f4f6fa; color: #111; }
@media print {
  html.rpt-dl .rpt-cmp-legend { color: #334155 !important; background: #fff !important; }
  html.rpt-dl .rpt-engine-note { color: #5a6472 !important; background: #fff !important; }
  html.rpt-dl .rpt-cover .meta,
  html.rpt-dl .rpt-cover .meta-grid { background: #f4f6fa !important; color: #111 !important; }
  html.rpt-dl .donut-leg-name { color: #1a1a1a !important; }
  html.rpt-dl .donut-leg-pct { color: #1A3566 !important; }
}

/* PWA update×offline: Round24 clearance (+4 vs R23) + race isolation */
body.pwa-update-offline,
body.is-offline.pwa-strip-visible {
  padding-bottom: calc(
    var(--sticky-cta-h, 72px) + var(--pwa-strip-h, 48px) + env(safe-area-inset-bottom, 0px) + 88px
  );
}
body.pwa-update-offline .pwa-strip,
body.is-offline.pwa-strip-visible .pwa-strip {
  bottom: calc(var(--sticky-cta-h) + env(safe-area-inset-bottom, 0px) + 54px) !important;
  gap: 12px;
  z-index: 45;
  box-shadow: 0 4px 24px rgba(15, 23, 42, 0.34);
}
body.pwa-update-offline .toast,
body.is-offline.pwa-strip-visible .toast {
  bottom: max(
    var(--toast-clearance),
    calc(var(--sticky-cta-h) + var(--pwa-strip-h) + env(safe-area-inset-bottom, 0px) + 80px)
  ) !important;
}
body.pwa-update-offline .offline-banner,
body.is-offline.pwa-strip-visible .offline-banner {
  margin-bottom: 32px;
  position: relative;
  z-index: 5;
}
/* Race Round24: when offline + update pending, never stack duplicate offline hint */
body.pwa-update-offline .pwa-hint[data-kind="offline"],
body.is-offline.pwa-strip-visible .pwa-hint[data-kind="offline"] {
  display: none !important;
}


/* —— Round25 overnight_self_optimize —— */
/* ≤200 retained (no ≤180 — R24 confirmed no spill; 唔為窄而窄) */
/* Light prefs: Round25 Escape modal-wins + focus ring polish */
.light-prefs[open] > summary {
  box-shadow: inset 0 -2px 0 #C0122C;
}
.light-prefs > summary:focus-visible {
  outline: 2px solid #C0122C;
  outline-offset: 2px;
  border-radius: 6px;
  box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.3);
}
.light-prefs .chip.tool:focus-visible {
  outline: 2px solid #C0122C;
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.4);
}
.light-prefs .chip.tool[aria-checked="true"]:focus-visible {
  box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.48), inset 0 0 0 1px #C0122C;
}
#modalFocusArrowHint.kb-hint {
  letter-spacing: 0.014em;
}
@media (forced-colors: active) {
  .light-prefs > summary:focus-visible,
  .light-prefs .chip.tool:focus-visible {
    outline: 3px solid Highlight;
    box-shadow: none;
  }
}

/* empty-art contrast Round25 */
.empty-state .empty-art[role="img"] {
  opacity: 1;
  filter: contrast(1.32) saturate(1.09);
  border-radius: 8px;
}
@media (prefers-contrast: more) {
  .empty-state .empty-art[role="img"] {
    filter: contrast(1.52) saturate(1.18);
    box-shadow: 0 0 0 1.5px #1A3566;
  }
  .empty-state { border-color: #1A3566; border-width: 2px; }
}
@media (forced-colors: active) {
  .empty-state .empty-art[role="img"] {
    forced-color-adjust: none;
    outline: 2px solid CanvasText;
    filter: none;
  }
}

/* Error flash Round25 */
.field.field-error-flash,
.alloc-row.field-error-flash {
  outline: 2px solid rgba(192, 18, 44, 0.76);
  outline-offset: 2px;
  border-radius: 8px;
  animation: uccl-field-flash-r25-wrap 1.2s ease-out 1;
}
.field.field-error-flash input,
.alloc-row.field-error-flash input {
  animation: uccl-field-flash-r25 1.15s ease-out 1;
  box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.48);
  border-color: #C0122C;
}
@keyframes uccl-field-flash-r25 {
  0% { box-shadow: 0 0 0 6px rgba(192, 18, 44, 0.68); background: rgba(192,18,44,.14); }
  55% { box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.4); }
  100% { box-shadow: 0 0 0 0 rgba(192, 18, 44, 0); background: transparent; }
}
@keyframes uccl-field-flash-r25-wrap {
  0% { outline-color: rgba(192, 18, 44, 0.99); }
  100% { outline-color: rgba(192, 18, 44, 0.76); }
}
@media (prefers-reduced-motion: reduce) {
  .field.field-error-flash,
  .alloc-row.field-error-flash,
  .field.field-error-flash input,
  .alloc-row.field-error-flash input {
    animation: none;
  }
  .field.field-error-flash input,
  .alloc-row.field-error-flash input {
    box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.58);
  }
}

/* Download / print shallow light — Round25 legend/engine reinforce */
html.rpt-dl .rpt-cmp-legend { color: #334155; font-weight: 600; background: transparent; }
html.rpt-dl .rpt-cmp-legend i.cur { background: #475569; }
html.rpt-dl .rpt-cmp-legend i.tgt { background: #1A3566; }
html.rpt-dl .rpt-engine-note { color: #64748b; background: transparent; }
html.rpt-dl .donut-leg-name { color: #1a1a1a; }
html.rpt-dl .donut-leg-pct { color: #1A3566; }
html.rpt-dl .rpt-cover .meta,
html.rpt-dl .rpt-cover .meta-grid { background: #f4f6fa; color: #111; }
@media print {
  html.rpt-dl .rpt-cmp-legend { color: #334155 !important; background: #fff !important; }
  html.rpt-dl .rpt-engine-note { color: #5a6472 !important; background: #fff !important; }
  html.rpt-dl .rpt-cover .meta,
  html.rpt-dl .rpt-cover .meta-grid { background: #f4f6fa !important; color: #111 !important; }
  html.rpt-dl .donut-leg-name { color: #1a1a1a !important; }
  html.rpt-dl .donut-leg-pct { color: #1A3566 !important; }
}

/* PWA update×offline: Round25 clearance (+4 vs R24) + race isolation */
body.pwa-update-offline,
body.is-offline.pwa-strip-visible {
  padding-bottom: calc(
    var(--sticky-cta-h, 72px) + var(--pwa-strip-h, 48px) + env(safe-area-inset-bottom, 0px) + 92px
  );
}
body.pwa-update-offline .pwa-strip,
body.is-offline.pwa-strip-visible .pwa-strip {
  bottom: calc(var(--sticky-cta-h) + env(safe-area-inset-bottom, 0px) + 58px) !important;
  gap: 12px;
  z-index: 45;
  box-shadow: 0 4px 24px rgba(15, 23, 42, 0.36);
}
body.pwa-update-offline .toast,
body.is-offline.pwa-strip-visible .toast {
  bottom: max(
    var(--toast-clearance),
    calc(var(--sticky-cta-h) + var(--pwa-strip-h) + env(safe-area-inset-bottom, 0px) + 84px)
  ) !important;
}
body.pwa-update-offline .offline-banner,
body.is-offline.pwa-strip-visible .offline-banner {
  margin-bottom: 34px;
  position: relative;
  z-index: 5;
}
/* Race Round25: when offline + update pending, never stack duplicate offline hint */
body.pwa-update-offline .pwa-hint[data-kind="offline"],
body.is-offline.pwa-strip-visible .pwa-hint[data-kind="offline"] {
  display: none !important;
}


/* —— Round26 overnight_self_optimize —— */
/* ≤200 retained (no ≤180 — R25 confirmed no spill; 唔為窄而窄) */
/* Light prefs: Round26 Escape modal-wins + focus ring polish */
.light-prefs[open] > summary {
  box-shadow: inset 0 -2px 0 #C0122C;
}
.light-prefs > summary:focus-visible {
  outline: 2px solid #C0122C;
  outline-offset: 2px;
  border-radius: 6px;
  box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.32);
}
.light-prefs .chip.tool:focus-visible {
  outline: 2px solid #C0122C;
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.42);
}
.light-prefs .chip.tool[aria-checked="true"]:focus-visible {
  box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.5), inset 0 0 0 1px #C0122C;
}
#modalFocusArrowHint.kb-hint {
  letter-spacing: 0.015em;
}
@media (forced-colors: active) {
  .light-prefs > summary:focus-visible,
  .light-prefs .chip.tool:focus-visible {
    outline: 3px solid Highlight;
    box-shadow: none;
  }
}

/* empty-art contrast Round26 */
.empty-state .empty-art[role="img"] {
  opacity: 1;
  filter: contrast(1.34) saturate(1.1);
  border-radius: 8px;
}
@media (prefers-contrast: more) {
  .empty-state .empty-art[role="img"] {
    filter: contrast(1.54) saturate(1.2);
    box-shadow: 0 0 0 1.5px #1A3566;
  }
  .empty-state { border-color: #1A3566; border-width: 2px; }
}
@media (forced-colors: active) {
  .empty-state .empty-art[role="img"] {
    forced-color-adjust: none;
    outline: 2px solid CanvasText;
    filter: none;
  }
}

/* Error flash Round26 */
.field.field-error-flash,
.alloc-row.field-error-flash {
  outline: 2px solid rgba(192, 18, 44, 0.78);
  outline-offset: 2px;
  border-radius: 8px;
  animation: uccl-field-flash-r26-wrap 1.2s ease-out 1;
}
.field.field-error-flash input,
.alloc-row.field-error-flash input {
  animation: uccl-field-flash-r26 1.15s ease-out 1;
  box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.5);
  border-color: #C0122C;
}
@keyframes uccl-field-flash-r26 {
  0% { box-shadow: 0 0 0 6px rgba(192, 18, 44, 0.7); background: rgba(192,18,44,.15); }
  55% { box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.42); }
  100% { box-shadow: 0 0 0 0 rgba(192, 18, 44, 0); background: transparent; }
}
@keyframes uccl-field-flash-r26-wrap {
  0% { outline-color: rgba(192, 18, 44, 0.99); }
  100% { outline-color: rgba(192, 18, 44, 0.78); }
}
@media (prefers-reduced-motion: reduce) {
  .field.field-error-flash,
  .alloc-row.field-error-flash,
  .field.field-error-flash input,
  .alloc-row.field-error-flash input {
    animation: none;
  }
  .field.field-error-flash input,
  .alloc-row.field-error-flash input {
    box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.6);
  }
}

/* Download / print shallow light — Round26 legend/engine reinforce */
html.rpt-dl .rpt-cmp-legend { color: #334155; font-weight: 600; background: transparent; }
html.rpt-dl .rpt-cmp-legend i.cur { background: #475569; }
html.rpt-dl .rpt-cmp-legend i.tgt { background: #1A3566; }
html.rpt-dl .rpt-engine-note { color: #64748b; background: transparent; }
html.rpt-dl .donut-leg-name { color: #1a1a1a; }
html.rpt-dl .donut-leg-pct { color: #1A3566; }
html.rpt-dl .rpt-cover .meta,
html.rpt-dl .rpt-cover .meta-grid { background: #f4f6fa; color: #111; }
@media print {
  html.rpt-dl .rpt-cmp-legend { color: #334155 !important; background: #fff !important; }
  html.rpt-dl .rpt-engine-note { color: #5a6472 !important; background: #fff !important; }
  html.rpt-dl .rpt-cover .meta,
  html.rpt-dl .rpt-cover .meta-grid { background: #f4f6fa !important; color: #111 !important; }
  html.rpt-dl .donut-leg-name { color: #1a1a1a !important; }
  html.rpt-dl .donut-leg-pct { color: #1A3566 !important; }
}

/* PWA update×offline: Round26 clearance (+4 vs R25) + race isolation */
body.pwa-update-offline,
body.is-offline.pwa-strip-visible {
  padding-bottom: calc(
    var(--sticky-cta-h, 72px) + var(--pwa-strip-h, 48px) + env(safe-area-inset-bottom, 0px) + 96px
  );
}
body.pwa-update-offline .pwa-strip,
body.is-offline.pwa-strip-visible .pwa-strip {
  bottom: calc(var(--sticky-cta-h) + env(safe-area-inset-bottom, 0px) + 62px) !important;
  gap: 12px;
  z-index: 45;
  box-shadow: 0 4px 24px rgba(15, 23, 42, 0.38);
}
body.pwa-update-offline .toast,
body.is-offline.pwa-strip-visible .toast {
  bottom: max(
    var(--toast-clearance),
    calc(var(--sticky-cta-h) + var(--pwa-strip-h) + env(safe-area-inset-bottom, 0px) + 88px)
  ) !important;
}
body.pwa-update-offline .offline-banner,
body.is-offline.pwa-strip-visible .offline-banner {
  margin-bottom: 36px;
  position: relative;
  z-index: 5;
}
/* Race Round26: when offline + update pending, never stack duplicate offline hint */
body.pwa-update-offline .pwa-hint[data-kind="offline"],
body.is-offline.pwa-strip-visible .pwa-hint[data-kind="offline"] {
  display: none !important;
}


/* —— Round27 overnight_self_optimize —— */
/* ≤200 retained (no ≤180 — R26 confirmed no spill; 唔為窄而窄) */
/* Light prefs: Round27 Escape modal-wins + focus ring polish */
.light-prefs[open] > summary {
  box-shadow: inset 0 -2px 0 #C0122C;
}
.light-prefs > summary:focus-visible {
  outline: 2px solid #C0122C;
  outline-offset: 2px;
  border-radius: 6px;
  box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.34);
}
.light-prefs .chip.tool:focus-visible {
  outline: 2px solid #C0122C;
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.44);
}
.light-prefs .chip.tool[aria-checked="true"]:focus-visible {
  box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.52), inset 0 0 0 1px #C0122C;
}
#modalFocusArrowHint.kb-hint {
  letter-spacing: 0.016em;
}
@media (forced-colors: active) {
  .light-prefs > summary:focus-visible,
  .light-prefs .chip.tool:focus-visible {
    outline: 3px solid Highlight;
    box-shadow: none;
  }
}

/* empty-art contrast Round27 */
.empty-state .empty-art[role="img"] {
  opacity: 1;
  filter: contrast(1.36) saturate(1.12);
  border-radius: 8px;
}
@media (prefers-contrast: more) {
  .empty-state .empty-art[role="img"] {
    filter: contrast(1.56) saturate(1.22);
    box-shadow: 0 0 0 1.5px #1A3566;
  }
  .empty-state { border-color: #1A3566; border-width: 2px; }
}
@media (forced-colors: active) {
  .empty-state .empty-art[role="img"] {
    forced-color-adjust: none;
    outline: 2px solid CanvasText;
    filter: none;
  }
}

/* Error flash Round27 */
.field.field-error-flash,
.alloc-row.field-error-flash {
  outline: 2px solid rgba(192, 18, 44, 0.8);
  outline-offset: 2px;
  border-radius: 8px;
  animation: uccl-field-flash-r27-wrap 1.2s ease-out 1;
}
.field.field-error-flash input,
.alloc-row.field-error-flash input {
  animation: uccl-field-flash-r27 1.15s ease-out 1;
  box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.52);
  border-color: #C0122C;
}
@keyframes uccl-field-flash-r27 {
  0% { box-shadow: 0 0 0 6px rgba(192, 18, 44, 0.72); background: rgba(192,18,44,.16); }
  55% { box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.44); }
  100% { box-shadow: 0 0 0 0 rgba(192, 18, 44, 0); background: transparent; }
}
@keyframes uccl-field-flash-r27-wrap {
  0% { outline-color: rgba(192, 18, 44, 0.99); }
  100% { outline-color: rgba(192, 18, 44, 0.8); }
}
@media (prefers-reduced-motion: reduce) {
  .field.field-error-flash,
  .alloc-row.field-error-flash,
  .field.field-error-flash input,
  .alloc-row.field-error-flash input {
    animation: none;
  }
  .field.field-error-flash input,
  .alloc-row.field-error-flash input {
    box-shadow: 0 0 0 3px rgba(192, 18, 44, 0.62);
  }
}

/* Download / print shallow light — Round27 legend/engine reinforce */
html.rpt-dl .rpt-cmp-legend { color: #334155; font-weight: 600; background: transparent; }
html.rpt-dl .rpt-cmp-legend i.cur { background: #475569; }
html.rpt-dl .rpt-cmp-legend i.tgt { background: #1A3566; }
html.rpt-dl .rpt-engine-note { color: #64748b; background: transparent; }
html.rpt-dl .donut-leg-name { color: #1a1a1a; }
html.rpt-dl .donut-leg-pct { color: #1A3566; }
html.rpt-dl .rpt-cover .meta,
html.rpt-dl .rpt-cover .meta-grid { background: #f4f6fa; color: #111; overflow: hidden; max-width: 100%; }
html.rpt-dl .rpt-cover .meta-grid .meta-v,
html.rpt-dl .rpt-cover .meta .meta-v {
  overflow-wrap: anywhere; word-break: break-word; max-width: 100%;
}
@media print {
  html.rpt-dl .rpt-cmp-legend { color: #334155 !important; background: #fff !important; }
  html.rpt-dl .rpt-engine-note { color: #5a6472 !important; background: #fff !important; }
  html.rpt-dl .rpt-cover .meta,
  html.rpt-dl .rpt-cover .meta-grid { background: #f4f6fa !important; color: #111 !important; }
  html.rpt-dl .donut-leg-name { color: #1a1a1a !important; }
  html.rpt-dl .donut-leg-pct { color: #1A3566 !important; }
}

/* PWA update×offline: Round27 clearance (+4 vs R26) + race isolation */
body.pwa-update-offline,
body.is-offline.pwa-strip-visible {
  padding-bottom: calc(
    var(--sticky-cta-h, 72px) + var(--pwa-strip-h, 48px) + env(safe-area-inset-bottom, 0px) + 100px
  );
}
body.pwa-update-offline .pwa-strip,
body.is-offline.pwa-strip-visible .pwa-strip {
  bottom: calc(var(--sticky-cta-h) + env(safe-area-inset-bottom, 0px) + 66px) !important;
  gap: 12px;
  z-index: 45;
  box-shadow: 0 4px 24px rgba(15, 23, 42, 0.4);
}
body.pwa-update-offline .toast,
body.is-offline.pwa-strip-visible .toast {
  bottom: max(
    var(--toast-clearance),
    calc(var(--sticky-cta-h) + var(--pwa-strip-h) + env(safe-area-inset-bottom, 0px) + 92px)
  ) !important;
}
body.pwa-update-offline .offline-banner,
body.is-offline.pwa-strip-visible .offline-banner {
  margin-bottom: 38px;
  position: relative;
  z-index: 5;
}
/* Race Round27: when offline + update pending, never stack duplicate offline hint */
body.pwa-update-offline .pwa-hint[data-kind="offline"],
body.is-offline.pwa-strip-visible .pwa-hint[data-kind="offline"] {
  display: none !important;
}

/* —— Client background & meeting close (Round33) —— */
.meeting-checks { display: flex; flex-direction: column; gap: 10px; margin: 12px 0 16px; }
.check-row { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: .93rem; line-height: 1.45; }
.check-row input[type="checkbox"] { margin-top: 3px; flex-shrink: 0; width: 16px; height: 16px; accent-color: var(--navy); cursor: pointer; }
textarea { width: 100%; box-sizing: border-box; border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; font-size: .93rem; font-family: inherit; resize: vertical; color: var(--text); background: var(--surface); }
textarea:focus { outline: 2px solid var(--navy); outline-offset: 1px; border-color: transparent; }
/* Report meeting close */
.rpt-meeting-close { margin: 0 0 16px; }
.rpt-meeting-checks { display: flex; flex-direction: column; gap: 8px; margin: 0 0 14px; }
.rpt-check-row { display: flex; align-items: flex-start; gap: 10px; font-size: .93rem; line-height: 1.5; }
.rpt-check-box { font-size: 1.1rem; min-width: 20px; color: var(--navy, #1A3566); font-weight: 700; }
.rpt-meeting-field { margin: 12px 0 0; }
.rpt-meeting-field p { margin: 4px 0 0; white-space: pre-line; }
.rpt-warn { color: #c0392b; font-weight: 600; }
.rpt-client-bg { display: flex; flex-direction: column; gap: 6px; margin: 0 0 16px; }
.rpt-client-bg .meta-l { font-size: .82rem; color: var(--muted, #64748b); min-width: 110px; display: inline-block; }
.rpt-client-bg .meta-v { font-size: .93rem; }
.rpt-restrictions { color: #b34a2e; font-weight: 500; }
.disclaimer-full { font-size: .82rem; line-height: 1.65; background: #fef9f0; border-left: 3px solid #f59e0b; padding: 12px 14px; border-radius: 0 6px 6px 0; }
@media (prefers-color-scheme: dark) {
  .disclaimer-full { background: #2a2010; border-left-color: #d97706; }
  .rpt-restrictions { color: #f08060; }
}
@media print { .meeting-checks { page-break-inside: avoid; } }
