/* «Слухавка» · стиль «Хвиля» (перенесено з макета design/sluhavka/hvylia).
   Характер: розмова видно як звукову хвилю. Довга розмова — довга хвиля,
   пропущений — рівна червона лінія. Спокійно, світло, як у програвачі. */

:root {
  --bg: #F3F2FA;
  --surface: #FFFFFF;
  --ink: #15132B;
  --muted: #5D5A73;        /* 6,6 : 1 на білому */
  --line: #E4E2EF;
  --accent: #4433E0;       /* слухати: хвиля, кнопка «грати» (7,5 : 1 з білим) */
  --accent-soft: #ECEAFF;
  --on-accent: #FFFFFF;
  --wave: #8E86DA;         /* хвиля в спокої */
  --wave-rest: #CBC6F3;    /* ще не прослухане в програвачі */
  --miss: #C8282B;         /* пропущений (5,5 : 1 на білому) */
  --miss-soft: #FDEDED;
  --on-miss: #FFFFFF;
  --ok: #1E7A4E;
  --solved: #B7B3C9;       /* пропущений, на який уже передзвонили */
  --chip-count-on: #B9B6CC; /* лічильник на натиснутому фільтрі */
  --miss-line: #F6CACA;    /* рамка картки «чекає дзвінка» */
  --miss-ink: #6B2A2B;     /* підпис у картці «чекає дзвінка» */
  --neutral-soft: #EFEEF5; /* сірі підкладки */
  --soon-dot: #E9E7F2;     /* бізнес «скоро» */
  --login-wave: #DCD8F8;   /* хвиля на тлі входу */
  --taken: #A84B00;        /* пропущений: «передзвонює Дана…» (5,7 : 1 на білому) */
  --taken-soft: #FFF3E0;   /* тло картки, яку вже взяли */
  --taken-line: #F2CC97;   /* рамка картки, яку вже взяли */
  --done: #12803E;         /* «✓ Передзвонила Дана»: смуга на всю ширину */
  --on-done: #FFFFFF;      /* текст на смузі (5 : 1) */
  --shade: 21, 19, 43;     /* колір тіней (R, G, B) */
  --shadow: 0 1px 2px rgba(var(--shade), .06), 0 10px 30px rgba(var(--shade), .07);
  /* Похідні: рахуються з основних, тож у palettes.css їх задавати не треба. */
  --ok-soft: color-mix(in srgb, var(--ok) 10%, var(--surface)); /* тло «підключено», «годиться» */
  --ok-text: color-mix(in srgb, var(--ok) 72%, var(--ink));     /* зелений текст: ≥ 4,5 : 1 у всіх наборах */
  --miss-text: color-mix(in srgb, var(--miss) 85%, var(--ink)); /* червоний текст на --miss-soft */

  --font: "Commissioner", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.45 var(--font); font-variant-numeric: tabular-nums; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
svg.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
svg.f { fill: currentColor; stroke: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Хвилі */
.wave { display: block; height: 100%; overflow: visible; }
.wave path { fill: none; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.wave .w-idle { stroke: var(--wave); stroke-width: 2.5px; }
.wave .w-done { stroke: var(--accent); stroke-width: 2.5px; }
.wave .w-rest { stroke: var(--wave-rest); stroke-width: 2.5px; }
.flat { display: block; height: 2px; margin-top: 11px; border-radius: 2px; background: repeating-linear-gradient(90deg, var(--miss) 0 6px, transparent 6px 11px); position: relative; }
.flat::before { content: ""; position: absolute; left: -2px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--miss); }
.flat.is-solved { background: repeating-linear-gradient(90deg, var(--solved) 0 6px, transparent 6px 11px); }
.flat.is-solved::before { background: var(--solved); }

/* Знак */
.mark { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--accent); color: var(--on-accent); flex: none; }
.mark svg { width: 24px; height: 24px; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; fill: none; }

/* ---------- Каркас ---------- */
.app { min-height: 100vh; }
.side { display: none; }
.mtop { display: flex; align-items: center; gap: 10px; padding: 12px 16px; position: relative; z-index: 3; }
.mtop .mark { width: 44px; height: 44px; }
.mtop > a:first-child { display: inline-flex; }
.biz-pill { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px 0 6px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow); text-decoration: none; font-weight: 600; font-size: 15px; }
.biz-dot { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--ink); color: var(--surface); font-weight: 700; font-size: 14px; flex: none; }
.avatar { margin-left: auto; display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow); font-weight: 700; text-decoration: none; }

