/* ИИ-администратор для клиник — демо. Vanilla CSS, mobile-first. Палитра как у бота клиники доктора Марата. */

:root {
  --accent: #0f9bb0;
  --accent-dark: #0b7f91;
  --accent-soft: #e3f4f7;
  --bg: #f2f6f8;
  --surface: #ffffff;
  --text: #17252b;
  --muted: #66777e;
  --line: #e1e9ed;
  --line-strong: #cbd8de;
  --green: #1f9d55;
  --green-soft: #e3f7ea;
  --orange: #c26a12;
  --orange-soft: #ffeedd;
  --red: #d64545;
  --red-soft: #fde8e8;
  --bubble-me: #d9fdd3;
  --bubble-bot: #ffffff;
  --chat-bg: #e8eeeb;
  --radius: 14px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(16, 40, 50, .06), 0 1px 6px rgba(16, 40, 50, .05);
  --shadow: 0 2px 6px rgba(16, 40, 50, .06), 0 10px 28px rgba(16, 40, 50, .08);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --topbar-h: 58px;
}

*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100%; font-family: var(--font); font-size: 15px; line-height: 1.45; color: var(--text); background: var(--bg); }
h1, h2, h3, p { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-dark); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid rgba(15, 155, 176, .45); outline-offset: 2px; }

