:root {
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 16px;
  color: #1b2b3e;
  background: #f1f4f7;
  --ink: #1b2b3e;
  --muted: #526477;
  --accent: #116d7d;
  --line: #cdd7df;
  --focus: #805c00;
  --danger: #8b2d24;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
button, a, summary, input, select, textarea { -webkit-tap-highlight-color: #d1e8ec; }
button { min-height: 44px; border: 1px solid transparent; border-radius: 5px; padding: 10px 15px; background: var(--accent); color: #fff; cursor: pointer; font-size: .875rem; font-weight: 600; line-height: 1.45; overflow-wrap: anywhere; }
button:hover { background: #095566; }
button:active { background: #064450; }
button:disabled { background: #e1e7eb; border-color: #bdc9d1; color: #4b5d6c; cursor: not-allowed; }
button.secondary { background: #edf2f5; color: #284a60; border-color: #b9c9d2; }
button.secondary:hover { background: #dae7ed; }
button.danger { background: #f9eae7; color: var(--danger); border-color: #dbaaa3; }
button.danger:hover { background: #f0d3cf; }
:where(button,input,select,textarea,summary,a):focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
:where(h1,h2,p[tabindex],div[tabindex]):focus { outline: 3px solid var(--focus); outline-offset: 5px; }
:where(h1,h2)[tabindex]:focus:not(:focus-visible) { outline: none; }
::selection { color: #fff; background: #075d6e; }
input, textarea { caret-color: var(--accent); }
a { color: #075d6e; text-underline-offset: 3px; }
[hidden] { display: none !important; }
.skip-link { position: fixed; top: -100px; left: 12px; z-index: 100; padding: 12px; background: #fff; color: var(--ink); }
.skip-link:focus { top: 12px; }
.simulation { padding: 9px 18px; text-align: center; background: #fff0ca; color: #674a08; font-size: .8125rem; font-weight: 600; line-height: 1.5; }
header { display: flex; align-items: center; gap: 14px; background: #122b45; color: #fff; padding: 22px 4vw; }
header strong { font-size: .9375rem; letter-spacing: .08em; }
header span { display: block; color: #c6d5e4; font-size: .875rem; margin-top: 4px; }
.mark { border: 2px solid #75bcc9; padding: 10px 7px; font-size: 22px; font-weight: 800; color: #a5dee3; }
.identity { margin-left: auto; max-width: 390px; width: 100%; }
.identity label { color: #d3e0e9; margin-top: 0; }
.shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: calc(100vh - 145px); }
aside { background: #17334e; color: #d3e0e9; padding: 24px 14px; }
.nav-label { display: none; }
nav { display: flex; flex-direction: column; gap: 23px; }
.nav-group { display: flex; flex-direction: column; gap: 3px; }
.nav-group-label { display: block; padding: 0 12px 5px; color: #c2d2df; font-size: .8125rem; font-weight: 600; }
nav button { text-align: left; background: transparent; color: #e1eaf0; }
nav button:hover { background: #284d6c; }
nav button[aria-current="page"] { background: #e2f1f0; color: #125965; }
.aside-note { padding: 26px 12px 0; color: #c2d2df; font-size: .8125rem; line-height: 1.7; }
#menu-toggle { display: none; }
main { min-width: 0; width: 100%; max-width: 1440px; margin: 0 auto; padding: 30px; }
.intro { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 24px; }
h1 { font-size: 1.875rem; letter-spacing: -.025em; margin: 0 0 9px; line-height: 1.25; }
h2 { font-size: 1.1875rem; margin: 0 0 16px; line-height: 1.4; }
h3 { font-size: 1rem; margin: 0 0 10px; }
p { color: var(--muted); line-height: 1.65; overflow-wrap: anywhere; }
.intro p { margin: 0; }
.tag { color: #315a68; background: #e2ecef; border-radius: 20px; padding: 8px 13px; font-size: .8125rem; white-space: nowrap; }
.panel { background: #fff; border: 1px solid #d5dfe6; border-radius: 12px; padding: 24px; margin-bottom: 22px; min-width: 0; }
.panel > p { max-width: 75ch; }
.panel-head { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.columns { display: grid; grid-template-columns: minmax(0,1.25fr) minmax(0,1fr); gap: 22px; }
.next-step h2 { font-size: 1.4rem; }
.next-step button + button { margin-left: 10px; background: #edf2f5; color: #284a60; }
.stats { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px; margin-bottom: 22px; }
.stat { border: 1px solid #d5dfe6; padding: 18px; border-radius: 12px; background: #fff; }
.stat span { display: block; font-size: .8125rem; color: var(--muted); }
.stat strong { display: block; font-size: 1.75rem; margin-top: 6px; font-variant-numeric: tabular-nums; }
#attention { display: flex; flex-direction: column; gap: 10px; }
#attention button { text-align: left; }
.subtle, .muted { font-size: .875rem; color: var(--muted); }
.row { padding: 16px 0; border-bottom: 1px solid #dce3e9; }
.row:last-child { border-bottom: 0; }
.row p { font-size: .875rem; margin: 7px 0; }
.row-title, .actions, .inline-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.actions { margin-top: 16px; }
.badge { display: inline-block; font-size: .8125rem; line-height: 1.5; border-radius: 5px; padding: 5px 9px; margin: 4px 0; color: #3e5264; background: #eaf0f5; }
.badge.success { background: #dff0e9; color: #21513f; }
.badge.warning { background: #fff0d2; color: #725014; }
.badge.danger { background: #f8e5e2; color: #7e3028; }
label, legend { display: block; font-size: .875rem; font-weight: 600; margin: 15px 0 7px; }
input, select, textarea { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid #98aab8; border-radius: 5px; background: #fff; color: #24374c; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: #586b7b; opacity: 1; }
textarea { min-height: 112px; resize: vertical; }
form > button { margin-top: 18px; }
form[aria-busy="true"] { cursor: progress; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border: 2px solid var(--danger); }
.form-error { color: #8b2d24; font-weight: 600; padding: 12px; background: #fff0ec; border: 1px solid #dbaaa3; border-radius: 5px; }
fieldset { min-width: 0; border: 1px solid #bccbd5; padding: 14px; border-radius: 8px; margin: 20px 0; }
legend { padding: 0 7px; }
.filters { display: flex; align-items: end; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.filters label { min-width: 140px; flex: 1; margin: 0; }
.filters input, .filters select { margin-top: 6px; }
.filters > input, .filters > select { width: auto; flex: 1; min-width: 150px; }
.filters > p { flex-basis: 100%; margin: 0; }
.result-tools { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 14px 0; }
.advanced-filters { flex-basis: 100%; }
details > summary { cursor: pointer; min-height: 44px; display: list-item; padding: 10px 0; font-size: .9375rem; color: #214d60; font-weight: 600; line-height: 1.5; }
details.panel > summary { font-size: 1.0625rem; }
details:not([open]) > summary { margin-bottom: 0; }
.note { background: #f1f6f8; border: 1px solid #c9d6dd; border-radius: 7px; padding: 14px; margin-top: 18px; color: #475e6d; font-size: .875rem; line-height: 1.7; }
.table-wrap { max-width: 100%; overflow: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: .875rem; }
th { font-size: .8125rem; color: #44596c; font-weight: 700; }
td, th { padding: 14px 10px; border-bottom: 1px solid #dce3e9; vertical-align: top; }
td:first-child { font-weight: 600; }
tr.selected { background: #e7f1f2; }
.inline-actions { min-width: 145px; }
.inline-actions button { width: 100%; }
.device-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,285px),1fr)); gap: 16px; }
.device-card { border: 1px solid #c9d6df; border-radius: 12px; padding: 20px; min-width: 0; }
.device-card p { font-size: .875rem; margin: 9px 0; }
.device-card .actions { align-items: stretch; }
.device-card button { width: 100%; }
.device-card details { margin-top: 12px; }
.request-context { color: var(--muted); line-height: 1.8; padding-left: 22px; font-size: .9375rem; }
.ticket-item { display: block; width: 100%; text-align: left; background: #f3f7f9; color: #233c52; border: 1px solid #cbd7df; padding: 16px; margin: 9px 0; }
.ticket-item:hover { color: #16384b; background: #e1eef1; }
.ticket-item.selected { background: #e0f0ee; border: 1px solid #116d7d; }
.ticket-item strong { display: block; margin-bottom: 5px; }
.ticket-item span { font-size: .875rem; font-weight: 400; }
.message { background: #f1f6f8; border-radius: 8px; padding: 15px; margin: 12px 0; }
.message strong { font-size: .875rem; }
.message p { white-space: pre-wrap; font-size: .9375rem; margin: 8px 0; }
.history-list { max-height: 540px; overflow: auto; scrollbar-color: #71899a #eef3f5; }
.notifications-unread { background: #f0f8f8; padding: 16px; border-radius: 8px; }
.check-label { display: flex; align-items: center; min-height: 44px; gap: 12px; margin: 3px 0; font-size: .9375rem; font-weight: 400; }
.check-label input { width: 22px; min-height: 22px; height: 22px; flex: 0 0 auto; accent-color: var(--accent); }
.checkbox-list { max-height: 250px; overflow: auto; margin-top: 13px; padding: 4px; scrollbar-color: #71899a #eef3f5; }
#agency-selection { font-size: .875rem; }
#notice:not(:empty), #warning:not(:empty) { padding: 16px 18px; margin-bottom: 22px; border: 1px solid #8eb9aa; border-radius: 7px; background: #e5f3ee; color: #214f40; line-height: 1.65; }
#notice.error, #warning:not(:empty) { background: #fff2dc; color: #70400b; border-color: #cfaa68; }
.footer { font-size: .8125rem; text-align: center; margin: 24px auto; max-width: 75ch; }
ol { padding-left: 22px; line-height: 1.9; color: var(--muted); }
dialog { max-width: min(600px,calc(100vw - 28px)); max-height: calc(100dvh - 36px); overflow: auto; border: 1px solid #98aab8; border-radius: 14px; padding: 28px; color: var(--ink); background: #fff; box-shadow: 0 14px 40px #132e4933; }
dialog::backdrop { background: #102b46aa; }
dialog h2 { font-size: 1.375rem; }
dialog ul { line-height: 1.9; padding-left: 22px; }
dialog .actions { justify-content: flex-end; }
.review-reminder { font-size: .875rem; }
@media (max-width: 1100px) {
  .shell { grid-template-columns: 190px minmax(0,1fr); }
  main { padding: 24px; }
  .columns { grid-template-columns: 1fr; gap: 0; }
  .stats { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 700px) {
  header { flex-wrap: wrap; padding: 18px; }
  .identity { margin: 5px 0 0; max-width: none; }
  .shell { display: block; }
  aside { padding: 12px 18px; }
  #menu-toggle { display: block; width: 100%; text-align: left; background: #e2f1f0; color: #125965; }
  nav { display: none; margin-top: 18px; gap: 18px; }
  aside[data-expanded="true"] nav { display: flex; }
  .nav-group { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; }
  .nav-group-label { grid-column: 1 / -1; }
  nav button { width: 100%; min-width: 0; background: #21415d; }
  .aside-note { display: none; }
  main { padding: 23px 16px; }
  .intro { display: block; }
  h1 { font-size: 1.625rem; }
  .tag { display: inline-block; margin-top: 14px; }
  .panel { padding: 20px; }
  .next-step button { width: 100%; }
  .next-step button + button { margin: 10px 0 0; }
  .filters { display: grid; grid-template-columns: 1fr; }
  .filters > input, .filters > select { width: 100%; min-width: 0; }
  .result-tools { align-items: start; flex-direction: column; }
  input, select, textarea { font-size: 1rem; }
  .device-grid { grid-template-columns: 1fr; }
  .actions > button { width: 100%; }
  .history-list { max-height: none; }
  dialog { padding: 22px; }
  dialog .actions { flex-direction: column; }
  dialog .actions > button { width: 100%; }
}
@media (prefers-reduced-motion: no-preference) {
  button, input, select, textarea { transition: background-color .15s ease-out, border-color .15s ease-out; }
}
@media (forced-colors: active) {
  button, .badge, .panel, .device-card, dialog { border: 1px solid CanvasText; }
  nav button[aria-current="page"] { outline: 2px solid Highlight; }
}

.setup-help > p, .setup-help details > p, .setup-help ol, .setup-help ul { max-width: 74ch; }
.setup-help > details { border-top: 1px solid #c9d6dd; padding: 8px 0; }
.setup-help li { padding-left: 5px; margin: 14px 0; line-height: 1.75; }
.setup-help ol, .setup-help ul { padding-left: 25px; }
.setup-help .setup-tip { margin: 18px 0; }

#setup-passphrase { font-family: ui-monospace, Consolas, monospace; font-size: 1rem; }
.readiness-list li { max-width: 74ch; margin: 18px 0; line-height: 1.75; }
.identity #sign-out { margin-top: 8px; min-height: 44px; }

#public-pages { max-width: 900px; }
#public-pages details { border-top: 1px solid #c9d6dd; padding: 8px 0; }
#public-pages p, .journey-steps { max-width: 74ch; }
.journey-steps li { margin: 18px 0; line-height: 1.75; }
#verify-inbox code { display: block; overflow-wrap: anywhere; margin: 12px 0; }

.field-error { color: #8c2230; font-weight: 600; }
.field-error:empty { display: none; }
