
/* ========== TOKENS ========== */
:root{
  --canvas:#000000;
  --surface:#0C0E13;
  --raised:#161A23;
  --line:#232836;
  --line-soft:#1A1F2B;
  --agent:#4F7CFF;
  --agent-dim:rgba(79,124,255,.14);
  --visitor:#FFC46B;
  --visitor-dim:rgba(255,196,107,.14);
  --ok:#3DDC97;
  --warn:#FF7A6B;
  --text:#EDEFF5;
  --muted:#8E94A6;
  --faint:#5C6273;
  --r-sm:10px;
  --r:16px;
  --r-lg:24px;
  --bubble:22px 22px 22px 6px;
  --bubble-r:22px 22px 6px 22px;
  --maxw:1240px;
  --shell:72px;
}
*{box-sizing:border-box;margin:0;padding:0}
html{scroll-behavior:smooth;-webkit-text-size-adjust:100%}
body{
  background:var(--canvas);
  color:var(--text);
  font-family:'Inter',system-ui,-apple-system,'Segoe UI',sans-serif;
  font-size:16px;line-height:1.62;
  -webkit-font-smoothing:antialiased;
  overflow-x:hidden;
}
h1,h2,h3,h4,.display{font-family:'Sora','Inter',sans-serif;line-height:1.1;letter-spacing:-.025em;font-weight:600}
h1{font-size:clamp(2.5rem,6vw,4.4rem);font-weight:700}
h2{font-size:clamp(1.9rem,4vw,3rem)}
h3{font-size:clamp(1.15rem,2vw,1.4rem)}
p{max-width:68ch}
a{color:inherit;text-decoration:none}
img{max-width:100%;display:block}
button,input,select,textarea{font:inherit;color:inherit}
:focus-visible{outline:2px solid var(--agent);outline-offset:3px;border-radius:4px}
::selection{background:var(--agent);color:#fff}
.wrap{width:100%;max-width:var(--maxw);margin-inline:auto;padding-inline:24px}
.sec{padding:clamp(64px,9vw,120px) 0}
.muted{color:var(--muted)}
.lead{font-size:1.12rem;color:var(--muted)}
.center{text-align:center;margin-inline:auto}
.center p{margin-inline:auto}
.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}

