* {
    box-sizing: border-box;
}

:root {
    --bg: #f6f8fa;
    --surface: #ffffff;
    --line: #e4e9ed;
    --muted: #687782;
    --text: #17212b;
    --soft: #eef7f2;
    --shadow: 0 14px 34px rgba(15, 23, 42, .08);
}

body {
    margin: 0;
    overflow: hidden;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, Segoe UI, Arial, Helvetica, sans-serif;
}

a {
    color: inherit;
    text-decoration: none;
}

.app-shell {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    height: 100vh;
    overflow: hidden;
    transition: grid-template-columns .18s ease;
}

.app-shell.sidebar-collapsed {
    grid-template-columns: 82px minmax(0, 1fr);
}

.sidebar {
    height: 100vh;
    overflow-y: auto;
    background: #0f1720;
    color: #d9e5e1;
    border-right: 1px solid #1f2c36;
    padding: 16px 12px;
}

.sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 44px;
    margin-bottom: 18px;
}


.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    font-size: 19px;
    font-weight: 800;
}

.brand img {
    width: 38px;
    height: 38px;
    object-fit: contain;
}

.brand-mark {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--brand-accent);
    color: #063d34;
    font-weight: 900;
}

.brand-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-toggle {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 10px;
    background: rgba(255,255,255,.06);
    color: #ffffff;
    cursor: pointer;
}

.nav {
    display: grid;
    gap: 6px;
}

.nav a {
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 42px;
    padding: 0 10px;
    border-radius: 10px;
    color: #afbfba;
    font-size: 14px;
    font-weight: 700;
}

.nav a.active,
.nav a:hover {
    background: rgba(37, 211, 102, .13);
    color: #ffffff;
}

.nav-icon {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: rgba(255,255,255,.08);
    color: var(--brand-accent);
    font-size: 12px;
    font-weight: 900;
}

.nav-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-collapsed .brand-text,
.sidebar-collapsed .nav-label {
    display: none;
}

.sidebar-collapsed .sidebar-head {
    justify-content: center;
    gap: 0;
}

.sidebar-collapsed .brand {
    display: none;
}

.sidebar-collapsed .sidebar-toggle {
    width: 42px;
}

.sidebar-collapsed .nav a {
    justify-content: center;
    padding: 0;
}

.main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100vh;
    overflow: hidden;
    background: var(--bg);
}

.topbar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 92px;
    margin: 0;
    padding: 18px 26px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 8px 22px rgba(15, 23, 42, .04);
}

.topbar-copy {
    min-width: 0;
}

.header-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 9px;
    margin-bottom: 7px;
    border-radius: 999px;
    background: var(--soft);
    color: var(--brand-primary);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

h1 {
    margin: 0;
    font-size: 26px;
    letter-spacing: 0;
}

.topbar-copy p,
.eyebrow {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.4;
}

.topbar-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    position: relative;
}

