/* Личный дашборд. Образ — доска расписания операционной: день как шкала времени,
   красная линия «сейчас», прошедшее бледнеет. Всё остальное — тихое. */

:root {
  --paper: #eef3f1;      /* фон: холодный, чуть зелёный — свет операционной */
  --panel: #ffffff;      /* поверхность «Сегодня» */
  --ink: #132320;
  --muted: #5f7773;
  --rule: #d2dedb;
  --scrub: #1d6a61;      /* хирургическая бирюза: операции, ссылки */
  --scrub-soft: #d7ebe7;
  --now: #d9412b;        /* «сейчас» и срочное */
  --now-soft: #fbe3de;
  --gutter: 16px;
  --radius-lg: 18px;
  --radius-sm: 8px;
  --sans: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Unbounded", var(--sans);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0d1b19;
    --panel: #142825;
    --ink: #e4eeeb;
    --muted: #8ea7a2;
    --rule: #23403b;
    --scrub: #5fc0b3;
    --scrub-soft: #1b3a35;
    --now: #ff6a50;
    --now-soft: #3a1f1a;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.45 var(--sans);
  font-variant-numeric: tabular-nums;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
a { color: var(--scrub); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid var(--scrub); outline-offset: 2px; border-radius: 4px; }
button { font: inherit; color: inherit; cursor: pointer; }

.boot { padding: 40px var(--gutter); color: var(--muted); }

/* ---------- каркас ---------- */
.wrap { max-width: 1440px; margin: 0 auto; padding: 20px var(--gutter) 48px; }
.board { display: flex; flex-direction: column; gap: 28px; }
.col { display: contents; }          /* телефон: одна колонка, порядок разделов — из config.yaml */

@media (min-width: 700px) {
  .col { display: flex; flex-direction: column; gap: 28px; min-width: 0; }
}

@media (min-width: 700px) {
  :root { --gutter: 24px; }
  .board {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    grid-template-areas: "c1 c3" "c2 c3";
    grid-template-rows: auto 1fr;
    column-gap: 28px; row-gap: 28px;
    align-items: start;
  }
  .c1 { grid-area: c1; } .c2 { grid-area: c2; } .c3 { grid-area: c3; }
}
@media (min-width: 1180px) {
  .board {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas: "c1 c2 c3";
    grid-template-rows: auto;
  }
}

/* ---------- шапка ---------- */
.top {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 12px 24px; margin-bottom: 24px;
}
.date { margin: 0; font-family: var(--display); font-weight: 600; letter-spacing: -0.01em; line-height: 1.02; }
.date .wd { display: block; font-size: clamp(30px, 7.5vw, 56px); }
.date .dm { display: block; font-size: clamp(17px, 3.4vw, 22px); font-weight: 600; color: var(--muted); margin-top: 6px; letter-spacing: 0; }
.fresh { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; }
.fresh.stale { color: var(--now); }
.btn {
  border: 1px solid var(--rule); background: var(--panel); border-radius: 999px;
  padding: 7px 14px; font-size: 14px; font-weight: 600;
}
.btn:hover { border-color: var(--scrub); }
.btn[disabled] { opacity: .5; cursor: default; }

.alerts { width: 100%; }
.alerts summary { cursor: pointer; color: var(--now); font-weight: 600; font-size: 14px; }
.alerts ul { margin: 8px 0 0; padding-left: 18px; color: var(--muted); font-size: 14px; }

/* ---------- раздел ---------- */
.sec h2 {
  margin: 0 0 10px; font-size: 19px; font-weight: 700; letter-spacing: -0.005em;
  display: flex; align-items: baseline; gap: 8px;
}
.sec h2 .count { font-size: 14px; font-weight: 600; color: var(--muted); }
.sec ul.list { list-style: none; margin: 0; padding: 0; }
.empty { color: var(--muted); margin: 0; }
.note { font-size: 14px; color: var(--muted); margin: 8px 0 0; }
.note.err { color: var(--now); }
.sub { margin: 18px 0 6px; font-size: 14px; font-weight: 700; color: var(--muted); }

/* ---------- «Сегодня»: шкала дня ---------- */
.today {
  background: var(--panel); border-radius: var(--radius-lg);
  padding: 18px 18px 14px;
  box-shadow: 0 1px 0 var(--rule), 0 12px 32px -22px rgba(19, 35, 32, .35);
}
.allday { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; padding: 0; list-style: none; }
.allday li { background: var(--scrub-soft); border-radius: 999px; padding: 4px 12px; font-size: 14px; font-weight: 600; }
.allday a { color: inherit; }

.day { list-style: none; margin: 0; padding: 0; position: relative; }
.day::before {                       /* сама шкала */
  content: ""; position: absolute; left: 66px; top: 6px; bottom: 6px;
  width: 2px; background: var(--rule); border-radius: 2px;
}
.ev { display: grid; grid-template-columns: 56px 22px 1fr; align-items: start; padding: 7px 0; }
.ev .t { font-weight: 700; font-size: 16px; text-align: right; padding-top: 1px; }
.ev .m { position: relative; height: 22px; }
.ev .m::after {                      /* отметка на шкале */
  content: ""; position: absolute; left: 6px; top: 6px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--panel); border: 2px solid var(--muted);
}
.ev.op .m::after { background: var(--scrub); border-color: var(--scrub); border-radius: 3px; width: 12px; height: 12px; left: 5px; top: 5px; }
.ev.visit .m::after { border-color: var(--scrub); }
.ev .b { min-width: 0; padding-left: 4px; }
.ev .title { display: block; font-weight: 600; overflow-wrap: anywhere; }
.ev.op .title { color: var(--scrub); }
.ev .meta { display: block; font-size: 13px; color: var(--muted); }
.ev.past { opacity: .45; }
.ev.hi .title::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--now); margin-right: 6px; vertical-align: 2px; }
.ev a.title { color: inherit; }
.ev.op a.title { color: var(--scrub); }

