:root {
  --bg: #f4f1ea; --surface: #fffdf8; --ink: #1d2421; --muted: #66706b;
  --line: #e2ddd2; --accent: #166552; --accent-ink: #ffffff; --accent-soft: #dcebe4;
  --warn: #a4361c; --warn-soft: #f6e1d9; --gold: #f2b93b; --gold-soft: #fbefcf;
  --radius: 14px; --shadow: 0 1px 2px rgba(29,36,33,.06), 0 4px 16px rgba(29,36,33,.05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121614; --surface: #1b211e; --ink: #e8ece9; --muted: #98a39d;
    --line: #2c3430; --accent: #4fbf98; --accent-ink: #0c1512; --accent-soft: #1d3a30;
    --warn: #f08a6c; --warn-soft: #3a221b; --gold: #f2b93b; --gold-soft: #3a3120;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) calc(32px + env(safe-area-inset-bottom)) env(safe-area-inset-left);
}
.wrap { max-width: 640px; margin: 0 auto; padding: 0 16px; }
header.top { display: flex; align-items: center; gap: 12px; padding: 20px 0 8px; }
header.top img { width: 40px; height: 40px; border-radius: 10px; }
header.top h1 { font-size: 22px; margin: 0; letter-spacing: -.01em; }
header.top p { margin: 0; color: var(--muted); font-size: 13px; }
.badge { margin-left: auto; white-space: nowrap; flex: none; font-size: 12px; padding: 3px 8px; border-radius: 99px; background: var(--gold-soft); color: var(--ink); }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 28px 0 10px; display: flex; align-items: center; justify-content: space-between; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.card + .card { margin-top: 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
button, .btn {
  font: inherit; font-size: 15px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  padding: 9px 14px; border-radius: 10px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; min-height: 40px;
}
button.primary, .btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button.ghost { border-color: transparent; background: transparent; color: var(--muted); padding: 9px 10px; }
button.danger { color: var(--warn); }
button:disabled { opacity: .5; cursor: default; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
input, select {
  font: inherit; width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); color: var(--ink); min-height: 44px;
}
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.grid2 { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 10px; }
.grid2 input { min-width: 0; }
input[type=date], input[type=time] { -webkit-appearance: none; appearance: none; }
.watch-head { display: flex; gap: 10px; align-items: flex-start; }
.watch-head h3 { font-size: 17px; margin: 0; line-height: 1.3; }
.dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 7px; flex: none; background: var(--muted); }
.dot.on { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.dot.err { background: var(--warn); box-shadow: 0 0 0 4px var(--warn-soft); }
.slots { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.slot { background: var(--gold-soft); border-radius: 8px; padding: 4px 8px; font-size: 14px; font-variant-numeric: tabular-nums; }
.status { margin-top: 8px; font-size: 13px; color: var(--muted); }
.status.err { color: var(--warn); }
.actions { margin-top: 12px; display: flex; gap: 4px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 8px; }
.empty { text-align: center; padding: 28px 16px; color: var(--muted); }
.people { display: flex; flex-direction: column; }
.person { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); }
.person:last-child { border-bottom: none; }
.events li { padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.events li:last-child { border-bottom: none; }
.events ul { list-style: none; margin: 0; padding: 0; }
.events time { color: var(--muted); font-size: 12px; display: block; }
.doctors { display: flex; flex-direction: column; gap: 6px; max-height: 300px; overflow: auto; margin-top: 4px; }
.doctor { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; background: var(--bg); }
.doctor input { width: auto; min-height: 0; margin-top: 4px; }
.doctor:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
dialog { border: none; border-radius: 18px; padding: 0; width: min(560px, calc(100vw - 24px)); background: var(--surface); color: var(--ink); max-height: calc(100dvh - 24px); }
dialog::backdrop { background: rgba(10, 14, 12, .45); }
dialog form { padding: 18px 18px 16px; }
dialog h3 { margin: 0 0 4px; font-size: 19px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.hint { background: var(--accent-soft); border-radius: 10px; padding: 10px 12px; font-size: 14px; margin-top: 10px; }
.hint.warn { background: var(--warn-soft); }
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(120%); opacity: 0;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; transition: .25s; max-width: calc(100vw - 32px); z-index: 10; }
.toast.show { transform: translateX(-50%); opacity: 1; }
.login { max-width: 360px; margin: 12vh auto 0; }
[hidden] { display: none !important; }

/* --- добавлено: подключение ЕМИАС, доступность врачей, шаги --- */
.conn { display: flex; gap: 12px; align-items: flex-start; }
.conn .dot { margin-top: 6px; }
.conn .grow { flex: 1; min-width: 0; }
.pill { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 99px; margin-top: 4px; }
.pill.ok { background: var(--accent-soft); color: var(--ink); }
.pill.no { background: var(--line); color: var(--muted); }
.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; }
.steps > li { counter-increment: step; position: relative; padding: 0 0 18px 42px; }
.steps > li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; display: grid; place-items: center; font-size: 14px; }
.steps h4 { margin: 2px 0 4px; font-size: 16px; }
.steps p { margin: 0 0 8px; }
.bookmarklet { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 10px; border: 2px dashed var(--accent);
  color: var(--accent); font-weight: 700; text-decoration: none; cursor: grab; background: var(--accent-soft); }
textarea { font: 13px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; width: 100%; min-height: 96px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink); resize: vertical; }
textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
a { color: var(--accent); }
kbd { font: 12px ui-monospace, monospace; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 1px 5px; background: var(--surface); }
