/* Витрина v2 — по макетам design/schedule-v2. 1 px сетки дня = 1 минута. */
:root {
  --ink: #0F172A; --ink2: #334155; --mut: #64748B; --mut2: #94A3B8;
  --line: #E8E8E4; --line2: #EFEFEB; --line3: #F3F3EF; --btn-line: #E5E7EB;
  --bg: #F7F7F5; --bg2: #FBFBF9; --bg3: #FAFAF7; --track: #F1F2F6;
  --accent: #5B5BF5; --accent-bg: #EEF0FF;
  --red: #EF4444; --red-bg: #FEF2F2; --red-line: #FCA5A5; --we: #E11D48;
  --ok: #10B981; --wait: #F59E0B;
  --hatch: repeating-linear-gradient(135deg, #FAFAF7 0 6px, #F2F2EC 6px 12px);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: 'Inter', system-ui, -apple-system, sans-serif; color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased; font-size: 14px; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.grow { flex: 1; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--mut2)); display: inline-block; flex-shrink: 0; }
.vsep { width: 1px; height: 20px; background: var(--btn-line); margin: 0 6px; flex-shrink: 0; }
.empty { padding: 64px 24px; text-align: center; color: var(--mut2); font-size: 14px; }

/* --- каркас --- */
.app { display: flex; height: 100vh; height: 100dvh; }
.rail { width: 72px; background: #FFF; border-right: 1px solid var(--line); display: flex; flex-direction: column;
  align-items: center; padding: 20px 0; gap: 4px; flex-shrink: 0; }
.logo { width: 36px; height: 36px; border-radius: 10px; background: var(--ink); color: #FFF; display: flex;
  align-items: center; justify-content: center; margin-bottom: 20px; }
.rail-btn { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; color: var(--mut); }
.rail-btn.active { background: var(--accent-bg); color: var(--accent); }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar { height: 64px; background: #FFF; border-bottom: 1px solid var(--line); display: flex; align-items: center;
  padding: 0 24px; gap: 20px; flex-shrink: 0; }
.brand { display: flex; align-items: baseline; gap: 20px; min-width: 0; }
.brand-title { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.brand-sub { color: var(--mut2); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.datenav { flex: 1; display: flex; justify-content: center; gap: 12px; align-items: center; }
.date-title { font-size: 15px; font-weight: 600; min-width: 200px; text-align: center; }
.icon-btn { width: 32px; height: 32px; border: 1px solid var(--btn-line); background: #FFF; border-radius: 8px; display: inline-flex;
  align-items: center; justify-content: center; cursor: pointer; color: #475569; flex-shrink: 0; transition: background .15s, border-color .15s; }
.icon-btn:hover, .btn:hover { background: var(--bg2); border-color: #D6D9DE; }
.icon-btn:active, .btn:active { background: var(--track); }
.icon-btn.sm { width: 28px; height: 28px; border-radius: 7px; }
.print-btn { width: 36px; height: 36px; border-radius: 9px; }
.btn { height: 32px; padding: 0 12px; border: 1px solid var(--btn-line); background: #FFF; border-radius: 8px; font-size: 13px;
  font-weight: 500; color: var(--ink2); display: inline-flex; align-items: center; white-space: nowrap; transition: background .15s; }
.seg { display: flex; background: var(--track); border-radius: 10px; padding: 3px; gap: 2px; flex-shrink: 0; }
.seg a { height: 30px; padding: 0 14px; font-size: 13px; font-weight: 500; color: var(--mut); border-radius: 7px; display: flex; align-items: center; }
.seg a:hover { color: var(--ink); }
.seg a.on { background: #FFF; font-weight: 600; color: var(--ink); box-shadow: 0 1px 2px rgba(15,23,42,.08); }

.strip { height: 52px; background: #FFF; border-bottom: 1px solid var(--line); display: flex; align-items: center;
  padding: 0 24px; gap: 8px; flex-shrink: 0; }
.strip .label { font-size: 12px; color: var(--mut2); font-weight: 500; letter-spacing: .02em; text-transform: uppercase; margin-right: 4px; }
.stat { font-size: 12px; color: var(--mut); white-space: nowrap; }
.stat b { color: var(--ink); font-weight: 600; }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; min-width: 0; flex: 0 1 auto; padding: 2px 0; }
.chips::-webkit-scrollbar { display: none; }
.chip { height: 28px; padding: 0 10px 0 8px; border: 1px solid var(--btn-line); background: #FFF; border-radius: 999px; font-size: 12px;
  color: var(--ink2); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; transition: background .15s, border-color .15s; }
.chip:hover { border-color: #CBD5E1; background: var(--bg2); }
.chip.on { border-color: var(--c); background: color-mix(in srgb, var(--c) 9%, white); color: var(--ink); font-weight: 600; }
.chip:not(:has(.dot)) { padding: 0 10px; }
.select-chip { position: relative; display: inline-flex; align-items: center; height: 28px; border: 1px solid var(--btn-line);
  border-radius: 999px; background: #FFF; color: var(--mut); }
.select-chip select { appearance: none; border: 0; background: transparent; font: inherit; font-size: 12px; color: var(--ink2);
  height: 100%; padding: 0 28px 0 10px; cursor: pointer; border-radius: 999px; }
.select-chip svg { position: absolute; right: 10px; pointer-events: none; }
/* выбор врача с поиском */
.docpick { position: relative; display: flex; align-items: center; flex-shrink: 0; }
.dp-btn { height: 28px; padding: 0 10px; border: 1px solid var(--btn-line); background: #FFF; border-radius: 999px; font-size: 12px;
  color: var(--ink2); display: inline-flex; align-items: center; gap: 6px; cursor: pointer; transition: background .15s, border-color .15s; }
.dp-btn:hover { border-color: #CBD5E1; background: var(--bg2); }
.dp-btn svg { color: var(--mut); flex-shrink: 0; }
.dp-btn.on { border-color: var(--accent); background: var(--accent-bg); color: var(--ink); font-weight: 600; padding-right: 26px; }
.dp-label { max-width: 160px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dp-clear { position: absolute; right: 4px; width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; color: var(--mut); font-size: 15px; line-height: 1; }
.dp-clear:hover { background: #DCE0FF; color: var(--ink); }
.dp-panel { position: absolute; top: 34px; left: 0; z-index: 40; width: 320px; max-width: calc(100vw - 24px);
  background: #FFF; border-radius: 12px; box-shadow: 0 12px 40px rgba(15,23,42,.18), 0 0 0 1px rgba(15,23,42,.06); overflow: hidden; }
.dp-input { width: 100%; border: 0; border-bottom: 1px solid var(--line2); padding: 12px 14px; font: inherit; font-size: 13px; outline: none; }
.dp-input::placeholder { color: var(--mut2); }
.dp-list { max-height: 360px; overflow-y: auto; padding: 4px; }
.dp-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; font-size: 13px; }
.dp-item .dot { width: 7px; height: 7px; }
.dp-name { font-weight: 500; white-space: nowrap; }
.dp-spec { color: var(--mut2); font-size: 11px; margin-left: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.dp-item:hover, .dp-item.act { background: var(--track); }
.dp-item.on .dp-name { color: var(--accent); font-weight: 600; }
.dp-all { color: var(--mut); }
.dp-item[hidden] { display: none; }
.dp-empty { padding: 14px; text-align: center; color: var(--mut2); font-size: 12px; }
.summary { gap: 24px; }
.legend { display: flex; align-items: center; gap: 12px; font-size: 11px; color: var(--mut); overflow-x: auto; scrollbar-width: none; min-width: 0; }
.leg { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.leg .dot { width: 7px; height: 7px; }
.leg:hover, .leg.on { color: var(--ink); }
.leg.on { font-weight: 600; }

.content { flex: 1; min-height: 0; overflow: auto; background: #FFF; position: relative; }

/* --- день: сетка часы × врачи --- */
.daygrid { display: grid; grid-template-columns: 68px repeat(var(--cols), minmax(168px, 1fr));
  grid-template-rows: 68px var(--h); min-width: min-content; position: relative; padding-bottom: 24px; }
.dg-corner { position: sticky; top: 0; left: 0; z-index: 7; background: var(--bg2); border-right: 1px solid var(--line2); border-bottom: 1px solid var(--line2); }
.dg-head { position: sticky; top: 0; z-index: 6; background: #FFF; height: 68px; padding: 12px 14px; border-bottom: 1px solid var(--line2);
  border-right: 1px solid var(--line2); display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: color-mix(in srgb, var(--c) 10%, white); color: var(--c);
  display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 12px; flex-shrink: 0; }
.avatar.big { width: 48px; height: 48px; font-size: 16px; font-weight: 700; }
.who { min-width: 0; display: flex; flex-direction: column; }
.who .name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
a.name:hover { color: var(--accent); }
.role { font-size: 11px; color: var(--mut); display: flex; align-items: center; gap: 5px; white-space: nowrap; min-width: 0; }
.role .dot { width: 6px; height: 6px; }
.role-t { overflow: hidden; text-overflow: ellipsis; }
.dg-times { grid-column: 1; grid-row: 2; position: sticky; left: 0; z-index: 5; background: var(--bg2); border-right: 1px solid var(--line2); }
.dg-hour { position: absolute; right: 10px; transform: translateY(6px); color: var(--mut2); font-size: 11px; font-weight: 500; }
.dg-col { grid-row: 2; position: relative; border-right: 1px solid var(--line2);
  background: repeating-linear-gradient(to bottom, transparent 0 59px, var(--line3) 59px 60px); }
.gap { position: absolute; left: 8px; right: 8px; border: 1px dashed var(--btn-line); border-radius: 8px; display: flex; align-items: center;
  justify-content: center; color: var(--mut2); font-size: 12px; background: rgba(255,255,255,.6); }

.card { position: absolute; border: 0; text-align: left; cursor: pointer; overflow: hidden; z-index: 2;
  background: color-mix(in srgb, var(--c) 10%, white); border-left: 3px solid var(--c); border-radius: 8px; padding: 6px 10px;
  display: flex; flex-direction: column; gap: 1px; box-shadow: 0 0 0 1px #FFF; transition: box-shadow .15s, transform .15s; }
.card:hover { box-shadow: 0 0 0 1px #FFF, 0 4px 14px rgba(15,23,42,.12); z-index: 4; }
.card:active { transform: scale(.99); }
.card.short { padding: 3px 10px; justify-content: center; }
.c-top, .c-line { display: flex; justify-content: space-between; align-items: start; gap: 6px; min-width: 0; }
.c-line { align-items: center; }
.c-name { font-size: 12px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-time { font-size: 11px; color: var(--c); font-weight: 500; flex-shrink: 0; }
.c-meta { font-size: 11px; color: var(--c); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-sub { font-size: 11px; color: var(--mut); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sdot { width: 6px; height: 6px; border-radius: 50%; background: var(--mut2); margin-top: 4px; flex-shrink: 0; }
.st-new .sdot { background: var(--wait); }
.st-conf .sdot, .st-here .sdot, .st-done .sdot { background: var(--ok); }
.st-cancel .sdot { background: var(--red); }
.card.st-cancel { background: #F8FAFC; border-left-color: #CBD5E1; }
.card.st-cancel .c-name { text-decoration: line-through; color: var(--mut); }
.card.st-cancel .c-meta, .card.st-cancel .c-time { color: var(--mut2); }
.card.behind { z-index: 1; opacity: .55; background: var(--hatch); }
.card.behind:hover { opacity: 1; }
/* линия «сейчас» поверх всех колонок; top — минуты от начала сетки, шапка — сверху */
.nowline { position: absolute; left: 68px; right: 0; margin-top: 68px; height: 0; z-index: 5; pointer-events: none;
  border-top: 1px solid var(--red); }
.nowline::before { content: ""; position: absolute; left: -6px; top: -6px; width: 11px; height: 11px; border-radius: 50%; background: var(--red);
  box-shadow: 0 0 0 3px rgba(239,68,68,.18); }
.nowline span { position: absolute; left: 10px; top: -18px; background: var(--red); color: #FFF; font-size: 10px; font-weight: 600;
  padding: 2px 6px; border-radius: 4px; }

/* мобильные части дня — на десктопе скрыты */
.m-dates, .m-toggle, .mlist { display: none; }

/* --- неделя: врачи × 7 дней --- */
.week { display: flex; flex-direction: column; min-height: 100%; min-width: 1060px; }
.wk-row { display: grid; grid-template-columns: 200px repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--line2); }
.wk-row > * { border-right: 1px solid var(--line2); }
.wk-row > *:last-child { border-right: 0; }
.wk-days { height: 72px; position: sticky; top: 0; z-index: 3; background: #FFF; }
.wk-label { padding: 10px 16px; display: flex; align-items: end; font-size: 11px; color: var(--mut2); font-weight: 500; letter-spacing: .03em; text-transform: uppercase; }
.wk-day { padding: 12px 14px; display: flex; flex-direction: column; justify-content: center; background: #FFF; }
.wk-day:hover { background: var(--bg2); }
.wk-day .wd { font-size: 11px; color: var(--mut2); font-weight: 500; letter-spacing: .03em; text-transform: uppercase; }
.wk-day .num { font-size: 22px; font-weight: 700; line-height: 1; margin-top: 4px; }
.wk-day.we { background: var(--bg2); }
.wk-day.we .wd, .wk-day.we .num { color: var(--we); }
.wk-day.today, .wk-axis .today { background: var(--red-bg); }
.wk-day.today .wd { color: var(--red); font-weight: 600; }
.wk-day.today .num { color: var(--red); }
.wk-axis { height: 24px; background: var(--bg2); }
.wk-axis > div { position: relative; font-size: 9px; color: var(--mut2); }
.wk-axis .we { background: var(--bg2); }
.wk-axis span { position: absolute; top: 7px; left: 6px; }
.wk-axis span + span { left: auto; right: 6px; }
.wk-row:not(.wk-days):not(.wk-axis) { min-height: 104px; }
.wk-doc { padding: 10px 14px; display: flex; align-items: center; gap: 10px; min-width: 0; }
a.wk-doc:hover .name { color: var(--accent); }
.wk-cell { padding: 14px 10px; display: flex; flex-direction: column; justify-content: space-between; gap: 8px; min-width: 0; transition: background .15s; }
.wk-cell:hover { background: var(--bg2); }
.wk-cell.we { background: var(--bg2); }
.wk-cell.today { background: var(--red-bg); }
.wk-cell.off { background: var(--hatch); }
.off-t { font-size: 11px; color: var(--mut2); font-weight: 500; }
.wk-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 10px; color: var(--mut); }
.wk-top b { font-size: 13px; font-weight: 700; color: var(--ink); }
.now-t { color: var(--red); font-weight: 600; }
.wk-bar { height: 10px; background: var(--track); border-radius: 3px; position: relative; overflow: hidden; display: block; }
.today .wk-bar { background: #FEE2E2; }
.wk-bar i { position: absolute; top: 0; bottom: 0; background: var(--c); border-radius: 3px; }
.wk-bar i.ahead { background: color-mix(in srgb, var(--c) 28%, white); }
.wk-bar em { position: absolute; top: -2px; bottom: -2px; width: 1px; background: var(--red); }
.wk-note { font-size: 10px; color: var(--mut2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wk-note.warn { color: var(--red); font-weight: 500; }
.wk-legend { flex: 1; padding: 14px 24px; background: var(--bg2); display: flex; align-items: center; gap: 24px; font-size: 11px; color: var(--mut); min-height: 52px; }
.wk-legend > div { display: flex; align-items: center; gap: 6px; }
.wk-legend b { color: var(--ink); font-weight: 600; }
.wk-legend i { width: 20px; height: 8px; border-radius: 2px; display: inline-block; }
.lg-busy { background: #4F46E5; } .lg-free { background: var(--track); }
.lg-off { background: repeating-linear-gradient(135deg, #FAFAF7 0 3px, #D4D4CA 3px 6px); }
.wk-legend .lg-now { width: 1px; height: 12px; background: var(--red); }

/* --- месяц: 7 × 6 --- */
.month { display: flex; flex-direction: column; height: 100%; min-height: 560px; }
.mo-wd { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--bg2); border-bottom: 1px solid var(--line); }
.mo-wd div { padding: 10px 14px; font-size: 11px; color: var(--mut2); font-weight: 600; letter-spacing: .03em; text-transform: uppercase; border-right: 1px solid var(--line2); }
.mo-wd .we { color: var(--we); }
.mo-grid { flex: 1; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-template-rows: repeat(6, minmax(84px, 1fr)); }
.mo-cell { border-right: 1px solid var(--line2); border-bottom: 1px solid var(--line2); padding: 8px 10px; display: flex; flex-direction: column;
  justify-content: space-between; min-width: 0; background: #FFF; transition: background .15s; }
.mo-cell:nth-child(7n) { border-right: 0; }
.mo-cell:hover { background: var(--bg2); }
.mo-cell.we { background: var(--bg2); }
.mo-cell.we .mo-num { color: var(--we); }
.mo-cell.other { background: var(--bg3); }
.mo-cell.other .mo-num { color: #CBD5E1; }
.mo-cell.other.we .mo-num { color: #FCA5A5; }
.mo-cell.today { background: var(--red-bg); box-shadow: inset 0 0 0 1px var(--red-line); }
.mo-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.mo-num { font-size: 14px; font-weight: 600; }
.mo-num small { font-size: 10px; color: var(--mut2); margin-left: 4px; font-weight: 500; }
.mo-cnt { font-size: 11px; color: var(--mut); font-weight: 500; }
.today .mo-cnt { color: var(--ink); font-weight: 600; }
.mo-today { display: flex; align-items: center; gap: 6px; font-size: 10px; color: var(--red); font-weight: 600; letter-spacing: .03em; text-transform: uppercase; }
.mo-badge { font-size: 11px; font-weight: 700; color: #FFF; background: var(--red); width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; letter-spacing: 0; }
.mo-bar { height: 4px; background: var(--track); border-radius: 2px; position: relative; overflow: hidden; display: block; }
.today .mo-bar { height: 5px; }
.mo-bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 2px; }

/* --- всплывающая карточка приёма --- */
.pop { position: fixed; z-index: 50; width: 300px; max-width: calc(100vw - 24px); background: #FFF; border-radius: 12px; padding: 14px 16px;
  box-shadow: 0 12px 40px rgba(15,23,42,.18), 0 0 0 1px rgba(15,23,42,.06); font-size: 12px; }
.pop-title { font-size: 14px; font-weight: 600; }
.pop-sub { color: var(--c); font-size: 12px; margin-top: 3px; display: flex; align-items: center; gap: 6px; }
.pop-sub .dot { width: 6px; height: 6px; }
.pop dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 12px 0 0; }
.pop dt { color: var(--mut2); }
.pop dd { margin: 0; color: var(--ink2); }
.pop dd a { color: var(--accent); }
.pop dd.st-cancel { color: var(--red); }
.pop dd.st-new { color: #B45309; }
.pop dd.st-conf, .pop dd.st-here, .pop dd.st-done { color: #047857; }
.pop-link { display: inline-flex; align-items: center; gap: 4px; margin-top: 12px; color: var(--accent); font-weight: 500; }
.pop-link:hover { color: #3F3FD0; }

/* --- мобильные: дата-лента, список --- */
.m-dates-row { display: flex; gap: 6px; padding: 0 12px; overflow-x: auto; scrollbar-width: none; }
.m-date { min-width: 46px; flex: 1; height: 60px; border-radius: 12px; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 4px; position: relative; }
.m-date .wd { font-size: 10px; color: var(--mut2); font-weight: 500; }
.m-date .num { font-size: 16px; font-weight: 600; }
.m-date.we .wd, .m-date.we .num { color: var(--we); }
.m-date.today:not(.on) .num { color: var(--red); }
.m-date.on { background: var(--ink); box-shadow: 0 4px 14px rgba(15,23,42,.18); }
.m-date.on .num { color: #FFF; font-weight: 700; }
.m-date i { position: absolute; bottom: 8px; width: 4px; height: 4px; border-radius: 50%; background: var(--accent); }
.m-dates-row.small .m-date { min-width: 42px; height: 48px; border-radius: 10px; gap: 2px; }
.m-dates-row.small .wd { font-size: 9px; }
.m-dates-row.small .num { font-size: 13px; }
.m-dates-row.small i { bottom: 6px; width: 3px; height: 3px; }
.m-seg { display: flex; background: #FFF; border: 1px solid var(--btn-line); border-radius: 8px; padding: 2px; }
.m-seg button { height: 26px; width: 36px; border: 0; background: transparent; border-radius: 6px; display: flex; align-items: center;
  justify-content: center; cursor: pointer; color: var(--mut); }
.m-seg button.on { background: var(--ink); color: #FFF; }
.m-seg.txt { background: var(--track); border: 0; border-radius: 7px; }
.m-seg.txt a { height: 24px; padding: 0 10px; font-size: 11px; font-weight: 500; color: var(--mut); border-radius: 5px; display: flex; align-items: center; }
.m-seg.txt a.on { background: #FFF; color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(15,23,42,.08); }

.ml-head, .dl-head { display: flex; align-items: center; gap: 10px; padding: 10px 0 8px; }
.ml-head b { font-size: 12px; font-weight: 700; letter-spacing: .02em; }
.ml-head i, .dl-head i { flex: 1; height: 1px; background: var(--line); }
.ml-head span { font-size: 11px; color: var(--mut); }
.ml-card { width: 100%; border: 0; text-align: left; cursor: pointer; background: #FFF; border-radius: 14px; padding: 12px; display: flex;
  gap: 12px; margin-bottom: 8px; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.ml-card .bar, .dl-card .bar { width: 4px; background: var(--c); border-radius: 2px; flex-shrink: 0; align-self: stretch; }
.ml-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ml-top { display: flex; justify-content: space-between; align-items: start; gap: 8px; }
.ml-name { font-size: 15px; font-weight: 600; line-height: 1.2; }
.ml-st { display: flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 500; color: var(--mut); flex-shrink: 0; }
.ml-st .sdot { margin-top: 0; }
.st-conf .ml-st, .st-here .ml-st, .st-done .ml-st { color: #047857; }
.st-new .ml-st { color: #B45309; }
.st-cancel .ml-st { color: var(--red); }
.ml-card.st-cancel .ml-name { text-decoration: line-through; color: var(--mut); }
.ml-card.st-cancel .bar { background: #CBD5E1; }
.ml-doc { font-size: 12px; color: #475569; margin-top: 6px; display: flex; gap: 6px; align-items: center; }
.ml-time { font-weight: 700; color: var(--ink); }
.tags { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.tag { background: var(--track); color: #475569; font-size: 11px; font-weight: 500; padding: 3px 8px; border-radius: 6px; }
.tag.tc { background: color-mix(in srgb, var(--c) 10%, white); color: var(--c); }
.tag.tx { background: #FEE2E2; color: #B91C1C; }

/* --- личная страница врача --- */
body.doctor { background: var(--bg); }
.dphone { max-width: 480px; margin: 0 auto; min-height: 100vh; background: var(--bg); display: flex; flex-direction: column; }
.d-head { background: #FFF; padding: 14px 16px; border-bottom: 1px solid var(--line2); }
.d-id { display: flex; align-items: center; gap: 12px; }
.eyebrow { font-size: 11px; color: var(--mut); font-weight: 500; letter-spacing: .03em; text-transform: uppercase; }
.d-name { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; margin-top: 2px; }
.d-head .role { font-size: 12px; color: #475569; margin-top: 2px; }
.d-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.d-stats > div { background: var(--bg); border-radius: 10px; padding: 10px; }
.d-stats span { display: block; font-size: 10px; color: var(--mut); font-weight: 500; letter-spacing: .02em; text-transform: uppercase; }
.d-stats b { display: block; font-size: 18px; font-weight: 700; margin-top: 2px; }
.d-stats b.sm { font-size: 14px; padding-top: 3px; }
.d-stats b.free { color: #047857; }
.d-dates { background: #FFF; padding: 8px 0 10px; border-bottom: 1px solid var(--line2); }
.d-dates-head { display: flex; justify-content: space-between; align-items: center; padding: 0 16px 8px; gap: 8px; }
.d-nav { display: flex; align-items: center; gap: 8px; }
.d-title { font-size: 14px; font-weight: 600; }
.d-list { flex: 1; padding: 6px 16px 24px; }
.next { width: 100%; border: 0; text-align: left; cursor: pointer; margin: 10px 0 4px; background: var(--ink); color: #FFF; border-radius: 14px;
  padding: 12px 14px; display: flex; align-items: center; gap: 12px; }
.next-in { width: 44px; height: 44px; border-radius: 11px; background: rgba(255,255,255,.1); display: flex; flex-direction: column;
  align-items: center; justify-content: center; flex-shrink: 0; font-size: 13px; font-weight: 700; }
.next-in small { font-size: 9px; color: var(--mut2); font-weight: 500; letter-spacing: .03em; text-transform: uppercase; }
.next-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.next-body small { font-size: 10px; color: var(--mut2); font-weight: 500; letter-spacing: .03em; text-transform: uppercase; }
.next-body b { font-size: 14px; font-weight: 600; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.next-body span { font-size: 11px; color: #CBD5E1; margin-top: 1px; }
.dl-head { padding: 10px 2px 6px; }
.dl-head b { font-size: 11px; font-weight: 700; color: var(--mut2); letter-spacing: .03em; text-transform: uppercase; }
.dl-head.red b { color: var(--red); }
a.dl-head:hover b { color: var(--ink); }
.dl-card { width: 100%; border: 0; text-align: left; cursor: pointer; background: #FFF; border-radius: 12px; padding: 10px 12px; display: flex;
  align-items: center; gap: 10px; margin-bottom: 6px; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.dl-card.past { opacity: .6; }
.dl-card.past .bar { background: #CBD5E1; }
.dl-card .sdot { width: 7px; height: 7px; margin-top: 0; }
.dl-time { font-size: 12px; font-weight: 700; min-width: 38px; }
.dl-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dl-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dl-card.st-cancel .dl-name { text-decoration: line-through; color: var(--mut); }
.dl-meta { font-size: 11px; color: var(--mut); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dl-gap { border-radius: 12px; padding: 10px 12px; display: flex; align-items: center; gap: 10px; margin-bottom: 6px; border: 1px dashed var(--btn-line);
  font-size: 12px; color: var(--mut2); }
.dl-gap .dl-time { color: var(--mut2); font-weight: 600; }
.hint { margin-top: 16px; background: #FFFBEB; border: 1px solid #FDE68A; border-radius: 12px; padding: 10px 12px; display: flex; gap: 10px; align-items: start; }
.hint-ic { width: 28px; height: 28px; border-radius: 8px; background: #FEF3C7; color: #B45309; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.hint b { display: block; font-size: 12px; font-weight: 600; color: #78350F; }
.hint span { display: block; font-size: 11px; color: #92400E; margin-top: 2px; line-height: 1.35; }

/* --- телефон --- */
@media (max-width: 760px) {
  .rail, .print-btn, .brand-sub { display: none; }
  .topbar { height: auto; flex-wrap: wrap; padding: 10px 12px; gap: 8px 10px; }
  .brand { flex: 1; }
  .brand-title { font-size: 15px; }
  .seg a { height: 28px; padding: 0 10px; font-size: 12px; }
  .datenav { order: 3; flex-basis: 100%; gap: 8px; }
  .date-title { min-width: 0; flex: 1; font-size: 14px; }
  .v-day .datenav { display: none; }
  .strip { padding: 0 12px; height: 48px; }
  .strip .label, .strip .stat, .filters .vsep, .summary .stat:not(:first-child), .summary .vsep { display: none; }
  .chips { flex: 1; }
  .dp-label { max-width: 96px; }
  .dp-panel { position: fixed; left: 12px; width: calc(100vw - 24px); } /* top — из JS, под кнопкой */
  .dp-list { max-height: 55vh; }
  .filial { flex-shrink: 0; }
  .select-chip select { max-width: 120px; }

  .v-day .content { background: var(--bg); }
  .m-dates { display: block; background: #FFF; padding: 10px 0 12px; border-bottom: 1px solid var(--line2); }
  .m-dates-head { display: flex; justify-content: space-between; align-items: baseline; padding: 0 16px 8px; }
  .m-month { font-size: 13px; font-weight: 600; }
  .m-count { font-size: 11px; color: var(--mut); }
  .m-toggle { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px 8px; font-size: 13px; color: #475569; }
  .m-toggle b { color: var(--ink); font-weight: 600; }
  body:not(.l-grid) .daygrid { display: none; }
  body:not(.l-grid) .mlist { display: block; padding: 4px 16px 16px; }
  body:not(.l-grid) [data-layout="list"], body.l-grid [data-layout="grid"] { background: var(--ink); color: #FFF; }
  .l-grid .daygrid { grid-template-columns: 48px repeat(var(--cols), minmax(124px, 1fr)); grid-template-rows: 56px var(--h); background: #FFF; }
  .l-grid .dg-head { height: 56px; padding: 8px 10px; gap: 8px; }
  .l-grid .nowline { left: 48px; margin-top: 56px; }
  .l-grid .dg-head .avatar { width: 26px; height: 26px; font-size: 10px; }
  .l-grid .dg-hour { right: 6px; font-size: 10px; }
  .l-grid .card { padding: 4px 7px; }
  .l-grid .c-meta, .l-grid .c-sub { font-size: 10px; }

  .week { min-width: 860px; }
  .wk-row { grid-template-columns: 150px repeat(7, minmax(0, 1fr)); }
  .wk-row .wk-doc { position: sticky; left: 0; z-index: 2; background: #FFF; padding: 8px 10px; }
  .wk-row .wk-doc .avatar { display: none; }
  .wk-legend { display: none; }

  .mo-wd div { padding: 8px 6px; font-size: 10px; text-align: center; }
  .mo-grid { grid-template-rows: repeat(6, minmax(64px, 1fr)); }
  .mo-cell { padding: 6px; }
  .mo-row { flex-direction: column; align-items: start; gap: 2px; }
  .mo-today span:last-child { display: none; }
  .month { min-height: 460px; }
}

@media print {
  .rail, .print-btn, .datenav .icon-btn, .today-btn, .seg, .filters .filial, .m-dates, .m-toggle, .mlist { display: none !important; }
  .app { height: auto; display: block; }
  .content { overflow: visible; }
  .dg-head, .dg-corner, .dg-times, .wk-days { position: static; }
  .card, .ml-card { break-inside: avoid; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
