:root {
  color: #102a43;
  background: #f4f7fb;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; }
.page-shell { max-width: 1120px; margin: 0 auto; padding: 32px 20px 56px; }
.page-header { margin-bottom: 28px; }
h1 { margin: 0; font-size: clamp(1.75rem, 5vw, 2.5rem); }
.sync-status { min-height: 1.5em; margin: 12px 0 0; color: #486581; }
.stage-tabs { display: flex; gap: 8px; overflow-x: auto; margin: 0 -4px 20px; padding: 4px; }
.stage-tab { flex: 0 0 auto; border: 1px solid #bcccdc; border-radius: 999px; background: #fff; color: #334e68; cursor: pointer; font: inherit; padding: 8px 14px; }
.stage-tab:hover { border-color: #486581; }
.stage-tab[aria-pressed="true"] { border-color: #102a43; background: #102a43; color: #fff; font-weight: 700; }
.theme-1 { --stage-accent: #627d98; }
.theme-2 { --stage-accent: #5b5fc7; }
.theme-3, .theme-4, .theme-5 { --stage-accent: #d97706; }
.theme-6 { --stage-accent: #2f855a; }
.stage-tab[class*="theme-"][aria-pressed="true"] { border-color: var(--stage-accent); background: var(--stage-accent); }
.stage { margin-top: 24px; }
.stage-heading { display: flex; align-items: baseline; gap: 10px; margin: 0 0 12px; font-size: 1.25rem; }
.count { color: #486581; font-size: 0.875rem; font-weight: 500; }
.case-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.case-card, .empty-state, .error-state { border: 1px solid #d9e2ec; border-radius: 12px; background: #fff; box-shadow: 0 2px 8px rgb(16 42 67 / 0.05); }
.case-card { border-top: 5px solid var(--stage-accent, #d9e2ec); padding: 16px; }
.case-label { margin: 0 0 10px; color: var(--stage-accent, #486581); font-size: 0.875rem; font-weight: 700; }
.case-title { margin: 0; font-size: 1.1rem; }
.case-dates { display: grid; gap: 7px; margin: 14px 0 0; border-top: 1px solid #edf2f7; padding-top: 12px; }
.case-dates:empty { display: none; }
.case-date { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; color: #334e68; }
.date-label { color: #829ab1; font-size: 0.8125rem; }
.date-value { font-size: 0.9375rem; font-variant-numeric: tabular-nums; }
.case-actions { display: grid; gap: 8px; margin-top: 14px; }
.case-actions:empty { display: none; }
.case-action { justify-self: start; border: 1px solid var(--stage-accent, #486581); border-radius: 8px; background: #fff; color: var(--stage-accent, #334e68); cursor: pointer; font: inherit; font-weight: 700; padding: 8px 12px; }
.case-action:disabled { cursor: default; opacity: 0.7; }
.case-action-status { min-height: 1.25em; color: #486581; font-size: 0.8125rem; }
.access-state { max-width: 420px; padding: 22px; border: 1px solid #d9e2ec; border-radius: 12px; background: #fff; box-shadow: 0 2px 8px rgb(16 42 67 / 0.05); }
.access-state h2 { margin: 0; font-size: 1.15rem; }
.access-state p { color: #486581; }
.access-form { display: grid; gap: 12px; margin-top: 16px; }
.access-form label { display: grid; gap: 6px; color: #334e68; font-size: 0.875rem; font-weight: 700; }
.access-form input { width: 100%; border: 1px solid #9fb3c8; border-radius: 8px; font: inherit; padding: 10px; }
.access-form button { justify-self: start; border: 0; border-radius: 8px; background: #102a43; color: #fff; cursor: pointer; font: inherit; font-weight: 700; padding: 10px 14px; }
.access-form button:disabled { cursor: default; opacity: 0.7; }
.access-feedback { min-height: 1.25em; margin: 0; color: #9b1c1c; font-size: 0.875rem; }
.empty-state, .error-state { padding: 22px; color: #486581; }
.error-state { border-color: #f8b4b4; color: #9b1c1c; }
@media (max-width: 520px) { .page-shell { padding: 24px 16px 40px; } .case-action { width: 100%; } }
