:root {
    --ink: #101827;
    --ink-2: #18233a;
    --ink-3: #2c3a55;
    --paper: #f4f6f8;
    --surface: #ffffff;
    --line: #e4e8ee;
    --line-strong: #d2d9e3;
    --text: #101827;
    --muted: #667085;
    --faint: #98a2b3;
    --signal: #f05a28;
    --signal-dark: #d94818;
    --signal-soft: #fff1ea;
    --blue: #2a78d6;
    --blue-soft: #eaf2fd;
    --teal: #0f8f83;
    --teal-soft: #e7f5f3;
    --green: #0ca30c;
    --green-soft: #e9f7e9;
    --red: #d03b3b;
    --red-soft: #fdeeee;
    --amber: #b7791f;
    --amber-soft: #fdf5e6;
    --sidebar-w: 256px;
    --radius: 16px;
    --radius-sm: 11px;
    --shadow: 0 1px 2px rgba(16, 24, 39, .05), 0 8px 24px -18px rgba(16, 24, 39, .25);
    --font: "Sora", system-ui, -apple-system, "Segoe UI", sans-serif;
    --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-decoration: none; }
a:hover { color: #1f5fae; }

:focus-visible {
    outline: 2px solid var(--signal);
    outline-offset: 2px;
}

h1, h2, h3, h4, h5, h6 { font-family: var(--font); color: var(--ink); letter-spacing: -.015em; }
h1 { font-size: 30px; font-weight: 600; }
h2 { font-size: 22px; font-weight: 600; }
h3 { font-size: 17px; font-weight: 600; }

p { margin: 0 0 1em; }

::selection { background: #ffd9c9; color: var(--ink); }

/* ── Shell ──────────────────────────────────────────────────────────────── */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(circle at 12% -5%, rgba(240, 90, 40, .24), transparent 38%),
        radial-gradient(circle at 110% 62%, rgba(42, 120, 214, .14), transparent 46%),
        linear-gradient(180deg, #101827 0%, #0c1320 100%);
    color: #c6d0df;
    border-right: 1px solid rgba(255, 255, 255, .05);
    transition: transform .22s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 22px 20px 18px;
    color: #fff;
}

.sidebar-brand:hover { color: #fff; }

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #f4744a, var(--signal));
    color: #fff;
    border-radius: 11px;
    box-shadow: 0 8px 18px -8px rgba(240, 90, 40, .8);
    flex-shrink: 0;
}

.brand-mark svg { width: 62%; height: 62%; }

.brand-word { display: block; font-size: 17px; font-weight: 600; letter-spacing: -.02em; }
.brand-sub { display: block; font-size: 11px; color: #8b98ab; margin-top: 1px; }

.workspace-chip {
    margin: 0 14px 14px;
    padding: 10px 12px;
    border-radius: 11px;
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .07);
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 12.5px;
    color: #dbe4ef;
}

.workspace-chip .ws-avatar {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: rgba(240, 90, 40, .18);
    color: #ffb59b;
    display: grid;
    place-items: center;
    font-weight: 600;
    font-size: 11px;
    flex-shrink: 0;
}

.workspace-chip .ws-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workspace-chip a { color: #ffb59b; font-size: 11px; margin-left: auto; white-space: nowrap; }

.side-nav {
    flex: 1;
    overflow-y: auto;
    padding: 6px 12px 12px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .14) transparent;
}

.side-nav::-webkit-scrollbar { width: 6px; }
.side-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .14); border-radius: 3px; }

.side-label {
    font-size: 11px;
    color: #738095;
    padding: 14px 10px 6px;
    letter-spacing: .01em;
}

.side-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 11px;
    border-radius: 9px;
    color: #b8c4d4;
    font-size: 13.5px;
    margin-bottom: 2px;
    position: relative;
    transition: background .14s ease, color .14s ease;
}

