/* SmartAISphere design system. Bootstrap 5.3 underneath; colours are CSS variables so light and dark mode share one set of rules. */

:root {
    --brand: #4f46e5;
    --brand-hover: #4338ca;
    --brand-active: #3730a3;
    --brand-rgb: 79, 70, 229;
    --brand-soft: #eef2ff;
    --brand-soft-text: #4338ca;
    --accent: #0d9488;
    --app-bg: #f5f6fb;
    --surface: #ffffff;
    --surface-2: #f8f9fc;
    --line: #e6e8f0;
    --text: #0f172a;
    --muted: #64748b;
    --ok: #16a34a;
    --ok-soft: #dcfce7;
    --warn: #d97706;
    --warn-soft: #fef3c7;
    --bad: #dc2626;
    --bad-soft: #fee2e2;
    --info-soft: #e0f2fe;
    --info: #0369a1;
    --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 14px rgba(15, 23, 42, .05);
    --radius: 14px;
    --sidebar-w: 268px;

    --bs-primary: var(--brand);
    --bs-primary-rgb: var(--brand-rgb);
    --bs-link-color: var(--brand);
    --bs-link-hover-color: var(--brand-hover);
    --bs-link-color-rgb: var(--brand-rgb);
    --bs-body-font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    --bs-body-bg: var(--app-bg);
    --bs-body-color: var(--text);
    --bs-border-color: var(--line);
    --bs-card-bg: var(--surface);
}

[data-bs-theme="dark"] {
    --brand: #818cf8;
    --brand-hover: #a5b4fc;
    --brand-active: #c7d2fe;
    --brand-rgb: 129, 140, 248;
    --brand-soft: #1e2347;
    --brand-soft-text: #c7d2fe;
    --accent: #2dd4bf;
    --app-bg: #0b1020;
    --surface: #131a2e;
    --surface-2: #182038;
    --line: #26314f;
    --text: #e6e9f5;
    --muted: #94a3b8;
    --ok: #4ade80;
    --ok-soft: #123524;
    --warn: #fbbf24;
    --warn-soft: #3a2c0b;
    --bad: #f87171;
    --bad-soft: #3b1618;
    --info-soft: #0c2d3f;
    --info: #7dd3fc;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .25);
    --bs-body-bg: var(--app-bg);
    --bs-body-color: var(--text);
    --bs-secondary-bg: var(--surface-2);
    --bs-tertiary-bg: var(--surface-2);
    --bs-card-bg: var(--surface);
}