.main { padding: 4px 16px 168px; min-width: 0; }
.title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0 14px; }
.title-row h1 { margin: 0; font-size: 32px; line-height: 1; font-weight: 800; letter-spacing: -.03em; }
.date-pill { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow); text-decoration: none; font-weight: 600; font-size: 15px; }
.date-arrows { display: none; }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stat { background: var(--surface); border-radius: 18px; padding: 12px 12px 14px; box-shadow: var(--shadow); min-width: 0; }
.stat b { display: block; font-size: 28px; line-height: 1; font-weight: 800; letter-spacing: -.03em; }
.stat span { display: block; margin-top: 6px; font-size: 13px; line-height: 1.25; color: var(--muted); }
.stat.is-miss b { color: var(--miss); }
.stat.is-miss em { font-style: normal; font-weight: 700; color: var(--miss); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 4px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px; border-radius: 999px; background: var(--surface); text-decoration: none; font-weight: 600; font-size: 15px; box-shadow: inset 0 0 0 1.5px var(--line); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--surface); box-shadow: none; }
.chip small { font-size: 13px; color: var(--muted); font-weight: 600; }
.chip[aria-pressed="true"] small { color: var(--chip-count-on); }
.chip-sep { display: none; }

.sec-h { display: flex; align-items: baseline; gap: 8px; margin: 22px 4px 10px; font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.sec-h b { color: var(--miss); }

/* Чекають дзвінка */
.wait-list { display: grid; gap: 8px; }
.wait-card { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; padding: 14px 14px 14px 16px; border-radius: 18px; background: var(--miss-soft); box-shadow: inset 0 0 0 1.5px var(--miss-line); }
.wait-card .num { font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.wait-card .sub { grid-column: 1; font-size: 14px; color: var(--miss-ink); }
.wait-card .sub b { color: var(--miss); }
.btn-miss { grid-column: 1 / -1; margin-top: 8px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 20px; border-radius: 999px; background: var(--miss); color: var(--on-miss); text-decoration: none; font-weight: 700; font-size: 16px; }

/* Журнал */
.log { display: grid; gap: 8px; }
.row {
  display: grid; align-items: center; gap: 2px 12px;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  grid-template-areas: "play num dur" "play meta meta" "wave wave wave";
  padding: 12px 14px 14px 12px; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow);
}
.r-play { grid-area: play; align-self: start; display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); text-decoration: none; }
.r-play svg { width: 18px; height: 18px; margin-left: 2px; }
.r-play.is-miss { background: var(--miss-soft); color: var(--miss); }
.r-play.is-miss svg { margin: 0; }
.r-play.is-solved { background: var(--neutral-soft); color: var(--muted); }
.r-num { grid-area: num; font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-meta { grid-area: meta; font-size: 14px; color: var(--muted); }
.r-meta .dir { display: inline-flex; align-items: center; gap: 2px; }
.r-meta .dir svg { width: 15px; height: 15px; vertical-align: -2px; }
.dir-t, .d-long { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.r-meta .miss { color: var(--miss); font-weight: 600; }
.r-meta .solved { color: var(--ok); font-weight: 600; }
.r-dur { grid-area: dur; font-size: 15px; font-weight: 700; }
.r-wave { grid-area: wave; height: 24px; margin-top: 8px; }
.r-wave .wave { width: var(--w); }
.row.is-playing { box-shadow: inset 0 0 0 2px var(--accent), var(--shadow); }
.row.is-playing .r-play { background: var(--accent); color: var(--on-accent); }
.row.is-playing .r-play svg { margin: 0; }
.more { display: flex; justify-content: center; margin-top: 12px; }
.btn-ghost { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; width: 100%; padding: 0 22px; border-radius: 999px; background: var(--surface); text-decoration: none; font-weight: 700; box-shadow: inset 0 0 0 1.5px var(--line); }

/* Програвач: на телефоні прилипає знизу */
.player {
  position: fixed; z-index: 3; left: 8px; right: 8px; bottom: 8px;
  background: var(--surface); border-radius: 24px; box-shadow: 0 -2px 30px rgba(var(--shade), .16);
  padding: 12px 14px 14px;
  display: grid; gap: 10px 12px; align-items: center;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  grid-template-areas: "bigwave bigwave bigwave" "pp info speed";
}
.p-label, .p-times, .p-next, .p-ai, .p-meta-wide, .p-skip { display: none; }
.p-ctl { display: contents; }
.p-wave { grid-area: bigwave; position: relative; height: 36px; }
.p-wave .wave { width: 100%; }
.p-head { position: absolute; top: -3px; bottom: -3px; left: 24.5%; width: 3px; margin-left: -1.5px; border-radius: 2px; background: var(--ink); }
.pp { grid-area: pp; display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--accent); color: var(--on-accent); cursor: pointer; }
.pp svg { width: 24px; height: 24px; }
.p-info { grid-area: info; min-width: 0; line-height: 1.25; }
.p-info b { display: block; font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-info span { font-size: 14px; color: var(--muted); }
.p-info .t { color: var(--ink); font-weight: 700; }
.p-speed-m { grid-area: speed; display: inline-grid; place-items: center; min-width: 52px; min-height: 44px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 800; font-size: 15px; border: 0; }

/* Перемикач бізнесу */
.biz-menu { display: none; position: fixed; inset: 0; z-index: 10; }
.biz-menu.is-open { display: block; }
.biz-scrim { position: absolute; inset: 0; background: rgba(var(--shade), .38); }
.biz-sheet {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 10px 12px 24px;
  background: var(--surface); border-radius: 28px 28px 0 0; box-shadow: 0 -10px 40px rgba(var(--shade), .2);
}
.grip { display: block; width: 40px; height: 5px; margin: 0 auto 12px; border-radius: 3px; background: var(--line); }
.biz-sheet h2 { margin: 4px 8px 12px; font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.biz-item { display: flex; align-items: center; gap: 12px; min-height: 68px; padding: 10px 12px; border-radius: 18px; text-decoration: none; }
.biz-item.is-on { background: var(--accent-soft); }
.biz-item .biz-dot { width: 44px; height: 44px; font-size: 17px; }
.biz-item.is-on .biz-dot { background: var(--accent); }
.biz-item .txt { display: grid; line-height: 1.25; }
.biz-item .txt b { font-size: 17px; font-weight: 700; }
.biz-item .txt small { font-size: 14px; color: var(--muted); }
.biz-item .end { margin-left: auto; color: var(--accent); }
.biz-item .soon.end { color: var(--muted); }
.biz-item.is-soon { color: var(--muted); }
.biz-item.is-soon .biz-dot { background: var(--soon-dot); color: var(--muted); }
.soon { display: inline-flex; align-items: center; min-height: 28px; padding: 0 10px; border-radius: 999px; background: var(--neutral-soft); font-size: 13px; font-weight: 700; color: var(--muted); }
.biz-note { margin: 10px 12px 0; font-size: 14px; color: var(--muted); }

/* ---------- Вхід ---------- */
.login { position: relative; min-height: 100vh; display: grid; place-items: center; padding: 24px 16px 40px; overflow: hidden; }
.login-bg { position: absolute; left: 0; right: 0; top: 50%; height: 340px; transform: translateY(-58%); pointer-events: none; }
.login-bg .wave { width: 100%; height: 100%; }
.login-bg .wave path { stroke: var(--login-wave); stroke-width: 3px; }
.login-card { position: relative; width: 100%; max-width: 420px; background: var(--surface); border-radius: 28px; box-shadow: 0 2px 4px rgba(var(--shade), .05), 0 24px 60px rgba(var(--shade), .12); padding: 28px 20px 24px; }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.brand b { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.login-card h1 { margin: 0 0 6px; font-size: 30px; line-height: 1.1; font-weight: 800; letter-spacing: -.03em; }
.login-card .lead { margin: 0 0 22px; color: var(--muted); }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 14px; font-weight: 700; }
.input { position: relative; }
.input input { width: 100%; min-height: 56px; padding: 0 16px; font-size: 17px; font-weight: 500; background: var(--bg); border: 1.5px solid transparent; border-radius: 16px; }
.input input:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 4px var(--accent-soft); }
.input input::placeholder { color: var(--muted); }
.input .show { position: absolute; right: 6px; top: 6px; bottom: 6px; padding: 0 14px; border: 0; border-radius: 12px; background: var(--surface); font-weight: 700; font-size: 14px; color: var(--accent); cursor: pointer; }
.input.has-show input { padding-right: 112px; }
.btn-main { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 58px; margin-top: 10px; border: 0; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: 18px; cursor: pointer; }
.help { margin: 16px 0 0; text-align: center; font-size: 15px; color: var(--muted); }
.lock { display: flex; gap: 8px; margin: 20px 0 0; padding: 12px 14px; border-radius: 14px; background: var(--bg); font-size: 13px; color: var(--muted); }
.lock svg { width: 18px; height: 18px; margin-top: 1px; }

/* ---------- Від 1000 px: три колонки ---------- */
@media (min-width: 1000px) {
  .app { display: grid; grid-template-columns: 252px minmax(0, 1fr) 380px; align-items: start; }
  .mtop { display: none; }
  .side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px; padding: 20px 16px; border-right: 1px solid var(--line); }
  .side .logo { display: flex; align-items: center; gap: 10px; margin: 0 4px 18px; font-size: 20px; font-weight: 800; letter-spacing: -.02em; text-decoration: none; }
  .biz-card { display: flex; align-items: center; gap: 10px; min-height: 60px; padding: 8px 10px; margin-bottom: 16px; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); text-decoration: none; }
  .biz-card .txt { display: grid; line-height: 1.2; }
  .biz-card .txt b { font-weight: 700; font-size: 15px; }
  .biz-card .txt small { font-size: 13px; color: var(--muted); }
  .biz-card svg { margin-left: auto; color: var(--muted); }
  .snav { display: grid; gap: 2px; }
  .snav a, .snav button { width: 100%; border: 0; background: none; font: inherit; font-weight: 600; text-align: left; cursor: pointer; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border-radius: 12px; text-decoration: none; font-weight: 600; color: var(--muted); }
  .snav a[aria-current] { background: var(--accent-soft); color: var(--accent); }
  .snav a .soon, .snav button .soon { margin-left: auto; min-height: 22px; padding: 0 8px; font-size: 12px; }
  .side .me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; }
  .side .me .avatar { margin: 0; box-shadow: none; background: var(--accent-soft); color: var(--accent); }
  .side .me .txt { display: grid; line-height: 1.2; font-size: 14px; }
  .side .me .txt small { color: var(--muted); }

  .main { padding: 28px 32px 64px; }
  .title-row { margin: 0 0 20px; }
  .title-row h1 { font-size: 40px; }
  .date-ctl { display: flex; gap: 8px; align-items: center; }
  .date-arrows { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow); text-decoration: none; }
  .stats { gap: 12px; }
  .stat { padding: 18px 20px; border-radius: 20px; }
  .stat b { font-size: 40px; }
  .stat span { font-size: 14px; }
  .chip-sep { display: inline-block; width: 1px; height: 28px; margin: 8px 4px; background: var(--line); }
  .wait-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .dir-t, .d-long { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
  .row { grid-template-columns: 44px 56px minmax(250px, 1.1fr) minmax(0, 1.4fr) 52px; grid-template-areas: "play time num wave dur" "play time meta wave dur"; padding: 12px 18px 12px 14px; gap: 0 14px; }
  .r-time { grid-area: time; font-size: 16px; font-weight: 700; }
  .r-meta .t-m { display: none; }
  .r-wave { margin: 0; height: 30px; }
  .r-dur { text-align: right; }
  .r-play { align-self: center; }
  .btn-ghost { width: auto; }

  .player { position: sticky; top: 20px; left: auto; right: auto; bottom: auto; margin: 20px 20px 20px 0; border-radius: 24px; box-shadow: var(--shadow); padding: 20px; display: block; }
  .p-label { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
  .p-label .live { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); }
  .p-label .live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
  .p-info b { font-size: 24px; letter-spacing: -.01em; }
  .p-info span { display: none; }
  .p-meta-wide { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 18px; }
  .p-meta-wide span { display: inline-flex; align-items: center; gap: 4px; min-height: 30px; padding: 0 10px; border-radius: 999px; background: var(--bg); font-size: 13px; font-weight: 600; }
  .p-meta-wide svg { width: 15px; height: 15px; }
  .p-wave { height: 88px; }
  .p-wave .wave path { stroke-width: 3.5px; }
  .p-times { display: flex; justify-content: space-between; margin: 10px 0 14px; font-size: 14px; font-weight: 700; }
  .p-times span:last-child { color: var(--muted); }
  .p-ctl { display: flex; align-items: center; justify-content: center; gap: 18px; }
  .p-skip { display: inline-grid !important; place-items: center; width: 52px; height: 52px; border-radius: 50%; border: 0; background: var(--bg); color: var(--ink); font-size: 11px; font-weight: 800; position: relative; cursor: pointer; }
  .p-skip svg { width: 26px; height: 26px; }
  .p-skip i { position: absolute; font-style: normal; font-size: 9px; top: 21px; }
  .pp { width: 72px; height: 72px; }
  .pp svg { width: 30px; height: 30px; }
  .p-speed-m { display: none; }
  .p-speeds { display: flex; justify-content: center; gap: 6px; margin: 16px 0 0; }
  .p-speeds span { display: inline-grid; place-items: center; min-width: 56px; min-height: 36px; border-radius: 999px; font-weight: 700; font-size: 14px; color: var(--muted); background: var(--bg); }
  .p-speeds span[aria-current] { background: var(--ink); color: var(--surface); }
  .p-next { display: flex; align-items: center; gap: 10px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); }
  .p-next b { color: var(--ink); font-weight: 700; }
  .p-next .r-play { width: 36px; height: 36px; margin-left: auto; }
  .p-ai { display: block; margin-top: 16px; padding: 14px; border-radius: 16px; border: 1.5px dashed var(--line); font-size: 13px; color: var(--muted); }
  .p-ai b { display: block; color: var(--ink); font-size: 14px; margin-bottom: 2px; }

  .biz-sheet { left: 16px; right: auto; top: 132px; bottom: auto; width: 360px; border-radius: 22px; padding: 12px; }
  .grip { display: none; }

  .login-card { padding: 36px 36px 28px; }
  .login-bg { height: 460px; }
  .login-bg .wave path { stroke-width: 10px; }
}
@media (max-width: 999px) { .p-speeds { display: none; } .r-time { display: none; } }
