:root {
  --accent: #1F5FAE;
  --accent-dark: #174A88;
  --bg: #F4F6F5;
  --card: #FFFFFF;
  --text: #16211D;
  --muted: #4A5753;
  --line: #DDE3E0;
  --ok: #1E6B44; --ok-bg: #E5F2EA;
  --warn: #9A4A00; --warn-bg: #FDF0DD;
  --risk: #B42318; --risk-bg: #FDECEA;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
a:hover { color: var(--accent-dark); }
h1 { font-size: 1.6rem; line-height: 1.25; margin: 0 0 .35rem; }
h2 { font-size: 1.15rem; line-height: 1.3; margin: 0 0 .6rem; }
h3 { font-size: 1rem; margin: 0 0 .35rem; }
p { margin: 0 0 .75rem; }
code, .code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .85rem; word-break: break-all; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 8px; top: 8px; z-index: 10; background: #fff; padding: 8px 12px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Shell */
.topbar { display: flex; align-items: center; gap: 16px; padding: 10px 20px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 700; color: var(--accent); }
.topbar-practice { color: var(--muted); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.langs { display: inline-flex; border: 1px solid var(--line); border-radius: 99px; overflow: hidden; }
.langs a { padding: 6px 12px; text-decoration: none; color: var(--text); font-weight: 600; font-size: .85rem; min-height: 32px; display: inline-flex; align-items: center; }
.langs a.on { background: var(--accent); color: #fff; }
button.link { background: none; border: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; padding: 6px 0; }
.shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); max-width: 1280px; margin: 0 auto; }
.sidenav { padding: 20px 12px; display: flex; flex-direction: column; gap: 2px; }
.sidenav a { position: relative; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border-radius: 10px; text-decoration: none; color: var(--text); font-weight: 600; }
.sidenav a:hover { background: #E6ECEA; }
.sidenav a.active { background: var(--accent); color: #fff; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; background: transparent; }
.dot-ok { background: var(--ok); } .dot-warn { background: var(--warn); } .dot-risk { background: var(--risk); }
.sidenav a.active .dot { background: #fff; }
.count { margin-left: auto; background: var(--risk); color: #fff; border-radius: 99px; font-size: .75rem; padding: 1px 8px; }
.help { margin-top: 24px; padding: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; font-size: .875rem; }
.help p { margin: 6px 0 0; }
.main { padding: 24px 20px 64px; min-width: 0; }
.main a, .main code, .log span, .check-results span { overflow-wrap: anywhere; }

/* Plain pages */
.plain-main { max-width: 760px; margin: 0 auto; padding: 24px 16px 48px; }
.plain-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }

/* Cards and layout */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px; margin: 0 0 16px; }
.card.narrow { max-width: 440px; margin: 0 auto; }
.card.wide { max-width: 760px; margin: 0 auto; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin-bottom: 16px; }
.grid-cards .card { margin: 0; }
.muted-card { opacity: .75; }
section > h2 { margin-top: 8px; }

/* Forms */
.form label { display: block; font-weight: 600; margin: 0 0 14px; }
.form small { display: block; font-weight: 400; color: var(--muted); font-size: .85rem; margin-top: 4px; }
input, select, textarea { display: block; width: 100%; margin-top: 6px; min-height: 44px; padding: 8px 12px; font: inherit; color: var(--text); background: #fff; border: 1px solid #C9D2CE; border-radius: 10px; }
textarea { min-height: 80px; }
input[type="checkbox"], input[type="radio"] { display: inline-block; width: 20px; height: 20px; min-height: 0; margin: 0 8px 0 0; vertical-align: middle; flex-shrink: 0; }
input[type="number"] { display: inline-block; width: 5.5em; }
input[type="file"] { padding: 8px; }
input.color { width: 72px; padding: 4px; }
.form label.check, label.check { display: flex; align-items: flex-start; gap: 0; font-weight: 400; min-height: 32px; margin: 0 0 8px; }
label.check input { margin-top: 2px; }
label.check.strong { font-weight: 600; margin-top: 12px; }
fieldset { border: 0; padding: 0; margin: 0 0 14px; }
legend { font-weight: 600; margin-bottom: 6px; padding: 0; }
.choices { display: grid; gap: 10px; }
.choice { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 10px 14px; border: 2px solid var(--line); border-radius: 12px; cursor: pointer; font-weight: 400 !important; margin: 0 !important; }
.choice:has(input:checked) { border-color: var(--accent); background: #EEF4FB; }
.location-row { border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 12px; }
.group-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0 16px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 18px; border-radius: 10px; border: 1px solid #C9D2CE; background: #fff; color: var(--text); font: 600 15px/1.2 inherit; font-family: inherit; text-decoration: none; cursor: pointer; }
.btn:hover { background: #F0F3F2; color: var(--text); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); color: #fff; }
.btn-success { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-success:hover { background: #17573A; color: #fff; }
.btn-outline { border: 2px solid var(--accent); color: var(--accent); }
.btn-wide { width: 100%; margin-top: 8px; }
.btn-tall { min-height: 56px; font-size: 17px; }
.btn[disabled] { opacity: .6; cursor: progress; }
.sticky-save { position: sticky; bottom: 0; padding: 12px 0; background: linear-gradient(transparent, var(--bg) 30%); }
.links { margin-top: 16px; text-align: center; }

/* Status */
.badge { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: .8rem; font-weight: 700; white-space: nowrap; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-risk { background: var(--risk-bg); color: var(--risk); }
.flash { padding: 12px 14px; border-radius: 10px; font-weight: 600; margin: 0 0 16px; }
.flash-ok { background: var(--ok-bg); color: var(--ok); }
.flash-error { background: var(--risk-bg); color: var(--risk); }
.alert-risk { border-color: #F3B8B2; background: var(--risk-bg); }
.ok-note { background: var(--ok-bg); border-color: #B7DCC5; color: var(--ok); font-weight: 600; }

/* Overview */
.score { display: flex; gap: 20px; align-items: center; }
.score-ring { flex-shrink: 0; width: 84px; height: 84px; border-radius: 50%; border: 8px solid var(--ok); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.1rem; }
.score-warn .score-ring { border-color: var(--warn); }
.todos { list-style: none; margin: 0; padding: 0; }
.todo { display: flex; gap: 14px; align-items: flex-start; }
.todo-body { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.todo-risk { border-left: 4px solid var(--risk); }
.todo-warn { border-left: 4px solid var(--warn); }
.insurer.relevant { border-width: 2px; }
.calendar { list-style: none; padding: 8px 20px; }
.calendar li { display: grid; grid-template-columns: 150px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid #EEF1F0; }
.calendar li:last-child { border-bottom: 0; }
.calendar li span:first-child { font-weight: 600; }

/* Tables */
.table-wrap { overflow-x: auto; }
.table { border-collapse: collapse; width: 100%; }
.table th, .table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid #EEF1F0; vertical-align: middle; }
.table thead th { font-size: .85rem; color: var(--muted); }
.table tbody th { font-weight: 600; }
.weeks td { white-space: nowrap; }
.norm-ok { color: var(--ok); font-weight: 700; } .norm-above { color: var(--warn); font-weight: 700; }
.confirm { border-width: 2px; }
.confirm-ok { border-color: #B7DCC5; }
.confirm-warn { border-color: #E0A44A; }

/* Lists */
.summary { list-style: none; padding: 16px; margin: 0 0 16px; border: 1px solid var(--line); border-radius: 14px; }
.summary li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; }
.done-mark { width: 64px; height: 64px; border-radius: 50%; background: var(--ok-bg); color: var(--ok); font-size: 32px; display: flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.check-results { list-style: none; padding: 0; margin: 0 0 12px; }
.check-results li { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; padding: 10px 0; border-bottom: 1px solid #EEF1F0; }
.log { list-style: none; padding: 0; margin: 0; }
.log li { display: flex; gap: 10px; flex-wrap: wrap; padding: 6px 0; border-bottom: 1px solid #EEF1F0; }
.steps { display: flex; gap: 8px; list-style: none; padding: 0; margin: 0 0 24px; }
.steps li { flex: 1; font-size: .85rem; font-weight: 600; color: #6B7773; padding-top: 10px; border-top: 6px solid var(--line); }
.steps li.on { color: var(--text); border-top-color: var(--accent); }


@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidenav { min-width: 0; }
  .sidenav { flex-direction: row; overflow-x: auto; padding: 8px; gap: 4px; background: var(--card); border-bottom: 1px solid var(--line); }
  .sidenav a { white-space: nowrap; }
  .help { display: none; }
  .topbar { flex-wrap: wrap; padding: 10px 16px; }
  .topbar-practice { order: 3; flex-basis: 100%; }
  .main { padding: 16px 16px 64px; }
  .two { grid-template-columns: 1fr; }
  .calendar li { grid-template-columns: 1fr; gap: 0; }
  .score { flex-direction: column; align-items: flex-start; }
  .todo { flex-wrap: wrap; }
}
@media (max-width: 600px) {
  /* Waiting-time rows stack so both inputs are visible without sideways scrolling. */
  .weeks thead { display: none; }
  .weeks tr { display: block; padding: 10px 0; border-bottom: 1px solid #EEF1F0; }
  .weeks tr[hidden] { display: none; }
  .weeks th, .weeks td { display: block; border: 0; padding: 4px 0; }
  .weeks td[data-label]::before { content: attr(data-label); display: block; font-size: .85rem; color: var(--muted); }
  .weeks td[data-norm]:empty { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

.preview .ggzw { margin-top: 12px; }
.card-highlight { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
