:root {
  color-scheme: light dark;
  --bg: #f1f5f4;
  --panel: #fff;
  --text: #183535;
  --muted: #526967;
  --line: #d9e6e3;
  --accent: #186a5d;
  --soft: #e5f4ef;
  --on-accent: #fff;
  --danger: #942f35;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) { --bg: #132021; --panel: #1b2b2c; --text: #e2f4f0; --muted: #b2c9c4; --line: #314a49; --accent: #8cddc9; --soft: #263e38; --on-accent: #142c27; --danger: #ffabb1; }
}
:root[data-theme="dark"] { color-scheme: dark; --bg: #132021; --panel: #1b2b2c; --text: #e2f4f0; --muted: #b2c9c4; --line: #314a49; --accent: #8cddc9; --soft: #263e38; --on-accent: #142c27; --danger: #ffabb1; }
:root[data-theme="light"] { color-scheme: light; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
.access { width: min(460px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 20px; }
.access form { display: grid; gap: 12px; margin: 12px 0; }
.access input { display: block; width: 100%; margin-top: 4px; min-height: 40px; border: 1px solid var(--line); border-radius: 8px; padding-inline: 8px; }
.access a { color: var(--accent); }
.account-actions { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.account-actions output { overflow-wrap: anywhere; min-width: 0; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 Inter, system-ui, sans-serif; }
.shell { width: min(1120px, calc(100% - 48px)); margin-inline: auto; }
.masthead { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); }
.brand { color: inherit; text-decoration: none; font-weight: 750; display: flex; align-items: center; gap: 10px; }
.brand-mark { display: grid; place-items: center; background: var(--accent); color: var(--on-accent); width: 33px; height: 33px; border-radius: 10px; }
.header-actions, .date-actions, .dialog-actions { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
#environment, .muted, .legend { color: var(--muted); font-size: 13px; }
.intro { margin: 38px 0 25px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(28px, 4vw, 42px); line-height: 1.16; letter-spacing: -.04em; }
.intro p { margin-top: 7px; color: var(--muted); }
h2 { font-size: 20px; letter-spacing: -.025em; }
.calendar { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; }
.toolbar { padding: 16px 20px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
button, input { font: inherit; color: inherit; }
button, .date { border: 1px solid var(--line); border-radius: 9px; background: var(--panel); }
button { cursor: pointer; white-space: nowrap; min-height: 40px; padding: 6px 12px; }
button:hover:not(:disabled) { background: var(--soft); }
button:disabled { opacity: .6; cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon { font-size: 20px; flex: none; width: 40px; padding-inline: 0; }
.date input { width: 132px; min-height: 38px; border: 0; border-radius: inherit; background: transparent; padding: 6px 8px; }
.calendar-scroll { overflow-x: auto; }
.grid { display: grid; grid-template-columns: 58px repeat(3, minmax(146px, 1fr)); gap: 5px; min-width: 525px; padding: 0 18px 14px; align-items: stretch; }
.doctor { padding: 9px 8px; border-bottom: 1px solid var(--line); font-weight: 700; }
.doctor small { display: block; color: var(--muted); font-weight: 400; }
.time { color: var(--muted); align-self: center; text-align: center; font-variant-numeric: tabular-nums; }
.slot { min-height: 32px; padding: 3px 6px; border-color: transparent; background: var(--soft); color: var(--accent); }
.slot:hover:not(:disabled) { border-color: var(--accent); }
.slot.mine { cursor: grab; }
.slot.mine, .primary, .primary:hover:not(:disabled) { background: var(--accent); color: var(--on-accent); }
.slot.busy { background: var(--bg); color: var(--muted); }
.legend { padding: 10px 20px 14px; display: flex; gap: 16px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--soft); margin-right: 4px; }
.legend i.mine { background: var(--accent); }
#feedback:not(:empty) { margin: 0 18px 10px; padding: 8px 12px; border-radius: 8px; background: var(--soft); }
#feedback[data-error] { color: var(--danger); }
.visits { margin: 22px 0 45px; }
.visits h2 { margin-bottom: 10px; }
.visit { padding: 13px 16px; margin-bottom: 7px; border: 1px solid var(--line); background: var(--panel); border-radius: 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.visit strong, .visit small { display: block; }
.visit small { color: var(--muted); }
.visit-actions { display: flex; gap: 6px; flex: none; }
dialog { width: min(420px, calc(100% - 32px)); border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 16px; padding: 22px; }
dialog::backdrop { background: #081a1999; }
dialog p { margin: 8px 0 20px; color: var(--muted); }
.dialog-actions { justify-content: flex-end; }
.visually-hidden { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); }
@media (max-width: 620px) {
  .shell { width: calc(100% - 24px); }
  .masthead { min-height: 64px; }
  #environment { display: none; }
  .intro { margin-top: 24px; }
  .toolbar { padding: 12px; }
  .toolbar h2 { font-size: 17px; }
  .date-actions { gap: 3px; }
  .date-actions .icon { width: 32px; }
  .date input { width: 110px; padding-inline: 4px; }
  .grid { padding-inline: 8px; grid-template-columns: 45px repeat(3, minmax(115px, 1fr)); min-width: 398px; }
  .slot { min-height: 40px; }
}