body { min-height: 100vh; background: var(--app-bg); color: var(--text); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, h5, h6 { letter-spacing: -.01em; }
.text-muted { color: var(--muted) !important; }
.bg-body-tertiary, .bg-white { background-color: var(--surface) !important; }
a { text-decoration-thickness: from-font; }

/* ---------- buttons, forms, cards ---------- */
.btn { border-radius: 10px; font-weight: 500; padding: .5rem .95rem; }
.btn-sm { padding: .3rem .65rem; border-radius: 8px; }
.btn-primary { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand-hover); --bs-btn-hover-border-color: var(--brand-hover);
    --bs-btn-active-bg: var(--brand-active); --bs-btn-active-border-color: var(--brand-active); --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: var(--brand);
    --bs-btn-color: #fff; --bs-btn-hover-color: #fff; --bs-btn-active-color: #fff; box-shadow: 0 1px 2px rgba(var(--brand-rgb), .35); }
[data-bs-theme="dark"] .btn-primary { --bs-btn-color: #0b1020; --bs-btn-hover-color: #0b1020; --bs-btn-active-color: #0b1020; --bs-btn-disabled-color: #0b1020; }
.btn-outline-primary { --bs-btn-color: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand); --bs-btn-active-bg: var(--brand-hover); }
.btn-outline-secondary { --bs-btn-color: var(--muted); --bs-btn-border-color: var(--line); --bs-btn-hover-bg: var(--surface-2); --bs-btn-hover-color: var(--text); --bs-btn-hover-border-color: var(--line); --bs-btn-active-bg: var(--surface-2); --bs-btn-active-color: var(--text); }
.btn-link { color: var(--brand); text-decoration: none; }
.btn-link:hover { color: var(--brand-hover); text-decoration: underline; }
.form-control, .form-select { border-radius: 10px; border-color: var(--line); background-color: var(--surface); padding: .55rem .8rem; color: var(--text); }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 .22rem rgba(var(--brand-rgb), .18); background-color: var(--surface); color: var(--text); }
.form-control::placeholder { color: var(--muted); opacity: .7; }
.form-control[readonly] { background-color: var(--surface-2); }
.form-label { font-weight: 500; font-size: .875rem; margin-bottom: .3rem; }
.form-text { color: var(--muted); }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.input-group-text { background: var(--surface-2); border-color: var(--line); color: var(--muted); border-radius: 10px; }
.card { border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); }
.card.shadow-sm { box-shadow: var(--shadow) !important; }
.card-footer { background: transparent; border-top-color: var(--line); }
.table { --bs-table-bg: transparent; --bs-table-border-color: var(--line); --bs-table-color: var(--text); }
.table > :not(caption) > * > * { padding: .75rem .9rem; }
.table-light, .table-light > th, .table thead.table-light th { --bs-table-bg: var(--surface-2); color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
.table-hover > tbody > tr:hover > * { --bs-table-hover-bg: var(--surface-2); }
.alert { border-radius: 12px; border: 1px solid transparent; }
.alert-success { background: var(--ok-soft); color: var(--ok); }
.alert-danger { background: var(--bad-soft); color: var(--bad); }
.alert-warning { background: var(--warn-soft); color: var(--warn); }
.alert-info { background: var(--info-soft); color: var(--info); }
.badge { font-weight: 600; border-radius: 999px; padding: .38em .7em; }
.text-bg-primary { background-color: var(--brand) !important; color: #fff !important; }
.text-bg-secondary { background-color: var(--surface-2) !important; color: var(--muted) !important; border: 1px solid var(--line); }
.text-bg-success { background-color: var(--ok-soft) !important; color: var(--ok) !important; }
.text-bg-warning { background-color: var(--warn-soft) !important; color: var(--warn) !important; }
.text-bg-danger { background-color: var(--bad-soft) !important; color: var(--bad) !important; }
.text-bg-info { background-color: var(--info-soft) !important; color: var(--info) !important; }
.text-bg-light { background-color: var(--surface-2) !important; color: var(--text) !important; }
.progress { background: var(--surface-2); border-radius: 999px; }
.progress-bar { background: var(--brand); border-radius: 999px; }
.nav-pills .nav-link { border-radius: 999px; color: var(--muted); font-weight: 500; }
.nav-pills .nav-link.active { background: var(--brand-soft); color: var(--brand-soft-text); }
.page-link { color: var(--brand); border-color: var(--line); background: var(--surface); }
.page-item.active .page-link { background: var(--brand); border-color: var(--brand); color: #fff; }
.dropdown-menu { border-radius: 12px; border-color: var(--line); box-shadow: var(--shadow); background: var(--surface); padding: .4rem; }
.dropdown-item { border-radius: 8px; padding: .5rem .75rem; color: var(--text); }
.dropdown-item:hover { background: var(--surface-2); color: var(--text); }
.modal-content { border-radius: 16px; border-color: var(--line); background: var(--surface); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- app shell ---------- */
.app-shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--line); width: var(--sidebar-w); display: flex; flex-direction: column; }
@media (min-width: 992px) { .sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; } }
@media (max-width: 991.98px) { .app-shell { grid-template-columns: minmax(0, 1fr); } }
.sidebar-brand { display: flex; align-items: center; gap: .7rem; padding: 1.15rem 1.15rem .9rem; text-decoration: none; color: var(--text); }
.brand-mark { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; color: #fff; font-size: 1.15rem;
    background: linear-gradient(135deg, var(--brand) 0%, var(--accent) 100%); box-shadow: 0 4px 12px rgba(var(--brand-rgb), .35); flex: none; }
[data-bs-theme="dark"] .brand-mark { color: #0b1020; }
.brand-name { font-weight: 700; font-size: 1.05rem; line-height: 1.1; }
.brand-sub { font-size: .72rem; color: var(--muted); }
.nav-group { padding: .35rem .85rem; }
.nav-label { font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: .7rem .6rem .35rem; }
.nav-app { display: flex; align-items: center; gap: .7rem; padding: .55rem .7rem; border-radius: 10px; color: var(--muted); text-decoration: none; font-weight: 500; font-size: .92rem; margin-bottom: 2px; position: relative; }
.nav-app i { font-size: 1.1rem; width: 1.25rem; text-align: center; }
.nav-app:hover { background: var(--surface-2); color: var(--text); }
.nav-app.active { background: var(--brand-soft); color: var(--brand-soft-text); }
.nav-app.active::before { content: ""; position: absolute; left: -.85rem; top: 22%; bottom: 22%; width: 4px; border-radius: 0 4px 4px 0; background: var(--brand); }
.nav-app .nav-badge { margin-left: auto; background: var(--bad); color: #fff; font-size: .7rem; font-weight: 700; border-radius: 999px; padding: .1rem .5rem; min-width: 1.4rem; text-align: center; }
.nav-soon { display: flex; align-items: center; gap: .7rem; padding: .45rem .7rem; color: var(--muted); font-size: .85rem; opacity: .65; }
.nav-soon i { width: 1.25rem; text-align: center; }
.sidebar-footer { margin-top: auto; padding: 1rem; border-top: 1px solid var(--line); }
.plan-pill { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: .7rem .8rem; font-size: .82rem; }

.app-main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .75rem; padding: .7rem 1.5rem; background: color-mix(in srgb, var(--app-bg) 82%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar-title { font-weight: 650; font-size: 1.05rem; margin: 0; }
.icon-btn { width: 40px; height: 40px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); display: inline-grid; place-items: center; position: relative; text-decoration: none; padding: 0; }
.icon-btn:hover { color: var(--text); background: var(--surface-2); }
.icon-btn .dot { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 999px; background: var(--bad); color: #fff; font-size: .65rem; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--app-bg); }
.icon-btn .dot[hidden], .nav-badge[hidden] { display: none !important; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .85rem; color: #fff; background: linear-gradient(135deg, var(--brand), var(--accent)); flex: none; }
[data-bs-theme="dark"] .avatar { color: #0b1020; }
.user-btn { display: flex; align-items: center; gap: .6rem; background: transparent; border: 0; padding: .25rem .4rem; border-radius: 12px; color: var(--text); }
.user-btn:hover { background: var(--surface-2); }
.page-content { padding: 1.5rem; max-width: 1480px; width: 100%; margin: 0 auto; }
@media (max-width: 575.98px) { .page-content { padding: 1rem; } .topbar { padding: .6rem 1rem; } }

/* ---------- dashboard pieces ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.25rem; }
.page-head h1 { font-size: 1.55rem; font-weight: 700; margin: 0; }
.page-head .sub { color: var(--muted); }
.card.stat-card { flex-direction: row; }
.stat-card { padding: 1.1rem 1.15rem; height: 100%; display: flex; gap: .9rem; align-items: flex-start; text-decoration: none; color: inherit; transition: transform .12s ease, box-shadow .12s ease; }
a.stat-card:hover { transform: translateY(-2px); color: inherit; }
.stat-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 1.25rem; flex: none; background: var(--brand-soft); color: var(--brand-soft-text); }
.stat-icon.ok { background: var(--ok-soft); color: var(--ok); }
.stat-icon.warn { background: var(--warn-soft); color: var(--warn); }
.stat-icon.bad { background: var(--bad-soft); color: var(--bad); }
.stat-icon.info { background: var(--info-soft); color: var(--info); }
.stat-label { font-size: .8rem; color: var(--muted); font-weight: 500; }
.stat-value { font-size: 1.65rem; font-weight: 700; line-height: 1.15; letter-spacing: -.02em; }
.stat-note { font-size: .78rem; color: var(--muted); }
.section-title { font-size: 1rem; font-weight: 650; margin: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.15rem .25rem; gap: .5rem; }
.chart-box { position: relative; height: 270px; padding: .5rem 1rem 1rem; }
.attention-item { display: flex; align-items: center; gap: .8rem; padding: .75rem 1.15rem; border-top: 1px solid var(--line); text-decoration: none; color: inherit; }
.attention-item:first-child { border-top: 0; }
.attention-item:hover { background: var(--surface-2); color: inherit; }
.attention-item .chev { margin-left: auto; color: var(--muted); }
.all-clear { display: flex; align-items: center; gap: .8rem; padding: 1rem 1.15rem; color: var(--ok); }
.list-row { display: flex; align-items: center; gap: .8rem; padding: .7rem 1.15rem; border-top: 1px solid var(--line); text-decoration: none; color: inherit; }
.list-row:first-child { border-top: 0; }
a.list-row:hover { background: var(--surface-2); color: inherit; }
.list-row .grow { min-width: 0; flex: 1; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stars { color: #f59e0b; letter-spacing: 1px; white-space: nowrap; }
.stars .off { color: var(--line); }
.empty-state { text-align: center; padding: 2.2rem 1rem; color: var(--muted); }
.empty-state i { font-size: 2rem; display: block; margin-bottom: .4rem; opacity: .7; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg a { padding: .3rem .8rem; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: .85rem; font-weight: 500; }
.seg a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ---------- toasts ---------- */
.toast-container { z-index: 1090; }
.toast { border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.toast .bi { font-size: 1.15rem; }
.toast.t-success .bi { color: var(--ok); } .toast.t-danger .bi { color: var(--bad); } .toast.t-warning .bi { color: var(--warn); } .toast.t-info .bi { color: var(--info); }

/* ---------- sign in / register ---------- */
.auth-grid { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.auth-brand { position: relative; overflow: hidden; color: #fff; padding: 3rem clamp(2rem, 5vw, 4.5rem); display: flex; flex-direction: column; justify-content: space-between;
    background: radial-gradient(1200px 600px at 10% -10%, rgba(255, 255, 255, .18), transparent 60%), linear-gradient(145deg, #4338ca 0%, #4f46e5 40%, #0d9488 115%); }
[data-bs-theme="dark"] .auth-brand { background: radial-gradient(1200px 600px at 10% -10%, rgba(255, 255, 255, .08), transparent 60%), linear-gradient(145deg, #1e1b4b 0%, #312e81 45%, #115e59 120%); }
.auth-brand::after { content: ""; position: absolute; right: -120px; bottom: -120px; width: 420px; height: 420px; border-radius: 50%; background: rgba(255, 255, 255, .08); }
.auth-brand .brand-mark { background: rgba(255, 255, 255, .18); box-shadow: none; color: #fff; }
.auth-brand h2 { font-size: clamp(1.8rem, 3vw, 2.5rem); font-weight: 750; line-height: 1.15; margin-bottom: 1rem; }
.auth-points { list-style: none; padding: 0; margin: 2rem 0 0; display: grid; gap: 1.1rem; }
.auth-points li { display: flex; gap: .9rem; align-items: flex-start; }
.auth-points .pt-icon { width: 38px; height: 38px; border-radius: 11px; background: rgba(255, 255, 255, .16); display: grid; place-items: center; flex: none; }
.auth-points b { display: block; }
.auth-points span { opacity: .82; font-size: .9rem; }
.auth-main { display: flex; flex-direction: column; padding: 1.25rem clamp(1.25rem, 5vw, 4rem); background: var(--app-bg); }
.auth-top { display: flex; justify-content: space-between; align-items: center; }
.auth-center { flex: 1; display: flex; align-items: center; justify-content: center; padding: 2rem 0; }
.auth-card { width: 100%; max-width: 460px; }
.auth-card.wide { max-width: 560px; }
.auth-card h1 { font-size: 1.7rem; font-weight: 750; margin-bottom: .35rem; }
.input-icon { position: relative; }
.input-icon > i.lead-icon { position: absolute; left: .9rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; z-index: 2; }
.input-icon > .form-control, .input-icon > .form-select { padding-left: 2.5rem; }
.input-icon .reveal { position: absolute; right: .35rem; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--muted); width: 36px; height: 36px; border-radius: 8px; z-index: 2; }
.input-icon .reveal:hover { color: var(--text); background: var(--surface-2); }
.input-icon.has-reveal > .form-control { padding-right: 2.8rem; }
.step-dots { display: flex; gap: .5rem; margin: 1rem 0 1.5rem; }
.step-dots span { height: 6px; flex: 1; border-radius: 999px; background: var(--line); }
.step-dots span.on { background: var(--brand); }
.strength { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; margin-top: .5rem; }
.strength > div { height: 100%; width: 0; border-radius: 999px; transition: width .2s ease, background .2s ease; }
.pw-rules { list-style: none; padding: 0; margin: .6rem 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: .2rem .8rem; font-size: .8rem; color: var(--muted); }
.pw-rules li i { margin-right: .3rem; }
.pw-rules li.ok { color: var(--ok); }
.btn-loading .spinner-border { width: 1rem; height: 1rem; border-width: .15em; margin-right: .5rem; }
.field-validation-error, .text-danger { color: var(--bad) !important; }
@media (max-width: 991.98px) { .auth-grid { grid-template-columns: 1fr; } .auth-brand { display: none; } }

/* ---------- misc ---------- */
.copy-field { display: flex; gap: .4rem; }
.kbd { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: .1rem .4rem; }
[dir="auto"] { unicode-bidi: plaintext; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* small screens: two KPI cards per row, icon above the text, tighter */
@media (max-width: 575.98px) {
    .card.stat-card { flex-direction: column; gap: .5rem; padding: .85rem .9rem; }
    .stat-icon { width: 36px; height: 36px; font-size: 1.05rem; border-radius: 10px; }
    .stat-value { font-size: 1.4rem; }
    .page-head h1 { font-size: 1.3rem; }
    .seg a { padding: .3rem .6rem; }
    .chart-box { height: 220px; }
}

/* ---------- inbox: list + conversation pane ---------- */
.inbox-layout { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 1rem; height: calc(100vh - 6.2rem); min-height: 520px; }
.inbox-list-pane, .inbox-pane { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.inbox-list-head { padding: .9rem 1rem .6rem; border-bottom: 1px solid var(--line); }
.inbox-tabs { display: flex; gap: .25rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.inbox-tabs a { flex: 1; text-align: center; padding: .3rem .4rem; border-radius: 8px; font-size: .82rem; font-weight: 500; color: var(--muted); text-decoration: none; white-space: nowrap; }
.inbox-tabs a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.inbox-tabs .cnt { font-size: .68rem; background: var(--line); color: var(--text); border-radius: 999px; padding: .05rem .4rem; margin-left: .15rem; }
.inbox-tabs .cnt.hot { background: var(--bad); color: #fff; }
.inbox-list { flex: 1; overflow-y: auto; }
.inbox-item { display: flex; gap: .75rem; padding: .8rem 1rem; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; position: relative; }
.inbox-item:hover { background: var(--surface-2); color: inherit; }
.inbox-item.active { background: var(--brand-soft); }
.inbox-item.active::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--brand); }
.inbox-item.waiting .avatar { box-shadow: 0 0 0 3px var(--warn-soft); }
.inbox-item .grow { min-width: 0; flex: 1; }
.inbox-pane { position: relative; }
.inbox-placeholder { margin: auto; text-align: center; padding: 2rem; color: var(--muted); }
.inbox-placeholder i { font-size: 2.6rem; display: block; margin-bottom: .6rem; opacity: .6; }
.inbox-loading { margin: auto; color: var(--muted); }
@media (max-width: 991.98px) {
    .inbox-layout { grid-template-columns: minmax(0, 1fr); height: calc(100vh - 5.4rem); }
    .inbox-layout .inbox-pane { display: none; }
    .inbox-layout.has-open .inbox-pane { display: flex; }
    .inbox-layout.has-open .inbox-list-pane { display: none; }
}

/* ---------- conversation panel ---------- */
.conv-card { overflow: hidden; }
.conv-panel { display: flex; flex-direction: column; min-height: 0; height: 100%; position: relative; }
.conv-card .conv-panel { height: calc(100vh - 11rem); min-height: 520px; }
.conv-head { display: flex; align-items: center; gap: .75rem; padding: .8rem 1rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.conv-title { min-width: 0; flex: 1 1 220px; }
.conv-name { font-size: 1.05rem; font-weight: 650; margin: 0; }
.conv-actions { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; margin-left: auto; }
.conv-actions form { margin: 0; }
.conv-back { display: none; }
@media (max-width: 991.98px) { .conv-back { display: inline-grid; } .conv-card .conv-back { display: none; } }
.avatar.lg { width: 44px; height: 44px; font-size: 1rem; }
.conv-body { flex: 1; min-height: 0; display: flex; position: relative; overflow: hidden; }
.thread { flex: 1; overflow-y: auto; padding: 1rem 1.1rem; background: var(--surface-2); }
.day-sep, .sys { text-align: center; margin: .8rem 0; }
.day-sep span, .sys span { display: inline-block; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: .18rem .75rem; font-size: .74rem; color: var(--muted); }
.sys span { background: transparent; border-style: dashed; }
.msg { display: flex; gap: .55rem; margin-bottom: .85rem; align-items: flex-end; }
.msg .mav { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: .85rem; background: var(--surface); border: 1px solid var(--line); color: var(--muted); flex: none; }
.msg .mbody { max-width: min(76%, 640px); display: flex; flex-direction: column; }
.msg .bubble { padding: .55rem .85rem; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); white-space: pre-wrap; word-break: break-word; line-height: 1.4; }
.msg.customer .bubble { border-bottom-left-radius: 4px; }
.msg .who { font-size: .72rem; color: var(--muted); margin-top: .2rem; }
.msg.ai, .msg.human { flex-direction: row-reverse; }
.msg.ai .mbody, .msg.human .mbody { align-items: flex-end; }
.msg.ai .bubble { background: var(--info-soft); border-color: transparent; color: var(--text); border-bottom-right-radius: 4px; }
.msg.ai .mav { background: var(--info-soft); color: var(--info); border-color: transparent; }
.msg.human .bubble { background: #4f46e5; border-color: transparent; color: #fff; border-bottom-right-radius: 4px; }
.msg.human .mav { background: var(--brand-soft); color: var(--brand-soft-text); border-color: transparent; }
.info-drawer { position: absolute; top: 0; right: 0; bottom: 0; width: min(340px, 100%); background: var(--surface); border-left: 1px solid var(--line); box-shadow: -8px 0 24px rgba(15, 23, 42, .08); overflow-y: auto; transform: translateX(105%); transition: transform .2s ease; z-index: 5; }
.info-drawer.open { transform: translateX(0); }
@media (min-width: 1500px) { .conv-card .info-drawer { position: static; transform: none; box-shadow: none; width: 340px; flex: none; } .conv-card [data-conv-info] { display: none; } }
.info-section { padding: 1rem 1.1rem; border-bottom: 1px solid var(--line); }
.info-title { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: .6rem; }
.info-list { display: grid; grid-template-columns: 90px 1fr; gap: .3rem .5rem; font-size: .85rem; margin-bottom: .9rem; }
.info-list dt { color: var(--muted); font-weight: 500; } .info-list dd { margin: 0; word-break: break-word; }
.note { border-left: 3px solid var(--brand); padding-left: .6rem; margin-bottom: .7rem; }
.min-w-0 { min-width: 0; }
.conv-footer { border-top: 1px solid var(--line); padding: .8rem 1rem; background: var(--surface); }
.reply-text { resize: none; }
.quick-menu { max-width: 340px; }
.closed-note { color: var(--muted); font-size: .9rem; }
.closed-note i { color: var(--ok); }

/* ---- Leads board ---- */
.kanban{display:grid;grid-template-columns:repeat(5,minmax(176px,1fr));gap:.75rem;overflow-x:auto;padding-bottom:.5rem}
.kan-col{background:var(--surface-2,var(--bs-tertiary-bg));border:1px solid var(--line);border-radius:12px;padding:.6rem;display:flex;flex-direction:column;min-height:260px}
.kan-col.over{outline:2px dashed var(--brand);outline-offset:-2px}
.kan-head{display:flex;justify-content:space-between;align-items:center;padding:.1rem .25rem}
.kan-sum{padding:0 .25rem .5rem}
.kan-body{flex:1;display:flex;flex-direction:column;gap:.5rem;min-height:80px}
.kan-card{background:var(--surface);border:1px solid var(--line);border-radius:10px;padding:.6rem .7rem;cursor:grab;box-shadow:var(--shadow-sm,none)}
.kan-card:hover{border-color:var(--brand)}
.kan-card.dragging{opacity:.4}
@media (max-width:767.98px){.kanban{grid-template-columns:repeat(5,80%);scroll-snap-type:x mandatory}.kan-col{scroll-snap-align:start}}

/* ---- Knowledge upload zone ---- */
.drop-zone{border:2px dashed var(--line);border-radius:14px;padding:2rem 1rem;text-align:center;cursor:pointer;transition:border-color .15s,background .15s}
.drop-zone:hover,.drop-zone.over{border-color:var(--brand);background:var(--brand-soft,rgba(79,70,229,.06))}
.drop-zone i{font-size:2rem;color:var(--brand)}
.drop-zone input[type=file]{display:none}

h1.page-title{font-size:1.4rem;font-weight:700;letter-spacing:-.01em}
.page-head h1 .badge{vertical-align:middle}

/* ---- Channel: hub status ---- */
.hub-status{border:1px solid var(--line);border-radius:10px;padding:.7rem .85rem;background:var(--surface-2,transparent)}
.hub-dot{width:10px;height:10px;border-radius:50%;background:var(--muted,#9ca3af);flex:none}
.hub-status[data-state="WaitingForMeta"] .hub-dot{background:#f59e0b;animation:hubpulse 1.4s infinite}
.hub-status[data-state="Verified"] .hub-dot{background:#3b82f6}
.hub-status[data-state="Receiving"] .hub-dot{background:#22c55e}
.hub-status[data-state="Problem"] .hub-dot,.hub-status[data-state="Unavailable"] .hub-dot{background:#ef4444}
@keyframes hubpulse{50%{opacity:.3}}

/* ---- Rates ---- */
.rate-group td{background:var(--surface-2,var(--bs-tertiary-bg));font-weight:700;font-size:.8rem;text-transform:uppercase;letter-spacing:.04em;color:var(--muted,#6b7280)}

/* ---- Social posts ---- */
.post-thumb{width:84px;height:84px;border-radius:10px;object-fit:cover;border:1px solid var(--line);flex:none}
.post-thumb-rates{display:flex;align-items:center;justify-content:center;font-size:1.8rem;color:var(--brand);background:var(--surface-2,transparent)}
.post-caption{white-space:pre-wrap;word-break:break-word;display:-webkit-box;-webkit-line-clamp:4;-webkit-box-orient:vertical;overflow:hidden}
