/* ОКЕАН · Запись — общий стиль клиентской страницы и рабочего экрана */
:root {
  --bg: #f6f3ec;
  --surface: #ffffff;
  --surface-2: #fbf9f4;
  --ink: #1c2230;
  --muted: #687082;
  --line: #e4ddcf;
  --accent: #8f6f2e;
  --accent-ink: #ffffff;
  --accent-soft: #f2e8d2;
  --ok: #2d7a4c;
  --ok-soft: #e3f2e8;
  --warn: #a15f00;
  --warn-soft: #fbefd9;
  --bad: #b3261e;
  --bad-soft: #fbe5e3;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(28, 34, 48, .06), 0 4px 16px rgba(28, 34, 48, .05);
  --serif: Georgia, "PT Serif", "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f131b;
    --surface: #161b26;
    --surface-2: #1b2130;
    --ink: #ece6d8;
    --muted: #9ba3b3;
    --line: #2a3242;
    --accent: #d2ae63;
    --accent-ink: #1a1407;
    --accent-soft: #2b2416;
    --ok: #6fcf97;
    --ok-soft: #173024;
    --warn: #f0b35a;
    --warn-soft: #33270f;
    --bad: #ff8a80;
    --bad-soft: #3a1a18;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 var(--sans);
}
a { color: var(--accent); text-underline-offset: 3px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; font-family: var(--sans); }
p { margin: 0 0 .8em; }
small, .muted { color: var(--muted); }
.muted { font-size: .92em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.5rem 0; }

/* ── кнопки и поля ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  padding: .7em 1.2em; border-radius: 999px; border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-ink); font: 600 .95rem var(--sans);
  text-decoration: none; cursor: pointer; min-height: 44px;
}
.btn:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.quiet { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.danger { background: transparent; color: var(--bad); border-color: var(--bad); }
.btn.small { padding: .35em .9em; min-height: 34px; font-size: .85rem; }
.btn.block { width: 100%; }
label { display: block; font-weight: 600; font-size: .92rem; margin: 0 0 .35em; }
input, select, textarea {
  width: 100%; padding: .65em .8em; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--ink); font: 1rem var(--sans); min-height: 44px;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
.field { margin-bottom: 1rem; }
.check { display: flex; gap: .6em; align-items: flex-start; font-weight: 400; font-size: .92rem; margin: .6rem 0; }
.check input { width: 20px; height: 20px; min-height: 0; margin-top: 2px; flex: none; accent-color: var(--accent); }
.row { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }

/* ── карточки и плашки ── */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.25rem; box-shadow: var(--shadow); margin-bottom: 1rem;
}
.flash { padding: .8rem 1rem; border-radius: 10px; background: var(--accent-soft); margin-bottom: 1rem; }
.error { padding: .8rem 1rem; border-radius: 10px; background: var(--bad-soft); color: var(--bad); margin-bottom: 1rem; }
.badge {
  display: inline-block; padding: .1em .6em; border-radius: 999px; font-size: .78rem; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); white-space: nowrap;
}
.badge.confirmed, .badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.pending, .badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.cancelled, .badge.no_show, .badge.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge.done { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

/* ══════════ клиентская часть ══════════ */
.public header.top {
  padding: 1.1rem 16px; border-bottom: 1px solid var(--line); background: var(--surface);
}
.public header.top .in, .public main { max-width: 720px; margin: 0 auto; }
.public main { padding: 1.5rem 16px 3rem; }
.brand { font-family: var(--serif); font-size: 1.15rem; font-weight: 600; color: var(--ink); text-decoration: none; }
.brand small { display: block; font-family: var(--sans); font-size: .8rem; font-weight: 400; }
.steps { display: flex; gap: .5rem; font-size: .82rem; color: var(--muted); margin-bottom: 1rem; flex-wrap: wrap; }
.steps b { color: var(--accent); }
.service {
  display: block; text-decoration: none; color: inherit; transition: border-color .15s;
}
.service:hover { border-color: var(--accent); }
.service .meta { display: flex; gap: .6rem; flex-wrap: wrap; color: var(--muted); font-size: .9rem; margin-top: .4rem; }
.service .go { color: var(--accent); font-weight: 600; margin-top: .6rem; display: inline-block; }
.days { display: flex; gap: .5rem; overflow-x: auto; padding-bottom: .5rem; margin: 0 -16px 1rem; padding-left: 16px; padding-right: 16px; scroll-snap-type: x mandatory; }
.day {
  flex: none; width: 64px; text-align: center; padding: .55rem .2rem; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); text-decoration: none; color: var(--ink);
  scroll-snap-align: start;
}
.day .wd { font-size: .75rem; color: var(--muted); text-transform: uppercase; }
.day .n { font-size: 1.25rem; font-weight: 700; font-family: var(--serif); }
.day .m { font-size: .72rem; color: var(--muted); }
.day.off { opacity: .4; pointer-events: none; }
.day.on { border-color: var(--accent); background: var(--accent-soft); }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: .5rem; }
.slot {
  text-align: center; padding: .6rem 0; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); text-decoration: none; font-weight: 600;
}
.slot:hover { border-color: var(--accent); color: var(--accent); }
.summary { display: grid; grid-template-columns: auto 1fr; gap: .3rem 1rem; font-size: .95rem; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; font-weight: 600; }
.footer-note { margin-top: 2rem; font-size: .82rem; color: var(--muted); }
.doc { font-size: .95rem; }
.doc h2 { margin-top: 1.5rem; }
.hp { position: absolute; left: -9999px; height: 0; overflow: hidden; }