.topbar-actions { display:flex; align-items:center; gap:12px; }
.vps-indicator { display:flex; align-items:center; gap:7px; color:var(--muted); font-size:12px; font-weight:900; }
.vps-indicator.pending { visibility:hidden; }
.vps-indicator i { position:relative; width:11px; height:11px; border-radius:50%; background:#f79009; }
.vps-indicator.online i { background:#12b76a; box-shadow:0 0 0 3px #d1fadf; }
.vps-indicator.offline i { background:#f04438; box-shadow:0 0 0 3px #fee4e2; }
.vps-indicator.inactive i { border-radius:3px; background:#f79009; box-shadow:0 0 0 3px #fef0c7; }
.vps-indicator.offline i::after { content:"×"; position:absolute; top:-7px; left:1px; color:#fff; font-size:10px; font-style:normal; }
.vps-indicator.inactive i::after { content:"⏻"; position:absolute; top:-6px; left:1px; color:#fff; font-size:10px; font-style:normal; }
.header-plan-pill {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 48px;
    max-width: 270px;
    padding: 6px 7px 6px 9px;
    border: 1px solid #d8f0e7;
    border-radius: 999px;
    background: #f4fbf8;
}

.header-plan-icon {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 31px;
    height: 31px;
    border-radius: 50%;
    background: #dff8ee;
    color: var(--brand-primary);
    font-size: 13px;
    font-weight: 900;
}

.header-plan-copy {
    display: grid;
    min-width: 0;
    gap: 1px;
}

.header-plan-copy strong {
    overflow: hidden;
    color: var(--text);
    font-size: 13px;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-plan-copy small {
    overflow: hidden;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-upgrade-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    flex: 0 0 auto;
    min-height: 32px;
    padding: 0 10px;
    border: 1px solid #b7ebc6;
    border-radius: 999px;
    background: #ecfdf3;
    color: #067647;
    font-size: 12px;
    font-weight: 900;
    text-decoration: none;
}

.header-upgrade-btn svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.header-upgrade-btn:hover {
    background: #d1fadf;
    color: #05603a;
}

.pwa-install-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 38px;
    padding: 0 12px;
    border: 1px solid #b2ddff;
    border-radius: 999px;
    background: #eff8ff;
    color: #175cd3;
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
}

.pwa-install-btn:hover {
    border-color: #84caff;
    background: #d1e9ff;
}

.pwa-install-btn svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.1;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.pwa-install-btn[hidden] { display:none !important; }
.template-modal { position:relative; width:min(760px,100%); max-height:90vh; overflow:auto; padding:22px; border-radius:10px; background:#fff; box-shadow:var(--shadow); }
.template-modal h2 { margin-top:0; }
.template-editor-modal { position:relative; width:min(1180px,100%); max-height:92vh; overflow:auto; border-radius:10px; background:#fff; box-shadow:var(--shadow); }
.template-editor-header { display:flex; position:sticky; top:0; z-index:4; align-items:center; justify-content:space-between; min-height:58px; padding:0 18px 0 22px; border-bottom:1px solid var(--line); background:#fff; }
.template-editor-header h2 { margin:0; font-size:20px; }
.template-editor-header .modal-close { position:static; flex:0 0 auto; }
.template-editor-modal > .form-grid,
.template-editor-modal > form.form-grid { padding:16px 20px 20px; }
.template-editor-grid { display:grid; grid-template-columns:minmax(0,1fr) 280px; }
.template-builder { padding:22px; }
.phone-preview { position:sticky; top:58px; align-self:start; height:calc(92vh - 58px); min-height:420px; overflow:auto; padding:14px; background:#efeae2; }
.dynamic-section { padding:14px; border:1px solid var(--line); border-radius:8px; }
.dynamic-section.full { grid-column:1/-1; }
[hidden] { display:none !important; }
.media-fields { display:grid; grid-template-columns:160px minmax(0,1fr); gap:12px; }
.field.message-toolbar { display:flex; position:relative; flex-flow:row nowrap; align-items:center; gap:6px; margin-top:-8px; overflow:visible; }
.message-toolbar button { display:grid; place-items:center; width:34px; height:32px; border:1px solid var(--line); border-radius:7px; background:#fff; color:var(--text); cursor:pointer; font-size:14px; }
.message-toolbar button:hover { border-color:#8ac9ba; background:#f2fbf8; color:var(--brand-primary); }
.emoji-menu { position:relative; }
.emoji-panel { display:none; position:absolute; top:38px; left:0; z-index:8; width:286px; max-height:248px; overflow-y:auto; grid-template-columns:repeat(7,34px); gap:4px; padding:7px; border:1px solid var(--line); border-radius:8px; background:#fff; box-shadow:var(--shadow); }
.emoji-panel.open { display:grid; }
.emoji-panel button { border:0; font-size:18px; }
.media-source-row { display:grid; grid-template-columns:minmax(0,1fr) 42px; gap:7px; }
.media-upload-btn { display:grid; place-items:center; width:42px; border:1px solid #d6dfdc; border-radius:8px; background:#fff; color:var(--brand-primary); cursor:pointer; }
.media-upload-btn:hover { border-color:#8ac9ba; background:#f2fbf8; }
.media-upload-btn input { display:none; }
.media-upload-btn svg { width:20px; height:20px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
.dynamic-row { display:grid; grid-template-columns:150px minmax(0,1fr) minmax(0,1fr) 40px; gap:8px; margin-top:8px; }
.variable-row { grid-template-columns:84px minmax(0,1fr) 40px; }
.variable-token { display:grid; place-items:center; border:1px solid #b9dad1; border-radius:8px; background:#ecfdf3; color:var(--brand-primary); font-weight:900; }
.template-body { min-height:100px; padding:12px; border-radius:8px; background:#f8faf9; font-size:14px; line-height:1.5; }
.template-icon-summary { display:flex; gap:7px; }
.template-mini-icon { display:grid; place-items:center; width:26px; height:26px; border-radius:50%; background:#ecfdf3; color:#087b65; }
.template-mini-icon svg { width:15px; height:15px; fill:none; stroke:currentColor; stroke-width:2.2; stroke-linecap:round; stroke-linejoin:round; }
.check-field { display:flex; grid-column:1/-1; align-items:center; gap:9px; }
.check-field input { width:auto; }
.settings-tabs { display:flex; gap:18px; overflow-x:auto; margin:4px 0 18px; border-bottom:1px solid var(--line); }
.settings-tab { padding:12px 2px; border:0; border-bottom:2px solid transparent; background:transparent; color:var(--muted); cursor:pointer; font-weight:800; white-space:nowrap; }
.settings-tab.active { border-bottom-color:var(--brand-primary); color:var(--brand-primary); }
.settings-pane { display:none; }
.settings-pane.active { display:block; }
.settings-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
.settings-grid.three { grid-template-columns:repeat(3,minmax(0,1fr)); }
.settings-box { display:grid; gap:12px; padding:15px; border:1px solid var(--line); border-radius:8px; background:#fff; }
.settings-box h3 { margin:0; font-size:15px; }
.storage-overview { grid-row:span 2; }
.storage-used { display:grid; gap:2px; }
.storage-used strong { font-size:26px; line-height:1; }
.storage-used span, .storage-available { color:var(--muted); font-size:13px; }
.storage-bar { display:flex; overflow:hidden; height:16px; border-radius:999px; background:#e4e7ec; }
.storage-bar span { min-width:3px; }
.storage-list { display:grid; gap:10px; padding-top:4px; border-top:1px solid var(--line); }
.storage-list label { display:grid; grid-template-columns:18px 16px minmax(0,1fr) auto 42px; align-items:center; gap:8px; font-size:13px; cursor:pointer; }
.storage-list input { width:15px; height:15px; accent-color:#2e90fa; }
.storage-list strong { font-size:13px; text-align:right; }
.storage-list em { color:var(--muted); font-style:normal; text-align:right; }
.storage-dot { width:10px; height:10px; border-radius:50%; box-shadow:0 0 0 4px #f2f4f7; }
.storage-clear-footer { display:flex; align-items:center; justify-content:space-between; gap:12px; padding-top:12px; border-top:1px solid var(--line); color:var(--muted); font-size:13px; }
.contacts-workspace { gap:16px; }
.contacts-main-card { min-width:0; }
.contacts-workspace .topbar-actions { flex-wrap:wrap; justify-content:flex-end; }
.contact-tabs { margin-top:16px; }
.contact-tabs .settings-tab { display:inline-flex; align-items:center; gap:8px; }
.table-wrap { width:100%; overflow:auto; }
.table td small { display:block; margin-top:3px; color:var(--muted); font-size:12px; }
.group-chip-list { display:grid; gap:10px; }
.group-chip-card { display:grid; gap:8px; padding:12px; border:1px solid var(--line); border-radius:8px; background:#f8fafc; }
.group-chip-card div:first-child { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.group-chip-card strong { font-size:14px; }
.group-chip-card span, .group-chip-card p { margin:0; color:var(--muted); font-size:12px; }
.compact-editor { width:min(720px,calc(100vw - 28px)); }
.small-modal { width:min(520px,calc(100vw - 28px)); }
.icon-btn { min-width:38px; padding:8px 10px; }
.contacts-workspace .icon-btn { width:38px; height:38px; border:1px solid var(--line); background:#fff; }
.contacts-workspace .danger-btn.icon-btn { border-color:#ffd5d2; background:#fff5f4; }
.contacts-workspace .form-grid { gap:16px; }
.contacts-workspace .field { gap:8px; }
.slim-btn { min-height:38px; padding:0 13px; border-radius:8px; }
.sample-csv-btn { border-color:#b7ebc6; background:#f0fff5; color:#067647; }
.import-csv-btn { border-color:#b2ddff; background:#eff8ff; color:#175cd3; }
.form-submit-btn { grid-column:1/-1; width:max-content; min-width:190px; justify-self:start; min-height:42px; padding:0 18px; }
.list-footer { display:flex; align-items:center; justify-content:space-between; gap:12px; padding-top:12px; border-top:1px solid var(--line); }
.list-footer strong { color:var(--muted); font-size:13px; }
.list-footer strong span { display:inline-grid; place-items:center; min-width:28px; min-height:24px; margin-left:5px; border-radius:999px; background:#ecfdf3; color:#027a48; }
.pagination-lite { display:flex; align-items:center; gap:6px; }
.pagination-lite button, .pagination-lite span { display:grid; place-items:center; width:30px; height:30px; border:1px solid var(--line); border-radius:8px; background:#fff; color:var(--muted); }
.pagination-lite span { border-color:#b7ebc6; background:#f0fff5; color:#067647; font-weight:800; }
.combo-multi { position:relative; display:grid; gap:7px; }
.combo-control { display:flex; flex-wrap:wrap; align-items:center; gap:6px; min-height:42px; padding:6px 8px; border:1px solid #d6dfdc; border-radius:8px; background:#fff; }
.combo-control input { flex:1 1 160px; min-width:120px; border:0; padding:5px 2px; outline:0; }
.combo-toggle { display:grid; place-items:center; flex:0 0 auto; width:28px; height:28px; border:0; border-radius:6px; background:#f2f4f7; color:var(--muted); cursor:pointer; font-size:16px; line-height:1; }
.combo-toggle:hover { background:#ecfdf3; color:#067647; }
.combo-rotation-off .combo-control { background:#f8fafc; }
.combo-rotation-off .combo-control input { color:var(--muted); }
.combo-single .combo-chip { background:#ecfdf3; color:#067647; }
.combo-chips { display:flex; flex-wrap:wrap; gap:6px; }
.combo-chip { display:inline-flex; align-items:center; gap:6px; padding:5px 8px; border-radius:999px; background:#eff8ff; color:#175cd3; font-size:12px; font-weight:700; }
.combo-chip button { display:grid; place-items:center; width:16px; height:16px; padding:0; border:0; border-radius:50%; background:#d1e9ff; color:#175cd3; cursor:pointer; }
.combo-options { display:none; position:absolute; z-index:12; top:100%; left:0; right:0; max-height:170px; overflow:auto; border:1px solid var(--line); border-radius:8px; background:#fff; box-shadow:var(--shadow); }
.combo-multi.open .combo-options { display:block; }
.combo-option { display:flex; align-items:center; justify-content:space-between; width:100%; min-height:36px; padding:7px 10px; border:0; background:#fff; color:var(--text); text-align:left; cursor:pointer; }
.combo-option:hover, .combo-option.selected { background:#eff8ff; color:#175cd3; }
.combo-empty { padding:9px 10px; color:var(--muted); font-size:13px; }
.campaign-builder { align-items:start; grid-template-columns:minmax(0,1fr) 300px; overflow:visible; }
.campaign-form-panel { min-width:0; width:100%; align-content:start; overflow:visible; padding:14px 14px 18px 18px; }
.campaign-form-panel > * { min-width:0; max-width:100%; }
.campaign-form-panel > .field:not(.full) { align-self:stretch; }
.campaign-form-panel > .field:not(.full) input,
.campaign-form-panel > .field:not(.full) .combo-control { min-height:42px; }
.campaign-split { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.campaign-two-cards { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:14px; align-items:start; }
.sub-card { display:grid; min-width:0; max-width:100%; gap:14px; padding:15px; border:1px solid var(--line); border-radius:8px; background:#fff; }
.sub-card .section-title { margin-bottom:0; }
.campaign-options { display:flex; flex-wrap:wrap; gap:10px 18px; }
.field-title-row { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.inline-toggle { display:inline-flex; align-items:center; gap:7px; color:var(--muted); font-size:12px; font-weight:600; white-space:nowrap; cursor:pointer; }
.inline-toggle input { width:auto; accent-color:var(--brand-primary); }
.select-search { margin-bottom:8px; }
.selected-chip-row { display:flex; flex-wrap:wrap; gap:6px; min-height:0; }
.selected-chip { display:inline-flex; align-items:center; max-width:100%; padding:5px 9px; border-radius:999px; background:#e7f8ff; color:#075985; font-size:12px; line-height:1.2; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.segmented-control { display:inline-flex; width:max-content; max-width:100%; padding:4px; border:1px solid var(--line); border-radius:8px; background:#f8fafc; gap:4px; }
.segmented-control label { cursor:pointer; }
.segmented-control input { position:absolute; opacity:0; pointer-events:none; }
.segmented-control span { display:block; padding:8px 14px; border-radius:6px; color:var(--muted); font-weight:800; font-size:13px; }
.segmented-control input:checked + span { background:#fff; color:var(--primary); box-shadow:0 1px 4px rgba(15,23,42,.08); }
.campaign-preview { position:sticky; top:58px; min-height:420px; height:auto; align-self:start; overflow:hidden; }
.campaign-preview .chat-window { overflow:hidden; }
.campaign-preview .bubble { max-height:100%; }
.campaign-submit { display:flex; justify-content:flex-end; }
.preview-delivery-settings { margin-top:14px; padding:12px; border:1px solid var(--line); border-radius:8px; background:#fff; }
.preview-delivery-settings h3 { margin:0 0 10px; font-size:14px; }
.media-placeholder { display:grid; place-items:center; min-height:80px; padding:12px; border-radius:6px; background:#d8dedb; color:#344054; font-weight:800; font-size:13px; }
.campaign-variable-tools { align-items:end; }
.campaign-launch { display:flex; align-items:center; justify-content:space-between; gap:14px; padding:16px; border:1px solid var(--line); border-radius:8px; background:#fff; }
.compatibility-note { display:grid; gap:4px; margin-bottom:12px; padding:11px 12px; border:1px solid #fedf89; border-radius:8px; background:#fffaeb; color:#7a2e0e; font-size:12px; line-height:1.45; }
.compatibility-note strong { font-size:13px; color:#93370d; }
.compatibility-note span { color:#7a2e0e; }
.campaign-launch h3 { margin:0 0 4px; }
.campaign-card-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(280px,360px)); gap:14px; margin-top:16px; }
.campaign-status-card { display:grid; gap:12px; padding:16px; border:1px solid var(--line); border-radius:8px; background:#fff; }
.campaign-status-card h3 { margin:0; }
.billing-plan-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(260px,1fr)); gap:14px; margin:16px 0; }
.billing-plan-card { display:grid; position:relative; grid-template-columns:28px minmax(0,1fr); gap:12px; min-height:170px; padding:16px; border:1px solid var(--line); border-radius:8px; background:#fff; cursor:pointer; transition:border-color .16s ease, box-shadow .16s ease, background .16s ease; }
.billing-plan-card:hover { border-color:#a9dccc; background:#fbfffd; }
.billing-plan-card.selected { border-color:#12b76a; background:#f0fff6; box-shadow:0 10px 24px rgba(7,118,88,.08); }
.billing-plan-card input { position:absolute; opacity:0; pointer-events:none; }
.billing-plan-check { display:grid; place-items:center; width:22px; height:22px; margin-top:2px; border:2px solid #cfdad6; border-radius:50%; background:#fff; }
.billing-plan-card.selected .billing-plan-check { border-color:#12b76a; box-shadow:inset 0 0 0 5px #fff; background:#12b76a; }
.billing-plan-body { display:grid; gap:7px; min-width:0; color:#344054; font-size:13px; }
.billing-plan-body strong { color:var(--text); font-size:18px; }
.billing-price { color:#087b65; font-size:20px; font-weight:900; }
.billing-price small { color:var(--muted); font-size:12px; font-weight:700; }
.billing-plan-body em { color:var(--muted); font-style:normal; line-height:1.45; }
.billing-payment-panel { display:none; margin-top:14px; padding:16px; border:1px solid var(--line); border-radius:8px; background:#fff; }
.billing-payment-panel.active { display:block; }
.billing-payment-grid { display:grid; grid-template-columns:280px minmax(0,1fr); gap:18px; align-items:start; }
.billing-qr-box { display:grid; gap:9px; align-content:start; padding:14px; border:1px solid #d8f0e7; border-radius:8px; background:#f8fffb; }
.billing-qr-box img { width:190px; height:190px; padding:8px; border:1px solid #dbe7e3; border-radius:8px; background:#fff; }
.billing-qr-box strong { font-size:16px; }
.billing-request-form { align-self:start; margin:0; }
.campaign-progress { overflow:hidden; height:10px; border-radius:999px; background:#e4e7ec; }
.campaign-progress span { display:block; height:100%; border-radius:inherit; background:#087b65; }
.campaign-modal { width:min(1100px,calc(100vw - 28px)); max-height:92vh; overflow-y:auto; overflow-x:hidden; }
.campaign-modal .campaign-form-panel { max-height:none; }
.campaign-modal .campaign-preview { top:0; height:auto; }
.campaign-editor-header { gap:12px; }
.campaign-header-actions { display:flex; align-items:center; gap:8px; margin-left:auto; }
.campaign-header-actions .modal-close { position:static; }
.campaign-footer-actions { display:flex; align-items:center; justify-content:flex-start; flex-wrap:nowrap; gap:10px; min-width:0; padding:13px; border:1px solid var(--line); border-radius:8px; background:#fff; }
.campaign-footer-actions .segmented-control { flex:0 0 auto; }
.campaign-footer-actions .schedule-header-input { flex:0 1 190px; width:190px; min-width:170px; }
.campaign-footer-actions .primary-btn { flex:0 0 auto; }
.compact-segment span { padding:7px 11px; }
.schedule-header-input { min-height:36px; max-width:190px; padding:0 9px; border:1px solid var(--line); border-radius:8px; }
.campaign-builder select[multiple] { min-height:76px; padding:8px; }
.campaign-builder select[multiple] option { padding:7px 9px; border-radius:6px; margin:2px 0; }
.campaign-builder select[multiple] option:checked { background:#dff8ee; color:#075e54; font-weight:800; }
.campaign-builder .segmented-control { background:#edf7ff; border-color:#bfdbfe; }
.campaign-builder .segmented-control input:checked + span { background:#087b65; color:#fff; }
.campaign-builder [data-recipient-source] + span { min-width:130px; text-align:center; }
.campaign-builder [data-message-mode] + span { min-width:142px; text-align:center; }
.campaign-modal .field > span,
.campaign-modal input,
.campaign-modal textarea,
.campaign-modal select { font-weight:400; }
.campaign-modal textarea { max-height:150px; }
.campaign-message-card textarea[name="custom_body"] { min-height:96px; }
.campaign-message-card .dynamic-section { max-width:100%; }
.custom-template-save { display:flex; align-items:end; gap:12px; flex-wrap:wrap; }
.custom-template-save .check-field { flex:0 0 auto; min-height:42px; }
.custom-template-save .field { flex:1 1 260px; }
.campaign-modal .segmented-control span,
.campaign-modal h2,
.campaign-modal h3,
.campaign-modal .primary-btn,
.campaign-modal .ghost-btn,
.campaign-modal .danger-btn { font-weight:800; }
.mini-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
.mini-grid.three { grid-template-columns:repeat(3,minmax(0,1fr)); }
.recipient-list-card { min-width:0; max-width:100%; margin-top:2px; padding:12px; border:1px solid var(--line); border-radius:8px; background:#fbfcfc; }
.recipient-list-card .section-title { margin-bottom:8px; }
.recipient-list-card .table-wrap { max-height:208px; border:1px solid #edf1ef; border-radius:8px; background:#fff; }
.recipient-list-card table { min-width:720px; }
.compact-table th, .compact-table td { padding:9px 10px; font-size:13px; }
.manual-import-modal { width:min(700px,calc(100vw - 28px)); }
.manual-import-body { display:grid; gap:8px; padding:16px 22px 20px; }
.manual-import-body textarea { min-height:145px; }
.manual-file-btn { width:max-content; }
.manual-import-table { min-height:210px; max-height:260px; border:1px solid var(--line); border-radius:8px; background:#fff; }
.manual-import-table table { min-width:760px; }
.compact-table td[contenteditable="true"] { min-width:110px; background:#fff; outline:0; }
.compact-table td[contenteditable="true"]:focus { box-shadow:inset 0 0 0 2px #8ac9ba; border-radius:6px; }
.manual-import-body .confirm-actions { justify-content:flex-end; }
.recipient-list-card .icon-btn, .manual-import-table .icon-btn { width:32px; height:32px; }
.settings-save { margin-top:16px; }
@media (max-width: 820px) { .template-editor-grid { grid-template-columns:1fr; } .campaign-builder { grid-template-columns:1fr; height:auto; overflow:auto; } .campaign-form-panel { height:auto; max-height:none; overflow:visible; padding:16px; } .phone-preview { position:static; height:auto; min-height:360px; } .campaign-preview { height:auto; min-height:360px; overflow:hidden; } .media-fields, .dynamic-row, .settings-grid, .settings-grid.three, .mini-grid.three, .campaign-split, .campaign-two-cards { grid-template-columns:1fr; } }
@media (max-width: 920px) { .contacts-layout { grid-template-columns:1fr; } }
@media (max-width: 820px) { .campaign-editor-header { align-items:flex-start; padding:12px 14px; } .campaign-header-actions { flex-wrap:wrap; margin-left:auto; } .campaign-footer-actions { justify-content:flex-start; flex-wrap:wrap; } .schedule-header-input { max-width:100%; flex:1 1 180px; } }

.user-avatar {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    background: var(--brand-primary);
    color: #ffffff;
    font-weight: 900;
}

.user-avatar-img {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    object-fit: cover;
    border: 2px solid #ffffff;
}

.user-meta {
    display: grid;
    gap: 2px;
}

.user-meta strong {
    font-size: 14px;
}

.user-meta small {
    color: var(--muted);
    font-size: 12px;
}

.profile-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 5px 8px 5px 5px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #ffffff;
    cursor: pointer;
}

.profile-caret {
    color: var(--muted);
    font-size: 13px;
    font-weight: 900;
}

.profile-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 170px;
    padding: 7px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #ffffff;
    box-shadow: var(--shadow);
    z-index: 20;
}

.profile-menu.open .profile-dropdown {
    display: grid;
}

.profile-dropdown a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 11px;
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    font-weight: 800;
}

.profile-dropdown a:hover {
    background: var(--soft);
    color: var(--brand-primary);
}

.profile-plan-summary {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 5px;
    padding: 10px 11px;
    border: 1px solid #d8f0e7;
    border-radius: 8px;
    background: #f2fbf8;
}

.profile-plan-summary .plan-icon {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    border-radius: 7px;
    background: #dff8ee;
    color: var(--brand-primary);
    font-size: 13px;
    font-weight: 900;
}

.profile-plan-summary span:last-child {
    display: grid;
    min-width: 0;
    gap: 2px;
    flex: 1 1 auto;
}

.profile-plan-summary small {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
}

.profile-plan-summary strong {
    overflow: hidden;
    color: var(--text);
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-upgrade-link {
    flex: 0 0 auto;
    min-height: 30px;
    padding: 0 9px !important;
    border-radius: 7px !important;
    background: #dff8ee;
    color: #067647 !important;
    font-size: 12px !important;
    white-space: nowrap;
}

.profile-upgrade-link:hover {
    background: #d1fadf !important;
    color: #05603a !important;
}

.logout-link {
    min-height: 34px;
    padding: 8px 11px;
    border-radius: 8px;
    color: #b42318;
    background: #fff1ef;
    font-size: 13px;
    font-weight: 800;
}

.profile-preview {
    display: flex;
    align-items: center;
    gap: 18px;
}

.profile-preview img,
.profile-big {
    width: 86px;
    height: 86px;
    border-radius: 999px;
    object-fit: cover;
    flex: 0 0 auto;
}

.content-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 22px 26px;
}

.footer {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 42px;
    padding: 0 26px;
    border-top: 1px solid var(--line);
    background: var(--surface);
    color: var(--muted);
    font-size: 13px;
}

.footer span:last-child {
    color: var(--brand-primary);
    font-weight: 900;
}

.primary-btn,
.ghost-btn,
.danger-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 14px;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 800;
}

.with-icon {
    gap: 8px;
}

.svg-icon,
.with-icon svg,
.primary-btn svg,
.ghost-btn svg,
.danger-btn svg {
    flex: 0 0 auto;
    width: 17px;
    height: 17px;
}

.svg-icon {
    display: inline-block;
    object-fit: contain;
}

.with-icon svg,
.primary-btn svg,
.ghost-btn svg,
.danger-btn svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.primary-btn {
    background: var(--brand-primary);
    color: #ffffff;
}

.ghost-btn {
    background: #ffffff;
    color: var(--text);
    border: 1px solid var(--line);
}

.danger-btn {
    background: #ffebe9;
    color: #b42318;
}

.grid {
    display: grid;
    gap: 16px;
}

.grid.stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid.two {
    grid-template-columns: minmax(0, 1.1fr) minmax(360px, .9fr);
}

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 18px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .03);
    overflow-x: auto;
}

.stat-label {
    color: var(--muted);
    font-size: 13px;
}

.stat-value {
    margin-top: 8px;
    font-size: 30px;
    font-weight: 900;
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.section-title h2 {
    margin: 0;
    font-size: 18px;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 12px 10px;
    border-bottom: 1px solid #edf1ef;
    text-align: left;
    font-size: 14px;
    vertical-align: top;
}

.table th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.status {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    background: #ecfdf3;
    color: #027a48;
    font-size: 12px;
    font-weight: 800;
}

.status.warn {
    background: #fff7e6;
    color: #9a5b00;
}

.status.danger {
    background: #ffebe9;
    color: #b42318;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.api-settings-grid {
    grid-template-columns: minmax(0, 2fr) minmax(220px, 1fr);
}

.api-settings-grid > .field:first-child {
    grid-column: 1 / -1;
    max-width: 50%;
}

.api-test-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.field {
    display: grid;
    gap: 7px;
}

.field.full {
    grid-column: 1 / -1;
}

label {
    color: #4d5b57;
    font-size: 13px;
    font-weight: 700;
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid #d6dfdc;
    border-radius: 8px;
    padding: 10px 11px;
    font: inherit;
    font-weight: 400;
    background: #ffffff;
}

.field > span {
    font-weight: 700;
}

.password-field {
    position: relative;
    display: block;
}

.password-field input {
    padding-right: 48px;
}

.icon-btn {
    display: grid;
    place-items: center;
    position: relative;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 15px;
}

.icon-btn svg {
    width: 19px;
    height: 19px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.eye-btn.is-visible::after {
    content: "";
    position: absolute;
    width: 22px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
    transform: rotate(-38deg);
}

.password-field .icon-btn {
    position: absolute;
    top: 50%;
    right: 5px;
    transform: translateY(-50%);
}

.ai-secret-field .password-field {
    display: flex;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-top: 6px;
}

.ai-secret-field .password-field input {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding-right: 42px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.secret-saved {
    display: inline-flex;
    align-items: center;
    margin-left: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #dcfce7;
    color: #047857;
    font-size: 11px;
    font-weight: 800;
    vertical-align: middle;
    max-width: 72px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

textarea {
    min-height: 110px;
    resize: vertical;
}

.template-builder input,
.template-builder textarea,
.template-builder select {
    font-weight: 400;
}

.composer {
    display: grid;
    grid-template-rows: auto minmax(360px, 1fr) auto;
    min-height: 560px;
    overflow: hidden;
}

.chat-head {
    padding-bottom: 12px;
    border-bottom: 1px solid #edf1ef;
    font-weight: 900;
}

.chat-window {
    padding: 16px;
    background: #efeae2;
    border-radius: 8px;
    margin: 14px 0;
}

.bubble {
    max-width: 94%;
    margin-left: auto;
    overflow:hidden;
    padding: 10px;
    border-radius: 8px;
    background: #d9fdd3;
    box-shadow: 0 1px 1px rgba(0,0,0,.08);
    font-size: 14px;
    line-height: 1.45;
}

.message-footer {
    color: #66766f;
    font-size: 12px;
}
.message-meta { display:flex; align-items:end; justify-content:space-between; gap:10px; margin-top:8px; }
.message-time { flex:0 0 auto; color:#66766f; font-size:11px; }
.preview-media { margin:-4px -4px 9px; overflow:hidden; border-radius:6px; background:#d8dedb; }
.preview-media img, .preview-media video { display:block; width:100%; max-height:210px; object-fit:cover; }
.preview-file { display:flex; align-items:center; gap:9px; min-height:62px; padding:12px; background:#f7f9f8; color:#41524d; font-size:12px; font-weight:800; }
.preview-file svg { width:24px; height:24px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.chip {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 10px;
    border: 1px solid #b9dad1;
    border-radius: 999px;
    background: #ffffff;
    color: var(--brand-primary);
    font-size: 13px;
    font-weight: 800;
}

.phone-preview .quick-actions {
    display: grid;
    gap: 0;
    margin: 10px -10px -10px;
}

.phone-preview .chip {
    justify-content: center;
    min-height: 38px;
    border-width: 1px 0 0;
    border-radius: 0;
    color: #087b65;
}
.phone-preview .chip svg { width:17px; height:17px; margin-right:7px; fill:none; stroke:currentColor; stroke-width:2.2; stroke-linecap:round; stroke-linejoin:round; }

.row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.row-actions form {
    margin: 0;
}

.qr-preview {
    display: block;
    width: 120px;
    max-width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
}

.steps {
    display: grid;
    gap: 10px;
}

.steps span {
    display: flex;
    align-items: center;
    min-height: 38px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfc;
    color: #34443f;
    font-weight: 800;
}

.inline-panel {
    display: none;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.inline-panel.open {
    display: block;
}

.account-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 360px));
    gap: 16px;
}

.template-card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.template-card {
    min-width: 0;
    min-height: 218px;
    max-height: 218px;
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    gap: 10px;
    padding: 16px;
    overflow: hidden;
}

.template-card .account-card-head {
    min-width: 0;
    padding-right: 58px;
}

.template-card .account-card-head h2 {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.template-card .template-body {
    display: -webkit-box;
    min-height: 0;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
}

.template-card .row-actions {
    align-self: end;
}

@media (max-width: 1080px) {
    .template-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
    .template-card-grid { grid-template-columns: 1fr; }
}

.account-card {
    position: relative;
    display: grid;
    gap: 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 18px;
}

.device-ribbon {
    position: absolute;
    top: 12px;
    right: -8px;
    min-height: 25px;
    padding: 5px 10px;
    border-radius: 7px 7px 0 7px;
    color: #ffffff;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.device-ribbon::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: -7px;
    border-top: 7px solid #075e54;
    border-right: 7px solid transparent;
}

.device-ribbon.connected {
    background: #079455;
}

.device-ribbon.qr {
    background: #1688f8;
}

.device-ribbon.qr::after {
    border-top-color: #0a5ead;
}
.device-ribbon.media { background:#087b65; }
.device-ribbon.media::after { border-top-color:#045c4b; }
.template-card .device-ribbon { max-width: 58%; border-radius: 6px 0 0 6px; padding: 6px 12px; right: -1px; top: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.template-card .device-ribbon::after { display: none; }
.icon-btn.bordered { border:1px solid var(--line); background:#fff; }
.icon-btn.danger-icon { color:#d92d20; background:#fff1f0; }
.template-view-modal { position:relative; width:min(390px,100%); max-height:92vh; overflow:auto; border-radius:10px; background:#fff; box-shadow:var(--shadow); }
.template-view-phone { position:static; height:auto; min-height:440px; }
.log-preview-meta { padding: 12px 18px 0; color: var(--muted); font-size: 13px; }
.auto-reply-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(285px,1fr)); gap:16px; margin-top:16px; }
.auto-reply-card { position:relative; overflow:hidden; gap:10px; }
.auto-reply-card h2 { padding-right:88px; }
.rule-line { display:flex; justify-content:space-between; gap:12px; padding-top:8px; border-top:1px solid var(--line); font-size:13px; }
.rule-line span { color:var(--muted); }
.rule-line strong { text-align:right; }
.auto-reply-actions { display:flex; flex-wrap:wrap; gap:8px; margin-top:6px; }
.auto-reply-actions form { margin:0; }
.compact-editor-modal { width:min(760px,calc(100vw - 24px)); }
.auto-reply-form { padding:18px; }
.log-stat { text-decoration:none; color:inherit; }
.log-stat.active { outline:2px solid #087b65; outline-offset:2px; }
.log-search { display:flex; gap:10px; align-items:center; margin:16px 0; }
.log-search input { flex:1; min-width:0; }
.pagination-bar { display:flex; justify-content:space-between; align-items:center; gap:12px; margin-top:14px; color:var(--muted); font-size:13px; }

.compact-device {
    align-content: start;
}

.compact-form {
    grid-template-columns: minmax(0, 420px) auto;
}

.action-field {
    align-self: end;
}

.copy-line {
    display: flex;
    align-items: center;
    gap: 6px;
}

.copy-btn {
    display: inline-grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border: 0;
    border-radius: 6px;
    background: #eef3f1;
    color: var(--brand-primary);
    cursor: pointer;
    font-weight: 900;
}

.qr-open-btn {
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f7fbf9;
    color: var(--brand-primary);
    cursor: pointer;
    font-weight: 900;
}

.compact-qr-btn {
    min-height: 38px;
    padding: 0 14px;
}

.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100;
    place-items: center;
    padding: 18px;
    background: rgba(15, 23, 32, .6);
}

.modal-backdrop.open {
    display: grid;
}

.qr-modal {
    position: relative;
    display: grid;
    justify-items: center;
    gap: 10px;
    width: min(390px, 100%);
    padding: 22px;
    border-radius: 10px;
    background: #ffffff;
    box-shadow: var(--shadow);
}

.account-modal {
    position: relative;
    width: min(430px, 100%);
    padding: 22px;
    border-radius: 10px;
    background: #ffffff;
    box-shadow: var(--shadow);
}

.confirm-modal {
    display: grid;
    justify-items: center;
    gap: 12px;
    width: min(420px, 100%);
    padding: 24px;
    border-radius: 10px;
    background: #ffffff;
    box-shadow: var(--shadow);
    text-align: center;
}

.confirm-modal h2,
.confirm-modal p {
    margin: 0;
}

.confirm-modal p {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
}

.confirm-icon {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 999px;
    background: #ffebe9;
    color: #b42318;
    font-size: 24px;
    font-weight: 900;
}

.warn-icon {
    background: #fff7e6;
    color: #9a5b00;
}

.confirm-actions {
    display: flex;
    gap: 9px;
    margin-top: 4px;
}

.account-modal h2,
.account-modal p {
    margin: 0 0 12px;
}

.account-modal p {
    color: var(--muted);
    font-size: 14px;
}

.qr-help-layout {
    width: min(620px, 100%);
    grid-template-columns: minmax(0, 1fr) minmax(190px, 240px);
    align-items: center;
    justify-items: stretch;
    gap: 24px;
}

.qr-instructions {
    display: grid;
    gap: 10px;
}

.qr-instructions ol {
    display: grid;
    gap: 12px;
    margin: 6px 0;
    padding-left: 22px;
    color: #34443f;
    font-size: 14px;
    line-height: 1.45;
}

.qr-modal h2,
.qr-modal p {
    margin: 0;
}

.qr-modal p {
    color: var(--muted);
}

.qr-modal img {
    width: min(240px, 100%);
}

.modal-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 7px;
    background: #f3f6f5;
    cursor: pointer;
    font-size: 20px;
}

@media (max-width: 640px) {
    .qr-help-layout {
        grid-template-columns: 1fr;
    }
}

.dashboard-grid { display:grid; grid-template-columns:minmax(0,1fr) 280px; gap:12px; margin-top:12px; }
.dashboard-side, .dashboard-campaigns { display:grid; gap:10px; align-content:start; }
.dashboard-campaigns { max-height:calc(100vh - 315px); overflow:auto; }
.dashboard-campaign { display:grid; gap:8px; padding:11px; border:1px solid var(--line); border-radius:8px; background:#fbfcfd; }
.dashboard-campaign h3 { margin:0; font-size:15px; font-weight:600; }
.dashboard-campaign p { margin:4px 0 0; color:var(--muted); font-size:12px; }
.dash-stat { position:relative; min-height:86px; overflow:hidden; border-top:3px solid #17b26a; background:linear-gradient(180deg,#ffffff 0%,#f4fbf8 100%); }
.dash-stat::after { content:""; position:absolute; right:14px; bottom:14px; width:34px; height:34px; border-radius:50%; background:rgba(18,183,106,.1); }
.dash-stat-1 { border-top-color:#2e90fa; background:linear-gradient(180deg,#ffffff 0%,#f4f9ff 100%); }
.dash-stat-1::after { background:rgba(46,144,250,.1); }
.dash-stat-2 { border-top-color:#f79009; background:linear-gradient(180deg,#ffffff 0%,#fffaf1 100%); }
.dash-stat-2::after { background:rgba(247,144,9,.12); }
.dash-stat-3 { border-top-color:#7a5af8; background:linear-gradient(180deg,#ffffff 0%,#f8f6ff 100%); }
.dash-stat-3::after { background:rgba(122,90,248,.1); }
.dash-stat .stat-value { font-weight:700; letter-spacing:0; }
.dashboard-action-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:6px; }
.dash-action { display:flex; min-height:38px; align-items:center; gap:7px; padding:6px 8px; border:1px solid transparent; border-radius:7px; color:#101828; text-decoration:none; font-weight:900; transition:transform .16s ease, box-shadow .16s ease; }
.dash-action:hover { transform:translateY(-1px); box-shadow:0 12px 28px rgba(15,23,42,.1); }
.dash-action span { display:grid; place-items:center; flex:0 0 auto; width:22px; height:22px; border-radius:6px; background:rgba(255,255,255,.72); font-size:11px; font-weight:900; }
.dash-action strong { overflow:hidden; font-size:12px; text-overflow:ellipsis; white-space:nowrap; }
.dash-action-chat { background:#eef6ff; border-color:#b2ddff; color:#175cd3; }
.dash-action-account { background:#ecfdf3; border-color:#abefc6; color:#067647; }
.dash-action-template { background:#fff6ed; border-color:#fedf89; color:#b54708; }
.dash-action-contact { background:#f4f3ff; border-color:#d9d6fe; color:#5925dc; }
.dash-action-billing { background:#fdf2fa; border-color:#fcceee; color:#c11574; }
.create-broadcast-cta { min-height:42px; border:0; background:linear-gradient(135deg,#075e54,#12b76a); color:#fff; box-shadow:0 12px 26px rgba(7,94,84,.22); }
.create-broadcast-cta:hover { transform:translateY(-1px); box-shadow:0 16px 34px rgba(7,94,84,.3); }
.create-broadcast-cta span { display:grid; place-items:center; width:22px; height:22px; border-radius:50%; background:rgba(255,255,255,.2); color:#fff; font-size:18px; line-height:1; }
.account-summary-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; }
.account-summary { display:grid; grid-template-columns:1fr auto; gap:6px; padding:12px; border:1px solid var(--line); border-radius:8px; background:#fbfcfd; }
.account-summary small { grid-column:1 / -1; color:var(--muted); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.account-overview { display:flex; flex-wrap:wrap; gap:10px; margin-top:14px; }
.account-overview span { padding:7px 10px; border:1px solid #dce7e4; border-radius:8px; background:#f5fbf9; color:#45605b; font-size:12px; }
.account-overview strong { color:#06705e; }

.chat-shell { display:grid; grid-template-columns:318px minmax(0,1fr); height:calc(100vh - 238px); min-height:430px; overflow:hidden; border:1px solid var(--line); border-radius:8px; background:#fff; }
.chat-account-badge { display:block; margin:9px 12px 0; padding:7px 10px; overflow:hidden; border:1px solid #b8e6d7; border-radius:8px; background:#edfdf7; color:#06705e; font-size:12px; text-overflow:ellipsis; white-space:nowrap; }
.chat-sidebar { display:flex; flex-direction:column; min-height:0; border-right:1px solid var(--line); background:#fff; }
.chat-sidebar-head, .chat-main-head { display:flex; align-items:center; gap:10px; min-height:54px; padding:8px 13px; border-bottom:1px solid var(--line); }
.chat-sidebar-head { justify-content:space-between; }
.chat-sidebar h2, .chat-sidebar p, .chat-main-head h2, .chat-main-head p { margin:0; }
.chat-sidebar h3 { margin:0; font-size:17px; }
.chat-main-head h2 { font-size:17px; font-weight:650; }
.chat-sidebar p, .chat-main-head p { color:var(--muted); font-size:12px; }
.chat-sidebar { overflow:hidden; }
.chat-main { min-height:0; }
.chat-account-filter { margin:9px 12px 0; }
.chat-account-filter select, .chat-search { width:100%; min-height:38px; border:1px solid var(--line); border-radius:8px; background:#f6f8f8; padding:0 11px; font:inherit; font-weight:400; }
.chat-account-filter select { background:#fff; }
.chat-search { width:calc(100% - 24px); margin:10px 12px; }
.chat-conversations { min-height:0; flex:1 1 auto; overflow:auto; }
.chat-conversation { display:grid; grid-template-columns:48px minmax(0,1fr); gap:10px; align-items:center; padding:10px 12px; color:inherit; text-decoration:none; border-bottom:1px solid #edf0f0; }
.chat-conversation.active, .chat-conversation:hover { background:#edf7f4; }
.chat-conversation-copy { display:grid; min-width:0; gap:4px; }
.chat-conversation-top, .chat-conversation-bottom { display:flex; min-width:0; align-items:center; justify-content:space-between; gap:8px; }
.chat-conversation-top strong, .chat-conversation-bottom small { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.chat-conversation-top strong { font-size:14px; }
.chat-conversation-bottom small { color:var(--muted); }
.chat-group-tag { margin-left:6px; padding:2px 5px; border-radius:999px; background:#e4f8f1; color:#087b65; font-size:9px; font-style:normal; font-weight:600; }
.chat-conversation time { flex:0 0 auto; color:var(--muted); font-size:11px; }
.chat-list-tick { margin-right:4px; color:#079455; letter-spacing:-2px; }
.chat-unread { display:grid; min-width:19px; height:19px; place-items:center; padding:0 5px; border-radius:999px; background:#16a375; color:#fff; font-size:10px; line-height:1; }
.chat-avatar { display:grid; place-items:center; width:46px; height:46px; flex:0 0 46px; overflow:hidden; border-radius:50%; background:#d9f3eb; color:#06705e; font-weight:700; }
.chat-main-head .chat-avatar { width:50px; height:50px; flex-basis:50px; }
.chat-avatar-img { width:100%; height:100%; object-fit:cover; }
.chat-avatar-img { cursor:zoom-in; }
.chat-avatar-placeholder { width:23px; height:23px; fill:none; stroke:currentColor; stroke-linecap:round; stroke-linejoin:round; stroke-width:1.8; }
.chat-presence { color:#11845f !important; }
.chat-main { display:flex; flex-direction:column; min-width:0; min-height:0; background:#efeae2; }
.chat-thread { display:flex; flex:1 1 auto; flex-direction:column; gap:7px; min-height:0; overflow:auto; padding:18px 6%; background-color:#efeae2; }
.chat-date-separator { position:sticky; top:4px; z-index:2; display:flex; justify-content:center; pointer-events:none; }
.chat-date-separator span { padding:5px 10px; border-radius:7px; background:rgba(255,255,255,.92); color:#60706d; font-size:11px; box-shadow:0 1px 2px rgba(0,0,0,.08); }
.chat-older-hint { align-self:center; max-width:460px; margin:10px auto 2px; padding:8px 12px; border-radius:999px; background:rgba(255,255,255,.94); color:#60706d; font-size:11px; line-height:1.35; text-align:center; box-shadow:0 1px 2px rgba(0,0,0,.08); }
.chat-bubble { position:relative; align-self:flex-start; max-width:min(72%,720px); padding:9px 11px 6px; border-radius:7px; background:#fff; box-shadow:0 1px 1px rgba(0,0,0,.08); }
.chat-bubble.new-message { animation:chatBubbleIn .16s ease-out; }
.chat-bubble.outgoing { align-self:flex-end; background:#d9fdd3; }
.chat-bubble p { margin:0 0 3px; white-space:pre-wrap; }
.chat-bubble code { padding:1px 3px; border-radius:3px; background:rgba(0,0,0,.07); font-family:Consolas,monospace; font-size:.92em; }
.chat-bubble time { display:block; color:#72817e; font-size:10px; text-align:right; }
.chat-tick { margin-left:3px; color:#72817e; letter-spacing:-2px; }
.chat-tick.delivered { color:#9a6a3a; }
.chat-tick.read { color:#079455; }
.chat-message-menu { position:absolute; top:4px; right:5px; z-index:3; display:none !important; min-width:142px; overflow:hidden; border:1px solid #dfe7e5; border-radius:6px; background:#fff; box-shadow:0 8px 22px rgba(16,45,40,.16); }
.chat-bubble:hover .chat-message-menu, .chat-bubble:focus-within .chat-message-menu { display:block !important; }
.chat-message-menu form { margin:0; }
.chat-message-menu button { width:100%; padding:8px 10px; border:0; border-bottom:1px solid #edf1f0; background:#fff; color:#344844; cursor:pointer; font:inherit; font-size:12px; text-align:left; }
.chat-message-menu button:hover { background:#fff2f2; color:#b42318; }
.chat-media { display:block; width:min(100%,360px); max-height:280px; margin-bottom:8px; border-radius:6px; object-fit:cover; }
.chat-audio { display:block; max-width:100%; margin-bottom:8px; }
.chat-file { display:flex; align-items:center; gap:9px; width:100%; margin-bottom:8px; padding:9px 10px; border:0; border-radius:6px; background:rgba(255,255,255,.62); color:#087b65; cursor:pointer; font:inherit; font-size:13px; text-align:left; text-decoration:none; }
.chat-file:hover { background:rgba(255,255,255,.86); }
.chat-file span:last-child { display:grid; gap:2px; }
.chat-file small { color:#71807d; font-size:11px; font-weight:400; }
.chat-file-icon { display:grid; place-items:center; width:32px; height:32px; flex:0 0 32px; border-radius:50%; background:#e7f7f2; }
.chat-file-icon svg { width:18px; height:18px; fill:none; stroke:currentColor; stroke-linecap:round; stroke-linejoin:round; stroke-width:1.8; }
.chat-media-badge { display:inline-flex; margin:0 0 7px; padding:3px 6px; border-radius:5px; background:rgba(8,123,101,.1); color:#087b65; font-size:10px; font-weight:700; }
.chat-action { display:flex; width:calc(100% + 22px); align-items:center; justify-content:center; gap:7px; margin:7px -11px -6px; padding:9px 12px; border:0; border-top:1px solid rgba(8,123,101,.18); background:transparent; color:#087b65; cursor:pointer; font:inherit; text-align:center; text-decoration:none; font-size:13px; font-weight:600; }
.chat-action:hover { background:rgba(255,255,255,.28); }
.chat-action-icon { display:inline-flex; align-items:center; justify-content:center; width:16px; height:16px; }
.chat-action-icon svg { width:16px; height:16px; fill:none; stroke:currentColor; stroke-linecap:round; stroke-linejoin:round; stroke-width:2; }
.chat-composer { position:relative; display:flex; align-items:center; gap:7px; padding:10px 12px; background:#f0f2f5; }
.chat-composer input[type="text"] { width:auto; min-width:0; min-height:42px; flex:1 1 auto; border:0; border-radius:8px; padding:0 12px; font:inherit; font-weight:400; }
.chat-tool { display:grid; place-items:center; width:36px; height:36px; flex:0 0 36px; border:0; border-radius:50%; background:transparent; color:#586965; cursor:pointer; font-size:20px; }
.chat-tool:hover { background:#e2e8e6; color:#087b65; }
.chat-tool svg { width:22px; height:22px; fill:none; stroke:currentColor; stroke-linecap:round; stroke-linejoin:round; stroke-width:1.8; }
.chat-popover { position:absolute; bottom:62px; left:12px; z-index:7; display:none; min-width:220px; max-width:min(360px,calc(100vw - 40px)); padding:10px; border:1px solid var(--line); border-radius:8px; background:#fff; box-shadow:0 14px 34px rgba(16,45,40,.16); }
.chat-popover.open { display:block; }
.chat-emoji-grid { display:grid; grid-template-columns:repeat(8,1fr); gap:3px; max-height:190px; overflow:auto; }
.chat-emoji { display:grid; place-items:center; min-height:32px; border:0; border-radius:6px; background:#fff; cursor:pointer; font-size:20px; }
.chat-emoji:hover { background:#edf7f4; }
.chat-attachment-menu { display:grid; gap:3px; }
.chat-attachment-label, .chat-attachment-menu button { display:flex; align-items:center; gap:9px; width:100%; padding:9px 10px; border:0; border-radius:6px; background:#fff; color:#263b37; cursor:pointer; font:inherit; font-size:13px; text-align:left; }
.chat-attachment-label:hover, .chat-attachment-menu button:hover { background:#edf7f4; color:#087b65; }
.chat-attachment-label input { display:none; }
.chat-contact-select { max-width:190px; min-height:38px; border:1px solid var(--line); border-radius:7px; background:#fff; padding:0 8px; font:inherit; font-weight:400; }
.chat-send, .chat-sidebar-head .icon-btn { display:grid; place-items:center; width:42px; height:42px; border:0; border-radius:50%; background:#087b65; color:#fff; cursor:pointer; text-decoration:none; }
.chat-send:disabled { cursor:wait; opacity:.62; }
.chat-sidebar-head .icon-btn { width:36px; height:36px; }
.chat-head-tools { display:flex; align-items:center; gap:6px; }
.chat-head-tools form { margin:0; }
.chat-notification-toggle { display:grid; width:36px; height:36px; place-items:center; border:1px solid #d8e4e1; border-radius:50%; background:#fff; color:#74827f; cursor:pointer; font-size:18px; }
.chat-notification-toggle.active { border-color:#a9e3d3; background:#eafaf5; color:#087b65; }
.chat-notification-toggle svg { width:17px; height:17px; fill:none; stroke:currentColor; stroke-linecap:round; stroke-linejoin:round; stroke-width:2; }
.chat-photo-modal { position:fixed; inset:0; z-index:40; display:grid; place-items:center; padding:24px; background:rgba(10,25,23,.72); }
.chat-photo-modal[hidden] { display:none; }
.chat-photo-modal img { display:block; max-width:min(520px,90vw); max-height:82vh; border-radius:10px; box-shadow:0 20px 70px rgba(0,0,0,.34); }
.chat-photo-modal button { position:fixed; top:22px; right:26px; width:42px; height:42px; border:0; border-radius:50%; background:#fff; color:#263b37; cursor:pointer; font-size:26px; }
.chat-sync-progress { position:relative; height:4px; flex:0 0 4px; overflow:visible; background:#dce7e4; }
.chat-sync-progress span { display:block; width:0; height:100%; background:#13a37f; transition:width .2s ease; }
.chat-sync-progress small { position:absolute; top:5px; right:8px; z-index:2; padding:1px 5px; border-radius:4px; background:#fff; color:#087b65; font-size:10px; box-shadow:0 1px 3px rgba(0,0,0,.12); }
.chat-disconnected { padding:9px 13px; border-bottom:1px solid #f0d7a6; background:#fff8e8; color:#9a5c00; font-size:12px; }
.chat-readonly { padding:13px 16px; border-top:1px solid #e3e7e6; background:#f0f2f5; color:#60706d; font-size:12px; text-align:center; }
.chat-welcome { display:grid; place-content:center; min-height:calc(100vh - 190px); text-align:center; color:#52706b; }
.chat-empty { padding:18px; color:var(--muted); font-size:13px; }
.api-token-box { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.api-doc-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
.api-doc-card { padding:14px; border:1px solid var(--line); border-radius:8px; background:#fff; }
.api-doc-card h3 { margin:0 0 8px; font-size:15px; }
.api-doc-card code, .api-endpoint-list code { color:#075f4f; font-weight:800; }
.api-doc-card pre { overflow:auto; margin:10px 0 0; padding:12px; border-radius:8px; background:#0f1720; color:#d5f7e8; font-size:12px; line-height:1.5; white-space:pre-wrap; }
.api-endpoint-list { display:grid; gap:8px; }
.api-endpoint-list p { margin:0; padding:10px 12px; border:1px solid var(--line); border-radius:8px; background:#fff; }
@keyframes chatBubbleIn { from { opacity:.35; transform:translateY(3px); } to { opacity:1; transform:translateY(0); } }

.account-chat-toggle { display:flex; align-items:center; gap:9px; padding:9px 11px; border:1px solid #dce7e4; border-radius:8px; background:#f7fbfa; color:#263b37; }
.account-chat-create-toggle { cursor:pointer; }
.account-chat-create-toggle input { position:absolute; width:1px; height:1px; opacity:0; pointer-events:none; }
.account-toggle-track { width:32px; height:18px; flex:0 0 auto; border-radius:99px; background:#c8d2d0; transition:background .16s ease; }
.account-toggle-track::after { display:block; width:14px; height:14px; margin:2px; border-radius:50%; background:#fff; content:""; transition:transform .16s ease; }
.account-chat-create-toggle input:checked + .account-toggle-track { background:#17a77d; }
.account-chat-create-toggle input:checked + .account-toggle-track::after { transform:translateX(14px); }
.account-toggle-copy { display:flex; align-items:baseline; gap:7px; }
.account-chat-toggle small { color:var(--muted); font-size:11px; font-weight:400; }
.account-chat-card-toggle { padding:0; border:0; background:transparent; }
.chat-feature-switch { display:flex; align-items:center; gap:8px; width:100%; padding:8px 10px; border:1px solid #dde6e4; border-radius:8px; background:#f7f9f9; color:#6a7976; cursor:pointer; font:inherit; text-align:left; }
.chat-feature-switch span { width:30px; height:17px; border-radius:99px; background:#c8d2d0; }
.chat-feature-switch span::after { display:block; width:13px; height:13px; margin:2px; border-radius:50%; background:#fff; content:""; transition:transform .16s ease; }
.chat-feature-switch.active { border-color:#b7e6da; background:#ecfbf6; color:#087b65; }
.chat-feature-switch.active span { background:#17a77d; }
.chat-feature-switch.active span::after { transform:translateX(13px); }
.chat-feature-switch b { font-size:12px; }
.ai-provider-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:14px; margin-top:14px; }
.ai-provider-card { display:grid; position:relative; gap:9px; min-height:190px; overflow:hidden; }
.ai-provider-card h3, .ai-provider-card p { margin:0; }
.ai-provider-card h3 { padding-right:84px; }
.ai-provider-card.is-active { border-color:#8fe3be; box-shadow:0 10px 28px rgba(7,118,88,.08); }
.ai-preset-card { align-content:start; min-height:320px; }
.ai-provider-hero { display:grid; place-items:center; min-height:92px; margin:-18px -18px 6px; background:linear-gradient(135deg,#e8efed,#f7faf9); color:#40534f; font-size:24px; font-weight:800; }
.ai-tags { display:flex; flex-wrap:wrap; gap:6px; }
.ai-tags span { padding:4px 8px; border-radius:999px; background:#f2f5f4; color:#52635f; font-size:11px; }
.ai-config-summary { margin:0 0 12px; padding:9px 11px; border-radius:8px; background:#ecfbf6; color:#087b65; font-weight:800; }
.ai-status-ribbon { position:absolute; top:15px; right:-34px; width:126px; padding:5px 0; transform:rotate(38deg); color:#fff; text-align:center; font-size:10px; font-weight:900; letter-spacing:.04em; text-transform:uppercase; box-shadow:0 4px 12px rgba(15,23,42,.16); }
.ai-status-ribbon.active { background:#079669; }
.ai-status-ribbon.inactive { background:#9aa4b2; }
.ai-provider-card form { margin-top:4px; }
.ai-provider-actions { display:flex; flex-wrap:wrap; gap:7px; align-items:center; }
.ai-provider-actions form { margin:0; }
.training-sub-list { display:grid; gap:8px; margin-top:6px; padding-top:10px; border-top:1px solid var(--line); }
.training-sub-item { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:10px; align-items:center; padding:10px; border:1px solid #dfe8e5; border-radius:8px; background:#f8fbfa; }
.training-sub-item strong { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:13px; }
.training-sub-item small { display:block; margin-top:3px; color:var(--muted); font-size:12px; }
.training-empty-sub { margin-top:4px; padding:10px; border:1px dashed #cfdad7; border-radius:8px; color:var(--muted); font-size:13px; }
.training-card { min-height:180px; }
.training-card-link { position:absolute; inset:0; z-index:1; border-radius:10px; }
.training-card .status,
.training-card .training-card-actions { position:relative; z-index:2; }
.training-main-card { cursor:pointer; }
.training-main-card:hover { border-color:#a8e8d1; box-shadow:0 10px 26px rgba(7,118,88,.08); }
.training-card-actions { align-self:end; margin-top:4px; }
.training-card-actions form { margin:0; }
.training-folder-mode .form-grid.two { grid-template-columns:1fr; }
.ai-agent-modal { width:min(840px,calc(100vw - 32px)); max-height:calc(100vh - 32px); overflow-y:auto; overscroll-behavior:contain; padding-top:0; }
.modal-sticky-head { display:flex; position:sticky; top:0; z-index:12; align-items:center; justify-content:space-between; gap:12px; margin:-18px -18px 16px; padding:16px 18px 12px; border-bottom:1px solid #e3e7e6; background:#fff; }
.modal-sticky-head h2 { margin:0; }
.modal-sticky-head .modal-close { position:static; flex:0 0 auto; }
.ai-safety-box { margin:10px 0; padding:11px; border:1px solid #dce7e4; border-radius:8px; background:#f8fbfa; }
.ai-safety-box h3 { margin:0 0 9px; font-size:14px; }
.ai-safety-box .account-chat-toggle { align-self:end; min-height:40px; }
.compact-toggle { min-height:40px; }
.compact-toggle span:last-child { font-weight:800; }

@media (max-width: 980px) {
    .ai-provider-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-grid { grid-template-columns:1fr; }
    .account-summary-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .chat-shell { grid-template-columns:280px minmax(0,1fr); }
}

@media (max-width: 700px) {
    .account-summary-grid { grid-template-columns:1fr; }
    .chat-shell { grid-template-columns:1fr; }
    .chat-sidebar { display:none; }
    .chat-shell:has(.chat-welcome) .chat-sidebar { display:block; }
    .chat-shell:has(.chat-welcome) .chat-main { display:none; }
    .chat-shell { min-height:600px; height:calc(100vh - 120px); }
    .chat-thread { padding:14px; }
    .chat-bubble { max-width:86%; }
}

.account-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.account-card h2 {
    margin: 0;
    font-size: 18px;
}

.account-card p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.account-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 42px;
    padding: 0 12px;
    border-radius: 8px;
    background: #f8faf9;
}

.account-meta span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.qr-box,
.qr-empty {
    display: grid;
    place-items: center;
    min-height: 190px;
    border: 1px dashed #cfdad6;
    border-radius: 8px;
    background: #fbfcfc;
    color: var(--muted);
    font-weight: 800;
    text-align: center;
}

.qr-box img {
    width: min(210px, 100%);
}

.auth-body {
    min-height: 100vh;
    overflow: auto;
    background: linear-gradient(135deg, #f5f7f6, #e7f5ee);
}

.auth-wrap {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-card {
    width: min(440px, 100%);
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 24px;
    box-shadow: var(--shadow);
}

.auth-brand {
    color: #111b21;
    margin-bottom: 22px;
}

.auth-form {
    grid-template-columns: 1fr;
}

.auth-note {
    margin: 16px 0 0;
    color: var(--muted);
    font-size: 14px;
}

.auth-note a {
    color: var(--brand-primary);
    font-weight: 900;
}

.alert {
    margin-bottom: 14px;
    padding: 11px 12px;
    border-radius: 8px;
    font-size: 14px;
}

.alert.error {
    background: #ffebe9;
    color: #b42318;
    border: 1px solid #ffd4cf;
}
.logs-stats { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:10px; margin:18px 0; }
.log-stat { display:flex; min-height:82px; flex-direction:column; justify-content:space-between; padding:13px; border:1px solid #e4e7ec; border-left:4px solid #98a2b3; border-radius:8px; background:#fff; }
.log-stat span { color:#667085; font-size:12px; }
.log-stat strong { color:#101828; font-size:24px; }
.log-stat.success { border-left-color:#12b76a; }
.log-stat.danger { border-left-color:#f04438; }
.log-stat.info { border-left-color:#2e90fa; }
.table-wrap { overflow-x:auto; }
.message-log-table { min-width:900px; }
.log-error { max-width:260px; overflow:hidden; color:#b42318; text-overflow:ellipsis; white-space:nowrap; }
.status-pill { display:inline-flex; padding:4px 8px; border-radius:999px; font-size:11px; font-weight:700; text-transform:capitalize; }
.status-pill.success { background:#ecfdf3; color:#027a48; }
.status-pill.danger { background:#ffebe9; color:#b42318; }
.status-pill.warning { background:#fffaeb; color:#b54708; }
.toast-notice { display:flex; position:fixed; top:84px; right:18px; z-index:180; align-items:center; gap:9px; max-width:min(420px,calc(100vw - 36px)); padding:12px 14px; border:1px solid #abefc6; border-radius:8px; background:#ecfdf3; color:#027a48; box-shadow:var(--shadow); font-size:13px; }
.toast-notice.error { border-color:#ffd4cf; background:#ffebe9; color:#b42318; }
.toast-notice span { display:grid; place-items:center; width:22px; height:22px; border-radius:50%; background:#12b76a; color:#fff; font-weight:900; }
.toast-notice.error span { background:#f04438; }
.toast-notice button { border:0; background:transparent; color:currentColor; cursor:pointer; font-size:20px; line-height:1; }

@media (max-width: 980px) {
    body {
        overflow: auto;
        background: #f8fafc;
    }

    .app-shell,
    .app-shell.sidebar-collapsed {
        grid-template-columns: 1fr;
        height: auto;
        overflow: visible;
    }

    .sidebar {
        position: fixed;
        top: 10px;
        left: 12px;
        z-index: 80;
        width: 42px;
        height: 42px;
        overflow: visible;
        padding: 0;
        border-radius: 10px;
        background: transparent;
        box-shadow: none;
    }

    .sidebar-head {
        margin-bottom: 0;
        min-height: 42px;
    }

    .app-shell:not(.mobile-sidebar-open) .sidebar-head {
        justify-content: flex-start;
        min-height: 42px;
    }

    .app-shell:not(.mobile-sidebar-open) .sidebar .brand {
        display: none;
    }

    .sidebar-toggle {
        width: 42px;
        height: 42px;
        border-color: rgba(255,255,255,.16);
        border-radius: 10px;
        background: #0f1720;
        box-shadow: 0 8px 20px rgba(15, 23, 42, .24);
    }

    .app-shell.mobile-sidebar-open .sidebar {
        top: 8px;
        left: 8px;
        width: min(300px, calc(100vw - 16px));
        height: auto;
        max-height: calc(100vh - 16px);
        overflow: auto;
        padding: 8px 10px 10px;
        border-radius: 12px;
        background: #0f1720;
        box-shadow: 0 18px 44px rgba(15, 23, 42, .32);
    }

    .app-shell.mobile-sidebar-open .sidebar-head {
        justify-content: space-between;
    }

    .app-shell.mobile-sidebar-open .sidebar-toggle {
        box-shadow: none;
    }

    .app-shell.mobile-sidebar-open .sidebar .brand {
        display: flex;
    }

    .app-shell.mobile-sidebar-open .brand-text,
    .app-shell.mobile-sidebar-open .nav-label {
        display: inline;
    }

    .nav {
        display: none;
        grid-template-columns: 1fr;
        gap: 7px;
        max-height: none;
        overflow: visible;
        margin-top: 9px;
        padding: 6px 0 4px;
    }

    .app-shell.mobile-sidebar-open .nav { display: grid; }

    .nav a {
        min-height: 42px;
        padding: 0 12px;
        border-radius: 9px;
        white-space: nowrap;
    }

    .main {
        height: auto;
        min-height: 100vh;
        overflow: visible;
    }

    .content-scroll {
        overflow: visible;
        padding: 12px;
    }

    .grid.stats,
    .grid.two,
    .form-grid,
    .api-token-box,
    .api-doc-grid,
    .billing-payment-grid,
    .logs-stats {
        grid-template-columns: 1fr;
    }

    .table-wrap,
    .card {
        max-width: 100%;
    }

    .table {
        min-width: 720px;
    }

    .section-title {
        gap: 10px;
        margin-bottom: 12px;
    }

    .section-title .primary-btn,
    .section-title .ghost-btn {
        width: 100%;
        justify-content: center;
    }

    .campaign-launch,
    .storage-clear-footer,
    .list-footer,
    .campaign-footer-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .quick-actions,
    .topbar-actions {
        width: 100%;
    }

    .quick-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 9px;
    }

    .quick-actions a,
    .quick-actions button {
        justify-content: center;
        min-width: 0;
    }

    .api-settings-grid > .field:first-child {
        max-width: none;
    }

    .topbar {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 10px;
        min-height: auto;
        padding: 10px 12px 10px 64px;
        box-shadow: none;
    }

    .topbar-copy h1 { font-size: 24px; }

    .topbar-copy p { display:none; }

    .header-badge { display:none; }

    .topbar-profile,
    .profile-trigger {
        width: auto;
    }

    .topbar-actions {
        width: auto;
        flex-wrap: nowrap;
        justify-content: flex-end;
        min-width: 0;
    }

    .header-plan-pill {
        flex: 0 1 210px;
        max-width: 210px;
        border-radius: 10px;
    }

    .profile-trigger {
        justify-content: space-between;
    }

    .profile-dropdown {
        left: 0;
        right: 0;
    }

    .footer {
        align-items: flex-start;
        flex-direction: column;
        height: auto;
        padding: 12px;
    }

    .billing-plan-grid,
    .campaign-card-grid,
    .ai-provider-grid,
    .dashboard-grid,
    .contacts-workspace {
        grid-template-columns: 1fr !important;
    }

    .training-sub-item {
        grid-template-columns: 1fr;
    }

    .billing-qr-box img {
        width: min(190px, 100%);
        height: auto;
        aspect-ratio: 1;
    }

    .modal,
    .template-modal,
    .template-editor-modal,
    .ai-agent-modal,
    .campaign-modal {
        width: calc(100vw - 20px) !important;
        max-height: calc(100vh - 20px);
        border-radius: 8px;
    }
}

@media (max-width: 640px) {
    .ai-provider-grid {
        grid-template-columns: 1fr;
    }

    h1 {
        font-size: 22px;
    }

    .brand {
        font-size: 16px;
    }

    .brand img,
    .brand-mark {
        width: 34px;
        height: 34px;
        border-radius: 8px;
    }

    .grid {
        gap: 12px;
    }

    .card {
        padding: 13px;
        border-radius: 8px;
    }

    .section-title {
        align-items: flex-start;
        flex-direction: column;
    }

    .header-badge {
        min-height: 21px;
        font-size: 10px;
    }

    .topbar-copy h1 {
        font-size: 19px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .topbar-actions {
        gap: 7px;
    }

    .header-plan-pill {
        display: flex;
        flex: 0 0 40px;
        width: 40px;
        max-width: 40px;
        min-height: 40px;
        padding: 4px;
        border-radius: 10px;
    }

    .header-plan-copy,
    .header-upgrade-btn {
        display: none;
    }

    .profile-trigger {
        min-height: 40px;
        padding: 4px;
        border-radius: 10px;
    }

    .profile-trigger .user-meta,
    .profile-trigger .profile-caret {
        display: none;
    }

    .quick-actions {
        grid-template-columns: 1fr;
    }

    .form-grid {
        gap: 11px;
    }

    .field input,
    .field select,
    .field textarea {
        font-size: 16px;
    }

    .segmented-control {
        width: 100%;
        overflow-x: auto;
    }

    .segmented-control label {
        flex: 1 0 auto;
    }

    .segmented-control span {
        text-align: center;
        padding: 8px 11px;
    }

    .table {
        min-width: 680px;
    }

    .profile-preview {
        align-items: flex-start;
        flex-direction: column;
    }

    .footer {
        padding: 12px 16px;
    }

    .logs-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
