/* RE-Logger web design system – shared by the admin panel and the tuner portal */
:root{
  --bg:#f3f4f7;--surface:#ffffff;--surface-2:#f7f8fa;--surface-3:#eef0f4;--border:#e4e7ec;--border-strong:#d0d5dd;
  --text:#101828;--text-2:#344054;--muted:#667085;--faint:#98a2b3;
  --brand:#e3342f;--brand-2:#ff7a45;--accent:#2563eb;--accent-soft:#eaf1ff;--accent-text:#1d4ed8;
  --ok:#12a150;--ok-soft:#e7f7ee;--warn:#d97706;--warn-soft:#fff4e0;--bad:#dc2626;--bad-soft:#fdecec;--na:#98a2b3;
  --shadow-sm:0 1px 2px rgba(16,24,40,.05);--shadow:0 1px 2px rgba(16,24,40,.04),0 6px 20px rgba(16,24,40,.06);
  --shadow-lg:0 20px 50px rgba(16,24,40,.18);--radius:14px;--radius-sm:10px;--grid:rgba(100,116,139,.16);
  --me-bubble:#2563eb;--me-text:#fff;--them-bubble:#f2f4f7;--them-text:#101828;
  --font:"Inter","Segoe UI Variable Text","Segoe UI",system-ui,-apple-system,sans-serif;
  color-scheme:light;
}
@media (prefers-color-scheme:dark){:root:not([data-theme=light]){
  --bg:#0c0e12;--surface:#14171d;--surface-2:#191d24;--surface-3:#20252e;--border:#262c36;--border-strong:#333b48;
  --text:#eef1f6;--text-2:#cdd3dd;--muted:#97a1b0;--faint:#6b7585;
  --accent:#5b8dff;--accent-soft:#18233d;--accent-text:#8fb1ff;
  --ok:#2fbf71;--ok-soft:#0f2a1c;--warn:#f0a32a;--warn-soft:#2d2210;--bad:#f05252;--bad-soft:#2e1416;
  --shadow-sm:0 1px 2px rgba(0,0,0,.4);--shadow:0 1px 2px rgba(0,0,0,.35),0 8px 24px rgba(0,0,0,.35);
  --shadow-lg:0 24px 60px rgba(0,0,0,.6);--grid:rgba(148,163,184,.13);
  --me-bubble:#3b6ff5;--them-bubble:#20252e;--them-text:#eef1f6;color-scheme:dark}}
:root[data-theme=dark]{
  --bg:#0c0e12;--surface:#14171d;--surface-2:#191d24;--surface-3:#20252e;--border:#262c36;--border-strong:#333b48;
  --text:#eef1f6;--text-2:#cdd3dd;--muted:#97a1b0;--faint:#6b7585;
  --accent:#5b8dff;--accent-soft:#18233d;--accent-text:#8fb1ff;
  --ok:#2fbf71;--ok-soft:#0f2a1c;--warn:#f0a32a;--warn-soft:#2d2210;--bad:#f05252;--bad-soft:#2e1416;
  --shadow-sm:0 1px 2px rgba(0,0,0,.4);--shadow:0 1px 2px rgba(0,0,0,.35),0 8px 24px rgba(0,0,0,.35);
  --shadow-lg:0 24px 60px rgba(0,0,0,.6);--grid:rgba(148,163,184,.13);
  --me-bubble:#3b6ff5;--them-bubble:#20252e;--them-text:#eef1f6;color-scheme:dark}
*{box-sizing:border-box}
svg.i{width:18px;height:18px;flex:none;vertical-align:-3px}
html,body{margin:0;height:100%}
body{font:14px/1.5 var(--font);background:var(--bg);color:var(--text);-webkit-font-smoothing:antialiased}
a{color:var(--accent-text);text-decoration:none}a:hover{text-decoration:underline}
h1,h2,h3{margin:0;letter-spacing:-.01em}h1{font-size:22px;font-weight:700}h2{font-size:16px;font-weight:650}
h3{font-size:12px;font-weight:650;text-transform:uppercase;letter-spacing:.06em;color:var(--muted)}
.muted{color:var(--muted)}.faint{color:var(--faint)}.small{font-size:12px}.mono{font-family:ui-monospace,"Cascadia Code",Consolas,monospace}
.row{display:flex;gap:10px;align-items:center}.wrap{flex-wrap:wrap}.grow{flex:1;min-width:0}.right{margin-left:auto}
.stack{display:flex;flex-direction:column;gap:14px}.hidden{display:none!important}
.ellipsis{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

/* ---------- shell: sidebar + main */
.shell{display:grid;grid-template-columns:268px 1fr;height:100vh}
.side{background:var(--surface);border-right:1px solid var(--border);display:flex;flex-direction:column;min-height:0}
.brand{display:flex;align-items:center;gap:11px;padding:18px 18px 14px}
.logo{width:36px;height:36px;border-radius:10px;display:grid;place-items:center;color:#fff;font-weight:800;font-size:13px;
  background:linear-gradient(135deg,var(--brand),var(--brand-2));box-shadow:0 6px 16px rgba(227,52,47,.35);letter-spacing:.02em}
.brand b{display:block;font-size:15px}.brand span{display:block;font-size:12px;color:var(--muted)}
.nav{padding:6px 10px;display:flex;flex-direction:column;gap:2px}
.nav a{display:flex;align-items:center;gap:10px;padding:8px 10px;border-radius:9px;color:var(--text-2);font-weight:550;cursor:pointer;text-decoration:none}
.nav a svg{width:18px;height:18px;flex:none;color:var(--muted)}
.nav a:hover{background:var(--surface-3)}.nav a.on{background:var(--accent-soft);color:var(--accent-text)}.nav a.on svg{color:var(--accent-text)}
.nav .count{margin-left:auto}
.side-sec{padding:14px 18px 6px;display:flex;align-items:center;justify-content:space-between}
.side-scroll{flex:1;overflow:auto;padding:0 10px 10px;min-height:0}
.side-foot{border-top:1px solid var(--border);padding:12px 14px;display:flex;align-items:center;gap:10px}
.main{display:flex;flex-direction:column;min-width:0;min-height:0}
.top{height:64px;flex:none;display:flex;align-items:center;gap:12px;padding:0 28px;border-bottom:1px solid var(--border);
  background:color-mix(in srgb,var(--surface) 82%,transparent);backdrop-filter:saturate(1.4) blur(10px);position:sticky;top:0;z-index:5}
.crumbs{display:flex;align-items:center;gap:8px;min-width:0}.crumbs .sep{color:var(--faint)}
.crumbs a{color:var(--muted);cursor:pointer}.crumbs b{font-size:16px}
.content{flex:1;overflow:auto;padding:24px 28px 40px}
.content-inner{max-width:1280px;margin:0 auto}
.menu-btn{display:none}
@media (max-width:900px){
  .shell{grid-template-columns:1fr}
  .side{position:fixed;inset:0 auto 0 0;width:286px;z-index:30;transform:translateX(-100%);transition:transform .2s ease;box-shadow:var(--shadow-lg)}
  .side.open{transform:none}.menu-btn{display:inline-flex}.top{padding:0 14px}.content{padding:16px 14px 30px}
  .scrim{position:fixed;inset:0;background:rgba(0,0,0,.35);z-index:25}
}

/* ---------- controls */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:7px;height:36px;padding:0 14px;border-radius:10px;
  border:1px solid var(--border-strong);background:var(--surface);color:var(--text);font:600 13px var(--font);cursor:pointer;
  box-shadow:var(--shadow-sm);transition:background .15s,border-color .15s,transform .05s;white-space:nowrap}
.btn:hover{background:var(--surface-2)}.btn:active{transform:translateY(1px)}
.btn:disabled{opacity:.55;cursor:not-allowed}
.btn svg{width:16px;height:16px}
.btn.primary{background:var(--accent);border-color:var(--accent);color:#fff}.btn.primary:hover{filter:brightness(1.07)}
.btn.brand{background:linear-gradient(135deg,var(--brand),var(--brand-2));border:0;color:#fff}
.btn.danger{color:var(--bad);border-color:color-mix(in srgb,var(--bad) 35%,var(--border))}.btn.danger:hover{background:var(--bad-soft)}
.btn.danger.solid{background:var(--bad);color:#fff;border-color:var(--bad)}
.btn.ghost{background:transparent;border-color:transparent;box-shadow:none;color:var(--text-2)}.btn.ghost:hover{background:var(--surface-3)}
.btn.sm{height:30px;padding:0 10px;font-size:12px;border-radius:8px}
.btn.icon{width:36px;padding:0}.btn.sm.icon{width:30px}
.input,select,textarea{font:14px var(--font);color:var(--text);background:var(--surface);border:1px solid var(--border-strong);
  border-radius:10px;padding:8px 12px;outline:none;transition:border-color .15s,box-shadow .15s;width:100%}
select{width:auto;padding-right:30px}
.input:focus,select:focus,textarea:focus{border-color:var(--accent);box-shadow:0 0 0 4px color-mix(in srgb,var(--accent) 18%,transparent)}
textarea{resize:vertical;min-height:40px;line-height:1.45}
label.field{display:flex;flex-direction:column;gap:6px;font-weight:600;font-size:13px;color:var(--text-2)}
label.field .hint{font-weight:400;color:var(--muted);font-size:12px}
.search{position:relative}.search svg{position:absolute;left:11px;top:50%;transform:translateY(-50%);width:16px;height:16px;color:var(--faint)}
.search .input{padding-left:34px}
.seg{display:inline-flex;background:var(--surface-3);border-radius:11px;padding:3px;gap:2px}
.seg button{border:0;background:transparent;color:var(--muted);font:600 13px var(--font);padding:6px 12px;border-radius:8px;cursor:pointer;display:flex;gap:6px;align-items:center}
.seg button.on{background:var(--surface);color:var(--text);box-shadow:var(--shadow-sm)}

/* ---------- cards, kpis, tables */
.card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow)}
.card-b{padding:18px 20px}.card-h{padding:16px 20px;border-bottom:1px solid var(--border);display:flex;align-items:center;gap:10px}
.card-h h2{flex:1}
.grid{display:grid;gap:16px}.g2{grid-template-columns:repeat(2,minmax(0,1fr))}.g3{grid-template-columns:repeat(3,minmax(0,1fr))}
.g4{grid-template-columns:repeat(4,minmax(0,1fr))}
@media (max-width:1100px){.g4{grid-template-columns:repeat(2,minmax(0,1fr))}.g3{grid-template-columns:1fr}}
@media (max-width:700px){.g2,.g4{grid-template-columns:1fr}}
.kpi{padding:16px 18px;display:flex;gap:14px;align-items:flex-start}
.kpi .ic{width:40px;height:40px;border-radius:11px;display:grid;place-items:center;flex:none}
.kpi .ic svg{width:20px;height:20px}
.kpi .v{font-size:26px;font-weight:750;letter-spacing:-.02em;line-height:1.1}.kpi .l{color:var(--muted);font-size:13px}
.kpi .s{font-size:12px;color:var(--faint);margin-top:2px}
.ic.blue{background:var(--accent-soft);color:var(--accent-text)}.ic.green{background:var(--ok-soft);color:var(--ok)}
.ic.orange{background:var(--warn-soft);color:var(--warn)}.ic.red{background:var(--bad-soft);color:var(--bad)}
.ic.gray{background:var(--surface-3);color:var(--muted)}
.table-wrap{overflow:auto}
table.t{width:100%;border-collapse:separate;border-spacing:0}
.t th{position:sticky;top:0;background:var(--surface-2);color:var(--muted);font-size:12px;font-weight:600;text-align:left;
  padding:10px 14px;border-bottom:1px solid var(--border);white-space:nowrap}
.t td{padding:12px 14px;border-bottom:1px solid var(--border);vertical-align:middle}
.t tr:last-child td{border-bottom:0}
.t tr.click{cursor:pointer}.t tr.click:hover td{background:var(--surface-2)}
.t .num{text-align:right;font-variant-numeric:tabular-nums}

/* ---------- pills, badges, dots, avatars */
.pill{display:inline-flex;align-items:center;gap:6px;padding:2px 9px;border-radius:999px;font-size:12px;font-weight:600;white-space:nowrap;
  background:var(--surface-3);color:var(--text-2)}
.pill::before{content:"";width:6px;height:6px;border-radius:50%;background:currentColor;opacity:.85}
.pill.plain::before{display:none}
.pill.ok{background:var(--ok-soft);color:var(--ok)}.pill.warn{background:var(--warn-soft);color:var(--warn)}
.pill.bad{background:var(--bad-soft);color:var(--bad)}.pill.blue{background:var(--accent-soft);color:var(--accent-text)}
.badge{display:inline-grid;place-items:center;min-width:20px;height:20px;padding:0 6px;border-radius:999px;font-size:11px;font-weight:700;
  background:var(--bad);color:#fff}.badge.blue{background:var(--accent)}.badge.gray{background:var(--surface-3);color:var(--muted)}
.dot{display:inline-block;width:10px;height:10px;border-radius:50%;flex:none;box-shadow:0 0 0 3px color-mix(in srgb,currentColor 18%,transparent)}
.dot.ok{background:var(--ok);color:var(--ok)}.dot.warn{background:var(--warn);color:var(--warn)}
.dot.bad{background:var(--bad);color:var(--bad)}.dot.na{background:var(--na);color:var(--na)}
.av{width:36px;height:36px;border-radius:50%;display:grid;place-items:center;color:#fff;font-weight:700;font-size:13px;flex:none;letter-spacing:.02em}
.av.lg{width:56px;height:56px;font-size:19px}.av.sm{width:28px;height:28px;font-size:11px}

/* ---------- list items (sidebar customers, conversations) */
.item{display:flex;gap:11px;align-items:center;padding:9px 10px;border-radius:11px;cursor:pointer;position:relative}
.item:hover{background:var(--surface-3)}.item.on{background:var(--accent-soft)}
.item .t1{font-weight:600;display:flex;gap:6px;align-items:center}.item .t2{font-size:12px;color:var(--muted)}
.item .meta{margin-left:auto;display:flex;flex-direction:column;align-items:flex-end;gap:4px;font-size:11px;color:var(--faint)}

/* ---------- empty states, skeletons */
.empty{padding:44px 20px;text-align:center;color:var(--muted)}
.empty .ill{width:56px;height:56px;margin:0 auto 12px;border-radius:16px;display:grid;place-items:center;background:var(--surface-3);color:var(--faint)}
.empty .ill svg{width:26px;height:26px}.empty b{display:block;color:var(--text);font-size:15px;margin-bottom:4px}
.skel{background:linear-gradient(90deg,var(--surface-3),var(--surface-2),var(--surface-3));background-size:200% 100%;
  animation:sh 1.2s infinite;border-radius:8px}
@keyframes sh{to{background-position:-200% 0}}

/* ---------- modal, toast */
.backdrop{position:fixed;inset:0;background:rgba(10,12,16,.45);backdrop-filter:blur(3px);display:grid;place-items:center;z-index:50;padding:16px;
  animation:fade .15s ease}
.modal{width:min(520px,100%);background:var(--surface);border:1px solid var(--border);border-radius:18px;box-shadow:var(--shadow-lg);
  animation:pop .18s cubic-bezier(.2,.9,.3,1.2);max-height:calc(100vh - 32px);display:flex;flex-direction:column}
.modal .mh{padding:20px 22px 6px}.modal .mh p{margin:6px 0 0;color:var(--muted)}
.modal .mb{padding:12px 22px;overflow:auto;display:flex;flex-direction:column;gap:14px}
.modal .mf{padding:14px 22px 20px;display:flex;justify-content:flex-end;gap:8px}
@keyframes fade{from{opacity:0}}@keyframes pop{from{opacity:0;transform:translateY(8px) scale(.97)}}
.toasts{position:fixed;right:20px;bottom:20px;display:flex;flex-direction:column;gap:8px;z-index:60}
.toast{display:flex;gap:10px;align-items:center;background:var(--text);color:var(--surface);padding:11px 14px;border-radius:12px;
  box-shadow:var(--shadow-lg);font-weight:550;animation:pop .2s ease;max-width:380px}
.toast.bad{background:var(--bad);color:#fff}.toast svg{width:18px;height:18px;flex:none}
.secret{display:flex;align-items:center;gap:8px;background:var(--surface-2);border:1px dashed var(--border-strong);border-radius:10px;padding:10px 12px}
.secret code{flex:1;font-size:15px;font-weight:600;word-break:break-all}

/* ---------- login */
.login-wrap{min-height:100vh;display:grid;place-items:center;padding:20px;
  background:radial-gradient(1200px 600px at 10% -10%,color-mix(in srgb,var(--brand) 18%,transparent),transparent 60%),
             radial-gradient(900px 500px at 110% 110%,color-mix(in srgb,var(--accent) 16%,transparent),transparent 60%),var(--bg)}
.login{width:min(400px,100%);padding:30px}.login .logo{width:48px;height:48px;font-size:16px;border-radius:14px;margin-bottom:16px}
.login h1{margin-bottom:4px}.login form{display:flex;flex-direction:column;gap:14px;margin-top:22px}
.shake{animation:shake .35s}@keyframes shake{25%{transform:translateX(-6px)}50%{transform:translateX(6px)}75%{transform:translateX(-3px)}}
.pw{position:relative}.pw .input{padding-right:42px}.pw button{position:absolute;right:4px;top:50%;transform:translateY(-50%)}

/* ---------- chat */
.chat{display:flex;flex-direction:column;min-height:0;height:100%}
.chat-head{display:flex;align-items:center;gap:12px;padding:14px 18px;border-bottom:1px solid var(--border)}
.chat-body{flex:1;overflow:auto;padding:18px 18px 8px;display:flex;flex-direction:column;gap:2px;
  background:linear-gradient(var(--surface),var(--surface-2))}
.day{align-self:center;font-size:11px;font-weight:650;color:var(--muted);background:var(--surface-3);padding:3px 10px;border-radius:999px;margin:14px 0 8px}
.unread-line{display:flex;align-items:center;gap:10px;color:var(--accent-text);font-size:11px;font-weight:700;margin:10px 0}
.unread-line::before,.unread-line::after{content:"";flex:1;height:1px;background:color-mix(in srgb,var(--accent) 40%,transparent)}
.msg{display:flex;gap:8px;align-items:flex-end;max-width:78%;margin-top:2px}
.msg.me{align-self:flex-end;flex-direction:row-reverse}
.msg.first{margin-top:10px}
.msg .avs{width:28px;flex:none}
.bubble .txt{white-space:pre-wrap}
.bubble{padding:9px 13px 7px;border-radius:18px;background:var(--them-bubble);color:var(--them-text);overflow-wrap:anywhere;
  box-shadow:var(--shadow-sm);position:relative;min-width:60px}
.msg.me .bubble{background:var(--me-bubble);color:var(--me-text)}
.msg:not(.me).first .bubble{border-top-left-radius:6px}.msg.me.first .bubble{border-top-right-radius:6px}
.bubble .who{font-size:11px;font-weight:700;color:var(--accent-text);margin-bottom:2px}
.bubble .meta{display:flex;justify-content:flex-end;align-items:center;gap:4px;font-size:10.5px;opacity:.7;margin-top:3px}
.bubble .meta svg{width:15px;height:15px}.bubble .meta .read{color:#a8f0c6;opacity:1}
.attach{display:flex;width:fit-content;align-items:center;gap:6px;font-size:12px;font-weight:600;padding:4px 9px;border-radius:8px;margin-bottom:5px;
  background:color-mix(in srgb,currentColor 12%,transparent);cursor:pointer}.attach svg{width:14px;height:14px}
.composer{border-top:1px solid var(--border);padding:12px 14px;background:var(--surface)}
.composer .ref{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--accent-text);background:var(--accent-soft);
  padding:5px 10px;border-radius:8px;margin-bottom:8px}
.composer .box{display:flex;gap:8px;align-items:flex-end;background:var(--surface-2);border:1px solid var(--border-strong);border-radius:14px;padding:6px 6px 6px 12px}
.composer .box:focus-within{border-color:var(--accent);box-shadow:0 0 0 4px color-mix(in srgb,var(--accent) 16%,transparent)}
.composer textarea{border:0;background:transparent;box-shadow:none!important;padding:6px 0;max-height:160px;resize:none;min-height:24px}
.composer .send{width:38px;height:38px;border-radius:11px;padding:0}
.composer .hint{font-size:11px;color:var(--faint);margin-top:6px;display:flex;justify-content:space-between}
.convs{display:grid;grid-template-columns:330px 1fr;height:calc(100vh - 64px - 64px);min-height:460px}
.convs .list{border-right:1px solid var(--border);overflow:auto;padding:8px}
@media (max-width:900px){.convs{grid-template-columns:1fr;height:auto}.convs .list{border-right:0;border-bottom:1px solid var(--border);max-height:260px}}

/* ---------- charts */
.chart{position:relative}.chart canvas{width:100%;display:block}
.chart .tip{position:absolute;pointer-events:none;background:var(--surface);border:1px solid var(--border);border-radius:10px;padding:8px 10px;
  font-size:12px;box-shadow:var(--shadow-lg);white-space:nowrap;display:none;z-index:3}
.chart-card .card-h{padding:12px 16px}.chart-card .card-h h2{font-size:14px}
.legend{display:flex;gap:12px;flex-wrap:wrap;font-size:12px;color:var(--muted)}
.legend i{display:inline-block;width:14px;height:3px;border-radius:2px;margin-right:5px;vertical-align:middle}
.legend i.dash{background:repeating-linear-gradient(90deg,currentColor 0 4px,transparent 4px 7px)!important}
.drop{border:2px dashed var(--border-strong);border-radius:14px;padding:26px;text-align:center;color:var(--muted);transition:.15s}
.drop.over{border-color:var(--accent);background:var(--accent-soft);color:var(--accent-text)}
