/* ===== Jollix — дизайн-система кабинета ===== */
:root {
  --bg:#0b0c11; --surface:#15161d; --surface2:#1d202b; --dock:#0f1017;
  --line:rgba(255,255,255,.07); --line2:rgba(255,255,255,.12);
  --text:#f2f3f7; --dim:#8b90a4; --dim2:#5a5e70;
  --red:#ff2e43; --purple:#7b3fa8; --yellow:#ffce3a; --green:#34dd86; --blue:#5b7be0;
  --cardsh:0 8px 24px rgba(0,0,0,.35);
  --grad:linear-gradient(135deg,#ff2e43,#7b3fa8);
  --r-card:18px; --r-ctl:12px;
}
[data-theme="light"] {
  --bg:#f5f6fa; --surface:#ffffff; --surface2:#eef0f5; --dock:#ffffff;
  --line:rgba(12,14,24,.09); --line2:rgba(12,14,24,.15);
  --text:#15161d; --dim:#6b7185; --dim2:#9aa0b2;
  --cardsh:0 6px 20px rgba(20,22,40,.08);
}

* { box-sizing:border-box; }
html, body { margin:0; height:100%; }
body {
  background:var(--bg); color:var(--text);
  font-family:'Manrope', system-ui, "Segoe UI", sans-serif;
  font-size:14px; -webkit-font-smoothing:antialiased;
}
.u, h1 { font-family:'Unbounded', sans-serif; }
.muted { color:var(--dim); }
.spacer, .grow { flex:1; }
.ml { margin-left:auto; }
::-webkit-scrollbar { width:10px; height:10px; }
::-webkit-scrollbar-thumb { background:rgba(128,128,140,.35); border-radius:8px; }
::-webkit-scrollbar-track { background:transparent; }
@keyframes pulse { 0%,100%{transform:scale(1);opacity:1} 50%{transform:scale(1.6);opacity:.35} }

/* ---- controls ---- */
button {
  cursor:pointer; border:none; border-radius:var(--r-ctl);
  padding:11px 17px; background:var(--red); color:#fff; font-weight:700;
  font-family:'Manrope',sans-serif; font-size:14px;
  box-shadow:0 6px 20px rgba(232,18,31,.4); transition:filter .15s,transform .1s;
}
button:hover { filter:brightness(1.06); }
button:active { transform:scale(.98); }
button.ghost { background:var(--surface2); color:var(--text); border:1px solid var(--line); box-shadow:none; font-weight:600; }
button.ghost:hover { border-color:var(--line2); filter:none; }
button.sm { padding:8px 13px; font-size:13px; }
input, select {
  width:100%; padding:11px 14px; border-radius:var(--r-ctl);
  border:1px solid var(--line); background:var(--surface2); color:var(--text);
  font-family:'Manrope',sans-serif; font-size:14px; outline:none;
}
input::placeholder { color:var(--dim); }
input:focus, select:focus { border-color:rgba(91,123,224,.6); }
.error { color:#ff6b6b; margin:0; font-size:13px; }

/* ===== Авторизация ===== */
.auth { min-height:100vh; display:grid; place-items:center; padding:24px; position:relative; overflow:hidden; }
.auth::before { content:''; position:absolute; top:-160px; left:50%; transform:translateX(-50%);
  width:680px; height:460px; background:radial-gradient(circle,rgba(255,46,67,.18),transparent 62%); filter:blur(30px); pointer-events:none; }
.card {
  position:relative; width:100%; max-width:380px; background:var(--surface);
  border:1px solid var(--line); border-radius:22px; box-shadow:var(--cardsh);
  padding:34px 30px; display:flex; flex-direction:column; gap:15px;
}
.card .logo { width:54px; height:54px; border-radius:15px; background:var(--grad);
  display:flex; align-items:center; justify-content:center; box-shadow:0 8px 26px rgba(255,46,67,.45); margin-bottom:4px; }
.card .logo span { font-family:'Unbounded',sans-serif; font-weight:800; color:#fff; font-size:20px; letter-spacing:-1px; }
.card h1 { margin:0; font-size:24px; font-weight:700; }
.card label { display:flex; flex-direction:column; gap:6px; font-size:13px; color:var(--dim); font-weight:600; }

/* ===== Каркас кабинета: док-рейл + main ===== */
.app { height:100vh; display:flex; overflow:hidden; }

.dock {
  width:92px; flex-shrink:0; background:var(--dock); border-right:1px solid var(--line);
  display:flex; flex-direction:column; align-items:center; padding:18px 0 14px;
}
.dock .logo { width:46px; height:46px; border-radius:13px; background:var(--grad);
  display:flex; align-items:center; justify-content:center; box-shadow:0 6px 22px rgba(255,46,67,.45); margin-bottom:6px; }
.dock .logo span { font-family:'Unbounded',sans-serif; font-weight:800; color:#fff; font-size:16px; letter-spacing:-1px; }
.brandsub { font-size:9px; letter-spacing:1.6px; color:var(--dim2); margin-bottom:18px; text-transform:uppercase; font-weight:700; }
.dock-nav { display:flex; flex-direction:column; gap:5px; flex:1; width:100%; align-items:center; overflow:auto; }
.navbtn { position:relative; width:68px; border-radius:14px; padding:9px 0 7px; text-decoration:none;
  display:flex; flex-direction:column; align-items:center; gap:5px; color:var(--dim); transition:background .18s,color .18s; }
.navbtn svg { width:21px; height:21px; }
.navbtn span { font-size:9.5px; font-weight:700; letter-spacing:.2px; }
.navbtn:hover { background:rgba(255,255,255,.04); color:var(--text); }
.navbtn.active { background:rgba(255,46,67,.12); color:#fff; }
.navbtn.active svg { color:var(--red); }
.navbtn.soon { opacity:.4; pointer-events:none; }
.navbtn.soon::after { content:''; position:absolute; top:7px; right:13px; width:5px; height:5px; border-radius:50%; background:var(--yellow); }
.theme { width:54px; height:30px; border-radius:16px; border:1px solid var(--line2); background:rgba(255,255,255,.05);
  position:relative; cursor:pointer; margin:6px 0 12px; padding:0; box-shadow:none; }
.theme .knob { position:absolute; top:3px; left:3px; width:22px; height:22px; border-radius:50%;
  background:linear-gradient(135deg,#ffce3a,#ff2e43); box-shadow:0 2px 8px rgba(0,0,0,.4); transition:left .22s cubic-bezier(.6,0,.2,1); }
[data-theme="light"] .theme .knob { left:29px; }
.dock .me { width:38px; height:38px; border-radius:50%; background:linear-gradient(135deg,#7b3fa8,#ff2e43);
  display:flex; align-items:center; justify-content:center; color:#fff; font-weight:800; font-size:14px; }
.dock .logout { background:none; box-shadow:none; padding:8px; color:var(--dim); margin-top:6px; }
.dock .logout:hover { color:var(--text); filter:none; }
.dock .logout svg { width:18px; height:18px; display:block; }
#who { display:none; }

.main { flex:1; min-width:0; display:flex; flex-direction:column; }

/* ---- topbar ---- */
.topbar { display:flex; align-items:center; gap:14px; padding:16px 26px; border-bottom:1px solid var(--line); background:var(--surface); }
.topbar .ptitle { font-family:'Unbounded',sans-serif; font-weight:700; font-size:21px; line-height:1; }
.topbar .psub { font-size:13px; color:var(--dim); margin-top:5px; display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.dotpulse { position:relative; width:8px; height:8px; display:inline-block; }
.dotpulse i { position:absolute; inset:0; border-radius:50%; background:var(--green); }
.dotpulse i:last-child { animation:pulse 1.8s ease-in-out infinite; }
.sep { opacity:.4; }
.tb-search { display:flex; align-items:center; gap:10px; border:1px solid var(--line); background:var(--surface2);
  border-radius:11px; padding:0 14px; color:var(--dim); width:240px; }
.tb-search svg { width:17px; height:17px; flex-shrink:0; }
.tb-search input { border:none; background:none; padding:11px 0; box-shadow:none; }
.tb-search input:focus { border:none; }

/* ===== Layout (inbox / calls) ===== */
.layout { flex:1; display:grid; grid-template-columns:344px 1fr; min-height:0; position:relative; background:var(--bg); }
.glow { position:absolute; top:-140px; left:120px; width:560px; height:380px; pointer-events:none;
  background:radial-gradient(circle,rgba(255,46,67,.14),transparent 62%); filter:blur(22px); z-index:0; }
.sidebar { border-right:1px solid var(--line); background:var(--surface); display:flex; flex-direction:column; min-height:0; z-index:1; }
.filters { padding:14px 16px; border-bottom:1px solid var(--line); display:flex; flex-direction:column; gap:9px; }
.f-search { width:100%; }
.f-row { display:flex; gap:7px; }
.f-row select { flex:1; min-width:0; padding:8px 10px; border-radius:9px; font-size:12.5px; }
.f-count { font-size:12px; color:var(--dim); }
.dialogs { list-style:none; margin:0; padding:0; overflow:auto; flex:1; }
.empty { margin:auto; text-align:center; padding:24px; color:var(--dim); }
.empty-li { padding:18px 16px; color:var(--dim); }

/* ---- dialog / call item ---- */
.dialog-item { display:flex; gap:12px; padding:13px 16px; cursor:pointer; border-bottom:1px solid var(--line); border-left:3px solid transparent; }
.dialog-item:hover { background:var(--surface2); }
.dialog-item.active { background:var(--surface2); border-left-color:var(--red); }
.av { width:42px; height:42px; border-radius:13px; flex-shrink:0; display:flex; align-items:center; justify-content:center;
  font-weight:700; font-size:15px; color:#fff; background:linear-gradient(135deg,#5b7be0,#7b3fa8); }
.di-main { flex:1; min-width:0; }
.di-top { display:flex; align-items:center; gap:8px; }
.di-top b { font-weight:700; font-size:14.5px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; flex:1; }
.di-prev { font-size:12.5px; color:var(--dim); margin-top:3px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.di-bot { display:flex; align-items:center; gap:7px; margin-top:8px; flex-wrap:wrap; }
.di-bot .muted { font-size:11.5px; color:var(--dim2); }
.ch { font-size:11px; font-weight:700; color:var(--blue); text-transform:uppercase; letter-spacing:.3px; }
.badge { margin-left:auto; background:var(--red); color:#fff; font-size:11px; font-weight:700; border-radius:20px;
  min-width:20px; height:20px; display:flex; align-items:center; justify-content:center; padding:0 6px; }
.assigned { color:var(--green); font-size:10px; }

/* ---- pills ---- */
.pill { font-size:11px; font-weight:700; border-radius:20px; padding:4px 10px; border:none; }
.st-new { background:rgba(91,123,224,.16); color:#9db0ee; }
.st-open { background:rgba(52,221,134,.16); color:var(--green); }
.st-waiting_human { background:rgba(255,206,58,.16); color:var(--yellow); }
.st-closed { background:rgba(255,255,255,.06); color:var(--dim); }
.ai-analyzed { background:rgba(52,221,134,.16); color:var(--green); }
.ai-skipped, .ai-new { background:rgba(255,255,255,.06); color:var(--dim); }
.ai-failed { background:rgba(255,46,67,.16); color:#ff8a96; }
.ai-analyzing, .ai-transcribing { background:rgba(91,123,224,.16); color:#9db0ee; }

/* ===== Переписка / детали ===== */
.chat { display:flex; flex-direction:column; min-height:0; background:var(--bg); z-index:1; }
.chat-head { padding:15px 22px; border-bottom:1px solid var(--line); background:var(--surface); display:flex; flex-direction:column; gap:3px; }
.ch-top { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.ch-top b { font-weight:700; font-size:17px; }
.ch-actions { display:flex; gap:8px; margin-top:10px; }
.messages { flex:1; overflow:auto; padding:22px; display:flex; flex-direction:column; gap:12px; }
.bubble { max-width:66%; padding:11px 14px; border-radius:16px; font-size:14px; line-height:1.5; white-space:pre-wrap; word-break:break-word; }
.bubble.in { align-self:flex-start; background:var(--surface); border:1px solid var(--line); border-bottom-left-radius:6px; }
.bubble.out { align-self:flex-end; background:var(--grad); color:#fff; border-bottom-right-radius:6px; box-shadow:0 6px 18px rgba(123,63,168,.35); }
.bubble.ai { align-self:flex-end; background:var(--surface); border:1px solid rgba(91,123,224,.4); border-bottom-right-radius:6px; }
.bmeta { font-size:11px; opacity:.72; margin-top:6px; }
.composer { display:flex; gap:10px; padding:14px 22px; border-top:1px solid var(--line); background:var(--surface); }
.composer input { flex:1; }
.composer button { padding:0 18px; }
.send-note { padding:0 22px 10px; min-height:0; font-size:12px; color:var(--dim); }
.send-note:not(:empty) { padding-top:6px; }

/* ---- YClients-карточка ---- */
.client-card { margin-top:12px; display:flex; align-items:center; gap:10px; font-size:12.5px; flex-wrap:wrap; }
.client-card:empty { display:none; }
.client-card a { color:var(--blue); }
.yc-tag { font-size:10.5px; font-weight:800; letter-spacing:.3px; color:#0b0c11; background:var(--yellow); border-radius:7px; padding:3px 8px; }
.yc-tag.new { color:#1a1205; background:var(--yellow); }

/* ---- call detail cards ---- */
.card-block { background:var(--surface); border:1px solid var(--line); border-radius:var(--r-card); padding:16px 18px; align-self:stretch; box-shadow:var(--cardsh); }
.card-block h4 { margin:0 0 8px; font-size:11px; color:var(--dim); text-transform:uppercase; letter-spacing:.06em; font-weight:700; }
.pre { white-space:pre-wrap; word-break:break-word; line-height:1.55; font-size:13.5px; }

/* ===== Расписание (таймлайн) ===== */
.bk-controls { display:flex; align-items:center; gap:12px; padding:12px 26px; border-bottom:1px solid var(--line); background:var(--surface); }
.date-nav { display:flex; align-items:center; gap:8px; }
.date-nav b { font-weight:700; font-size:15px; }
.bk-form { display:flex; flex-wrap:wrap; gap:8px; padding:12px 26px; border-bottom:1px solid var(--line); background:var(--surface); align-items:center; }
.bk-form input:not([type=number]), .bk-form select { width:auto; min-width:120px; }
.tl { flex:1; overflow:auto; background:var(--bg); }
.tl-head { display:flex; position:sticky; top:0; background:var(--bg); z-index:2; border-bottom:1px solid var(--line); }
.tl-corner { width:170px; flex:0 0 170px; }
.tl-hours { flex:1; display:flex; }
.tl-hour { flex:1; font-size:11px; color:var(--dim); padding:8px 4px; border-left:1px solid var(--line); }
.tl-row { display:flex; min-height:66px; border-bottom:1px solid var(--line); }
.tl-res { width:170px; flex:0 0 170px; padding:10px 14px; border-right:1px solid var(--line); display:flex; flex-direction:column; gap:2px; }
.tl-res b { font-weight:700; font-size:13.5px; }
.tl-res .muted { font-size:11px; }
.tl-track { flex:1; position:relative; background-image:repeating-linear-gradient(to right,transparent,transparent calc(100%/12 - 1px),var(--line) calc(100%/12 - 1px),var(--line) calc(100%/12)); }
.bk { position:absolute; top:7px; bottom:7px; border-radius:11px; padding:6px 9px; overflow:hidden; cursor:pointer; font-size:12px; border:1px solid transparent; }
.bk-l { font-weight:700; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.bk-t { font-size:10px; opacity:.85; margin-top:2px; }
.bk-new { background:rgba(91,123,224,.2); border-color:rgba(91,123,224,.55); color:#cdd6f7; }
.bk-confirmed { background:rgba(52,221,134,.18); border-color:rgba(52,221,134,.55); color:#bff3d7; }
.bk-arrived { background:rgba(123,63,168,.28); border-color:rgba(162,99,232,.6); color:#e7d6f7; }
.bk-done { background:var(--surface2); color:var(--dim); }
.bk-cancelled { background:rgba(255,46,67,.14); border-color:rgba(255,46,67,.5); color:var(--dim); text-decoration:line-through; }
.bk-detail:empty { display:none; }
.bk-card { margin:14px 26px; padding:14px 18px; background:var(--surface); border:1px solid var(--line); border-radius:var(--r-card); box-shadow:var(--cardsh); display:flex; flex-direction:column; gap:8px; }
.bk-acts { display:flex; gap:8px; flex-wrap:wrap; }
.bk-pill-new { background:rgba(91,123,224,.16); color:#9db0ee; }
.bk-pill-confirmed { background:rgba(52,221,134,.16); color:var(--green); }
.bk-pill-arrived { background:rgba(123,63,168,.22); color:#c79aef; }
.bk-pill-done { background:rgba(255,255,255,.06); color:var(--dim); }
.bk-pill-cancelled { background:rgba(255,46,67,.16); color:#ff8a96; }

@media (max-width:820px) {
  .layout { grid-template-columns:1fr; }
  .dock { width:64px; }
  .navbtn { width:52px; }
}
