/* ============================================================================
   Chatline — Suite design system (UI v3)
   Unified with Adline's "darkroom": warm signal orange on cold graphite.
   Bricolage Grotesque (display) · Manrope (body) · JetBrains Mono (machine)
   · Cairo (Arabic). All colors derive from --brand (white-label safe).
   ========================================================================== */

:root {
    --brand: #FF6B1A;
    --amber: #C6F24E;
    --red: #F0554E;
    --green: #3FCF8E;
    --blue: #5B8DEF;

    --ink-0: #07080A;          /* page base */
    --ink-1: #0D0F13;          /* app canvas */
    --ink-2: #121419;          /* raised surface */
    --card: rgba(255, 255, 255, .028);
    --card-hover: rgba(255, 255, 255, .05);
    --line: #232833;
    --line-strong: #2E3543;

    --text: #E7E9EE;
    --text-soft: #9AA1B0;
    --dim: #636B7C;

    --r-sm: 8px;
    --r: 10px;
    --r-lg: 14px;

    --shadow-1: 0 1px 0 rgba(255,255,255,.03) inset, 0 18px 40px -24px rgba(0,0,0,.9);
    --shadow-2: 0 2px 6px rgba(0, 0, 0, .4), 0 22px 60px -18px rgba(0, 0, 0, .65);
    --glow: 0 0 0 1px color-mix(in srgb, var(--brand) 45%, transparent),
            0 6px 26px -6px color-mix(in srgb, var(--brand) 55%, transparent);

    --font: 'Manrope', 'Cairo', 'Segoe UI', Tahoma, sans-serif;
    --font-disp: 'Bricolage Grotesque', 'Cairo', var(--font);
    --font-mono: 'JetBrains Mono', Consolas, Menlo, monospace;
}
html[dir="rtl"] body, [dir="rtl"] { font-family: 'Cairo', var(--font); }

/* ---------------------------------- reset --------------------------------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    font-size: 14.5px;
    line-height: 1.65;
    color: var(--text);
    background: var(--ink-0);
    -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); }
::selection { background: color-mix(in srgb, var(--brand) 35%, transparent); color: #fff; }
img { max-width: 100%; }
h1, h2, h3 { font-family: var(--font-disp); font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }

/* scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 999px; border: 3px solid var(--ink-1); }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.2); }

/* ------------------------------ atmosphere -------------------------------- */
/* Darkroom backdrop shared with Adline: faint signal glows + drafting grid + film grain */
.app-body::before, .login-body::before {
    content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .5;
    background-image:
        radial-gradient(900px 500px at 12% -10%, color-mix(in srgb, var(--brand) 10%, transparent), transparent 60%),
        radial-gradient(700px 500px at 110% 10%, rgba(91,141,239,.07), transparent 60%),
        linear-gradient(rgba(255,255,255,.014) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.014) 1px, transparent 1px);
    background-size: auto, auto, 44px 44px, 44px 44px;
}
.app-body::after, .login-body::after {
    content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .035;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/></filter><rect width='140' height='140' filter='url(%23n)'/></svg>");
}
.app-body, .login-body {
    background:
        radial-gradient(1100px 500px at 85% -10%, color-mix(in srgb, var(--brand) 9%, transparent), transparent 60%),
        radial-gradient(900px 600px at -15% 110%, rgba(198, 242, 78, .04), transparent 55%),
        linear-gradient(180deg, var(--ink-1), var(--ink-0) 70%);
    min-height: 100vh;
    position: relative;
}
.app-body::before, .login-body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: .5;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .035 0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}
.app-body > *, .login-body > * { position: relative; z-index: 1; }

/* ================================ APP SHELL ================================ */
.app-body { display: flex; }