.now {                               /* красная линия «сейчас» — главный элемент страницы */
  display: grid; grid-template-columns: 56px 22px 1fr; align-items: center;
  margin: 4px 0; color: var(--now); font-weight: 800; font-size: 15px;
}
.now .t { text-align: right; }
.now .m { position: relative; height: 14px; }
.now .m::after { content: ""; position: absolute; left: 4px; top: 0; width: 14px; height: 14px; border-radius: 50%; background: var(--now); box-shadow: 0 0 0 4px var(--now-soft); }
.now .line { height: 2px; background: var(--now); border-radius: 2px; margin-left: 4px; }
.done { color: var(--muted); font-size: 14px; margin: 10px 0 0 78px; }

/* ---------- неделя ---------- */
.week details { border-top: 1px solid var(--rule); }
.week details:last-of-type { border-bottom: 1px solid var(--rule); }
.week summary {
  list-style: none; cursor: pointer; padding: 11px 2px;
  display: grid; grid-template-columns: 92px 1fr auto; gap: 10px; align-items: baseline;
}
.week summary::-webkit-details-marker { display: none; }
.week summary .d { font-weight: 700; }
.week summary .s { color: var(--muted); font-size: 14px; }
.week summary .s b { color: var(--scrub); font-weight: 700; }
.week summary .chev { color: var(--muted); transition: transform .15s ease; }
.week details[open] summary .chev { transform: rotate(90deg); }
.week .list { padding: 0 0 10px; }
.week .list li { display: grid; grid-template-columns: 92px 1fr; gap: 10px; padding: 4px 2px; font-size: 15px; }
.week .list .t { color: var(--muted); font-weight: 600; text-align: right; }
.week .list .op { color: var(--scrub); font-weight: 600; }

/* ---------- задачи, почта, платежи ---------- */
.row { display: grid; grid-template-columns: 76px 1fr; gap: 10px; padding: 8px 0; border-top: 1px solid var(--rule); }
.row:first-child { border-top: 0; }
.row .w { color: var(--muted); font-size: 14px; font-weight: 600; padding-top: 2px; }
.row .w.soon { color: var(--now); }
.row .x { min-width: 0; overflow-wrap: anywhere; }
.row .x a { color: inherit; }
.row .x a:hover { color: var(--scrub); }
.row .src { display: block; font-size: 13px; color: var(--muted); }
.row.hi .x::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--now); margin-right: 6px; vertical-align: 2px; }
.row .from { display: block; font-weight: 700; }
.row .subj { display: block; }
.row.past { opacity: .7; }
.row.pay { grid-template-columns: 76px 1fr auto; align-items: baseline; }
.row .amt { font-weight: 800; white-space: nowrap; text-align: right; }
.gnote { font-size: 13px; color: var(--muted); margin: -2px 0 6px; max-width: 60ch; }
.more { display: inline-block; margin-top: 6px; font-size: 14px; font-weight: 600; }
.group { margin: 14px 0 4px; font-size: 14px; font-weight: 700; color: var(--muted); }
.group:first-of-type { margin-top: 0; }

/* ---------- вход ---------- */
.lock { max-width: 380px; margin: 12vh auto 0; padding: 0 var(--gutter); }
.lock h1 { font-family: var(--display); font-weight: 600; font-size: 30px; margin: 0 0 8px; }
.lock p { color: var(--muted); margin: 0 0 20px; }
.lock label { display: block; font-weight: 600; margin-bottom: 6px; }
.lock input {
  width: 100%; font: inherit; font-size: 18px; padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--rule); background: var(--panel); color: var(--ink);
}
.lock .go { margin-top: 14px; width: 100%; padding: 12px; font-size: 16px; background: var(--scrub); color: #fff; border: 0; border-radius: var(--radius-sm); font-weight: 700; }
.lock .err { color: var(--now); margin: 12px 0 0; min-height: 1.4em; }

.foot { margin-top: 40px; display: flex; flex-wrap: wrap; gap: 8px 20px; color: var(--muted); font-size: 13px; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--muted); text-decoration: underline; font-size: 13px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