/* ---------- topbar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar__inner { max-width: 1180px; margin: 0 auto; height: var(--topbar-h); padding: 0 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; min-width: 0; }
.brand__logo { width: 36px; height: 36px; border-radius: 10px; background: var(--accent-soft); display: grid; place-items: center; font-size: 20px; flex: none; }
.brand__text { display: flex; flex-direction: column; min-width: 0; }
.brand__name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46vw; }
.brand__sub { font-size: 12px; color: var(--muted); }
.tabs { display: flex; gap: 4px; background: var(--bg); padding: 4px; border-radius: 12px; }
.tab { padding: 7px 12px; border-radius: 9px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: 14px; white-space: nowrap; }
.tab[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- layout ---------- */
.views { min-height: calc(100vh - var(--topbar-h)); }
.page { max-width: 980px; margin: 0 auto; padding: 24px 16px 48px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.hint { color: var(--muted); font-size: 13px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 0 16px; border-radius: 11px; border: 1px solid var(--line-strong); background: var(--surface); font-weight: 600; text-decoration: none; color: var(--text); transition: background .15s, border-color .15s, transform .05s; }
.btn:hover { border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn--ghost { background: transparent; }
.btn--lg { min-height: 50px; padding: 0 22px; font-size: 16px; }
.btn--sm { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn--danger-text { border: none; background: none; color: var(--muted); min-height: 32px; padding: 0 8px; }
.btn--danger-text:hover { color: var(--red); }

/* ---------- hero ---------- */
.hero { display: grid; gap: 28px; padding-top: 40px; }
.eyebrow { color: var(--accent-dark); font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 10px; }
.hero h1 { font-size: clamp(26px, 5vw, 40px); line-height: 1.15; letter-spacing: -.01em; }
.lead { margin-top: 14px; font-size: 17px; color: #3a4b52; max-width: 640px; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 24px 0 10px; }
.features { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.feature { display: flex; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.feature__icon { font-size: 24px; line-height: 1; }
.feature h3 { font-size: 15px; margin-bottom: 4px; }
.feature p { color: var(--muted); font-size: 14px; }
@media (min-width: 860px) {
  .hero { grid-template-columns: 1.15fr 1fr; align-items: center; padding-top: 64px; }
}

/* ---------- stepper ---------- */
.stepper { list-style: none; padding: 0; margin: 0 0 16px; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.stepper::-webkit-scrollbar { display: none; }
.stepper__item { flex: 1 0 auto; }
.stepper__btn { width: 100%; display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-weight: 600; font-size: 14px; white-space: nowrap; }
.stepper__num { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--bg); font-size: 12px; flex: none; }
.stepper__btn[aria-current="step"] { border-color: var(--accent); color: var(--text); }
.stepper__btn[aria-current="step"] .stepper__num { background: var(--accent); color: #fff; }
.stepper__btn.is-done .stepper__num { background: var(--green-soft); color: var(--green); }

/* ---------- wizard ---------- */
.wizard { padding: 20px 16px; }
.step { border: 0; padding: 0; margin: 0; min-width: 0; }
.step legend { font-size: 20px; font-weight: 700; padding: 0; margin-bottom: 4px; }
.step__hint { color: var(--muted); margin-bottom: 18px; font-size: 14px; }
.grid { display: grid; gap: 14px; grid-template-columns: 1fr; margin-bottom: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 600; color: #3a4b52; }
.field b { color: var(--red); }
.field input, .field textarea, .field select, .cell {
  width: 100%; border: 1px solid var(--line-strong); border-radius: 10px; padding: 10px 12px; background: #fff; min-height: 42px;
}
.field textarea { resize: vertical; line-height: 1.45; }
.field input:focus, .field textarea:focus, .cell:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(15, 155, 176, .15); }
.field--check { flex-direction: row; align-items: center; gap: 10px; align-self: end; min-height: 42px; }
.field--check input { width: 20px; height: 20px; min-height: 0; accent-color: var(--accent); }
.is-invalid { border-color: var(--red) !important; }
@media (min-width: 640px) {
  .grid { grid-template-columns: 1fr 1fr; }
  .grid--3 { grid-template-columns: repeat(3, 1fr); }
  .field--wide { grid-column: 1 / -1; }
  .wizard { padding: 28px; }
}

.schedule { display: grid; gap: 8px; margin-bottom: 18px; }
.day { display: grid; grid-template-columns: 64px 1fr 1fr; gap: 8px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; }
.day__toggle { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.day__toggle input { width: 18px; height: 18px; accent-color: var(--accent); }
.day input[type="time"] { width: 100%; border: 1px solid var(--line-strong); border-radius: 9px; padding: 8px; min-height: 38px; background: #fff; }
.day.is-off input[type="time"] { opacity: .4; }

.rows { display: grid; gap: 12px; margin-bottom: 12px; }
.row-card { position: relative; border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.row-card .grid { margin: 0; }
.row-card__remove { position: absolute; top: 6px; right: 6px; }

.import { background: var(--accent-soft); border-radius: 14px; padding: 14px; margin-bottom: 16px; }
.import__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 10px; }
.services { display: grid; gap: 8px; margin-bottom: 12px; }
.svc { display: grid; grid-template-columns: 1fr auto; gap: 6px; border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.svc__fields { display: grid; gap: 6px; grid-template-columns: 1fr 1fr; }
.svc__fields .cell { min-height: 38px; padding: 8px 10px; font-size: 14px; }
.svc__name { grid-column: 1 / -1; }
@media (min-width: 760px) {
  .svc__fields { grid-template-columns: 140px 1fr 170px 1fr; }
  .svc__name { grid-column: auto; }
}
.services__empty { color: var(--muted); padding: 14px; border: 1px dashed var(--line-strong); border-radius: 12px; text-align: center; }

.contact { margin-top: 8px; padding: 14px; border-radius: 14px; background: var(--bg); }
.contact__title { font-weight: 700; margin-bottom: 10px; }

.wizard__nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.save-state { font-size: 13px; color: var(--muted); text-align: center; flex: 1; }

/* ---------- chat ---------- */
.chat-layout { max-width: 1180px; margin: 0 auto; padding: 16px; display: grid; gap: 16px; }
@media (min-width: 960px) { .chat-layout { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; } }
.chat { display: flex; flex-direction: column; height: calc(100vh - var(--topbar-h) - 32px); min-height: 460px; border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--line); background: var(--chat-bg); box-shadow: var(--shadow-sm); }
.chat__head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--surface); border-bottom: 1px solid var(--line); }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--accent-soft); display: grid; place-items: center; font-size: 20px; flex: none; }
.chat__who { flex: 1; min-width: 0; }
.chat__name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat__sub { font-size: 12px; color: var(--muted); }
.chat__scroll { flex: 1; overflow-y: auto; padding: 16px 12px; overscroll-behavior: contain; }
.chat__messages { display: flex; flex-direction: column; gap: 6px; }
.msg { display: flex; }
.msg--me { justify-content: flex-end; }
.bubble { max-width: min(80%, 560px); padding: 7px 10px 5px; border-radius: 12px; box-shadow: 0 1px 1px rgba(0, 0, 0, .06); white-space: pre-wrap; overflow-wrap: anywhere; }
.msg--me .bubble { background: var(--bubble-me); border-top-right-radius: 4px; }
.msg--bot .bubble { background: var(--bubble-bot); border-top-left-radius: 4px; }
.bubble__meta { font-size: 11px; color: var(--muted); text-align: right; margin-top: 2px; }
.chat__empty { margin: auto; max-width: 340px; text-align: center; color: var(--muted); background: rgba(255, 255, 255, .7); padding: 14px; border-radius: 12px; font-size: 14px; }
.typing { display: inline-flex; gap: 4px; background: var(--bubble-bot); padding: 10px 12px; border-radius: 12px; margin-top: 6px; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: #9aa9af; animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .typing span { animation: none; } }
.chips { display: flex; gap: 6px; padding: 8px 10px 0; overflow-x: auto; scrollbar-width: none; background: var(--chat-bg); }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 999px; padding: 6px 12px; font-size: 13px; }
.chip:hover { border-color: var(--accent); }
.composer { display: flex; align-items: flex-end; gap: 8px; padding: 8px 10px; background: var(--chat-bg); }
.composer textarea { flex: 1; resize: none; border: 0; border-radius: 22px; padding: 11px 16px; min-height: 44px; max-height: 140px; background: #fff; line-height: 1.4; }
.composer textarea:focus { outline: 2px solid rgba(15, 155, 176, .35); }
.composer__send { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none; }
.composer__send:disabled { opacity: .5; }
.chat__limit { font-size: 12px; color: var(--muted); text-align: center; padding: 0 10px 8px; background: var(--chat-bg); }
.chat__limit.is-low { color: var(--orange); }

/* ---------- admin panel ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px; box-shadow: var(--shadow-sm); }
.panel__title { font-size: 16px; margin-bottom: 4px; }
.events { display: grid; gap: 8px; margin: 14px 0; }
.event { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.event__top { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.badge--green { background: var(--green-soft); color: var(--green); }
.badge--orange { background: var(--orange-soft); color: var(--orange); }
.event__title { font-weight: 600; font-size: 14px; }
.event__text { font-size: 13px; color: var(--muted); }
.events__empty { color: var(--muted); font-size: 13px; padding: 12px; border: 1px dashed var(--line-strong); border-radius: 12px; text-align: center; }
.panel__cta { border-top: 1px solid var(--line); padding-top: 14px; display: grid; gap: 10px; font-size: 14px; }

/* ---------- toasts ---------- */
.toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 50; width: min(92vw, 420px); }
.toast { background: #17252b; color: #fff; padding: 12px 14px; border-radius: 12px; box-shadow: var(--shadow); font-size: 14px; }
.toast--error { background: var(--red); }
.toast--ok { background: var(--green); }

@media (max-width: 520px) {
  .brand__text { display: none; }
  .tab { padding: 7px 10px; }
}

/* ---------- сферы ---------- */
.industry-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.industry-grid__title { grid-column: 1 / -1; font-weight: 700; }
.industry { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 14px; border-radius: 14px; border: 1px solid var(--line-strong); background: var(--surface); text-align: left; font-weight: 600; }
.industry:hover { border-color: var(--accent); }
.industry.is-active { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 2px rgba(15, 155, 176, .25); }
.industry__emoji { font-size: 26px; line-height: 1; }
.industry__title { font-size: 14px; }
.example-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.hero__manager { margin-top: 18px; font-weight: 600; }

/* ---------- кабинет менеджера ---------- */
.mgr-login { padding: 24px; max-width: 620px; margin: 24px auto; }
.mgr-login h2 { margin-bottom: 6px; }
.mgr-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.mgr-head h2 { font-size: 22px; }
.bots { display: grid; gap: 10px; }
.bot-card { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-sm); }
.bot-card.is-hot { border-color: var(--green); }
.bot-card__title { font-weight: 700; font-size: 16px; }
.bot-card__stats { font-size: 13px; color: var(--muted); margin-top: 4px; }
.bot-card__stats.is-hot { color: var(--green); font-weight: 600; }
.bot-card__actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
@media (min-width: 760px) { .bot-card { grid-template-columns: 1fr auto; align-items: center; } }
.mgr-foot { margin-top: 20px; }

/* ---------- ссылка для клиента ---------- */
.side { display: grid; gap: 16px; }
.share__url { display: flex; gap: 6px; margin: 12px 0 10px; }
.share__url input { flex: 1; min-width: 0; border: 1px solid var(--line-strong); border-radius: 10px; padding: 8px 10px; font-size: 13px; background: var(--bg); }
.share__wa { width: 100%; }
.intro { padding: 12px 14px; background: var(--accent-soft); border-bottom: 1px solid var(--line); display: grid; gap: 4px; }
.bubble a { color: var(--accent-dark); word-break: break-all; }