/* -------- sidebar -------- */
.sidebar {
    width: 252px;
    flex: 0 0 252px;
    display: flex;
    flex-direction: column;
    padding: 18px 14px;
    border-inline-end: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(255,255,255,.022), rgba(255,255,255,0) 30%);
    min-height: 100vh;
    position: sticky;
    top: 0;
    max-height: 100vh;
    overflow-y: auto;
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 6px 10px 20px;
}
.brand-mark {
    width: 34px; height: 34px;
    flex: 0 0 auto;
    border-radius: 11px;
    background:
        radial-gradient(circle at 30% 25%, rgba(255,255,255,.5), transparent 45%),
        conic-gradient(from 210deg, var(--brand), #ffb680, var(--brand));
    box-shadow: var(--glow);
    position: relative;
}
.brand-mark::after {
    content: '';
    position: absolute;
    inset: 9px 8px;
    border-radius: 4px;
    border: 2px solid rgba(255,255,255,.9);
    border-block-end: 0;
    border-inline-end: 0;
    transform: rotate(-45deg) translate(1px, 3px);
}
.brand-mark.big { width: 54px; height: 54px; border-radius: 16px; margin: 0 auto 12px; display: block; }
.brand-logo { max-height: 34px; max-width: 150px; border-radius: 8px; }
.brand-logo.big { max-height: 58px; max-width: 210px; display: block; margin: 0 auto 10px; }
.brand-name {
    font-family: var(--font-disp);
    font-weight: 700;
    font-size: 18px;
    letter-spacing: -.03em;
    background: linear-gradient(90deg, #fff, color-mix(in srgb, var(--brand) 70%, #fff));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.nav-section {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--dim);
    padding: 16px 12px 6px;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 12px;
    border-radius: var(--r-sm);
    color: var(--text-soft);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    position: relative;
    transition: background .15s ease, color .15s ease, transform .15s ease;
}
.nav-item:hover { background: rgba(255,255,255,.045); color: var(--text); }
.nav-item.active {
    background: linear-gradient(90deg, color-mix(in srgb, var(--brand) 16%, transparent), transparent 80%);
    color: #fff;
}
.nav-item.active::before {
    content: '';
    position: absolute;
    inset-inline-start: -14px;
    top: 20%; bottom: 20%;
    width: 3px;
    border-radius: 0 999px 999px 0;
    background: var(--brand);
    box-shadow: 0 0 14px 1px var(--brand);
}
[dir="rtl"] .nav-item.active::before { border-radius: 999px 0 0 999px; }
.nav-ic { display: inline-flex; width: 19px; opacity: .8; }
.nav-item.active .nav-ic { opacity: 1; filter: drop-shadow(0 0 6px color-mix(in srgb, var(--brand) 70%, transparent)); }
.nav-ic svg { width: 18px; height: 18px; }
.nav-logout { color: var(--dim); margin-top: 6px; }
.nav-logout:hover { color: var(--red); background: rgba(244,119,107,.08); }

.sidebar-foot { margin-top: 14px; }
.nav-collapse {
    width: 100%;
    background: none;
    border: 0;
    cursor: pointer;
    font-family: inherit;
    color: var(--dim);
    margin-top: 4px;
}
.nav-collapse:hover { color: var(--text); background: rgba(255,255,255,.045); }
.nav-collapse .nav-ic svg { transition: transform .25s ease; }

/* -------- collapsed sidebar (WordPress-style, desktop only) -------- */
@media (min-width: 840px) {
    .sidebar, .nav-item { transition: width .18s ease, flex-basis .18s ease, background .15s ease, color .15s ease; }
    .side-min .sidebar { width: 72px; flex: 0 0 72px; padding: 18px 10px; overflow: visible; }
    .side-min .sidebar .nav-label,
    .side-min .sidebar .brand-name,
    .side-min .sidebar .nav-section,
    .side-min .sidebar .coins-label { display: none; }
    .side-min .sidebar .brand-logo { max-width: 44px; }
    .side-min .sidebar-brand { justify-content: center; padding: 6px 0 20px; }
    .side-min .nav-item { justify-content: center; gap: 0; padding: 11px 0; }
    .side-min .nav-item.active::before { inset-inline-start: -10px; }
    .side-min .coins-box { justify-content: center; padding: 9px 6px; }
    .side-min .nav-collapse .nav-ic svg { transform: rotate(180deg); }
    [dir="rtl"] .nav-collapse .nav-ic svg { transform: rotate(180deg); }
    [dir="rtl"] .side-min .nav-collapse .nav-ic svg { transform: rotate(0deg); }
    /* hover tooltip from the title attribute is enough; keep icons readable */
    .side-min .nav-ic { opacity: .95; }
}
.coins-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 14px;
    border-radius: var(--r);
    border: 1px solid color-mix(in srgb, var(--amber) 28%, transparent);
    background: linear-gradient(120deg, rgba(198,242,78,.1), rgba(198,242,78,.02));
    margin-bottom: 8px;
}
.coins-label { font-size: 11.5px; color: var(--amber); font-weight: 600; letter-spacing: .04em; }
.coins-value { font-family: var(--font-mono); font-weight: 600; font-size: 16px; color: #C6F24E; font-variant-numeric: tabular-nums; }

/* -------- main / topbar -------- */
.main-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 26px;
    border-block-end: 1px solid var(--line);
    backdrop-filter: blur(8px);
    background: rgba(10, 14, 22, .55);
    position: sticky;
    top: 0;
    z-index: 40;
}
.topbar-spacer { flex: 1; }
.topbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 13px;
    border-radius: 999px;
    border: 1px solid var(--line);
    color: var(--text-soft);
    text-decoration: none;
    font-size: 12.5px;
    transition: border-color .15s ease, color .15s ease;
}
.topbar-btn:hover { border-color: var(--line-strong); color: var(--text); }
.topbar-user { display: flex; align-items: center; gap: 9px; }
.user-avatar {
    width: 33px; height: 33px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    color: #08211d;
    background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 85%, #fff), var(--brand));
    box-shadow: 0 0 0 2px rgba(255,255,255,.08);
    flex: 0 0 auto;
}
.user-name { font-size: 13px; font-weight: 600; color: var(--text-soft); }
.burger { display: none; background: none; border: 0; padding: 8px; cursor: pointer; }
.burger span { display: block; width: 20px; height: 2px; background: var(--text-soft); margin: 4px 0; border-radius: 2px; }
.sidebar-overlay { display: none; }

.banner { padding: 10px 26px; font-size: 13px; }
.banner-warn { background: linear-gradient(90deg, rgba(198,242,78,.14), rgba(198,242,78,.04)); color: #C6F24E; border-block-end: 1px solid rgba(198,242,78,.25); }

.content { padding: 28px 26px 46px; flex: 1; max-width: 1460px; width: 100%; }

/* page load stagger */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.content > * { animation: rise .45s cubic-bezier(.22,.8,.3,1) both; }
.content > *:nth-child(2) { animation-delay: .05s; }
.content > *:nth-child(3) { animation-delay: .1s; }
.content > *:nth-child(4) { animation-delay: .15s; }
.content > *:nth-child(5) { animation-delay: .2s; }
.content > *:nth-child(n+6) { animation-delay: .25s; }

.page-head { margin-bottom: 20px; }
.page-head h1 { margin: 0 0 4px; font-size: 24px; }
.page-sub { margin: 0; color: var(--dim); font-size: 13.5px; }

/* ================================= CARDS =================================== */
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-1);
    position: relative;
}
.card::before {
    content: '';
    position: absolute;
    inset: 0 0 auto;
    height: 1px;
    border-radius: 999px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.16), transparent);
}
.form-card { padding: 22px 24px; margin-bottom: 18px; }
.card-title { margin: 0 0 16px; font-size: 15.5px; letter-spacing: -.01em; }
.empty-card { text-align: center; padding: 60px 24px; color: var(--dim); }
.empty-icon { font-size: 38px; margin-bottom: 10px; }

