:root {
  color-scheme: light;
  --bg: #f3f5f4;
  --surface: #fff;
  --text: #213831;
  --muted: #60736c;
  --accent: #17634e;
  --on-accent: #fff;
  --soft: #e8f1eb;
  --border: #d7e2db;
  --warm: #f6eddc;
  --warm-text: #75571d;
  --danger: #a03b37;
  --danger-bg: #faeae8;
  --shadow: 0 7px 24px #163a2710;
  --bottom-nav-height: 84px;
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
  --bottom-clearance: calc(var(--bottom-nav-height) + var(--safe-area-bottom) + 16px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #151c19; --surface: #202b25; --text: #e5eee8; --muted: #adbbb2;
    --accent: #9bd7b8; --on-accent: #142d20; --soft: #2b4033; --border: #43554a;
    --warm: #3b3425; --warm-text: #edcd8e; --danger: #f5aaa2; --danger-bg: #402b29;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #151c19; --surface: #202b25; --text: #e5eee8; --muted: #adbbb2;
  --accent: #9bd7b8; --on-accent: #142d20; --soft: #2b4033; --border: #43554a;
  --warm: #3b3425; --warm-text: #edcd8e; --danger: #f5aaa2; --danger-bg: #402b29;
  --shadow: none;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
a { color: var(--accent); text-underline-offset: 3px; }
button, input, textarea, select { font: inherit; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
[hidden] { display: none !important; }
.shell { width: min(100%, 760px); margin: auto; padding: 0 20px var(--bottom-clearance); }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 24px 0 18px; gap: 10px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-size: 14px; font-weight: 650; line-height: 1.4; }
.brand small { display: block; font-size: 11px; font-weight: 400; color: var(--muted); margin-top: 3px; }
.monogram { display: grid; place-items: center; width: 42px; height: 42px; flex: 0 0 42px; background: var(--accent); color: var(--on-accent); border-radius: 50% 50% 50% 12px; font-size: 14px; letter-spacing: 1px; }
.theme-button { width: 44px; height: 44px; border: 1px solid var(--border); border-radius: 50%; color: var(--text); background: var(--surface); font-size: 23px; flex: 0 0 44px; }
.demo-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 10px; color: var(--muted); border-top: 1px solid var(--border); padding: 12px 0; }
.demo-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
#mode-label { margin-left: auto; font-size: 10px; }
.session-bar { display: flex; justify-content: space-between; gap: 8px; align-items: center; color: var(--muted); font-size: 12px; padding-bottom: 8px; }
.session-bar a, .session-bar button { min-height: 36px; display: inline-flex; align-items: center; }
main { min-height: 45vh; padding-bottom: var(--bottom-clearance); }
h1 { font-family: Georgia, "Times New Roman", serif; font-weight: 400; font-size: clamp(30px, 6vw, 42px); line-height: 1.14; letter-spacing: -.8px; margin: 6px 0 12px; }
h2 { font-size: 20px; line-height: 1.3; font-weight: 600; margin: 24px 0 14px; }
h3 { font-size: 16px; line-height: 1.4; margin: 0 0 8px; }
p { margin: 0 0 12px; }
.eyebrow { font-size: 11px; letter-spacing: 1.8px; text-transform: uppercase; color: var(--accent); margin: 22px 0 12px; font-weight: 650; }
.lead { color: var(--muted); font-size: 15px; margin-bottom: 24px; max-width: 520px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.card { padding: 20px; border: 1px solid var(--border); background: var(--surface); border-radius: 18px; margin: 12px 0; box-shadow: var(--shadow); }
.card > :last-child { margin-bottom: 0; }
.soft-card { background: var(--soft); box-shadow: none; }
.router { padding: 20px; margin-bottom: 20px; }
.router label { font-size: 17px; font-weight: 600; }
.router .input-row { margin-top: 12px; }
.input-row { display: flex; gap: 8px; align-items: stretch; }
.input-row input { min-width: 0; flex: 1; }
.input-row .button { min-width: 48px; padding: 10px 14px; }
.tile { display: flex; align-items: center; gap: 14px; padding: 20px; color: var(--text); text-decoration: none; transition: transform .12s; }
.tile:hover { transform: translateY(-2px); }
.tile .tile-icon { font-size: 24px; width: 30px; flex-shrink: 0; color: var(--accent); text-align: center; }
.tile strong { display: block; font-size: 17px; font-weight: 600; }
.tile small { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
.tile .arrow { margin-left: auto; font-size: 20px; }
.tile.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.tile.primary .tile-icon, .tile.primary small { color: var(--on-accent); }
.tiles-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tiles-grid .tile { display: block; margin: 0; padding: 18px; }
.tiles-grid .tile-icon { display: block; margin-bottom: 10px; }
.tiles-grid strong { font-size: 15px; }
.tiles-grid small { min-height: 36px; }
.note { padding: 14px 16px; background: var(--soft); border-radius: 12px; font-size: 13px; color: var(--text); margin: 16px 0; }
.warm { background: var(--warm); color: var(--warm-text); }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px; padding: 11px 18px; background: var(--accent); color: var(--on-accent); border: 1px solid transparent; border-radius: 11px; font-size: 14px; font-weight: 600; text-decoration: none; text-align: center; }
.button.secondary { background: var(--surface); color: var(--accent); border-color: var(--border); }
.button.danger { color: var(--danger); background: var(--danger-bg); }
.button.full { width: 100%; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.actions > * { flex: 1 1 auto; }
.text-button { background: transparent; border: 0; color: var(--accent); padding: 4px 0; text-decoration: underline; font-size: inherit; min-height: 36px; }
label { display: block; font-size: 14px; margin: 16px 0 6px; font-weight: 550; }
input, textarea, select { display: block; width: 100%; min-width: 0; max-width: 100%; border: 1px solid var(--border); border-radius: 10px; padding: 12px; background: var(--surface); color: var(--text); font-size: 16px; }
textarea { min-height: 96px; resize: vertical; }
input[type="checkbox"] { display: inline-block; width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
fieldset { border: 1px solid var(--border); border-radius: 12px; margin: 20px 0; padding: 12px; }
legend { font-size: 14px; padding: 0 6px; }
.weekdays { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.weekdays label { margin: 0; display: flex; align-items: center; gap: 6px; min-height: 40px; }
.form-error { color: var(--danger); font-size: 14px; margin-top: 10px; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.badge { display: inline-flex; padding: 3px 9px; border-radius: 6px; background: var(--soft); color: var(--accent); font-size: 11px; font-weight: 600; }
.badge.paid, .badge.pending { background: var(--warm); color: var(--warm-text); }
.place-title { font-size: 17px; }
.filter { margin-bottom: 20px; }
.slots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.slot { display: block; padding: 12px; border: 1px solid var(--border); border-radius: 12px; color: var(--text); text-decoration: none; background: var(--surface); }
.slot:hover { border-color: var(--accent); background: var(--soft); }
.slot strong { font-size: 20px; font-weight: 550; }
.slot span { display: block; font-size: 11px; margin-top: 4px; color: var(--muted); }
.date-heading { display: flex; gap: 8px; align-items: baseline; margin: 24px 0 10px; font-size: 17px; }
.date-heading small { color: var(--muted); font-size: 12px; font-weight: 400; }
.back { display: inline-block; font-size: 13px; margin: 12px 0 16px; }
.empty { text-align: center; padding: 36px 20px; }
.empty-symbol { display: block; color: var(--accent); font-size: 38px; margin-bottom: 12px; }
.appointment-time { font-size: 26px; margin: 12px 0 8px; font-weight: 500; }
ul { padding-left: 20px; }
li { margin-bottom: 8px; }
.steps { list-style: none; padding: 0; counter-reset: step; }
.steps li { counter-increment: step; display: flex; align-items: baseline; gap: 12px; margin: 20px 0; }
.steps li::before { content: counter(step, decimal-leading-zero); color: var(--accent); font-size: 12px; }
.planner-day { display: grid; grid-template-columns: 48px minmax(0,1fr); gap: 10px; padding: 16px 0; border-top: 1px solid var(--border); }
.day-stamp { display: flex; flex-direction: column; align-items: center; }
.day-number { display: grid; place-items: center; width: 40px; height: 40px; font-size: 23px; }
.day-number.duty { border: 2px solid var(--accent); border-radius: 50%; transform: rotate(-6deg); }
.day-stamp small { color: var(--muted); font-size: 11px; }
.day-stamp .duty-label { font-size: 9px; white-space: nowrap; overflow-wrap: normal; }
.operation-list { list-style: none; padding: 0; margin: 0; }
.operation { display: grid; grid-template-columns: 20px minmax(0,1fr); gap: 4px; padding: 12px 6px; margin: 0; border-bottom: 1px dashed var(--border); }
.operation:last-child { border-bottom: 0; }
.operation .seq { color: var(--muted); font-size: 12px; padding-top: 3px; }
.operation p { margin-bottom: 5px; font-size: 13px; }
.operation strong { font-size: 16px; font-weight: 600; }
.exam-mark { display: inline-flex; border: 1px solid var(--text); border-radius: 50%; align-items: center; justify-content: center; min-width: 27px; height: 27px; font-size: 13px; margin-left: 4px; }
.exam-crop { display: inline-block; width: 36px; height: 36px; object-fit: contain; vertical-align: middle; margin-left: 4px; background: #fff; }
.op-arrow { color: var(--accent); font-size: 21px; line-height: 1; vertical-align: middle; }
.week-controls { display: grid; grid-template-columns: 44px minmax(0,1fr) 44px; align-items: center; gap: 8px; margin: 20px 0; text-align: center; }
.week-controls .button { padding: 8px; }
.week-controls strong { font-size: 14px; }
.planner-paper { padding: 10px 14px; border-radius: 4px 16px 16px 4px; border-left: 4px solid var(--border); }
.question-bubble { padding: 14px; border-radius: 12px 12px 2px 12px; margin-bottom: 10px; background: var(--soft); }
summary { cursor: pointer; padding: 12px 0; font-weight: 550; }
details { border-bottom: 1px solid var(--border); font-size: 14px; }
.footer { color: var(--muted); font-size: 11px; margin-top: 32px; border-top: 1px solid var(--border); padding-top: 20px; }
.footer-actions { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.bottom-nav { position: fixed; z-index: 10; bottom: 0; left: 50%; transform: translateX(-50%); width: min(100%, 760px); height: calc(var(--bottom-nav-height) + var(--safe-area-bottom)); display: flex; justify-content: space-around; padding: 9px 6px calc(10px + var(--safe-area-bottom)); background: var(--surface); border: 1px solid var(--border); border-bottom: 0; border-radius: 18px 18px 0 0; }
.bottom-nav a { flex: 1 1 0; min-width: 0; text-align: center; font-size: 10px; text-decoration: none; color: var(--muted); border-radius: 8px; padding: 7px 2px; }
.bottom-nav a span { display: block; font-size: 21px; line-height: 1.2; margin-bottom: 5px; }
.bottom-nav a[aria-current="page"] { color: var(--accent); background: var(--soft); }
.toast { position: fixed; z-index: 20; bottom: 100px; left: 50%; transform: translateX(-50%); width: min(90%, 470px); border: 1px solid var(--border); padding: 16px 20px; border-radius: 12px; background: var(--text); color: var(--bg); box-shadow: var(--shadow); font-size: 14px; }
.skip-link { position: absolute; top: -80px; z-index: 30; padding: 12px; background: var(--surface); }
.skip-link:focus { top: 0; }
.loading { padding: 40px 0; color: var(--muted); }
.shell, .card, .tile, .slot, .operation, .note { overflow-wrap: anywhere; }
@media (min-width: 600px) {
  .shell { padding-left: 32px; padding-right: 32px; }
  .slots { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .tiles-grid { grid-template-columns: repeat(3, 1fr); }
  .planner-day { grid-template-columns: 70px minmax(0,1fr); gap: 20px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