/* ══════════ рабочий экран ══════════ */
.admin { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh;
  background: linear-gradient(to right, var(--surface) 219px, var(--line) 219px, var(--line) 220px, var(--bg) 220px); }
.side {
  padding: 1.2rem .8rem;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.side .brand { padding: 0 .6rem 1rem; display: block; }
.side nav a {
  display: flex; justify-content: space-between; align-items: center; padding: .55rem .7rem;
  border-radius: 8px; color: var(--ink); text-decoration: none; font-size: .95rem; margin-bottom: 2px;
}
.side nav a:hover { background: var(--surface-2); }
.side nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.side .count { background: var(--accent); color: var(--accent-ink); border-radius: 999px; font-size: .72rem; padding: 0 .5em; font-weight: 700; }
.side .bottom { margin-top: 1.5rem; padding: 0 .7rem; font-size: .85rem; }
.content { padding: 1.5rem clamp(16px, 3vw, 2rem) 3rem; min-width: 0; }
.pagehead { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.pagehead h1 { margin: 0; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .8rem; margin-bottom: 1.2rem; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; }
.kpi .v { font-size: 1.8rem; font-weight: 700; font-family: var(--serif); line-height: 1.1; }
.kpi .l { font-size: .82rem; color: var(--muted); }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.col h3 { font-size: .95rem; margin-bottom: .6rem; }
.bk {
  display: block; text-decoration: none; color: inherit; border: 1px solid var(--line); border-left: 4px solid var(--accent);
  border-radius: 10px; padding: .6rem .8rem; margin-bottom: .5rem; background: var(--surface-2);
}
.bk.pending { border-left-color: var(--warn); }
.bk.done { border-left-color: var(--ok); opacity: .75; }
.bk.no_show { border-left-color: var(--bad); opacity: .75; }
.bk .t { font-weight: 700; }
.bk .who { font-weight: 600; }
.bk .s { font-size: .85rem; color: var(--muted); }
.empty { color: var(--muted); font-size: .92rem; padding: .8rem 0; }
table.list { width: 100%; border-collapse: collapse; font-size: .93rem; }
table.list th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; padding: .5rem; border-bottom: 1px solid var(--line); }
table.list td { padding: .6rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list tr:hover td { background: var(--surface-2); }
.table-wrap { overflow-x: auto; }
.chat { display: flex; flex-direction: column; gap: .5rem; max-height: 480px; overflow-y: auto; padding: .5rem; background: var(--surface-2); border-radius: 10px; border: 1px solid var(--line); }
.bubble { max-width: 80%; padding: .5rem .8rem; border-radius: 12px; font-size: .93rem; white-space: pre-wrap; }
.bubble.in { background: var(--surface); border: 1px solid var(--line); align-self: flex-start; }
.bubble.out { background: var(--accent-soft); align-self: flex-end; }
.bubble .meta { font-size: .72rem; color: var(--muted); margin-top: .2rem; }
.inbox-row { display: flex; gap: 1rem; justify-content: space-between; text-decoration: none; color: inherit; padding: .8rem; border-bottom: 1px solid var(--line); }
.inbox-row:hover { background: var(--surface-2); }
.inbox-row .who { font-weight: 600; }
.inbox-row.unread .who::after { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-left: .5em; vertical-align: middle; }
.slotpick { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .4rem; }
.slotpick button { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 8px; padding: .35rem .6rem; cursor: pointer; font: 600 .88rem var(--sans); }
.slotpick button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
details.edit { border: 1px solid var(--line); border-radius: 10px; padding: .6rem .9rem; margin-bottom: .6rem; background: var(--surface); }
details.edit summary { cursor: pointer; font-weight: 600; }
.hours { display: grid; grid-template-columns: 2.5rem 1fr 1fr; gap: .4rem .6rem; align-items: center; max-width: 360px; }
.hours input { min-height: 36px; padding: .3rem .5rem; }
pre.summary-box { white-space: pre-wrap; font: .9rem/1.5 var(--sans); background: var(--surface-2); padding: 1rem; border-radius: 10px; border: 1px solid var(--line); }
.menu-toggle { display: none; }

@media (max-width: 820px) {
  .admin { grid-template-columns: 1fr; background: var(--bg); }
  .side { position: static; height: auto; background: var(--surface); border-bottom: 1px solid var(--line); padding: .8rem; }
  .side nav { display: flex; gap: .3rem; overflow-x: auto; }
  .side nav a { white-space: nowrap; }
  .side .bottom { display: none; }
  .side .brand { padding-bottom: .6rem; }
}

/* v0.2 */
a.kpi { text-decoration: none; color: inherit; }
.hours4 { display: grid; grid-template-columns: 2.2rem 1fr 1fr 1.4fr; gap: .4rem .5rem; align-items: center; max-width: 560px; }
.hours4 input, .hours4 select { min-height: 36px; padding: .3rem .5rem; }
.funnel { display: grid; grid-template-columns: minmax(110px, 1.1fr) 2fr 2.5rem; gap: .5rem; align-items: center; text-decoration: none; color: inherit; padding: .2rem 0; font-size: .9rem; }
.funnel:hover .fl { color: var(--accent); }
.funnel .fb { background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; height: 10px; overflow: hidden; }
.funnel .fb span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.funnel .fn { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

/* v0.3 */
.pain { display: grid; grid-template-columns: repeat(10, 1fr); gap: .3rem; margin-top: .3rem; }
.pain-n { margin: 0; }
.pain-n input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pain-n span { display: flex; align-items: center; justify-content: center; height: 42px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-weight: 700; cursor: pointer; }
.pain-n.hot span { border-color: var(--bad); color: var(--bad); }
.pain-n input:checked + span { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.pain-n.hot input:checked + span { background: var(--bad); border-color: var(--bad); color: #fff; }
.pain-n input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.alt { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: .7rem 0; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.alt:last-child { border-bottom: 0; }
.alt span:last-child { color: var(--accent); font-weight: 600; }
.card.acute { border-color: var(--bad); background: var(--bad-soft); }
.health { border: 1px dashed var(--bad); background: var(--bad-soft); }
