:root {
  --paper: #f7f7fb;
  --ink: #12122b;
  --ink-soft: #55567a;
  --navy: #06038d;
  --coral: #f75128;
  --coral-soft: #fde8df;
  --mist: #e4e6f5;
  --white: #ffffff;
  --green: #1e9e5a;
  --screen: #070736;
  --screen-2: #10106a;
  --font: "Golos Text", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; font-weight: 600; line-height: 1.2; }
button { font: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }

/* Кнопки */
.btn {
  border: 0;
  border-radius: 999px;
  padding: 12px 22px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform .12s ease, background .15s ease, box-shadow .15s ease;
}
.btn:active { transform: scale(.97); }
.btn:focus-visible { outline: 3px solid var(--coral); outline-offset: 3px; }
.btn:disabled { cursor: default; opacity: .45; }
.btn svg { width: 22px; height: 22px; fill: currentColor; flex: none; }
.btn-primary { background: var(--navy); color: var(--white); font-weight: 600; }
.btn-primary:hover { background: #0b08b3; }
.btn-wide { width: 100%; padding: 14px 22px; }
.btn-ghost { background: transparent; color: var(--ink-soft); padding: 8px 14px; }
.btn-ghost:hover { background: var(--mist); color: var(--ink); }

/* Вход */
.view { min-height: 100dvh; }
#view-login { display: grid; place-items: center; padding: 24px; }
.login {
  width: min(420px, 100%);
  background: var(--white);
  border-radius: 24px;
  padding: 40px 36px 28px;
  box-shadow: 0 24px 60px rgba(6, 3, 141, .10);
}
.login-logo { height: 30px; width: auto; display: block; margin-bottom: 28px; }
.login h1 { font-size: 30px; letter-spacing: -.01em; }
.login-lead { color: var(--ink-soft); margin: 8px 0 24px; }
.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 14px; color: var(--ink-soft); margin-bottom: 6px; }
.field input {
  width: 100%;
  font: inherit;
  padding: 12px 14px;
  border: 1.5px solid var(--mist);
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
}
.field input:focus { outline: none; border-color: var(--navy); background: var(--white); }
.form-error { color: #c8321a; margin: 0 0 12px; font-size: 14px; }
.login .btn-wide { margin-top: 6px; }
.login-foot { margin: 20px 0 0; font-size: 13px; color: var(--ink-soft); text-align: center; }

/* Шапка */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px clamp(16px, 4vw, 40px);
}
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; font-weight: 600; }
.brand img { height: 26px; width: auto; }
.top-nav { display: flex; gap: 4px; align-items: center; }
.top-nav a { text-decoration: none; }
.brand span { padding-left: 14px; border-left: 1.5px solid var(--mist); color: var(--ink-soft); font-weight: 500; }

/* Раскладка */
.layout {
  display: grid;
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  gap: clamp(20px, 4vw, 56px);
  padding: 8px clamp(16px, 4vw, 40px) 48px;
  max-width: 1240px;
  margin: 0 auto;
}
@media (max-width: 880px) {
  .layout { grid-template-columns: 1fr; }
  .lines { order: 2; }
}