/* ================================ STATS ==================================== */
.stat-row, .kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}
.stat-card, .kpi-card { padding: 17px 19px 15px; overflow: hidden; }
.stat-card::after, .kpi-card::after {
    content: '';
    position: absolute;
    inset-inline-start: 19px;
    top: 0;
    width: 34px; height: 2px;
    border-radius: 999px;
    background: var(--brand);
    opacity: .8;
}
.stat-label, .kpi-label { font-size: 11.5px; color: var(--dim); font-weight: 600; letter-spacing: .05em; margin-bottom: 7px; }
.stat-value, .kpi-value {
    font-family: var(--font-mono);
    font-size: 27px;
    font-weight: 600;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    background: linear-gradient(180deg, #fff, #b9c6d8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.kpi-sub { font-size: 11.5px; color: var(--dim); margin-top: 5px; }
.stat-bad { background: linear-gradient(180deg, #ffb1a8, var(--red)); -webkit-background-clip: text; background-clip: text; }
.stat-hot { background: linear-gradient(180deg, #ffe2b3, var(--amber)); -webkit-background-clip: text; background-clip: text; }
.stat-link { text-decoration: none; color: var(--text); display: block; transition: transform .18s cubic-bezier(.22,.8,.3,1), border-color .18s ease, background .18s ease; }
.stat-link:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); background: var(--card-hover); }

/* =============================== BUTTONS =================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: 11px;
    border: 1px solid var(--line-strong);
    background: rgba(255,255,255,.05);
    color: var(--text);
    font-family: var(--font);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: transform .12s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { background: rgba(255,255,255,.09); border-color: rgba(255,255,255,.22); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary {
    background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 92%, #fff), color-mix(in srgb, var(--brand) 80%, #063a35));
    border-color: transparent;
    color: #06201c;
    box-shadow: 0 4px 18px -4px color-mix(in srgb, var(--brand) 60%, transparent);
}
.btn-primary:hover { box-shadow: 0 6px 26px -4px color-mix(in srgb, var(--brand) 75%, transparent); background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 100%, #fff), var(--brand)); }
.btn-danger { background: rgba(244,119,107,.1); border-color: rgba(244,119,107,.4); color: #ffb1a8; }
.btn-danger:hover { background: rgba(244,119,107,.18); }
.btn-secondary { /* inherits .btn ghost look */ }
.btn-sm { padding: 6px 13px; font-size: 12.5px; border-radius: 9px; }
.btn-block { width: 100%; }
.btn-row, .btn-line { display: flex; align-items: center; gap: 10px; margin-top: 16px; flex-wrap: wrap; }

/* ================================ FORMS ==================================== */
.field, .f-input,
select.field, select.f-input, textarea.field, textarea.f-input {
    width: 100%;
    padding: 10px 14px;
    border-radius: 11px;
    border: 1px solid var(--line);
    background: rgba(0, 0, 0, .28);
    color: var(--text);
    font-family: var(--font);
    font-size: 13.5px;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.field:focus, .f-input:focus {
    outline: none;
    border-color: color-mix(in srgb, var(--brand) 65%, transparent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent);
}
.field::placeholder, .f-input::placeholder { color: var(--dim); }
select.field, select.f-input { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--dim) 50%), linear-gradient(135deg, var(--dim) 50%, transparent 50%); background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-inline-end: 34px; }
[dir="rtl"] select.field, [dir="rtl"] select.f-input { background-position: 18px 55%, 13px 55%; }
option { background: var(--ink-2); }
.field-label, .f-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-soft); margin: 12px 0 6px; letter-spacing: .02em; }
.field-color { padding: 5px; height: 42px; cursor: pointer; }
.form-row { display: flex; gap: 18px; flex-wrap: wrap; }
.form-col { flex: 1; min-width: 220px; }
.builder-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(235px, 1fr)); gap: 16px 24px; margin-bottom: 12px; }
.builder-col .f-label:first-child { margin-top: 0; }
.mono { font-family: var(--font-mono); font-size: 12.5px; }