/* ========== BUTTONS ========== */
.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:10px;
  padding:14px 26px;border-radius:999px;border:1px solid transparent;
  font-weight:600;font-size:.96rem;cursor:pointer;
  transition:transform .15s ease,background .2s ease,border-color .2s ease,color .2s ease;
}
.btn:active{transform:translateY(1px)}
.btn-primary{background:var(--agent);color:#fff}
.btn-primary:hover{background:#6A90FF}
.btn-ghost{border-color:var(--line);color:var(--text);background:transparent}
.btn-ghost:hover{border-color:var(--agent);color:var(--agent)}
.btn-amber{background:var(--visitor);color:#1A1206}
.btn-amber:hover{background:#FFD18C}
.btn-sm{padding:9px 16px;font-size:.85rem}
.btn-block{width:100%}

/* ========== APP / DASHBOARD ========== */
#app-view{display:none;position:fixed;inset:0;z-index:200;background:var(--canvas)}
#app-view.on{display:grid;grid-template-columns:var(--shell) 1fr;grid-template-rows:60px 1fr}
.app-rail{
  grid-row:1 / -1;background:#07080B;border-right:1px solid var(--line-soft);
  display:flex;flex-direction:column;align-items:center;padding:12px 0;gap:4px;
}
.rail-logo{width:40px;height:40px;border-radius:12px;background:var(--agent);display:grid;place-items:center;margin-bottom:12px;flex:none}
.rail-logo svg{width:20px;height:20px}
.rail-btn{
  width:46px;height:46px;border-radius:13px;border:none;background:transparent;color:var(--faint);
  display:grid;place-items:center;cursor:pointer;position:relative;transition:.18s;
}
.rail-btn svg{width:20px;height:20px}
.rail-btn:hover{color:var(--text);background:var(--raised)}
.rail-btn.on{color:#fff;background:var(--agent)}
.rail-btn .lbl{
  position:absolute;left:56px;top:50%;transform:translateY(-50%) translateX(-6px);
  background:var(--raised);border:1px solid var(--line);padding:5px 11px;border-radius:8px;
  font-size:.78rem;white-space:nowrap;opacity:0;pointer-events:none;transition:.16s;z-index:5;color:var(--text);
}
.rail-btn:hover .lbl{opacity:1;transform:translateY(-50%) translateX(0)}
.rail-btn .dot{position:absolute;top:9px;right:9px;width:8px;height:8px;border-radius:50%;background:var(--warn);border:2px solid #07080B}
.rail-sp{margin-top:auto}
.rail-ava{width:38px;height:38px;border-radius:50%;background:linear-gradient(135deg,var(--agent),#8E5BFF);display:grid;place-items:center;font-size:.82rem;font-weight:700;color:#fff;cursor:pointer;border:none;position:relative}
.rail-ava::after{content:"";position:absolute;right:-1px;bottom:-1px;width:11px;height:11px;border-radius:50%;background:var(--ok);border:2px solid #07080B}

.app-top{
  grid-column:2;display:flex;align-items:center;gap:14px;padding:0 20px;
  border-bottom:1px solid var(--line-soft);background:var(--surface);
}
.app-top h2{font-size:1.05rem;font-family:'Sora';font-weight:600}
.app-search{
  flex:1;max-width:440px;margin-inline:auto;display:flex;align-items:center;gap:10px;
  background:var(--raised);border:1px solid var(--line);border-radius:10px;padding:8px 14px;color:var(--faint);
}
.app-search input{background:none;border:none;outline:none;flex:1;font-size:.88rem}
.app-search kbd{background:var(--surface);border:1px solid var(--line);border-radius:5px;padding:2px 6px;font-size:.7rem;font-family:inherit}
.app-top-actions{display:flex;gap:8px;align-items:center;margin-left:auto}
.icon-btn{width:36px;height:36px;border-radius:10px;border:1px solid var(--line);background:transparent;color:var(--muted);display:grid;place-items:center;cursor:pointer;transition:.2s}
.icon-btn:hover{color:var(--text);border-color:var(--agent)}
.icon-btn svg{width:17px;height:17px}
.status-chip{display:flex;align-items:center;gap:8px;background:var(--raised);border:1px solid var(--line);border-radius:999px;padding:6px 14px;font-size:.82rem;cursor:pointer}
.status-chip i{width:8px;height:8px;border-radius:50%;background:var(--ok)}

.app-main{grid-column:2;overflow:hidden;position:relative}
.panel{display:none;height:100%;overflow-y:auto;padding:26px}
.panel.on{display:block}
.panel-wide{max-width:1100px}
.panel h3.sec-t{font-size:1.15rem;margin-bottom:6px}
.panel .sub{color:var(--muted);font-size:.9rem;margin-bottom:24px}

.kpis{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:14px;margin-bottom:26px}
.kpi{background:var(--surface);border:1px solid var(--line-soft);border-radius:var(--r);padding:20px}
.kpi small{color:var(--faint);font-size:.8rem;display:block;margin-bottom:8px}
.kpi b{font-family:'Sora';font-size:1.9rem;display:block;line-height:1}
.kpi .delta{font-size:.79rem;margin-top:8px;display:inline-flex;gap:5px;align-items:center;color:var(--ok)}
.kpi .delta.down{color:var(--warn)}

.tiles{display:grid;grid-template-columns:1.4fr 1fr;gap:16px}
.tile{background:var(--surface);border:1px solid var(--line-soft);border-radius:var(--r);padding:20px}
.tile-h{display:flex;align-items:center;justify-content:space-between;margin-bottom:18px}
.tile-h h4{font-size:.98rem;font-family:'Sora'}
.tile-h a{font-size:.84rem;color:var(--agent);cursor:pointer}

.bars{display:flex;align-items:flex-end;gap:10px;height:170px}
.bars .b{flex:1;background:var(--agent-dim);border-radius:6px 6px 0 0;position:relative;display:flex;flex-direction:column;justify-content:flex-end}
.bars .b i{display:block;background:var(--agent);border-radius:6px 6px 0 0;width:100%}
.bars .b span{position:absolute;bottom:-22px;left:0;right:0;text-align:center;font-size:.72rem;color:var(--faint)}
.bars-x{height:22px}

.tbl{width:100%;border-collapse:collapse;font-size:.88rem}
.tbl th{text-align:left;padding:11px 12px;color:var(--faint);font-weight:500;font-size:.8rem;border-bottom:1px solid var(--line-soft)}
.tbl td{padding:13px 12px;border-bottom:1px solid var(--line-soft);color:var(--text)}
.tbl tr:last-child td{border-bottom:none}
.tbl tr:hover td{background:var(--raised)}
.badge{display:inline-flex;align-items:center;gap:6px;padding:4px 10px;border-radius:999px;font-size:.76rem;border:1px solid var(--line)}
.badge.ok{background:rgba(61,220,151,.1);color:var(--ok);border-color:rgba(61,220,151,.25)}
.badge.blue{background:var(--agent-dim);color:var(--agent);border-color:rgba(79,124,255,.3)}
.badge.amber{background:var(--visitor-dim);color:var(--visitor);border-color:rgba(255,196,107,.3)}
.badge.off{color:var(--faint)}

/* chats workspace */
.chat-wrap{display:grid;grid-template-columns:290px 1fr 300px;height:100%}
.chat-list{border-right:1px solid var(--line-soft);overflow-y:auto;background:var(--surface)}
.chat-list-h{padding:16px;border-bottom:1px solid var(--line-soft);position:sticky;top:0;background:var(--surface);z-index:2}
.chat-list-h h4{font-size:1rem;font-family:'Sora';margin-bottom:12px}
.seg{display:flex;background:var(--raised);border-radius:9px;padding:3px;gap:2px}
.seg button{flex:1;padding:6px;border:none;background:transparent;color:var(--muted);font-size:.79rem;border-radius:7px;cursor:pointer}
.seg button.on{background:var(--surface);color:var(--text);font-weight:600}
.conv{display:flex;gap:11px;padding:14px 16px;border-bottom:1px solid var(--line-soft);cursor:pointer;transition:background .15s}
.conv:hover{background:var(--raised)}
.conv.on{background:var(--raised);box-shadow:inset 3px 0 0 var(--agent)}
.conv .av{width:38px;height:38px;border-radius:50%;display:grid;place-items:center;font-size:.8rem;font-weight:600;flex:none;color:#fff}
.conv .txt{flex:1;min-width:0}
.conv .txt b{display:block;font-size:.9rem;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.conv .txt p{font-size:.81rem;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin:0}
.conv .meta{text-align:right;flex:none}
.conv .meta small{font-size:.72rem;color:var(--faint);display:block}
.conv .meta .un{display:inline-block;margin-top:6px;background:var(--agent);color:#fff;font-size:.68rem;min-width:18px;height:18px;line-height:18px;border-radius:999px;padding:0 5px;text-align:center}

.thread{display:flex;flex-direction:column;height:100%;min-width:0}
.thread-h{padding:13px 20px;border-bottom:1px solid var(--line-soft);display:flex;align-items:center;gap:12px;background:var(--surface)}
.thread-h .av{width:36px;height:36px;border-radius:50%;background:var(--agent);display:grid;place-items:center;font-size:.8rem;font-weight:600;color:#fff}
.thread-h b{font-size:.94rem;display:block;font-family:'Sora'}
.thread-h small{font-size:.77rem;color:var(--faint)}
.thread-h .acts{margin-left:auto;display:flex;gap:7px}
.thread-body{flex:1;overflow-y:auto;padding:22px;display:flex;flex-direction:column;gap:12px}
.tmsg{max-width:64%;padding:11px 15px;font-size:.9rem;line-height:1.55}
.tmsg.in{background:var(--raised);border-radius:var(--bubble);align-self:flex-start}
.tmsg.out{background:var(--agent);color:#fff;border-radius:var(--bubble-r);align-self:flex-end}
.tmsg .t{display:block;font-size:.7rem;opacity:.6;margin-top:5px}
.sys{align-self:center;font-size:.77rem;color:var(--faint);background:var(--surface);border:1px solid var(--line-soft);padding:5px 13px;border-radius:999px}
.composer{border-top:1px solid var(--line-soft);padding:12px 16px;background:var(--surface)}
.canned-row{display:flex;gap:7px;flex-wrap:wrap;margin-bottom:10px}
.canned-row button{padding:6px 12px;border-radius:999px;border:1px solid var(--line);background:var(--raised);color:var(--muted);font-size:.79rem;cursor:pointer;transition:.15s}
.canned-row button:hover{color:var(--text);border-color:var(--agent)}
.composer-in{display:flex;gap:10px;align-items:flex-end;background:var(--raised);border:1px solid var(--line);border-radius:14px;padding:10px 12px}
.composer-in textarea{flex:1;background:none;border:none;outline:none;resize:none;font-size:.92rem;max-height:110px;min-height:24px;line-height:1.5}
.send{width:38px;height:38px;border-radius:11px;background:var(--agent);border:none;color:#fff;display:grid;place-items:center;cursor:pointer;flex:none}
.send:hover{background:#6A90FF}
.send svg{width:17px;height:17px}

.detail{border-left:1px solid var(--line-soft);overflow-y:auto;background:var(--surface);padding:20px}
.detail h5{font-size:.78rem;color:var(--faint);font-weight:500;margin:22px 0 10px;font-family:'Inter'}
.detail h5:first-of-type{margin-top:0}
.dl{display:flex;justify-content:space-between;gap:10px;padding:8px 0;font-size:.85rem;border-bottom:1px solid var(--line-soft)}
.dl span{color:var(--faint)}
.dl b{font-weight:500;text-align:right}
.chips{display:flex;gap:7px;flex-wrap:wrap}
.chip{padding:5px 11px;border-radius:999px;background:var(--raised);border:1px solid var(--line);font-size:.77rem;color:var(--muted)}
.visitor-card{background:var(--raised);border-radius:14px;padding:18px;text-align:center;margin-bottom:6px}
.visitor-card .av{width:56px;height:56px;border-radius:50%;background:var(--visitor);color:#1A1206;display:grid;place-items:center;font-weight:700;margin:0 auto 12px;font-size:1.1rem}
.visitor-card b{display:block;font-family:'Sora'}
.visitor-card small{color:var(--faint);font-size:.8rem}

/* settings */
.set-wrap{display:grid;grid-template-columns:230px 1fr;height:100%}
.set-nav{border-right:1px solid var(--line-soft);padding:18px 12px;overflow-y:auto;background:var(--surface)}
.set-nav button{
  display:block;width:100%;text-align:left;padding:10px 13px;border-radius:9px;border:none;
  background:transparent;color:var(--muted);font-size:.88rem;cursor:pointer;margin-bottom:2px;
}
.set-nav button:hover{background:var(--raised);color:var(--text)}
.set-nav button.on{background:var(--agent-dim);color:var(--agent);font-weight:600}
.set-nav .grp{font-size:.73rem;color:var(--faint);padding:14px 13px 7px;font-weight:500}
.set-body{overflow-y:auto;padding:26px}
.set-pane{display:none;max-width:760px}
.set-pane.on{display:block}
.row-card{background:var(--surface);border:1px solid var(--line-soft);border-radius:var(--r);padding:18px 20px;margin-bottom:12px;display:flex;gap:16px;align-items:center}
.row-card .grow{flex:1;min-width:0}
.row-card b{display:block;font-size:.94rem;margin-bottom:3px}
.row-card p{font-size:.84rem;color:var(--muted);margin:0}
.switch{width:44px;height:25px;border-radius:999px;background:var(--line);border:none;position:relative;cursor:pointer;flex:none;transition:.2s}
.switch::after{content:"";position:absolute;top:3px;left:3px;width:19px;height:19px;border-radius:50%;background:#fff;transition:.2s}
.switch.on{background:var(--agent)}
.switch.on::after{transform:translateX(19px)}
.mini-form{display:flex;gap:10px;margin-bottom:16px;flex-wrap:wrap}
.mini-form input,.mini-form select{background:var(--surface);border:1px solid var(--line);border-radius:10px;padding:11px 13px;font-size:.9rem;flex:1;min-width:160px}
.swatches{display:flex;gap:9px}
.sw{width:34px;height:34px;border-radius:50%;border:2px solid transparent;cursor:pointer}
.sw.on{border-color:#fff}
.code-box{background:#07080B;border:1px solid var(--line);border-radius:12px;padding:16px;font-family:ui-monospace,Menlo,monospace;font-size:.8rem;color:#9FB4E8;overflow-x:auto;white-space:pre;line-height:1.7}
.acct{display:flex;gap:16px;align-items:center;background:var(--surface);border:1px solid var(--line-soft);border-radius:var(--r);padding:22px;margin-bottom:18px}
.acct .av{width:64px;height:64px;border-radius:50%;background:linear-gradient(135deg,var(--agent),#8E5BFF);display:grid;place-items:center;font-size:1.3rem;font-weight:700;color:#fff}
.empty{text-align:center;padding:56px 20px;color:var(--muted)}
.empty b{display:block;font-family:'Sora';font-size:1.1rem;color:var(--text);margin-bottom:8px}

/* profile popover */
.pop{
  position:absolute;bottom:64px;left:64px;width:250px;background:var(--raised);
  border:1px solid var(--line);border-radius:14px;padding:8px;z-index:20;display:none;
  box-shadow:0 20px 50px -12px rgba(0,0,0,.85);
}
.pop.on{display:block}
.pop .me{display:flex;gap:11px;align-items:center;padding:10px;border-bottom:1px solid var(--line-soft);margin-bottom:6px}
.pop .me .av{width:38px;height:38px;border-radius:50%;background:linear-gradient(135deg,var(--agent),#8E5BFF);display:grid;place-items:center;font-size:.8rem;font-weight:700;color:#fff}
.pop .me b{font-size:.88rem;display:block}
.pop .me small{color:var(--faint);font-size:.76rem}
.pop button{display:flex;width:100%;gap:10px;align-items:center;padding:9px 10px;border:none;background:none;color:var(--muted);font-size:.86rem;border-radius:8px;cursor:pointer;text-align:left}
.pop button:hover{background:var(--surface);color:var(--text)}

/* ========== FLOATING WIDGET ========== */
.fab{
  position:fixed;right:24px;bottom:24px;width:60px;height:60px;border-radius:50%;
  background:var(--agent);border:none;color:#fff;display:grid;place-items:center;cursor:pointer;
  box-shadow:0 12px 34px -6px rgba(79,124,255,.6);z-index:120;transition:transform .2s;
}
.fab:hover{transform:scale(1.06)}
.fab svg{width:26px;height:26px}
.fab .badge-n{position:absolute;top:-2px;right:-2px;background:var(--warn);color:#fff;font-size:.68rem;width:20px;height:20px;border-radius:50%;display:grid;place-items:center;border:2px solid #000}
.widget{
  position:fixed;right:24px;bottom:96px;width:370px;max-width:calc(100vw - 32px);
  background:var(--surface);border:1px solid var(--line);border-radius:20px;overflow:hidden;
  z-index:121;display:none;flex-direction:column;box-shadow:0 30px 70px -20px rgba(0,0,0,.9);
}
.widget.on{display:flex;animation:pop .22s ease both}
.w-head{background:var(--agent);padding:18px;display:flex;gap:12px;align-items:center}
.w-head .av{width:40px;height:40px;border-radius:50%;background:#fff;color:var(--agent);display:grid;place-items:center;font-weight:700}
.w-head b{color:#fff;font-size:.98rem;display:block;font-family:'Sora'}
.w-head small{color:rgba(255,255,255,.82);font-size:.77rem}
.w-head .x{margin-left:auto;background:none;border:none;color:#fff;cursor:pointer;font-size:1.3rem;line-height:1;opacity:.85}
.w-body{padding:18px;height:300px;overflow-y:auto;display:flex;flex-direction:column;gap:10px}
.w-foot{border-top:1px solid var(--line);padding:10px 12px;display:flex;gap:8px;align-items:center}
.w-foot input{flex:1;background:var(--raised);border:1px solid var(--line);border-radius:999px;padding:11px 15px;font-size:.88rem;outline:none}
.w-foot input:focus{border-color:var(--agent)}
.w-brand{text-align:center;font-size:.72rem;color:var(--faint);padding:0 0 10px}

/* toast */
.toast{
  position:fixed;left:50%;bottom:30px;transform:translateX(-50%) translateY(20px);
  background:var(--raised);border:1px solid var(--line);border-radius:12px;padding:12px 20px;
  font-size:.88rem;z-index:400;opacity:0;pointer-events:none;transition:.25s;
}
.toast.on{opacity:1;transform:translateX(-50%) translateY(0)}

/* ========== RESPONSIVE ========== */
@media (max-width:1080px){
  .hero-grid,.split,.contact-grid{grid-template-columns:1fr;gap:40px}
  .demo{margin-left:0}
  .foot-grid{grid-template-columns:1fr 1fr}
  .tiles{grid-template-columns:1fr}
  .chat-wrap{grid-template-columns:250px 1fr}
  .detail{display:none}
  .step{border-right:none;border-bottom:1px solid var(--line-soft)}
}
@media (max-width:860px){
  .nav,.head-cta .btn-ghost{display:none}
  .burger{display:grid}
  .steps{grid-template-columns:1fr}
  .app-search{display:none}
  .set-wrap{grid-template-columns:1fr}
  .set-nav{display:flex;gap:6px;overflow-x:auto;border-right:none;border-bottom:1px solid var(--line-soft);padding:10px}
  .set-nav button{width:auto;white-space:nowrap}
  .set-nav .grp{display:none}
  .set-wrap{grid-template-rows:auto 1fr}
}
@media (max-width:720px){
  .chat-wrap{grid-template-columns:1fr}
  .chat-list{display:none}
  .chat-list.show{display:block;position:absolute;inset:0;z-index:6}
  .back-btn{display:grid!important}
  .foot-grid{grid-template-columns:1fr;gap:30px}
  #app-view.on{grid-template-columns:58px 1fr}
  :root{--shell:58px}
  .rail-btn{width:42px;height:42px}
  .tmsg{max-width:82%}
  .widget{right:12px;left:12px;width:auto;bottom:88px}
  .fab{right:16px;bottom:16px}
}
.back-btn{display:none}
@media (prefers-reduced-motion:reduce){
  *{animation:none!important;transition:none!important;scroll-behavior:auto!important}
}

/* ========== FORM FIELDS ========== */
.field{margin-bottom:16px}
.field label{display:block;font-size:.86rem;color:var(--muted);margin-bottom:7px;font-weight:500}
.field input,.field select,.field textarea{
  width:100%;padding:13px 15px;background:var(--surface);border:1px solid var(--line);
  border-radius:var(--r-sm);font-size:.94rem;transition:border-color .2s;}
.field input:focus,.field textarea:focus,.field select:focus{border-color:var(--agent);outline:none}
.field textarea{min-height:130px;resize:vertical}

/* ========== LOGO ========== */
.logo{display:flex;align-items:center;gap:11px;font-family:'Sora';font-weight:700;font-size:1.12rem;letter-spacing:-.03em;color:var(--text)}
.logo-mark{width:36px;height:36px;border-radius:11px;background:var(--agent);display:grid;place-items:center;flex:none;position:relative}
.logo-mark svg{width:19px;height:19px}
.logo-mark::after{content:"";position:absolute;right:-3px;bottom:-3px;width:11px;height:11px;border-radius:50%;background:var(--visitor);border:2px solid #000}
.pop-link{display:block}
.pop-link button{width:100%}
/* ===================================================================
   Brio LiveChat — agent.briolivechat.com overrides
   Standalone dashboard + authentication screens
   =================================================================== */

/* The dashboard is the whole page here, not an overlay */
#app-view{display:grid !important;position:fixed;inset:0;z-index:1;
  grid-template-columns:var(--shell) 1fr;grid-template-rows:60px 1fr;}
@media (max-width:720px){ #app-view{grid-template-columns:58px 1fr;} }

/* ---------- Auth screens ---------- */
.auth-wrap{min-height:100vh;display:grid;grid-template-columns:1.05fr .95fr;}
.auth-side{
  background:var(--surface);border-right:1px solid var(--line-soft);
  padding:clamp(32px,5vw,64px);display:flex;flex-direction:column;gap:28px;justify-content:center;
  position:relative;overflow:hidden;
}
.auth-side::before{
  content:"";position:absolute;inset:-30% -20% auto -20%;height:560px;pointer-events:none;
  background:radial-gradient(55% 60% at 30% 30%,rgba(79,124,255,.20),transparent 70%),
             radial-gradient(45% 55% at 80% 20%,rgba(255,196,107,.12),transparent 70%);
}
.auth-side > *{position:relative}
.auth-side h1{font-size:clamp(1.9rem,3.4vw,2.7rem);margin-bottom:14px}
.auth-side p.lead{max-width:44ch}
.auth-points{list-style:none;display:flex;flex-direction:column;gap:14px;margin-top:6px}
.auth-points li{display:flex;gap:12px;align-items:flex-start;font-size:.94rem;color:var(--muted)}
.auth-points svg{width:18px;height:18px;color:var(--agent);flex:none;margin-top:3px}
.auth-demo{
  background:var(--raised);border:1px solid var(--line);border-radius:var(--r);
  padding:16px 18px;display:flex;flex-direction:column;gap:10px;max-width:400px;
}
.auth-demo b{font-family:'Sora';font-size:.86rem}
.auth-demo code{
  display:block;background:#07080B;border:1px solid var(--line);border-radius:8px;
  padding:9px 12px;font-family:ui-monospace,Menlo,monospace;font-size:.82rem;color:#9FB4E8;
}
.auth-main{display:flex;align-items:center;justify-content:center;padding:clamp(28px,4vw,56px) 24px;}
.auth-card{width:100%;max-width:400px}
.auth-card .logo{margin-bottom:30px}
.auth-card h2{font-size:1.6rem;margin-bottom:8px}
.auth-card > p.muted{font-size:.93rem;margin-bottom:26px}
.auth-card form{display:flex;flex-direction:column;gap:2px}
.auth-card .btn{margin-top:10px}
.auth-alt{margin-top:22px;padding-top:20px;border-top:1px solid var(--line-soft);font-size:.9rem;color:var(--muted)}
.auth-alt a{color:var(--agent);font-weight:600}
.auth-alt a:hover{text-decoration:underline}
.auth-back{display:inline-flex;align-items:center;gap:7px;font-size:.86rem;color:var(--faint);margin-top:18px}
.auth-back:hover{color:var(--text)}
.notice{
  display:flex;gap:11px;align-items:flex-start;padding:13px 15px;border-radius:var(--r-sm);
  font-size:.89rem;line-height:1.5;margin-bottom:20px;border:1px solid;
}
.notice svg{width:17px;height:17px;flex:none;margin-top:2px}
.notice.err{background:rgba(255,122,107,.09);border-color:rgba(255,122,107,.3);color:#FFAFA5}
.notice.ok{background:rgba(61,220,151,.09);border-color:rgba(61,220,151,.3);color:var(--ok)}
.field .hint{display:block;font-size:.79rem;color:var(--faint);margin-top:6px}
.field-row{display:flex;gap:12px}
.field-row .field{flex:1}
.pw-meter{height:4px;border-radius:999px;background:var(--line);margin-top:8px;overflow:hidden}
.pw-meter i{display:block;height:100%;width:0;background:var(--warn);transition:width .25s,background .25s}
@media (max-width:900px){
  .auth-wrap{grid-template-columns:1fr}
  .auth-side{display:none}
  .auth-main{min-height:100vh}
}

/* ===== Licence key card ===== */
.lic-card{display:flex;gap:18px;align-items:center;flex-wrap:wrap;background:linear-gradient(135deg,rgba(79,124,255,.16),rgba(79,124,255,.05));border:1px solid rgba(79,124,255,.38);border-radius:var(--r);padding:20px 22px;margin:0 0 18px}
.lic-card .grow{flex:1;min-width:220px}
.lic-label{display:block;font-size:.8rem;color:var(--muted);font-weight:500;margin-bottom:6px}
.lic-key{font-family:ui-monospace,Menlo,Consolas,monospace;font-size:1.5rem;font-weight:600;color:#fff;letter-spacing:.06em;line-height:1.2;user-select:all;cursor:text}
.lic-note{font-size:.84rem;color:var(--muted);margin-top:8px}
.lic-note strong{color:var(--text);font-weight:600}
@media (max-width:620px){.lic-key{font-size:1.2rem}}


/* ===== slash picker, attachments, modal, blocked ===== */
.composer{position:relative}
.slash-menu{
  display:none;position:absolute;left:16px;right:16px;bottom:100%;margin-bottom:8px;
  background:var(--raised);border:1px solid var(--line);border-radius:14px;overflow:hidden;
  box-shadow:0 20px 50px -14px rgba(0,0,0,.85);max-height:260px;overflow-y:auto;z-index:30;
}
.slash-menu.on{display:block}
.slash-menu button{
  display:flex;flex-direction:column;gap:2px;width:100%;text-align:left;border:0;background:none;
  padding:10px 14px;cursor:pointer;border-bottom:1px solid var(--line-soft);
}
.slash-menu button:last-child{border-bottom:0}
.slash-menu button:hover,.slash-menu button.on{background:var(--surface)}
.slash-menu button b{color:var(--agent);font-size:.85rem;font-family:ui-monospace,Menlo,monospace}
.slash-menu button span{color:var(--muted);font-size:.84rem;line-height:1.4}
.slash-empty{padding:14px;color:var(--faint);font-size:.85rem}

.composer-in .clip{
  width:36px;height:36px;border-radius:10px;border:0;background:transparent;color:var(--faint);
  display:grid;place-items:center;cursor:pointer;flex:none;
}
.composer-in .clip:hover{color:var(--text);background:var(--surface)}
.composer-in .clip svg{width:17px;height:17px;pointer-events:none}

.tmsg .att{display:block;margin-top:8px;text-decoration:none;color:inherit}
.tmsg .att.img img{max-width:260px;max-height:220px;border-radius:10px;display:block}
.tmsg .att .file{
  display:flex;flex-direction:column;gap:2px;background:rgba(0,0,0,.22);
  border-radius:9px;padding:9px 12px;font-size:.85rem;word-break:break-word;
}
.tmsg .att .file small{opacity:.7;font-size:.74rem}
.tmsg.in .att .file{background:rgba(255,255,255,.06)}

.icon-btn.danger:hover{color:var(--warn);border-color:var(--warn)}

.modal-wrap{
  position:fixed;inset:0;background:rgba(0,0,0,.66);backdrop-filter:blur(3px);
  display:grid;place-items:center;z-index:500;padding:20px;
}
.modal{
  width:100%;max-width:430px;background:var(--surface);border:1px solid var(--line);
  border-radius:var(--r-lg);padding:24px;box-shadow:0 30px 70px -20px rgba(0,0,0,.9);
}
.modal h4{font-family:'Sora';font-size:1.08rem;margin-bottom:14px;color:var(--text)}
.modal .mbody p{font-size:.9rem;line-height:1.6}
.mlabel{display:block;font-size:.82rem;color:var(--muted);margin:0 0 7px;font-weight:500}
.minput{
  width:100%;padding:11px 13px;background:var(--raised);border:1px solid var(--line);
  border-radius:var(--r-sm);font-size:.92rem;color:var(--text);outline:0;
}
.minput:focus{border-color:var(--agent)}
.mchips{display:flex;gap:7px;flex-wrap:wrap;margin-top:10px}
.mchips button{
  padding:5px 12px;border-radius:999px;background:var(--raised);border:1px solid var(--line);
  color:var(--muted);font-size:.8rem;cursor:pointer;
}
.mchips button:hover{color:var(--text);border-color:var(--agent)}
.mchips.on button:hover{border-color:var(--warn);color:var(--warn)}
.mfoot{display:flex;gap:9px;justify-content:flex-end;margin-top:20px}
.btn-danger{background:var(--warn);color:#2A0E09;border:1px solid var(--warn);font-weight:600}
.btn-danger:hover{background:#FF9385}


/* ==========================================================================
   Chat layout: only the message list scrolls.
   Grid and flex children default to min-height:auto, which means they refuse
   to shrink below their content — so a long conversation stretched the whole
   chat column and pushed the composer off the screen. Pinning min-height:0
   down the chain is what makes the inner scroll area actually scroll.
   ========================================================================== */
#p-chats.panel{overflow:hidden !important;padding:0 !important}
.chat-wrap{min-height:0;overflow:hidden}
.chat-wrap > *{min-height:0}
.chat-list{min-height:0;overflow-y:auto}
.detail{min-height:0;overflow-y:auto}
.thread{min-height:0;overflow:hidden}
.thread-h{flex:0 0 auto}
.thread-body{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain}
.composer{flex:0 0 auto}

/* Matching thin scrollbars so the panes look deliberate */
.thread-body,.chat-list,.detail,.panel{scrollbar-width:thin;scrollbar-color:#2E3444 transparent}
.thread-body::-webkit-scrollbar,.chat-list::-webkit-scrollbar,
.detail::-webkit-scrollbar,.panel::-webkit-scrollbar{width:9px}
.thread-body::-webkit-scrollbar-track,.chat-list::-webkit-scrollbar-track,
.detail::-webkit-scrollbar-track,.panel::-webkit-scrollbar-track{background:transparent}
.thread-body::-webkit-scrollbar-thumb,.chat-list::-webkit-scrollbar-thumb,
.detail::-webkit-scrollbar-thumb,.panel::-webkit-scrollbar-thumb{
  background:#2E3444;border-radius:99px;border:2px solid transparent;background-clip:content-box}
.thread-body::-webkit-scrollbar-thumb:hover,.chat-list::-webkit-scrollbar-thumb:hover,
.detail::-webkit-scrollbar-thumb:hover,.panel::-webkit-scrollbar-thumb:hover{background:#3C445A;background-clip:content-box}

/* ---- archive ---- */
.arc-row{cursor:pointer}
.arc-row:hover{background:var(--raised)}
.arc-row td{vertical-align:middle}
.rate-good{color:var(--ok)}
.rate-bad{color:var(--warn)}
.tx-wrap{max-height:56vh;overflow-y:auto;display:flex;flex-direction:column;gap:10px;padding-right:4px}
.tx-meta{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:14px}
.modal{max-width:640px;width:calc(100vw - 40px)}

/* ==========================================================================
   Theming.
   Everything above draws from the custom properties in :root, so a theme is
   a palette swap rather than a second stylesheet. The few colours that were
   hard-coded are promoted to variables just below so they can follow suit.
   ========================================================================== */
:root{
  --rail:#07080B;          /* the icon rail, kept dark in both themes */
  --rail-line:#1A1F2B;
  --scroll:#2E3444;
  --scroll-hover:#3C445A;
  --code-bg:#07080B;
  --code-fg:#9FB4E8;
  --shadow-lg:0 30px 70px -20px rgba(0,0,0,.6);
  --shadow-md:0 18px 44px -12px rgba(0,0,0,.55);
  --overlay:rgba(0,0,0,.72);
  --on-accent:#fff;        /* text that sits on the blue */
}

[data-theme="light"]{
  --canvas:#F4F6FA;
  --surface:#FFFFFF;
  --raised:#EEF2F8;
  --line:#DDE3ED;
  --line-soft:#E9EDF4;
  --agent:#3B6FF5;
  --agent-dim:rgba(59,111,245,.10);
  --visitor:#B7791F;
  --visitor-dim:rgba(183,121,31,.12);
  --ok:#128A5B;
  --warn:#D2432F;
  --text:#11141B;
  --muted:#596173;
  --faint:#828A9B;
  --scroll:#C7CEDC;
  --scroll-hover:#AEB7C8;
  --shadow-lg:0 24px 60px -24px rgba(19,26,45,.28);
  --shadow-md:0 14px 34px -14px rgba(19,26,45,.22);
  --overlay:rgba(19,26,45,.38);
}

/* Panels need a visible edge on white, where the dark theme relied on contrast */
[data-theme="light"] .tile,
[data-theme="light"] .kpi,
[data-theme="light"] .row-card{box-shadow:0 1px 2px rgba(19,26,45,.05)}
[data-theme="light"] .app-top{box-shadow:0 1px 0 var(--line-soft)}
[data-theme="light"] .sys{background:var(--raised);border-color:var(--line)}
[data-theme="light"] .tmsg.in{background:var(--raised);color:var(--text)}
[data-theme="light"] .code-box,
[data-theme="light"] .embed{color:var(--code-fg)}
[data-theme="light"] .conv.on{background:var(--agent-dim)}
[data-theme="light"] .btn-ghost:hover{background:var(--agent-dim)}
[data-theme="light"] .switch{background:#CBD3E1}
[data-theme="light"] .switch.on{background:var(--agent)}
[data-theme="light"] .chip{background:var(--raised);border-color:var(--line)}
[data-theme="light"] .composer-in{background:var(--surface)}
[data-theme="light"] .thread-body{background:var(--canvas)}
[data-theme="light"] .rail-btn{color:#9AA3B8}
[data-theme="light"] .rail-btn:hover{color:#fff;background:rgba(255,255,255,.08)}

/* Promote the remaining hard-coded colours onto the variables */
.app-rail{background:var(--rail);border-right:1px solid var(--rail-line)}
.rail-btn .dot,.rail-ava::after{border-color:var(--rail)}
.code-box{background:var(--code-bg);color:var(--code-fg)}
.thread-body,.chat-list,.detail,.panel{scrollbar-color:var(--scroll) transparent}
.thread-body::-webkit-scrollbar-thumb,.chat-list::-webkit-scrollbar-thumb,
.detail::-webkit-scrollbar-thumb,.panel::-webkit-scrollbar-thumb{background:var(--scroll);background-clip:content-box}
.thread-body::-webkit-scrollbar-thumb:hover,.chat-list::-webkit-scrollbar-thumb:hover,
.detail::-webkit-scrollbar-thumb:hover,.panel::-webkit-scrollbar-thumb:hover{background:var(--scroll-hover);background-clip:content-box}
.modal-wrap{background:var(--overlay)}
.modal{box-shadow:var(--shadow-lg)}

/* The theme picker itself */
.theme-pick{display:flex;gap:10px;flex-wrap:wrap;margin-top:4px}
.theme-opt{
  flex:1 1 150px;min-width:150px;cursor:pointer;text-align:left;
  background:var(--surface);border:2px solid var(--line);border-radius:var(--r-sm);
  padding:12px 14px;color:var(--text);font:inherit;font-size:.88rem;
  display:flex;align-items:center;gap:10px;transition:border-color .15s,background .15s;
}
.theme-opt:hover{border-color:var(--agent)}
.theme-opt.on{border-color:var(--agent);background:var(--agent-dim)}
.theme-opt .sw-prev{width:34px;height:24px;border-radius:6px;flex:none;border:1px solid var(--line);overflow:hidden;display:flex}
.theme-opt .sw-prev i{display:block;height:100%}
.theme-opt .sw-prev i:first-child{width:34%;background:#07080B}
.theme-opt .sw-prev i:last-child{width:66%}
.theme-opt[data-t="dark"]  .sw-prev i:last-child{background:#0C0E13}
.theme-opt[data-t="light"] .sw-prev i:last-child{background:#FFFFFF}
.theme-opt[data-t="auto"]  .sw-prev i:last-child{background:linear-gradient(90deg,#0C0E13 50%,#FFFFFF 50%)}
.theme-opt b{display:block;font-weight:600}
.theme-opt small{display:block;color:var(--muted);font-size:.78rem}

/* Transcript actions */
.tx-actions{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:12px}

/* Visitor panel: long values (page URLs, user agents) must not run past the column */
.dl{align-items:baseline}
.dl span{flex:0 0 auto;white-space:nowrap}
.dl b{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;direction:ltr}
.dl b[data-v="page"],.dl b[data-v="device"]{unicode-bidi:plaintext}
.visitor-card b,.visitor-card small{overflow-wrap:anywhere}
/* ==========================================================================
   The chat board: queued, assigned and archived rows.
   ========================================================================== */
.conv.is-closed .txt b,.conv.is-closed .txt p{opacity:.72}
.conv.is-closed .av{filter:grayscale(.55)}
.conv.is-queued .txt p{color:var(--agent);font-weight:600}
.conv .txt b .rate{font-size:.82em;margin-left:2px;vertical-align:1px}
.conv .meta{display:flex;align-items:center;gap:6px}
/* the × that clears an ended chat off the board */
.conv-x{
  width:22px;height:22px;flex:none;border:0;border-radius:50%;
  background:transparent;color:var(--faint);cursor:pointer;
  font-size:17px;line-height:1;display:grid;place-items:center;font-family:inherit;
  opacity:0;transition:opacity .12s,background .12s,color .12s;
}
.conv:hover .conv-x,.conv.on .conv-x,.conv-x:focus-visible{opacity:1}
.conv-x:hover{background:var(--raised);color:var(--text)}

/* the panel under the last message */
.thread-end{
  margin:18px auto 6px;max-width:520px;text-align:center;
  display:flex;flex-direction:column;align-items:center;gap:10px;
}
.thread-end p{margin:0;color:var(--muted);font-size:.9rem}
.thread-end .btn{min-width:150px}
.thread-end .btn+.btn{margin-top:-2px}

/* a composer you cannot type into should not invite typing */
.composer.locked .composer-in{opacity:.55}
.composer.locked .clip,.composer.locked .send{pointer-events:none;opacity:.5}
.composer.locked #msgBox{cursor:not-allowed}
/* ==========================================================================
   Notifications: the profile menu and its preferences dialog.
   ========================================================================== */
.pop .pop-sw,.pop .pop-note{
  display:flex !important;align-items:center;gap:10px;width:100%;
}
.pop .pop-sw span,.pop .pop-note span{flex:1 1 auto;min-width:0;text-align:left}
.pop .pop-sw .switch{flex:0 0 auto;pointer-events:none}
.pop-sep{height:1px;background:var(--line);margin:6px 0}
.note-dot{
  flex:0 0 auto;width:16px;height:16px;border-radius:50%;
  background:var(--warn);position:relative;
}
.note-dot::after{
  content:'!';position:absolute;inset:0;display:grid;place-items:center;
  color:#fff;font-size:11px;font-weight:700;line-height:1;font-style:normal;
}

/* the permission banner at the top of the dialog */
.note-perm{
  display:flex;flex-direction:column;gap:10px;align-items:flex-start;
  padding:14px 16px;border-radius:var(--r-sm);margin-bottom:16px;
  background:rgba(210,132,31,.12);border:1px solid rgba(210,132,31,.35);
}
.note-perm b{font-weight:600;font-size:.92rem}
.note-perm span{color:var(--muted);font-size:.85rem;line-height:1.5}
.note-perm.ok{background:var(--agent-dim);border-color:transparent}
.note-perm.bad{background:rgba(229,72,77,.12);border-color:rgba(229,72,77,.35)}

/* one row per event */
.note-row{display:flex;align-items:center;gap:12px;padding:11px 0;border-top:1px solid var(--line-soft)}
.note-row.top{border-top:0;padding-top:0}
.note-row.sub{padding-left:26px;border-top:0;padding-top:0}
.note-row label{display:flex;align-items:flex-start;gap:10px;flex:1 1 auto;min-width:0;cursor:pointer;margin:0}
.note-row input[type=checkbox]{
  flex:0 0 auto;width:17px;height:17px;margin-top:1px;accent-color:var(--agent);cursor:pointer;
}
.note-row label span{display:block;min-width:0}
.note-row label b{display:block;font-weight:500;font-size:.9rem}
.note-row label small{display:block;color:var(--muted);font-size:.79rem;margin-top:2px;line-height:1.45}
.note-test{
  flex:0 0 auto;background:none;border:0;padding:4px 6px;cursor:pointer;font:inherit;
  font-size:.82rem;color:var(--agent);text-decoration:underline;border-radius:6px;
}
.note-test:hover{background:var(--agent-dim)}
.note-h{margin:18px 0 2px;font-size:.88rem;font-weight:600;color:var(--text)}

/* volume slider */
#nVol{width:100%;accent-color:var(--agent);cursor:pointer}
#nVolNum{color:var(--muted);font-weight:400}

/* A tall dialog must never push its own buttons off the screen: the title and
   the footer stay put and only the middle scrolls. */
.modal{display:flex;flex-direction:column;max-height:calc(100vh - 56px)}
.modal h4{flex:0 0 auto}
.modal .mbody{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding-right:4px}
.mfoot{flex:0 0 auto}
/* the repeat line is one sentence, not a titled row */
.note-row.sub label span{display:inline;font-size:.87rem;line-height:1.5}
.note-row.sub label b{display:inline;font-weight:600}