/* Линии */
.lines h2 { font-size: 15px; color: var(--ink-soft); font-weight: 500; margin-bottom: 10px; }
.lines-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.line {
  width: 100%;
  text-align: left;
  background: var(--white);
  border: 1.5px solid transparent;
  border-radius: 16px;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 14px;
  align-items: center;
  cursor: pointer;
  color: inherit;
}
.line:hover { border-color: var(--mist); }
.line[aria-selected="true"] { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(6, 3, 141, .08); }
.line:focus-visible { outline: 3px solid var(--coral); outline-offset: 2px; }
.line-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700; font-size: 16px; color: var(--white);
  background: linear-gradient(135deg, var(--navy), #3d3bd6);
}
.line[data-id="collection"] .line-avatar { background: linear-gradient(135deg, var(--coral), #ff8a5c); }
.line[data-id="pharma"] .line-avatar { background: linear-gradient(135deg, #1e9e5a, #5fd49a); }
.line-title { font-weight: 600; }
.line-sub { font-size: 14px; color: var(--ink-soft); }

.variant-box { margin-top: 18px; }
.variant-box h3 { font-size: 14px; color: var(--ink-soft); font-weight: 500; margin-bottom: 8px; }
.variant-list { display: flex; flex-wrap: wrap; gap: 8px; }
.variant {
  border: 1.5px solid var(--mist);
  background: var(--white);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 14px;
  cursor: pointer;
  color: var(--ink);
}
.variant[aria-checked="true"] { border-color: var(--navy); background: var(--navy); color: var(--white); }
.variant:disabled { opacity: .4; cursor: default; }
.variant:focus-visible { outline: 3px solid var(--coral); outline-offset: 2px; }
.variant-note { width: 100%; font-size: 13px; color: var(--ink-soft); margin: 2px 0 0; }

.notice { background: var(--coral-soft); border-radius: 12px; padding: 10px 14px; font-size: 14px; margin: 0 0 12px; }

.help { margin-top: 26px; font-size: 14px; color: var(--ink-soft); }
.help summary { cursor: pointer; color: var(--ink); font-weight: 500; }
.help ol { padding-left: 20px; margin: 10px 0; }
.help li { margin-bottom: 4px; }

/* Телефон */
.phone { display: grid; gap: 20px; align-content: start; }
.screen {
  background: radial-gradient(120% 90% at 50% 0%, var(--screen-2), var(--screen) 65%);
  color: var(--white);
  border-radius: 28px;
  padding: 28px 24px 24px;
  min-height: 560px;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  gap: 16px;
  box-shadow: 0 30px 80px rgba(6, 3, 141, .25);
}
.screen-head { text-align: center; }
.screen-title { margin: 0; font-size: 24px; font-weight: 600; }
.screen-sub { margin: 2px 0 0; color: rgba(255,255,255,.65); font-size: 15px; }

.orb-wrap { display: grid; place-items: center; align-content: center; gap: 10px; }
.orb {
  width: 168px; height: 168px; border-radius: 50%;
  display: grid; place-items: center;
  position: relative;
  transition: transform .08s linear;
}
.orb::before, .orb::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.18);
  opacity: 0;
}
.orb-core {
  width: 104px; height: 104px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff9a72, var(--coral) 55%, #b2340f);
  box-shadow: 0 0 40px rgba(247, 81, 40, .55);
  transition: transform .08s linear, box-shadow .2s ease;
}
.screen[data-state="connecting"] .orb::before,
.screen[data-state="connecting"] .orb::after { animation: ring 1.6s ease-out infinite; }
.screen[data-state="connecting"] .orb::after { animation-delay: .8s; }
@keyframes ring {
  0% { transform: scale(.7); opacity: .8; }
  100% { transform: scale(1.5); opacity: 0; }
}
.screen[data-state="active"] .orb-core { box-shadow: 0 0 60px rgba(247, 81, 40, .7); }
.screen[data-state="active"][data-speaker="user"] .orb-core {
  background: radial-gradient(circle at 35% 30%, #8ff0b8, var(--green) 55%, #0c5c33);
  box-shadow: 0 0 60px rgba(30, 158, 90, .6);
}
.screen[data-state="ended"] .orb-core { background: radial-gradient(circle at 35% 30%, #7d7fb5, #3b3d7a 60%, #1b1c47); box-shadow: none; }
.screen[data-state="idle"] .orb-core { opacity: .55; box-shadow: none; }
.screen-status { margin: 0; color: rgba(255,255,255,.75); font-size: 15px; min-height: 22px; }
.timer { margin: 0; font-variant-numeric: tabular-nums; font-size: 22px; font-weight: 500; letter-spacing: .02em; }
.timer.warn { color: #ffb08a; }

.captions {
  list-style: none; margin: 0; padding: 0 4px;
  max-height: min(42vh, 380px); overflow-y: auto;
  display: flex; flex-direction: column; gap: 8px;
  align-self: end;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.35) transparent;
  padding-right: 8px;
}
.captions::-webkit-scrollbar { width: 6px; }
.captions::-webkit-scrollbar-thumb { background: rgba(255,255,255,.35); border-radius: 3px; }
.captions:empty { min-height: 0; }
.caption {
  padding: 8px 14px; border-radius: 16px; font-size: 15px; line-height: 1.4;
  max-width: 88%; flex: none;
}
.caption.bot { background: rgba(255,255,255,.10); align-self: flex-start; border-bottom-left-radius: 4px; }
.caption.user { background: var(--coral); align-self: flex-end; border-bottom-right-radius: 4px; }
.caption.sys { background: transparent; align-self: center; color: rgba(255,255,255,.55); font-size: 13px; }

.controls { display: flex; justify-content: center; gap: 14px; align-items: center; }
.btn-call { background: var(--green); color: var(--white); font-weight: 600; padding: 14px 28px; font-size: 17px; }
.btn-call:hover:not(:disabled) { background: #22b366; }
.btn-end { background: #d9331a; color: var(--white); font-weight: 600; padding: 14px 28px; font-size: 17px; }
.btn-end:hover { background: #ef3d1f; }
.btn-round { width: 52px; height: 52px; padding: 0; background: rgba(255,255,255,.14); color: var(--white); }
.btn-round[aria-pressed="true"] { background: var(--white); color: var(--screen); }

/* Подсказки */
.tips h3 { font-size: 14px; color: var(--ink-soft); font-weight: 500; margin-bottom: 8px; }
.tips ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tips li { background: var(--white); border: 1.5px solid var(--mist); border-radius: 999px; padding: 6px 14px; font-size: 14px; }

@media (max-width: 480px) {
  .screen { min-height: 520px; padding: 22px 16px 18px; border-radius: 22px; }
  .orb { width: 140px; height: 140px; }
  .orb-core { width: 88px; height: 88px; }
  .brand span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .screen[data-state="connecting"] .orb::before, .screen[data-state="connecting"] .orb::after { animation: none; opacity: .5; }
  .orb, .orb-core { transition: none; }
}

.disclaimer { margin: 18px 0 0; font-size: 13px; color: var(--ink-soft); }

/* Прошлые разговоры */
.calls { max-width: 900px; margin: 0 auto; padding: 8px clamp(16px, 4vw, 40px) 48px; }
.calls h1 { font-size: 24px; margin-bottom: 4px; }
.calls-lead { color: var(--ink-soft); margin: 0 0 20px; }
.call-card { background: var(--white); border-radius: 18px; padding: 16px 18px; margin-bottom: 12px; }
.call-card summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: baseline; }
.call-card summary b { font-weight: 600; }
.call-card summary span { color: var(--ink-soft); font-size: 14px; }
.call-log { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.call-log li { padding: 7px 12px; border-radius: 14px; max-width: 85%; font-size: 15px; line-height: 1.4; }
.call-log li.bot { background: var(--mist); align-self: flex-start; }
.call-log li.user { background: var(--coral-soft); align-self: flex-end; }
.call-log li.sys { color: var(--ink-soft); align-self: center; font-size: 13px; }
.call-log time { display: block; font-size: 11px; color: var(--ink-soft); margin-top: 2px; }
