:root {
  --bg: #f6f5fb;
  --card: #ffffff;
  --line: #e7e4f0;
  --text: #17142a;
  --muted: #6e6987;
  --brand: #7c5cff;
  --brand-soft: #efeaff;
  --green: #22c55e;
  --red: #ef4444;
  --slot: #f1eff7;
  --slot-text: #5b5674;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0d18; --card: #181526; --line: #2a2640; --text: #f1eefb; --muted: #9b95b8;
    --brand-soft: #2a2250; --slot: #221e35; --slot-text: #b5afd1;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 Inter, system-ui, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }

.top { max-width: 1280px; margin: 0 auto; padding: 22px 16px 6px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: center; }
.brand { display: flex; gap: 12px; align-items: center; }
.logo { width: 44px; height: 44px; border-radius: 12px; background: var(--brand); display: grid; place-items: center; }
.logo svg { width: 24px; fill: #fff; }
h1 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.brand p { margin: 0; color: var(--muted); font-size: 14px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
button, select { border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 8px 14px; font-weight: 600; font-size: 14px; cursor: pointer; }
button:hover, select:hover { border-color: var(--brand); }
.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.ghost { background: transparent; color: var(--muted); }

.grid { max-width: 1280px; margin: 0 auto; padding: 16px; display: grid; grid-template-columns: 360px 1fr; gap: 24px; align-items: start; }

/* ---------- phone ---------- */
.phone-col { position: sticky; top: 16px; }
.phone {
  position: relative; height: 640px; border-radius: 44px; padding: 14px;
  background: #0d0b14; box-shadow: 0 30px 60px -20px rgba(40, 20, 90, 0.45), inset 0 0 0 2px #2b2640;
  color: #fff; overflow: hidden;
}
.notch { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); width: 110px; height: 26px; background: #000; border-radius: 0 0 16px 16px; z-index: 3; }
.screen { height: 100%; border-radius: 32px; background: linear-gradient(170deg, #2a1f5c, #120f22 60%); padding: 56px 20px 24px; display: flex; flex-direction: column; align-items: center; }
.screen[hidden] { display: none; }
.avatar { width: 46px; height: 46px; border-radius: 50%; background: var(--brand); display: grid; place-items: center; font-weight: 800; font-size: 18px; flex: none; }
.avatar.big { width: 96px; height: 96px; font-size: 38px; margin-top: 60px; }
.callee { font-size: 24px; font-weight: 700; margin-top: 18px; text-align: center; }
.callee.small { font-size: 16px; margin: 0; }
.sub { color: #b9b2da; font-size: 13px; }
.call-btn { margin-top: auto; margin-bottom: 30px; width: 72px; height: 72px; border-radius: 50%; border: 0; background: var(--green); display: grid; place-items: center; box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6); animation: ring 1.8s infinite; }
.call-btn svg { width: 32px; fill: #fff; }
@keyframes ring { 0% { box-shadow: 0 0 0 0 rgba(34,197,94,.55); } 70% { box-shadow: 0 0 0 22px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }
.mic-note { font-size: 12px; color: #b9b2da; text-align: center; min-height: 18px; }

.call { align-items: stretch; padding-top: 50px; }
.call-head { display: flex; gap: 12px; align-items: center; }
.wave { display: flex; gap: 4px; height: 28px; align-items: center; justify-content: center; margin: 12px 0 6px; }
.wave i { width: 4px; height: 6px; border-radius: 2px; background: #8f7bff; transition: height .15s; }
.wave.on i { animation: wave 0.9s ease-in-out infinite; }
.wave.on i:nth-child(2) { animation-delay: .1s } .wave.on i:nth-child(3) { animation-delay: .2s } .wave.on i:nth-child(4) { animation-delay: .3s }
.wave.on i:nth-child(5) { animation-delay: .2s } .wave.on i:nth-child(6) { animation-delay: .1s }
.wave.listen i { background: var(--green); }
@keyframes wave { 0%, 100% { height: 6px; } 50% { height: 26px; } }
.transcript { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 4px 2px; scrollbar-width: none; }
.msg { max-width: 86%; padding: 8px 12px; border-radius: 16px; font-size: 13.5px; line-height: 1.4; }
.msg.ai { background: rgba(255,255,255,0.1); align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.me { background: var(--brand); align-self: flex-end; border-bottom-right-radius: 4px; }
.interim { min-height: 20px; font-size: 12.5px; color: #b9b2da; font-style: italic; text-align: right; padding: 2px 4px; }
.say { display: flex; gap: 6px; margin-top: 4px; }
.say input { flex: 1; min-width: 0; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.15); color: #fff; border-radius: 20px; padding: 8px 14px; font-size: 13.5px; }
.say input::placeholder { color: #9d96c0; }
.say button { border-radius: 50%; width: 38px; height: 38px; padding: 0; background: var(--brand); border: 0; color: #fff; }
.call-controls { display: flex; justify-content: space-around; margin-top: 14px; }
.round { width: 54px; height: 54px; border-radius: 50%; padding: 0; background: rgba(255,255,255,0.12); border: 0; font-size: 20px; display: grid; place-items: center; }
.round.off { opacity: 0.4; }
.round.red { background: var(--red); }
.round.red svg { width: 26px; fill: #fff; }

.sms { position: absolute; top: 46px; left: 22px; right: 22px; z-index: 4; background: rgba(250,249,255,0.96); color: #17142a; border-radius: 16px; padding: 10px 12px; font-size: 12.5px; box-shadow: 0 10px 30px rgba(0,0,0,.35); animation: drop .35s ease-out; }
.sms[hidden] { display: none; }
.sms-app { font-size: 11px; color: #6e6987; font-weight: 600; margin-bottom: 2px; }
@keyframes drop { from { transform: translateY(-30px); opacity: 0; } to { transform: none; opacity: 1; } }

.tries { margin-top: 16px; }
.tries-head { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; }
#tries { display: flex; flex-wrap: wrap; gap: 6px; }
#tries button { font-size: 12.5px; font-weight: 500; padding: 6px 10px; border-radius: 16px; text-align: left; }

/* ---------- front desk ---------- */
.desk { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 20px; min-width: 0; }
.desk-head { display: flex; justify-content: space-between; align-items: flex-start; }
.eyebrow { font-size: 12px; font-weight: 700; color: var(--brand); text-transform: uppercase; letter-spacing: .08em; }
.desk h2 { margin: 2px 0 0; font-size: 22px; letter-spacing: -0.01em; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 18px 0; }
.stat { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.stat .k { font-size: 12px; color: var(--muted); }
.stat .v { font-size: 24px; font-weight: 800; margin-top: 2px; }
.stat .v.bump { animation: bump .6s; color: var(--brand); }
@keyframes bump { 30% { transform: scale(1.18); } }

.days { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.days button { flex: none; font-size: 13px; padding: 6px 12px; border-radius: 18px; }
.days button.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.days button .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--green); margin-left: 6px; vertical-align: middle; }

.cal-wrap { overflow-x: auto; margin-top: 12px; border: 1px solid var(--line); border-radius: 14px; }
.cal { display: grid; position: relative; min-width: 520px; }
.cal .hdr { position: sticky; top: 0; font-weight: 700; font-size: 13px; padding: 10px; border-bottom: 1px solid var(--line); background: var(--card); z-index: 2; }
.cal .times { border-right: 1px solid var(--line); }
.cal .t { height: 72px; font-size: 11px; color: var(--muted); padding: 2px 8px; text-align: right; border-bottom: 1px dashed var(--line); }
.cal .col { position: relative; border-right: 1px solid var(--line); }
.cal .col:last-child { border-right: 0; }
.cal .cell { height: 72px; border-bottom: 1px dashed var(--line); }
.cal .closed { padding: 40px; text-align: center; color: var(--muted); grid-column: 1 / -1; }
.bk { position: absolute; left: 4px; right: 4px; border-radius: 8px; padding: 4px 8px; font-size: 11.5px; line-height: 1.3; overflow: hidden; background: var(--slot); color: var(--slot-text); border-left: 3px solid #c9c3dc; }
.bk b { display: block; font-size: 12px; }
.bk.ai { background: var(--brand-soft); color: var(--text); border-left-color: var(--brand); }
.bk.ai .tag { float: right; background: var(--brand); color: #fff; border-radius: 6px; font-size: 10px; font-weight: 700; padding: 0 5px; }
.bk.flash { animation: flash 1.6s ease-out 2; }
@keyframes flash { 0% { box-shadow: 0 0 0 0 rgba(124,92,255,.7); } 100% { box-shadow: 0 0 0 14px rgba(124,92,255,0); } }

h3 { font-size: 14px; margin: 22px 0 8px; }
.log { list-style: none; margin: 0; padding: 0; }
.log li { display: flex; gap: 10px; align-items: baseline; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.log li.empty { color: var(--muted); }
.log .when { color: var(--muted); font-size: 12px; width: 62px; flex: none; }
.pill { font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 10px; flex: none; }
.pill.booked { background: #dcfce7; color: #166534; } .pill.moved { background: #e0e7ff; color: #3730a3; }
.pill.cancelled { background: #fee2e2; color: #991b1b; } .pill.info { background: var(--slot); color: var(--slot-text); }

footer { max-width: 1280px; margin: 0 auto; padding: 4px 16px 32px; color: var(--muted); font-size: 12.5px; }

dialog { border: 1px solid var(--line); border-radius: 18px; padding: 22px; width: min(640px, calc(100vw - 32px)); background: var(--card); color: var(--text); }
dialog::backdrop { background: rgba(15, 10, 35, 0.5); }
dialog h2 { margin: 0 0 4px; }
.hint { color: var(--muted); margin: 0 0 14px; font-size: 14px; }
dialog label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 12px; }
dialog input, dialog textarea { display: block; width: 100%; margin-top: 4px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); font-weight: 400; }
dialog textarea { font: 13px ui-monospace, monospace; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
code { font-size: 12px; background: var(--slot); padding: 1px 5px; border-radius: 4px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 10; }

@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
  .phone-col { position: static; max-width: 360px; margin: 0 auto; width: 100%; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .two { grid-template-columns: 1fr; }
}
.bk.short { padding-top: 2px; padding-bottom: 2px; white-space: nowrap; text-overflow: ellipsis; }
.bk.short b { display: inline; margin-right: 4px; }