.alert, .ok-box, .err-box, .form-msg { border-radius: 11px; font-size: 13px; }
.alert { padding: 11px 15px; margin-bottom: 14px; }
.ok-box, .err-box { padding: 11px 15px; margin-top: 12px; }
.form-msg { margin-top: 12px; min-height: 18px; padding: 0; }
.form-msg.msg-ok, .form-msg.msg-err { padding: 10px 14px; }
.alert-ok, .ok-box, .msg-ok { background: rgba(74,222,128,.09); border: 1px solid rgba(74,222,128,.32); color: #a9f0c1; }
.alert-err, .err-box, .msg-err { background: rgba(244,119,107,.09); border: 1px solid rgba(244,119,107,.35); color: #ffb1a8; }
.hint-inline { font-size: 12px; color: var(--dim); }

/* ================================ CHIPS ==================================== */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 13px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255,255,255,.035);
    color: var(--text-soft);
    font-size: 12.5px;
    font-family: var(--font);
    text-decoration: none;
}
.chip-ok { background: rgba(74,222,128,.1); border-color: rgba(74,222,128,.4); color: #a9f0c1; }
.chip-err { background: rgba(244,119,107,.1); border-color: rgba(244,119,107,.45); color: #ffb1a8; }
.chip-dim { color: var(--dim); }
.chip-group { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-sel, .chip-tab { cursor: pointer; user-select: none; transition: all .13s ease; }
.chip-sel:hover, .chip-tab:hover { border-color: var(--line-strong); color: var(--text); }
.chip-sel.active, .chip-tab.active {
    background: color-mix(in srgb, var(--brand) 15%, transparent);
    border-color: color-mix(in srgb, var(--brand) 65%, transparent);
    color: color-mix(in srgb, var(--brand) 75%, #fff);
    font-weight: 600;
    box-shadow: 0 0 12px -3px color-mix(in srgb, var(--brand) 55%, transparent);
}
.agent-channel-tabs, .mode-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.preset-row { display: flex; align-items: center; gap: 10px; margin: 14px 0 4px; flex-wrap: wrap; }
.preset-row .chip { cursor: pointer; }

/* platform dots */
.pdot, .conv-dot {
    display: inline-block;
    width: 9px; height: 9px;
    border-radius: 999px;
    flex: 0 0 auto;
    background: var(--dim);
    box-shadow: 0 0 8px -1px currentColor;
}
.pdot-telegram, .conv-telegram .conv-dot { background: #2fa8dd; color: #2fa8dd; }
.pdot-whatsapp, .conv-whatsapp .conv-dot { background: #2fca62; color: #2fca62; }
.pdot-messenger, .conv-messenger .conv-dot { background: #7a8cff; color: #7a8cff; }
.pdot-instagram, .conv-instagram .conv-dot { background: #ff5f8f; color: #ff5f8f; }
.pdot-manual { background: var(--dim); color: var(--dim); }
.pdot-web { background: var(--brand); color: var(--brand); }

/* =============================== SWITCHES ================================== */
.switch-wrap { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.switch-label { font-size: 11.5px; font-weight: 700; letter-spacing: .08em; color: var(--dim); }
.switch-wrap input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch {
    width: 42px; height: 23px;
    background: rgba(255,255,255,.1);
    border: 1px solid var(--line);
    border-radius: 999px;
    position: relative;
    transition: background .18s ease, border-color .18s ease;
    flex: 0 0 auto;
}
.switch::after {
    content: '';
    position: absolute;
    top: 2px; inset-inline-start: 3px;
    width: 17px; height: 17px;
    border-radius: 50%;
    background: #cfd8e6;
    transition: transform .2s cubic-bezier(.34,1.56,.64,1), background .18s ease;
}
.switch-wrap input:checked + .switch { background: color-mix(in srgb, var(--brand) 75%, #063a35); border-color: transparent; box-shadow: 0 0 14px -3px var(--brand); }
.switch-wrap input:checked + .switch::after { transform: translateX(18px); background: #fff; }
[dir="rtl"] .switch-wrap input:checked + .switch::after { transform: translateX(-18px); }
.switch-wrap input:disabled + .switch { opacity: .45; }

/* ================================ TABLES =================================== */
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
    text-align: start;
    padding: 10px 13px;
    color: var(--dim);
    font-weight: 600;
    font-size: 11px;
    letter-spacing: .09em;
    text-transform: uppercase;
    border-block-end: 1px solid var(--line-strong);
    white-space: nowrap;
}
.data-table td { padding: 11px 13px; border-block-end: 1px solid var(--line); vertical-align: middle; }
.data-table tbody tr { transition: background .12s ease; }
.data-table tbody tr:hover { background: rgba(255,255,255,.028); }
.data-table a { color: var(--brand); text-decoration: none; font-weight: 500; }
.data-table a:hover { text-decoration: underline; }
.td-dim { color: var(--dim); white-space: nowrap; font-size: 12.5px; }
.td-pot { max-width: 230px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.stage-select {
    background: rgba(255,255,255,.05);
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 5px 11px;
    font-size: 12px;
    font-family: var(--font);
    cursor: pointer;
}
.stage-select.stage-won { border-color: rgba(74,222,128,.55); color: var(--green); }
.stage-select.stage-lost { border-color: rgba(244,119,107,.5); color: var(--red); }
.stage-select.stage-qualified { border-color: rgba(110,168,254,.55); color: var(--blue); }
.crm-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.crm-search { max-width: 290px; }
.crm-select { max-width: 175px; }
.crm-spacer { flex: 1; }
.crm-pager { display: flex; align-items: center; gap: 12px; justify-content: center; margin-top: 16px; }

/* ================================ MODALS =================================== */
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
.cl-modal-back {
    position: fixed; inset: 0;
    background: rgba(4, 6, 10, .68);
    backdrop-filter: blur(6px);
    display: flex; align-items: center; justify-content: center;
    z-index: 90;
    padding: 16px;
}
.cl-modal {
    background: linear-gradient(180deg, #131a29, #0e1420);
    border: 1px solid var(--line-strong);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-2);
    padding: 22px 24px;
    width: 100%; max-width: 640px;
    max-height: 90vh; overflow-y: auto;
    animation: modalIn .25s cubic-bezier(.22,.8,.3,1);
}
.cl-modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.cl-modal-head h3 { margin: 0; font-size: 17px; }
.cl-modal-x { background: none; border: 0; color: var(--dim); font-size: 24px; cursor: pointer; line-height: 1; transition: color .15s ease, transform .15s ease; }
.cl-modal-x:hover { color: var(--text); transform: rotate(90deg); }

/* ================================ INBOX ==================================== */
.inbox-wrap {
    display: flex;
    gap: 0;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    overflow: hidden;
    background: var(--card);
    box-shadow: var(--shadow-1);
    height: calc(100vh - 170px);
    min-height: 480px;
}
.inbox-list-pane {
    width: 330px;
    flex: 0 0 330px;
    display: flex;
    flex-direction: column;
    border-inline-end: 1px solid var(--line);
    min-height: 0;
}
.inbox-search { padding: 13px 13px 9px; }
.inbox-filters { display: flex; gap: 6px; padding: 0 13px 11px; flex-wrap: wrap; }
.pf-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 11px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: transparent;
    color: var(--text-soft);
    font-size: 11.5px;
    font-family: var(--font);
    cursor: pointer;
    transition: all .13s ease;
}
.pf-btn:hover { border-color: var(--line-strong); }
.pf-btn.active {
    background: color-mix(in srgb, var(--brand) 14%, transparent);
    border-color: color-mix(in srgb, var(--brand) 60%, transparent);
    color: color-mix(in srgb, var(--brand) 75%, #fff);
    font-weight: 600;
}
.pf-badge {
    background: var(--red);
    color: #fff;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    min-width: 17px;
    height: 17px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    font-variant-numeric: tabular-nums;
}
.inbox-conversations { flex: 1; overflow-y: auto; min-height: 0; }
.conv-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 12px 14px;
    cursor: pointer;
    border-block-end: 1px solid var(--line);
    transition: background .13s ease;
    position: relative;
}
.conv-item:hover { background: rgba(255,255,255,.03); }
.conv-item.open { background: color-mix(in srgb, var(--brand) 9%, transparent); }
.conv-item.open::before {
    content: '';
    position: absolute;
    inset-inline-start: 0;
    top: 0; bottom: 0;
    width: 3px;
    background: var(--brand);
    box-shadow: 0 0 10px var(--brand);
}
.conv-main { flex: 1; min-width: 0; }
.conv-top, .conv-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.conv-name { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-time { font-size: 10.5px; color: var(--dim); flex: 0 0 auto; font-variant-numeric: tabular-nums; }
.conv-preview { font-size: 12px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-unread {
    background: var(--brand);
    color: #06201c;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px; height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    flex: 0 0 auto;
    box-shadow: 0 0 10px -2px var(--brand);
}
.conv-human { font-size: 12px; }
.inbox-empty { padding: 34px 18px; text-align: center; color: var(--dim); font-size: 13px; }

.inbox-thread-pane { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.thread-placeholder { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--dim); gap: 8px; }
.thread-view { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.thread-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 18px;
    border-block-end: 1px solid var(--line);
    background: rgba(255,255,255,.018);
    flex-wrap: wrap;
}
.thread-who { display: flex; align-items: center; gap: 11px; min-width: 0; }
.thread-name { font-weight: 700; font-size: 14.5px; }
.thread-channel { font-size: 11.5px; color: var(--dim); }
.thread-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bot-toggle { display: inline-flex; align-items: center; gap: 8px; }
.bot-state { font-size: 11px; font-weight: 700; letter-spacing: .06em; }
.bot-state.on { color: var(--green); }
.bot-state.off { color: var(--amber); }

.thread-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 20px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
    background:
        radial-gradient(700px 300px at 70% 0%, color-mix(in srgb, var(--brand) 4%, transparent), transparent 65%);
}
@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.msg { max-width: 72%; display: flex; flex-direction: column; gap: 3px; animation: msgIn .22s ease both; }
.msg-in { align-self: flex-start; align-items: flex-start; }
.msg-out { align-self: flex-end; align-items: flex-end; }
.msg-who { font-size: 10.5px; color: var(--dim); font-weight: 600; letter-spacing: .04em; padding: 0 4px; }
.msg-body {
    padding: 9px 14px;
    border-radius: 16px;
    font-size: 13.5px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    box-shadow: var(--shadow-1);
}
.msg-in .msg-body {
    background: rgba(255,255,255,.065);
    border: 1px solid var(--line);
    border-start-start-radius: 5px;
}
.msg-out .msg-body {
    background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 30%, #10251f), color-mix(in srgb, var(--brand) 16%, #0d1a18));
    border: 1px solid color-mix(in srgb, var(--brand) 35%, transparent);
    border-start-end-radius: 5px;
}
.msg-time { font-size: 10px; color: var(--dim); padding: 0 5px; font-variant-numeric: tabular-nums; }
.msg-failed .msg-body { border-color: rgba(244,119,107,.55); background: rgba(244,119,107,.08); }
.msg-failed .msg-time { color: var(--red); }

.thread-reply { display: flex; gap: 10px; padding: 13px 16px; border-block-start: 1px solid var(--line); align-items: flex-end; background: rgba(0,0,0,.15); }
.reply-input { flex: 1; resize: none; border-radius: 14px; }
.thread-hint { font-size: 10.5px; color: var(--dim); padding: 4px 18px 10px; }

/* ============================ AGENT BUILDER ================================ */
.int-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.int-meta { color: var(--text-soft); font-size: 13px; margin: -6px 0 12px; }
.int-actions { display: flex; gap: 10px; }
.prompt-preview-wrap { margin-top: 16px; }
.prompt-preview {
    background: rgba(0,0,0,.35);
    border: 1px solid var(--line);
    border-inline-start: 3px solid color-mix(in srgb, var(--brand) 60%, transparent);
    border-radius: 12px;
    padding: 15px 17px;
    font-size: 13px;
    line-height: 2;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 330px;
    overflow-y: auto;
    min-height: 70px;
    color: var(--text-soft);
    font-family: var(--font);
}

/* ============================== FOLLOW-UPS ================================= */
.fu-step {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 14px 16px;
    margin-top: 10px;
    background: rgba(255,255,255,.02);
    position: relative;
}
.fu-step::before {
    content: '';
    position: absolute;
    inset-inline-start: -1px;
    top: 14px; bottom: 14px;
    width: 3px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--brand) 55%, transparent);
}
.fu-step-head { display: flex; align-items: center; gap: 12px; margin-bottom: 9px; }
.fu-step-wait { font-size: 12px; color: var(--dim); display: inline-flex; align-items: center; gap: 6px; }
.fu-step-x { margin-inline-start: auto; color: var(--dim); text-decoration: none; font-size: 19px; transition: color .13s ease; }
.fu-step-x:hover { color: var(--red); }

/* =============================== DASHBOARD ================================= */
.channel-strip { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.channel-pill {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid var(--line);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    color: var(--text);
    background: rgba(255,255,255,.03);
    transition: transform .15s ease, border-color .15s ease;
}
.channel-pill:hover { transform: translateY(-2px); }
.channel-pill .pill-state { font-size: 11px; color: var(--dim); }
.channel-pill.on { border-color: color-mix(in srgb, var(--brand) 45%, transparent); box-shadow: 0 0 16px -6px color-mix(in srgb, var(--brand) 60%, transparent); }
.channel-pill.on .pill-state { color: var(--brand); font-weight: 600; }
.channel-pill.off { opacity: .55; }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(285px, 1fr)); gap: 16px; }
.pipe-row { display: flex; align-items: center; gap: 10px; margin-bottom: 11px; }
.pipe-label { width: 92px; font-size: 12px; color: var(--dim); flex: 0 0 auto; }
.pipe-bar-wrap { flex: 1; background: rgba(255,255,255,.05); border-radius: 999px; height: 9px; overflow: hidden; }
.pipe-bar { display: block; height: 100%; border-radius: 999px; background: var(--brand); box-shadow: 0 0 10px -2px var(--brand); transition: width .6s cubic-bezier(.22,.8,.3,1); }
.pipe-won { background: var(--green); box-shadow: 0 0 10px -2px var(--green); }
.pipe-lost { background: var(--red); box-shadow: none; opacity: .7; }
.pipe-qualified { background: var(--blue); box-shadow: 0 0 10px -2px var(--blue); }
.pipe-contacted { background: var(--amber); box-shadow: 0 0 10px -2px var(--amber); }
.pipe-count { width: 34px; text-align: end; font-size: 13px; font-weight: 600; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.ops-list { display: flex; flex-direction: column; gap: 3px; }
.ops-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 13px; border-radius: 11px; text-decoration: none; color: var(--text); font-size: 13px; transition: background .13s ease; }
.ops-row:hover { background: rgba(255,255,255,.05); }
.ops-row strong { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.activity-list { display: flex; flex-direction: column; gap: 9px; }
.activity-row { display: flex; gap: 10px; font-size: 12.5px; line-height: 1.55; }

/* ============================ LEADS / NOTES ================================ */
.lead-notes-wrap { margin-top: 16px; }
.lead-notes { max-height: 210px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.lead-note { background: rgba(255,255,255,.04); border: 1px solid var(--line); border-radius: 12px; padding: 9px 13px; font-size: 13px; line-height: 1.7; }
.lead-note-meta { font-size: 11px; color: var(--dim); margin-bottom: 3px; }
.note-add { display: flex; gap: 8px; }
.note-add .f-input { flex: 1; }
.lead-chip-inline { display: inline-flex; align-items: center; gap: 5px; text-decoration: none; }

/* =============================== PRIORITY ================================== */
.prio { font-size: 11.5px; padding: 3px 11px; border-radius: 999px; border: 1px solid var(--line); font-weight: 600; }
.prio-high { color: #ffb1a8; border-color: rgba(244,119,107,.5); background: rgba(244,119,107,.08); }
.prio-medium { color: #C6F24E; border-color: rgba(198,242,78,.4); background: rgba(198,242,78,.06); }
.prio-low { color: var(--dim); }
.task-done-row td { opacity: .5; text-decoration: line-through; }
.task-done-row td select, .task-done-row td .switch-wrap { text-decoration: none; }

/* =============================== LOGIN ===================================== */
.login-body { display: flex; align-items: center; justify-content: center; padding: 24px; }
@keyframes cardIn { from { opacity: 0; transform: translateY(18px) scale(.98); } to { opacity: 1; transform: none; } }
.login-card {
    width: 100%;
    max-width: 400px;
    background: linear-gradient(180deg, rgba(255,255,255,.045), rgba(255,255,255,.015));
    border: 1px solid var(--line-strong);
    border-radius: 24px;
    box-shadow: var(--shadow-2), 0 0 80px -30px color-mix(in srgb, var(--brand) 45%, transparent);
    padding: 34px 32px 26px;
    animation: cardIn .5s cubic-bezier(.22,.8,.3,1);
}
.login-brand { text-align: center; margin-bottom: 22px; }
.login-brand h1, .login-brand h2 { margin: 6px 0 2px; font-size: 22px; letter-spacing: -.02em; }
.login-brand p { margin: 0; color: var(--dim); font-size: 13px; }
.login-title { font-size: 20px; margin: 0 0 6px; }
.login-foot { text-align: center; margin-top: 18px; font-size: 12px; color: var(--dim); }
.powered-by { text-align: center; font-size: 11px; color: var(--dim); margin-top: 18px; opacity: .75; letter-spacing: .04em; }

/* ============================== RESPONSIVE ================================= */
@media (max-width: 960px) {
    .sidebar {
        position: fixed;
        inset-inline-start: 0;
        top: 0;
        z-index: 100;
        transform: translateX(calc(-100% - 2px));
        transition: transform .25s cubic-bezier(.22,.8,.3,1);
        background: var(--ink-1);
        box-shadow: var(--shadow-2);
    }
    [dir="rtl"] .sidebar { transform: translateX(calc(100% + 2px)); }
    .sidebar.open { transform: none; }
    .sidebar-overlay.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 99; backdrop-filter: blur(2px); }
    .burger { display: block; }
    .content { padding: 20px 14px 40px; }
    .topbar { padding: 11px 14px; }
    .inbox-wrap { flex-direction: column; height: auto; }
    .inbox-list-pane { width: 100%; flex: 0 0 auto; max-height: 42vh; border-inline-end: 0; border-block-end: 1px solid var(--line); }
    .inbox-thread-pane { min-height: 55vh; }
    .msg { max-width: 88%; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* -------- copy-row (webhook / verify token fields) -------- */
.copy-row { display: flex; gap: 8px; align-items: stretch; }
.copy-row .field { flex: 1; min-width: 0; }
.copy-btn {
    flex: 0 0 auto;
    padding: 0 16px;
    border-radius: var(--r-sm);
    border: 1px solid color-mix(in srgb, var(--brand) 40%, transparent);
    background: color-mix(in srgb, var(--brand) 12%, transparent);
    color: var(--text);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s ease;
}
.copy-btn:hover { background: color-mix(in srgb, var(--brand) 24%, transparent); }

/* Why a message did not arrive — the reason, not just a red mark. */
.msg-err{
    margin-top:6px;padding:6px 9px;border-radius:8px;font-size:11.5px;line-height:1.5;
    background:rgba(240,85,78,.10);border:1px solid rgba(240,85,78,.32);color:#f5a29c;
    word-break:break-word;
}

/* =========================================================================
   AI Inbox v2 — attention model, views, notes, quick replies, notifier
   ========================================================================= */

/* Fix: badges rendered server-side are empty until the first AJAX list call
   succeeds. Without this they painted as bare red dots on page load. */
.pf-badge { display: none; }
.pf-badge:empty { display: none !important; }

/* Unify badge colors: teal = unread (bot has it under control),
   red = a human is needed. One meaning per color, everywhere. */
.pf-badge {
    background: var(--brand);
    color: #06201c;
}
.conv-unread.urgent { background: var(--red); color: #fff; box-shadow: 0 0 10px -2px var(--red); }
.conv-unread.handled { background: rgba(255,255,255,.14); color: var(--text-soft); box-shadow: none; }

/* view tabs (All / Needs human / Mine / Closed) */
.inbox-views { display: flex; gap: 4px; padding: 12px 13px 8px; border-block-end: 1px solid var(--line); }
.view-tab {
    flex: 1;
    padding: 6px 4px;
    border: 0;
    border-radius: var(--r-sm, 8px);
    background: transparent;
    color: var(--text-soft);
    font-size: 11.5px;
    font-family: var(--font);
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: all .13s ease;
    white-space: nowrap;
}
.view-tab:hover { background: rgba(255,255,255,.04); }
.view-tab.active { background: color-mix(in srgb, var(--brand) 14%, transparent); color: color-mix(in srgb, var(--brand) 75%, #fff); }
.attn-badge {
    display: none;
    background: var(--red);
    color: #fff;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    min-width: 16px; height: 16px;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    font-variant-numeric: tabular-nums;
}
.attn-badge:empty { display: none !important; }

/* needs-human markers in the list */
.conv-item.attn { background: color-mix(in srgb, var(--red) 5%, transparent); }
.attn-dot {
    display: inline-block;
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--red);
    margin-inline-end: 6px;
    box-shadow: 0 0 8px var(--red);
    vertical-align: middle;
}
.conv-sender { color: var(--dim); font-size: 11px; }
.chip-closed { font-size: 10px; padding: 1px 7px; background: rgba(255,255,255,.08); color: var(--text-soft); border-radius: 999px; flex: 0 0 auto; }
.chip-attn {
    background: color-mix(in srgb, var(--red) 18%, transparent);
    color: color-mix(in srgb, var(--red) 80%, #fff);
    border: 1px solid color-mix(in srgb, var(--red) 45%, transparent);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    display: inline-flex;
    align-items: center;
}

/* thread body row: messages + notes side panel */
.thread-body-row { flex: 1; display: flex; min-height: 0; }
.thread-body-row .thread-messages { flex: 1; min-width: 0; }
.thread-notes {
    width: 250px;
    flex: 0 0 250px;
    border-inline-start: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    background: rgba(255,255,255,.015);
    min-height: 0;
}
.notes-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 12px; font-weight: 700; font-size: 12.5px;
    border-block-end: 1px solid var(--line);
}
.notes-x { border: 0; background: transparent; color: var(--dim); cursor: pointer; font-size: 13px; }
.notes-list { flex: 1; overflow-y: auto; padding: 8px 12px; min-height: 0; }
.note-item { padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-sm, 8px); margin-block-end: 8px; background: var(--card); }
.note-txt { font-size: 12.5px; white-space: pre-wrap; word-break: break-word; }
.note-meta { font-size: 10.5px; color: var(--dim); margin-block-start: 5px; }
.notes-add { padding: 10px 12px; border-block-start: 1px solid var(--line); display: flex; flex-direction: column; gap: 7px; }

/* day separators inside a thread */
.day-sep {
    display: flex; align-items: center; gap: 10px;
    margin: 14px 0 10px;
    color: var(--dim); font-size: 11px;
}
.day-sep::before, .day-sep::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.day-sep span { padding: 2px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); }

/* optimistic sending bubble */
.msg-sending { opacity: .55; }
.msg-sending .msg-time { font-style: italic; }

/* media chips in message bodies */
.media-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px;
    border: 1px solid var(--line-strong, var(--line));
    border-radius: 999px;
    background: rgba(255,255,255,.05);
    font-size: 12px;
}
.media-caption { margin-block-start: 5px; font-size: 12.5px; }
.media-img { max-width: 240px; max-height: 200px; border-radius: 8px; margin-block-start: 6px; display: block; }
.media-audio { margin-block-start: 6px; max-width: 240px; }
.media-link { color: var(--brand); font-size: 12px; text-decoration: none; }
.media-link:hover { text-decoration: underline; }

/* failed message retry */
.btn-xs { padding: 1px 8px; font-size: 10.5px; border-radius: 6px; border: 1px solid var(--line-strong, var(--line)); background: transparent; color: inherit; cursor: pointer; }
.btn-xs:hover { border-color: var(--red); }

/* quick replies panel */
.qr-panel { border-block-start: 1px solid var(--line); background: rgba(255,255,255,.015); max-height: 220px; overflow-y: auto; }
.qr-list { padding: 8px 12px 4px; }
.qr-item {
    display: flex; align-items: center; gap: 9px;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm, 8px);
    margin-block-end: 6px;
    cursor: pointer;
    transition: border-color .13s ease;
}
.qr-item:hover { border-color: var(--brand); }
.qr-title { font-weight: 700; font-size: 12px; flex: 0 0 auto; }
.qr-preview { font-size: 11.5px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.qr-del { border: 0; background: transparent; color: var(--dim); cursor: pointer; flex: 0 0 auto; }
.qr-del:hover { color: var(--red); }
.qr-hint { padding: 10px 12px; color: var(--dim); font-size: 12px; }
.qr-add { display: flex; gap: 7px; padding: 4px 12px 10px; }
.qr-add .field { flex: 1; }

/* reply toolbar buttons */
.reply-tool { flex: 0 0 auto; align-self: flex-end; }
.field-sm { padding: 5px 9px; font-size: 12px; max-width: 150px; }

/* thread header: mobile back button hidden on desktop */
.thread-back { display: none; }
.thread-who-txt { min-width: 0; }

/* sidebar nav unread badge */
.nav-badge {
    display: none;
    background: var(--brand);
    color: #06201c;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    min-width: 18px; height: 18px;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    margin-inline-start: auto;
    font-variant-numeric: tabular-nums;
    box-shadow: 0 0 10px -2px var(--brand);
}
.nav-badge:empty { display: none !important; }
body.side-min .nav-badge {
    position: absolute;
    inset-inline-end: 6px;
    top: 6px;
    min-width: 14px; height: 14px;
    font-size: 8.5px;
    padding: 0 3px;
}

/* topbar bell */
.bell-btn { position: relative; }
.bell-btn.on { color: var(--brand); }
.bell-state { position: absolute; top: 4px; inset-inline-end: 6px; color: var(--dim); font-size: 16px; line-height: 8px; }

/* mobile: list <-> thread toggle instead of two stacked panes */
@media (max-width: 960px) {
    .thread-back { display: inline-flex; }
    .inbox-wrap { position: relative; }
    .inbox-wrap .inbox-list-pane { max-height: none; flex: 1; border-block-end: 0; }
    .inbox-wrap .inbox-thread-pane { display: none; }
    .inbox-wrap.show-thread .inbox-list-pane { display: none; }
    .inbox-wrap.show-thread .inbox-thread-pane { display: flex; min-height: 70vh; }
    .thread-notes { position: absolute; inset: 0; width: auto; flex: 1 1 auto; z-index: 5; background: var(--card); }
}

/* ==================== Growth engine ==================== */

/* Campaigns */
.bc-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.bc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 960px) { .bc-grid { grid-template-columns: 1fr; } }
.bc-tpl-preview { background: var(--panel-2, #f4f6f8); border-radius: 8px; padding: 10px 12px; margin-top: 8px; font-size: 13px; white-space: pre-wrap; min-height: 20px; }
.bc-preview-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.tpl-body-cell { max-width: 340px; white-space: pre-wrap; font-size: 12.5px; }
.chip-bad { background: #fee2e2; color: #b91c1c; }
.card-title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-subtitle { font-size: 14px; margin: 18px 0 8px; opacity: .85; }
.cb-row { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; }

/* Inbox commerce: product picker + payment link */
.prod-panel, .pay-panel { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--border, #e5e7eb); background: var(--panel, #fff); }
.prod-panel { flex-direction: column; }
.prod-list { max-height: 220px; overflow-y: auto; }
.prod-item { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; cursor: pointer; }
.prod-item:hover { background: var(--panel-2, #f4f6f8); }
.prod-thumb { width: 34px; height: 34px; border-radius: 6px; object-fit: cover; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; background: var(--panel-2, #f4f6f8); }
.prod-name { flex: 1; font-size: 13.5px; }
.prod-price { font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.pay-panel .field-sm { flex: 1; min-width: 120px; }
.chip-ad { background: #ede9fe; color: #6d28d9; }

/* Suite overview */
.suite-row { flex-wrap: wrap; }
.suite-row .stat-card { min-width: 140px; }