.side-link i { font-size: 16px; width: 18px; text-align: center; color: #8c9bb0; }
.side-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.side-link:hover i { color: #dbe4ef; }

.side-link.active {
    background: rgba(255, 255, 255, .09);
    color: #fff;
    font-weight: 500;
}

.side-link.active::before {
    content: "";
    position: absolute;
    left: -12px;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--signal);
}

.side-link.active i { color: #ff9a76; }

.side-badge {
    margin-left: auto;
    font-size: 10.5px;
    padding: 1px 7px;
    border-radius: 20px;
    background: rgba(240, 90, 40, .18);
    color: #ffab8b;
}

.sidebar-user {
    border-top: 1px solid rgba(255, 255, 255, .07);
    padding: 14px;
}

.user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 11px;
    color: #dbe4ef;
    width: 100%;
    background: transparent;
    border: 0;
    text-align: left;
}

.user-card:hover { background: rgba(255, 255, 255, .06); color: #fff; }

.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(145deg, #2f405f, #1b2740);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

.avatar-sm { width: 30px; height: 30px; font-size: 11px; border-radius: 9px; }
.avatar-lg { width: 48px; height: 48px; font-size: 16px; border-radius: 13px; }

.user-meta { overflow: hidden; }
.user-name { font-size: 12.5px; font-weight: 500; color: #eef3f9; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { font-size: 10.5px; color: #8b98ab; }

.sidebar-user .dropdown-menu { font-size: 13px; }

/* ── Main ───────────────────────────────────────────────────────────────── */
.main {
    flex: 1;
    min-width: 0;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    height: 68px;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 30px;
    background: rgba(244, 246, 248, .88);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--line);
}

.topbar-title { font-size: 17px; font-weight: 600; margin: 0; letter-spacing: -.015em; }
.topbar-context { font-size: 12px; color: var(--faint); margin-top: 1px; }
.topbar-crumbs { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--faint); }
.topbar-crumbs .crumb-page { color: var(--ink); font-weight: 500; }
.topbar-crumbs i { font-size: 10px; color: #b6c0cd; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.sidebar-toggle {
    display: none;
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: 9px;
    width: 36px;
    height: 36px;
    color: var(--ink);
}

.content {
    flex: 1;
    width: 100%;
    max-width: 1420px;
    margin: 0 auto;
    padding: 26px 30px 52px;
}

.app-footer {
    padding: 16px 30px 22px;
    color: var(--faint);
    font-size: 11.5px;
    display: flex;
    gap: 14px;
    align-items: center;
}

.app-footer .sep { color: var(--line-strong); }

.page-enter { animation: rise .32s ease; }

@keyframes rise {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

/* ── Headings / utilities ───────────────────────────────────────────────── */
.page-head {
    display: flex;
    align-items: flex-start;
    gap: 18px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}

.page-head h1 { margin: 0; font-size: 26px; }
.page-head .sub { color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.page-head .actions { margin-left: auto; display: flex; gap: 9px; flex-wrap: wrap; }

.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.tny { font-size: 11.5px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.num { font-variant-numeric: tabular-nums; }
.fw-600 { font-weight: 600; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.section-gap { margin-top: 22px; }
.hairline { height: 1px; background: var(--line); border: 0; margin: 18px 0; }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
    --bs-btn-border-radius: 10px;
    font-family: var(--font);
    font-weight: 500;
    font-size: 13.5px;
    padding: 9px 16px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    line-height: 1.35;
    white-space: nowrap;
    transition: background .15s ease, border-color .15s ease, color .15s ease, transform .1s ease;
}

.btn:active { transform: translateY(1px); }
.btn i { font-size: 15px; }

.btn-ink { background: var(--ink); color: #fff; border: 1px solid var(--ink); }
.btn-ink:hover { background: #1b2942; color: #fff; border-color: #1b2942; }

.btn-signal { background: var(--signal); color: #fff; border: 1px solid var(--signal); box-shadow: 0 8px 18px -10px rgba(240, 90, 40, .8); }
.btn-signal:hover { background: var(--signal-dark); color: #fff; border-color: var(--signal-dark); }

.btn-soft { background: #fff; color: var(--ink); border: 1px solid var(--line-strong); }
.btn-soft:hover { background: #f8fafc; color: var(--ink); border-color: #bfc9d6; }

.btn-ghost { background: transparent; color: var(--muted); border: 1px solid transparent; }
.btn-ghost:hover { background: rgba(16, 24, 39, .05); color: var(--ink); }

.btn-danger-soft { background: var(--red-soft); color: #a52222; border: 1px solid #f3caca; }
.btn-danger-soft:hover { background: #fbe0e0; color: #8d1a1a; }

.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn-lg { padding: 12px 22px; font-size: 14.5px; border-radius: 12px; }
.btn-icon { width: 34px; height: 34px; padding: 0; justify-content: center; }

.btn[disabled], .btn.disabled { opacity: .55; pointer-events: none; }

/* ── Panels / cards ─────────────────────────────────────────────────────── */
.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.panel-pad { padding: 22px; }
.panel-head {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 18px 22px 0;
}
.panel-head h2, .panel-head h3 { margin: 0; font-size: 16px; }
.panel-head .sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.panel-head .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.panel-body { padding: 18px 22px 22px; }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-hero { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
.grid-chart { grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); }

/* ── Hero dispatch board ────────────────────────────────────────────────── */
.hero-board {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at 88% -20%, rgba(240, 90, 40, .34), transparent 46%),
        radial-gradient(circle at 5% 120%, rgba(42, 120, 214, .22), transparent 44%),
        linear-gradient(150deg, #131d30 0%, #0d1522 100%);
    color: #fff;
    border-radius: 20px;
    padding: 26px 28px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
    gap: 26px;
    min-height: 212px;
    border: 1px solid rgba(255, 255, 255, .06);
}

.hero-board::after {
    content: "";
    position: absolute;
    right: -90px;
    top: -90px;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, .09);
    box-shadow: 0 0 0 28px rgba(255, 255, 255, .025), 0 0 0 58px rgba(255, 255, 255, .02);
    pointer-events: none;
}

.hero-label { font-size: 12.5px; color: #9caabd; display: flex; align-items: center; gap: 8px; }
.hero-label .pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--signal); box-shadow: 0 0 0 4px rgba(240, 90, 40, .18); }
.hero-value { font-size: 54px; font-weight: 600; line-height: 1.05; letter-spacing: -.04em; margin: 10px 0 8px; }
.hero-sub { color: #a9b6c8; font-size: 12.5px; display: flex; flex-wrap: wrap; gap: 14px; }
.hero-sub strong { color: #fff; font-weight: 600; }
.hero-sub .up { color: #7fe0b0; }
.hero-sub .down { color: #ff9f9f; }
.hero-actions { margin-top: 18px; display: flex; gap: 9px; flex-wrap: wrap; }

.hero-pipeline { align-self: center; position: relative; z-index: 1; }
.pipeline-title { font-size: 12.5px; color: #9caabd; margin-bottom: 12px; }
.pipeline-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; position: relative; }
.pipeline-stage {
    position: relative;
    padding: 12px 12px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .055);
    border: 1px solid rgba(255, 255, 255, .08);
}
.pipeline-stage .stage-label { font-size: 11px; color: #93a1b5; display: flex; align-items: center; gap: 6px; }
.pipeline-stage .stage-value { font-size: 21px; font-weight: 600; margin-top: 4px; letter-spacing: -.02em; }
.pipeline-stage .stage-bar { height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .12); margin-top: 9px; overflow: hidden; }
.pipeline-stage .stage-bar > span { display: block; height: 100%; border-radius: 3px; background: #6da7ec; }
.pipeline-stage[data-stage="sent"] .stage-bar > span { background: #86b6ef; }
.pipeline-stage[data-stage="delivered"] .stage-bar > span { background: #55c9a8; }
.pipeline-stage[data-stage="opened"] .stage-bar > span { background: #f08d66; }
.pipeline-failed {
    margin-top: 12px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 11.5px;
    color: #ffb3b3;
    background: rgba(208, 59, 59, .13);
    border: 1px solid rgba(208, 59, 59, .25);
    padding: 5px 10px;
    border-radius: 20px;
}
.pipeline-failed .dot { width: 5px; height: 5px; border-radius: 50%; background: #ff8c8c; }

/* ── Metrics ────────────────────────────────────────────────────────────── */
.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.metric-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metric {
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    position: relative;
    overflow: hidden;
}
.metric-label { color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 8px; }
.metric-label i { color: var(--faint); }
.metric-value { font-size: 29px; font-weight: 600; letter-spacing: -.03em; line-height: 1.2; margin-top: 4px; }
.metric-sub { font-size: 11.5px; color: var(--faint); }
.metric-sub strong { color: var(--muted); font-weight: 500; }
.metric-accent { position: absolute; right: -20px; bottom: -28px; width: 84px; height: 84px; border-radius: 50%; background: var(--signal-soft); opacity: .6; }

/* ── Charts ─────────────────────────────────────────────────────────────── */
.chart-wrap { position: relative; height: 290px; }
.chart-wrap-sm { height: 250px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; font-size: 12px; color: var(--muted); }
.legend-item { display: inline-flex; align-items: center; gap: 7px; }
.legend-swatch { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.legend-line { width: 16px; height: 0; border-top: 2px solid; }
.legend-line.dashed { border-top-style: dashed; }

.segmented-wrap { display: flex; gap: 16px; align-items: stretch; height: 250px; }
.segmented-bar {
    width: 58px;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column-reverse;
    background: #f0f3f6;
    border: 1px solid var(--line);
    flex-shrink: 0;
}
.segmented-bar .seg { position: relative; display: flex; align-items: center; justify-content: center; min-height: 6px; font-size: 10px; font-weight: 600; color: #fff; transition: height .4s ease; }
.seg-email { background: #2a78d6; }
.seg-sms { background: #eb6834; }
.seg-rcs { background: #1baf7a; }
.seg-empty { background: #e9edf2; }
.segmented-legend { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 12px; }
.segmented-row { display: flex; align-items: center; gap: 9px; font-size: 12.5px; }
.segmented-row .swatch { width: 9px; height: 9px; border-radius: 3px; }
.segmented-row .name { color: var(--muted); flex: 1; }
.segmented-row .value { font-weight: 600; font-variant-numeric: tabular-nums; }
.segmented-row .pct { color: var(--faint); font-size: 11px; width: 38px; text-align: right; }

.data-table-toggle { margin-top: 10px; font-size: 12px; }
.data-table-toggle summary { cursor: pointer; color: var(--muted); }
.data-table-toggle summary:hover { color: var(--ink); }
.data-table-toggle .table-wrap { margin-top: 10px; }

/* ── Tables ─────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: 12px; }
.table-clean { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.table-clean thead th {
    text-align: left;
    font-size: 11.5px;
    font-weight: 500;
    color: var(--faint);
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
    background: #fbfcfd;
}
.table-clean tbody td {
    padding: 13px 14px;
    border-bottom: 1px solid #eef1f5;
    vertical-align: middle;
}
.table-clean tbody tr:last-child td { border-bottom: 0; }
.table-clean tbody tr { transition: background .12s ease; }
.table-clean tbody tr:hover { background: #fafbfd; }
.table-clean .cell-main { font-weight: 500; color: var(--ink); }
.table-clean .cell-sub { font-size: 11.5px; color: var(--faint); margin-top: 1px; }
.table-clean .actions { display: flex; gap: 4px; justify-content: flex-end; }
.table-clean .row-avatar { display: flex; align-items: center; gap: 10px; min-width: 190px; }
.table-empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.table-empty i { display: block; font-size: 30px; color: #c3ccd8; margin-bottom: 10px; }

.table-toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    padding: 16px 18px;
    border-bottom: 1px solid var(--line);
}
.table-toolbar .search-box { position: relative; flex: 1; min-width: 200px; max-width: 380px; }
.table-toolbar .search-box i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); font-size: 14px; }
.table-toolbar .search-box input { padding-left: 35px; }
.table-toolbar .spacer { flex: 1; }
.table-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 18px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
    flex-wrap: wrap;
}
.table-footer .pagination { margin-left: auto; }

.pagination { display: flex; gap: 4px; flex-wrap: wrap; margin: 0; }
.pagination .page-link {
    border: 1px solid var(--line);
    color: var(--muted);
    border-radius: 8px;
    padding: 5px 10px;
    font-size: 12px;
    min-width: 32px;
    text-align: center;
    background: #fff;
}
.pagination .page-link:hover { background: #f5f7fa; color: var(--ink); }
.pagination .active .page-link { background: var(--ink); border-color: var(--ink); color: #fff; }
.pagination .disabled .page-link { opacity: .4; }

/* ── Pills / badges ─────────────────────────────────────────────────────── */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border-radius: 20px;
    padding: 3px 9px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    line-height: 1.4;
}
.pill i { font-size: 11px; }
.pill.is-queued { background: #f1f4f7; color: #667085; }
.pill.is-sending { background: var(--blue-soft); color: #1f5fae; }
.pill.is-sent { background: var(--blue-soft); color: #1f5fae; }
.pill.is-delivered { background: var(--green-soft); color: #107010; }
.pill.is-opened { background: var(--teal-soft); color: #0b6b61; }
.pill.is-failed { background: var(--red-soft); color: #a52222; }
.pill.is-scheduled { background: var(--amber-soft); color: #8f5c10; }
.pill.is-paused { background: #f1f4f7; color: #667085; }

.channel-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}
.channel-chip .ch-icon {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    display: inline-grid;
    place-items: center;
    font-size: 13px;
}
.channel-email .ch-icon { background: var(--blue-soft); color: var(--blue); }
.channel-sms .ch-icon { background: #fdf0ea; color: #d3541f; }
.channel-rcs .ch-icon { background: var(--teal-soft); color: var(--teal); }
.channel-other .ch-icon { background: #f1f4f7; color: var(--muted); }

.tag {
    display: inline-block;
    background: #f3f5f8;
    border: 1px solid #e7ebf0;
    color: #5b6678;
    border-radius: 6px;
    padding: 1px 7px;
    font-size: 10.5px;
    margin: 1px 3px 1px 0;
}

/* ── Forms ──────────────────────────────────────────────────────────────── */
.form-label { font-size: 12.5px; font-weight: 500; color: var(--ink-3); margin-bottom: 6px; }
.form-label .req { color: var(--signal); }
.form-text { font-size: 11.5px; color: var(--faint); }
.form-control, .form-select {
    font-family: var(--font);
    font-size: 13.5px;
    color: var(--ink);
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    padding: 9px 12px;
    background-color: #fff;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.form-control:focus, .form-select:focus {
    border-color: #9db9e6;
    box-shadow: 0 0 0 3px rgba(42, 120, 214, .12);
}
.form-control::placeholder { color: #a7b0be; }
.form-control-sm, .form-select-sm { font-size: 12.5px; padding: 6px 10px; border-radius: 8px; }
textarea.form-control { min-height: 110px; }
.form-check-input { border-color: var(--line-strong); }
.form-check-input:checked { background-color: var(--ink); border-color: var(--ink); }
.form-check-input:focus { box-shadow: 0 0 0 3px rgba(42, 120, 214, .12); }
.form-switch .form-check-input:checked { background-color: var(--signal); border-color: var(--signal); }
.input-group-text { background: #f7f9fb; border-color: var(--line-strong); color: var(--muted); font-size: 12.5px; border-radius: 10px; }
.invalid-feedback { font-size: 11.5px; }

.form-section { padding: 22px; }
.form-section + .form-section { border-top: 1px solid var(--line); }
.form-section-title { font-size: 14px; font-weight: 600; margin: 0 0 3px; }
.form-section-sub { font-size: 12px; color: var(--muted); margin: 0 0 18px; }

.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field-grid .span-2 { grid-column: span 2; }
.field { display: flex; flex-direction: column; }

/* ── Flash / alerts ─────────────────────────────────────────────────────── */
.flash-area { width: 100%; max-width: 1420px; margin: 0 auto; padding: 16px 30px 0; }
.flash {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border-radius: 11px;
    padding: 11px 14px;
    font-size: 13px;
    margin-bottom: 10px;
    border: 1px solid transparent;
    animation: rise .25s ease both;
}
.flash i { font-size: 16px; margin-top: 1px; }
.flash-success { background: var(--green-soft); border-color: #c8e9c8; color: #176317; }
.flash-error { background: var(--red-soft); border-color: #f3caca; color: #a52222; }
.flash .btn-close { margin-left: auto; font-size: 10px; }

.alert { border-radius: 11px; font-size: 13px; border: 1px solid transparent; }
.alert-info { background: var(--blue-soft); border-color: #cfe1fa; color: #1f5fae; }
.alert-warning { background: var(--amber-soft); border-color: #f3e2bd; color: #8f5c10; }
.alert-danger { background: var(--red-soft); border-color: #f3caca; color: #a52222; }

/* ── Empty states ───────────────────────────────────────────────────────── */
.empty {
    text-align: center;
    padding: 44px 22px;
    color: var(--muted);
}
.empty .empty-icon {
    width: 52px;
    height: 52px;
    border-radius: 15px;
    background: #f2f5f8;
    color: #93a0b2;
    display: inline-grid;
    place-items: center;
    font-size: 22px;
    margin-bottom: 12px;
}
.empty h3 { font-size: 15px; margin: 0 0 4px; }
.empty p { font-size: 12.5px; margin: 0 0 16px; }

/* ── Dropzone ───────────────────────────────────────────────────────────── */
.dropzone {
    border: 1.5px dashed #c6d0dc;
    border-radius: 14px;
    background: #fbfcfd;
    padding: 30px 22px;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, transform .15s ease;
}
.dropzone:hover { border-color: #9fb2c8; background: #f7fafc; }
.dropzone.is-dragover { border-color: var(--signal); background: var(--signal-soft); }
.dropzone .dz-icon {
    width: 46px;
    height: 46px;
    border-radius: 13px;
    background: #fff;
    border: 1px solid var(--line);
    display: inline-grid;
    place-items: center;
    font-size: 20px;
    color: var(--signal);
    margin-bottom: 10px;
}
.dropzone h4 { font-size: 14px; margin: 0 0 3px; }
.dropzone p { font-size: 12px; color: var(--faint); margin: 0; }
.dropzone input[type="file"] { display: none; }
.dropzone .dz-file {
    margin-top: 12px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 7px 11px;
    font-size: 12px;
    color: var(--ink-3);
}

/* ── Campaign wizard ────────────────────────────────────────────────────── */
.wizard { display: grid; grid-template-columns: 228px minmax(0, 1fr); gap: 20px; align-items: start; }
.step-rail { position: sticky; top: 90px; padding: 16px; }
.step-item { display: flex; gap: 11px; padding: 10px 8px; border-radius: 10px; color: var(--muted); position: relative; }
.step-item + .step-item { margin-top: 2px; }
.step-item::before { content: ""; position: absolute; left: 22px; top: 38px; bottom: -4px; width: 1px; background: var(--line); }
.step-item:last-child::before { display: none; }
.step-num {
    width: 29px;
    height: 29px;
    border-radius: 50%;
    border: 1px solid var(--line-strong);
    background: #fff;
    color: var(--muted);
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}
.step-item.active { background: #f8fafc; color: var(--ink); }
.step-item.active .step-num { background: var(--ink); border-color: var(--ink); color: #fff; }
.step-item.done .step-num { background: var(--green-soft); border-color: #bfe3bf; color: #107010; }
.step-item .step-name { font-size: 12.5px; font-weight: 500; }
.step-item .step-hint { font-size: 10.5px; color: var(--faint); }

.wizard-panel { min-width: 0; }
.wizard-step { display: none; }
.wizard-step.active { display: block; animation: rise .22s ease both; }
.wizard-foot {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 22px;
    border-top: 1px solid var(--line);
    background: #fbfcfd;
    border-radius: 0 0 var(--radius) var(--radius);
}
.wizard-foot .spacer { flex: 1; }

.channel-picker { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.channel-option { position: relative; }
.channel-option input { position: absolute; opacity: 0; pointer-events: none; }
.channel-option label {
    display: block;
    border: 1.5px solid var(--line);
    border-radius: 13px;
    padding: 15px;
    cursor: pointer;
    background: #fff;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
    height: 100%;
}
.channel-option label:hover { border-color: #b9c6d6; }
.channel-option input:checked + label {
    border-color: var(--ink);
    box-shadow: 0 0 0 3px rgba(16, 24, 39, .07);
    background: #fbfcfe;
}
.channel-option .ch-name { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.channel-option .ch-desc { font-size: 11.5px; color: var(--faint); margin-top: 4px; }
.channel-option .ch-check { position: absolute; top: 12px; right: 12px; color: var(--ink); opacity: 0; font-size: 15px; }
.channel-option input:checked + label .ch-check { opacity: 1; }

.recipient-box {
    border: 1px solid var(--line);
    border-radius: 12px;
    max-height: 280px;
    overflow-y: auto;
    background: #fff;
}
.recipient-row { display: flex; align-items: center; gap: 10px; padding: 10px 13px; border-bottom: 1px solid #eef1f5; font-size: 12.5px; }
.recipient-row:last-child { border-bottom: 0; }
.recipient-row:hover { background: #fafbfd; }
.recipient-row .meta { flex: 1; min-width: 0; }
.recipient-row .meta .name { font-weight: 500; }
.recipient-row .meta .sub { color: var(--faint); font-size: 11px; }

.chip-list { display: flex; flex-wrap: wrap; gap: 6px; }
.member-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: #f4f6f9;
    border: 1px solid #e6eaf0;
    border-radius: 20px;
    padding: 4px 6px 4px 10px;
    font-size: 12px;
}
.member-chip button { border: 0; background: transparent; color: var(--faint); padding: 0 2px; line-height: 1; }
.member-chip button:hover { color: var(--red); }

.summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.summary-item { border: 1px solid var(--line); border-radius: 12px; padding: 13px 15px; }
.summary-item .k { font-size: 11px; color: var(--faint); }
.summary-item .v { font-size: 14px; font-weight: 600; margin-top: 2px; }

.sms-counter { display: flex; gap: 16px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); margin-top: 8px; }
.sms-counter strong { color: var(--ink); }
.sms-counter .warn { color: var(--amber); }

/* ── Template editor ────────────────────────────────────────────────────── */
.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.editor-side { position: sticky; top: 90px; display: flex; flex-direction: column; gap: 16px; }
.variable-list { display: flex; flex-direction: column; gap: 5px; }
.variable-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 9px;
    padding: 7px 9px;
    font-size: 11.5px;
    color: var(--muted);
    cursor: pointer;
    text-align: left;
}
.variable-chip:hover { border-color: #b8c6d8; background: #fbfcfd; }
.variable-chip code { font-family: var(--mono); font-size: 10.5px; color: var(--signal); background: var(--signal-soft); padding: 1px 5px; border-radius: 4px; }
.variable-chip .desc { margin-left: auto; font-size: 10px; color: var(--faint); }

.block-list { display: flex; flex-direction: column; gap: 10px; }
.block-card {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
}
.block-head { display: flex; align-items: center; gap: 9px; padding: 9px 12px; background: #fbfcfd; border-bottom: 1px solid var(--line); }
.block-head .block-type { font-size: 11.5px; font-weight: 500; color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
.block-head .block-type i { color: var(--signal); }
.block-head .block-actions { margin-left: auto; display: flex; gap: 2px; }
.block-body { padding: 12px; }
.block-body textarea { min-height: 86px; }
.block-body .media-preview { margin-top: 9px; max-width: 100%; border-radius: 9px; border: 1px solid var(--line); }
.block-body audio, .block-body video { width: 100%; margin-top: 9px; }
.block-empty { border: 1.5px dashed #d2dae4; border-radius: 12px; padding: 26px; text-align: center; color: var(--faint); font-size: 12.5px; }

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.media-card { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; position: relative; }
.media-card .thumb { height: 88px; background: #f2f5f8; display: grid; place-items: center; overflow: hidden; }
.media-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.media-card .thumb i { font-size: 24px; color: #8fa0b5; }
.media-card .media-meta { padding: 7px 9px; }
.media-card .media-name { font-size: 10.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-card .media-size { font-size: 10px; color: var(--faint); }
.media-card .media-pick { position: absolute; inset: 0; border: 0; background: transparent; }
.media-card:hover { border-color: #aebdd0; box-shadow: 0 4px 14px -10px rgba(16,24,39,.4); }
.media-card.is-selected { border-color: var(--signal); box-shadow: 0 0 0 2px rgba(240,90,40,.16); }

.preview-frame { width: 100%; height: 420px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.rcs-preview { background: #eef2f6; border-radius: 16px; padding: 16px; }
.rcs-preview .rcs-phone { background: #fff; border-radius: 14px; padding: 16px; max-width: 360px; margin: 0 auto; box-shadow: 0 10px 30px -18px rgba(16,24,39,.35); }
.rcs-preview .rcs-title { font-weight: 600; font-size: 14px; margin-bottom: 10px; }
.rcs-preview .rcs-block { border-top: 1px solid var(--line); padding: 10px 0; font-size: 12.5px; white-space: pre-wrap; }
.rcs-preview .rcs-block:first-of-type { border-top: 0; }
.rcs-preview img, .rcs-preview video { max-width: 100%; border-radius: 8px; }

/* ── Log detail ─────────────────────────────────────────────────────────── */
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 20px; }
.detail-item { padding: 7px 0; border-bottom: 1px dashed #eef1f5; }
.detail-item .k { font-size: 11px; color: var(--faint); }
.detail-item .v { font-size: 12.5px; margin-top: 1px; word-break: break-word; }
.detail-content {
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 14px;
    font-size: 12.5px;
    max-height: 300px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
}
.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item { display: flex; gap: 10px; position: relative; padding-bottom: 16px; }
.timeline-item::before { content: ""; position: absolute; left: 5px; top: 14px; bottom: 0; width: 1px; background: var(--line); }
.timeline-item:last-child::before { display: none; }
.timeline-dot { width: 11px; height: 11px; border-radius: 50%; background: #cfd8e3; margin-top: 3px; flex-shrink: 0; z-index: 1; border: 2px solid #fff; box-shadow: 0 0 0 1px #cfd8e3; }
.timeline-item.done .timeline-dot { background: var(--green); box-shadow: 0 0 0 1px var(--green); }
.timeline-item.fail .timeline-dot { background: var(--red); box-shadow: 0 0 0 1px var(--red); }
.timeline-item .t { font-size: 12px; font-weight: 500; }
.timeline-item .d { font-size: 11px; color: var(--faint); }

/* ── Progress ───────────────────────────────────────────────────────────── */
.progress { height: 8px; border-radius: 20px; background: #edf1f5; overflow: hidden; }
.progress-bar { background: var(--ink); border-radius: 20px; transition: width .4s ease; }
.progress-bar.is-done { background: var(--green); }
.progress-bar.is-failed { background: var(--red); }
.progress-bar.is-signal { background: var(--signal); }

.campaign-progress { display: flex; align-items: center; gap: 10px; min-width: 130px; }
.campaign-progress .progress { flex: 1; height: 6px; }
.campaign-progress .pct { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; width: 34px; text-align: right; }

/* ── Profile / settings ─────────────────────────────────────────────────── */
.settings-nav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; }
.settings-nav a {
    font-size: 12.5px;
    color: var(--muted);
    padding: 7px 12px;
    border-radius: 9px;
    border: 1px solid transparent;
}
.settings-nav a:hover { background: #eef2f6; color: var(--ink); }
.settings-nav a.active { background: #fff; border-color: var(--line); color: var(--ink); font-weight: 500; }

.connection-card { border: 1px solid var(--line); border-radius: 12px; padding: 15px; background: #fff; }
.connection-card .conn-head { display: flex; align-items: center; gap: 9px; }
.connection-card .conn-icon { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; font-size: 15px; }
.connection-card .conn-title { font-size: 13px; font-weight: 600; }
.connection-card .conn-sub { font-size: 11px; color: var(--faint); }
.connection-card .conn-body { margin-top: 12px; font-size: 11.5px; color: var(--muted); display: flex; flex-direction: column; gap: 5px; }
.connection-card .conn-body code { font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); background: #f5f7fa; padding: 1px 5px; border-radius: 4px; word-break: break-all; }

.usage-bar { height: 6px; border-radius: 10px; background: #eef2f6; overflow: hidden; margin-top: 7px; }
.usage-bar span { display: block; height: 100%; background: var(--blue); border-radius: 10px; }

/* ── Auth ───────────────────────────────────────────────────────────────── */
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: var(--paper); }
.auth-visual {
    background:
        radial-gradient(circle at 80% 10%, rgba(240, 90, 40, .32), transparent 42%),
        radial-gradient(circle at 10% 90%, rgba(42, 120, 214, .25), transparent 45%),
        linear-gradient(160deg, #121c2e 0%, #0b1220 100%);
    color: #fff;
    padding: 48px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}
.auth-visual::before {
    content: "";
    position: absolute;
    right: -140px;
    bottom: -160px;
    width: 480px;
    height: 480px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,.08);
    box-shadow: 0 0 0 50px rgba(255,255,255,.025), 0 0 0 100px rgba(255,255,255,.018), 0 0 0 150px rgba(255,255,255,.012);
}
.auth-brand { display: flex; align-items: center; gap: 11px; }
.auth-headline { font-size: clamp(28px, 3.4vw, 44px); line-height: 1.12; letter-spacing: -.035em; font-weight: 600; color: #fff; max-width: 560px; margin: 0 0 16px; }
.auth-copy { color: #a5b3c7; font-size: 14px; max-width: 480px; line-height: 1.65; }
.auth-points { display: flex; flex-direction: column; gap: 11px; margin-top: 22px; position: relative; z-index: 1; }
.auth-point { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: #c4d0e0; }
.auth-point .ap-icon { width: 28px; height: 28px; border-radius: 8px; background: rgba(255,255,255,.07); display: grid; place-items: center; color: #ffb59b; font-size: 13px; }
.auth-foot { color: #738095; font-size: 11px; position: relative; z-index: 1; }
.auth-form-side { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 390px; }
.auth-card h1 { font-size: 25px; margin: 0 0 5px; }
.auth-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 26px; }
.auth-card .form-control { padding: 11px 13px; }
.auth-card .btn { width: 100%; justify-content: center; padding: 11px; }
.auth-demo { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 16px; font-size: 11.5px; color: var(--faint); }
.auth-demo code { color: var(--ink-3); background: #eef2f6; padding: 1px 5px; border-radius: 4px; font-family: var(--mono); }

/* ── Public page ────────────────────────────────────────────────────────── */
.public-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at 15% 10%, rgba(240,90,40,.08), transparent 35%),
        radial-gradient(circle at 90% 90%, rgba(42,120,214,.08), transparent 40%),
        var(--paper);
}
.public-card { width: 100%; max-width: 480px; background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 34px; box-shadow: var(--shadow); text-align: center; }
.public-card .pub-logo { display: inline-flex; margin-bottom: 18px; }
.public-card h1 { font-size: 22px; margin: 0 0 8px; }
.public-card p { color: var(--muted); font-size: 13px; }
.public-card .email { font-weight: 600; color: var(--ink); }
.public-card .btn { min-width: 160px; justify-content: center; }
.public-foot { margin-top: 26px; font-size: 11px; color: var(--faint); }

/* ── Modals / dialogs / toasts ──────────────────────────────────────────── */
.modal-content { border: 0; border-radius: 16px; box-shadow: 0 24px 60px -20px rgba(16,24,39,.4); }
.modal-header { border-bottom: 1px solid var(--line); padding: 16px 20px; }
.modal-title { font-size: 15px; font-weight: 600; }
.modal-body { padding: 20px; }
.modal-footer { border-top: 1px solid var(--line); padding: 14px 20px; }
.modal-backdrop.show { opacity: .42; }

.app-dlg-backdrop {
    position: fixed;
    inset: 0;
    z-index: 20000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(9, 15, 26, .5);
    opacity: 0;
    transition: opacity .15s ease;
    padding: 1rem;
}
.app-dlg-backdrop.show { opacity: 1; }
.app-dlg {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 60px -20px rgba(0,0,0,.45);
    max-width: 430px;
    width: 100%;
    transform: translateY(-8px) scale(.985);
    transition: transform .16s ease;
    overflow: hidden;
}
.app-dlg-backdrop.show .app-dlg { transform: none; }
.app-dlg-body { display: flex; gap: 13px; padding: 22px 22px 6px; }
.app-dlg-icon {
    width: 38px; height: 38px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
    font-size: 18px; flex-shrink: 0; line-height: 1;
}
.app-dlg-icon-warning { background: var(--amber-soft); color: var(--amber); }
.app-dlg-icon-danger { background: var(--red-soft); color: var(--red); }
.app-dlg-icon-info { background: var(--blue-soft); color: var(--blue); }
.app-dlg-msg { margin: 0; padding-top: 4px; white-space: pre-line; color: var(--ink-3); font-size: 13.5px; line-height: 1.55; }
.app-dlg-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 22px 20px; }
.app-dlg-btn { border: 0; border-radius: 9px; padding: 8px 15px; font-size: 13px; font-weight: 500; cursor: pointer; font-family: var(--font); }
.app-dlg-btn-cancel { background: #eef1f5; color: #3d4a5c; }
.app-dlg-btn-cancel:hover { background: #e3e8ef; }
.app-dlg-btn-ok { background: var(--ink); color: #fff; }
.app-dlg-btn-ok:hover { background: #1b2942; }
.app-dlg-btn-danger { background: var(--red); color: #fff; }
.app-dlg-btn-danger:hover { background: #b32f2f; }

.toast-stack { position: fixed; right: 20px; bottom: 20px; z-index: 21000; display: flex; flex-direction: column; gap: 8px; max-width: 360px; }
.app-toast {
    display: flex; align-items: flex-start; gap: 9px;
    background: var(--ink); color: #fff; border-radius: 11px; padding: 11px 14px;
    font-size: 12.5px; box-shadow: 0 14px 30px -14px rgba(16,24,39,.6);
    animation: toastIn .22s ease both;
}
.app-toast.is-error { background: #7f1d1d; }
.app-toast.is-success { background: #14532d; }
.app-toast i { margin-top: 1px; font-size: 14px; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ── Misc ───────────────────────────────────────────────────────────────── */
.divider-text { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: 11px; margin: 18px 0; }
.divider-text::before, .divider-text::after { content: ""; height: 1px; background: var(--line); flex: 1; }

.kv { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; padding: 7px 0; border-bottom: 1px dashed #eef1f5; }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--faint); }
.kv .v { font-weight: 500; text-align: right; }

.hint-box { background: #f8fafc; border: 1px solid var(--line); border-radius: 11px; padding: 12px 14px; font-size: 11.5px; color: var(--muted); }
.hint-box code { font-family: var(--mono); color: var(--ink-3); background: #eef2f6; padding: 1px 5px; border-radius: 4px; }

.toggle-password {
    background: #fff;
    border: 1px solid var(--line-strong);
    border-left: 0;
    border-radius: 0 10px 10px 0;
    color: var(--faint);
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
}
.toggle-password:hover { color: var(--ink); }
.input-group > .form-control { border-radius: 10px 0 0 10px; }
.input-group > .form-control:last-child { border-radius: 10px; }

.spinner-border-sm { width: 13px; height: 13px; border-width: 2px; }

.loading-overlay {
    position: absolute; inset: 0; background: rgba(255,255,255,.65); display: none;
    align-items: center; justify-content: center; border-radius: var(--radius); z-index: 5;
}
.loading-overlay.show { display: flex; }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 1200px) {
    .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .metric-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .hero-board { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
}

@media (max-width: 992px) {
    .sidebar { transform: translateX(-100%); box-shadow: 0 0 40px rgba(0,0,0,.3); }
    .sidebar.show { transform: none; }
    .main { margin-left: 0; }
    .sidebar-toggle { display: inline-flex; align-items: center; justify-content: center; }
    .grid-hero, .grid-chart, .grid-2 { grid-template-columns: minmax(0, 1fr); }
    .editor-grid { grid-template-columns: minmax(0, 1fr); }
    .editor-side { position: static; }
    .wizard { grid-template-columns: minmax(0, 1fr); }
    .step-rail { position: static; display: flex; gap: 6px; overflow-x: auto; padding: 10px; }
    .step-item { min-width: 150px; }
    .step-item::before { display: none; }
    .auth-shell { grid-template-columns: minmax(0, 1fr); }
    .auth-visual { display: none; }
    .auth-form-side { min-height: 100vh; }
}

@media (max-width: 768px) {
    .content { padding: 18px 16px 40px; }
    .topbar { padding: 0 16px; height: 62px; }
    .flash-area { padding: 12px 16px 0; }
    .app-footer { padding: 14px 16px 20px; }
    .page-head h1 { font-size: 22px; }
    .hero-board { grid-template-columns: minmax(0, 1fr); padding: 22px; min-height: 0; }
    .hero-value { font-size: 42px; }
    .pipeline-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .metric-grid, .grid-3, .grid-4, .metric-grid-4 { grid-template-columns: minmax(0, 1fr); }
    .field-grid { grid-template-columns: minmax(0, 1fr); }
    .field-grid .span-2 { grid-column: span 1; }
    .channel-picker { grid-template-columns: minmax(0, 1fr); }
    .summary-grid { grid-template-columns: minmax(0, 1fr); }
    .detail-grid { grid-template-columns: minmax(0, 1fr); }
    .table-toolbar { padding: 12px; }
    .table-toolbar .search-box { max-width: none; }
    .topbar-actions .date-chip { display: none; }
    .panel-head { padding: 15px 16px 0; }
    .panel-body { padding: 15px 16px 18px; }
    .segmented-wrap { height: 210px; }
    .toast-stack { left: 16px; right: 16px; bottom: 16px; max-width: none; }
    .public-card { padding: 26px 20px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

@media print {
    .sidebar, .topbar, .app-footer, .flash-area, .page-head .actions, .table-toolbar, .table-footer, .wizard-foot { display: none !important; }
    .main { margin-left: 0; }
    .content { padding: 0; max-width: none; }
    .panel { box-shadow: none; border-color: #ccc; }
}
