/* TechViv WhatsApp Assistant Portal
   Brand: TechViv "VS" mark — cyan → blue → violet. Light theme by default, dark via [data-theme="dark"]. */

:root {
    color-scheme: light;

    --bg: #f4f6fb;
    --surface: #ffffff;
    --surface-2: #f8fafd;
    --line: #e3e8f2;
    --line-strong: #cfd7e6;
    --ink: #0b1426;
    --ink-2: #4a5670;
    --ink-3: #8591a8;

    --brand: #1f5bff;
    --brand-hover: #1747d6;
    --brand-soft: #eaf0ff;
    --brand-ink: #1747d6;
    --grad: linear-gradient(120deg, #00c2f7 0%, #1f5bff 52%, #7a1cf5 100%);

    --ok: #0e9f6a;
    --ok-soft: #e4f6ee;
    --warn: #c77c00;
    --warn-soft: #fdf2dc;
    --bad: #d92d47;
    --bad-soft: #fde8eb;
    --idle: #8591a8;
    --idle-soft: #eef1f6;

    /* Sidebar stays navy in both themes: the logo was drawn for a dark ground */
    --side-bg: #0b1426;
    --side-line: #1a2540;
    --side-ink: #e6ecf7;
    --side-ink-2: #97a3bb;
    --side-hover: rgba(255, 255, 255, 0.06);
    --side-active: rgba(31, 91, 255, 0.22);

    --shadow-sm: 0 1px 2px rgba(11, 20, 38, 0.06);
    --shadow-md: 0 4px 16px rgba(11, 20, 38, 0.08);
    --tip-bg: #0b1426;
    --tip-ink: #ffffff;
    --bubble-me: #e6eeff;
    --bubble-them: #ffffff;
    /* chart series, validated for colour-blind separation on this surface */
    --series-1: #d9771f;
    --series-2: #1f5bff;

    --radius: 12px;
    --radius-sm: 8px;
    --font-display: 'Space Grotesk', 'Segoe UI', system-ui, sans-serif;
    --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
    --side-w: 264px;
}

:root[data-theme='dark'] {
    color-scheme: dark;

    --bg: #070d1a;
    --surface: #0e1628;
    --surface-2: #121c31;
    --line: #1f2a42;
    --line-strong: #2c3a57;
    --ink: #eaf0fa;
    --ink-2: #a9b5cb;
    --ink-3: #6f7c96;

    --brand: #5b8cff;
    --brand-hover: #7aa2ff;
    --brand-soft: rgba(91, 140, 255, 0.14);
    --brand-ink: #8fb0ff;

    --ok: #2bd49a;
    --ok-soft: rgba(43, 212, 154, 0.13);
    --warn: #f2b347;
    --warn-soft: rgba(242, 179, 71, 0.13);
    --bad: #ff5c73;
    --bad-soft: rgba(255, 92, 115, 0.13);
    --idle: #6f7c96;
    --idle-soft: rgba(111, 124, 150, 0.15);

    --side-bg: #050a14;
    --side-line: #141d31;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 6px 24px rgba(0, 0, 0, 0.35);
    --tip-bg: #eaf0fa;
    --tip-ink: #0b1426;
    --bubble-me: #16294f;
    --bubble-them: #121c31;
    --series-1: #d9771f;
    --series-2: #5b8cff;
}

/* ---------- base ---------- */

*,
*::before,
*::after {
    box-sizing: border-box;
}
html,
body {
    height: 100%;
}
body {
    margin: 0;
    font: 14.5px/1.55 var(--font-body);
    background: var(--bg);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}
h1,
h2,
h3,
h4 {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.2;
    margin: 0;
    text-wrap: balance;
}
h1 {
    font-size: 1.75rem;
}
h2 {
    font-size: 1.3rem;
}
h3 {
    font-size: 1.05rem;
}
p {
    margin: 0;
}
a {
    color: var(--brand-ink);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}
code,
.mono {
    font-family: var(--font-mono);
    font-size: 0.86em;
}
code {
    background: var(--surface-2);
    border: 1px solid var(--line);
    padding: 0 5px;
    border-radius: 5px;
}
hr {
    border: none;
    border-top: 1px solid var(--line);
    margin: 4px 0;
}
:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}
[hidden],
.hidden {
    display: none !important;
}
.num {
    font-variant-numeric: tabular-nums;
}
.muted {
    color: var(--ink-3);
}
.small {
    font-size: 0.82rem;
}

.icon {
    width: 18px;
    height: 18px;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.icon.sm {
    width: 15px;
    height: 15px;
}
.icon.lg {
    width: 22px;
    height: 22px;
}
.spin {
    animation: spin 1.1s linear infinite;
}
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ---------- app shell ---------- */

.app {
    display: grid;
    grid-template-columns: var(--side-w) minmax(0, 1fr);
    min-height: 100%;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--side-bg);
    color: var(--side-ink);
    border-right: 1px solid var(--side-line);
    overflow-y: auto;
}
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 22px 20px 20px;
    color: var(--side-ink);
    text-decoration: none;
}
.brand:hover {
    text-decoration: none;
}
.brand img {
    width: 42px;
    height: 42px;
    flex: none;
}
.brand-name {
    font-family: var(--font-display);
    font-size: 1.15rem;
    line-height: 1.1;
    letter-spacing: -0.01em;
}
.brand-name b {
    font-weight: 700;
}
.brand-name span {
    font-weight: 400;
}
.brand-sub {
    display: block;
    font-family: var(--font-body);
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--side-ink-2);
    margin-top: 4px;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px 12px;
}
.nav-label {
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--side-ink-2);
    padding: 16px 12px 6px;
}
.nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: var(--side-ink-2);
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}
.nav a:hover {
    background: var(--side-hover);
    color: var(--side-ink);
}
.nav a.active {
    background: var(--side-active);
    color: #fff;
}
.nav a.active .icon {
    color: #7fb2ff;
}
.nav .nav-number {
    min-width: 0;
}
.nav .nav-number .label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}
.nav-empty {
    padding: 4px 12px;
    font-size: 0.82rem;
    color: var(--side-ink-2);
}

.side-foot {
    margin-top: auto;
    border-top: 1px solid var(--side-line);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.me {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
}
.me-avatar {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    display: grid;
    place-items: center;
    background: var(--grad);
    color: #fff;
    font-family: var(--font-display);
    font-weight: 700;
    flex: none;
}
.me-name {
    font-weight: 600;
    color: var(--side-ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.me-role {
    font-size: 0.75rem;
    color: var(--side-ink-2);
    text-transform: capitalize;
}
.side-actions {
    display: flex;
    gap: 6px;
}
.side-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--side-line);
    background: transparent;
    color: var(--side-ink-2);
    font: 500 0.82rem var(--font-body);
    cursor: pointer;
    text-decoration: none;
}
.side-btn:hover {
    background: var(--side-hover);
    color: var(--side-ink);
    text-decoration: none;
}
.side-btn form {
    display: contents;
}
.theme-dark-only {
    display: none;
}
:root[data-theme='dark'] .theme-dark-only {
    display: inline;
}
:root[data-theme='dark'] .theme-light-only {
    display: none;
}

.main {
    min-width: 0;
    padding: 32px clamp(16px, 3.5vw, 44px) 64px;
}
.page {
    max-width: 1180px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* mobile top bar + drawer */
.topbar {
    display: none;
}
.scrim {
    display: none;
}
@media (max-width: 900px) {
    .app {
        grid-template-columns: 1fr;
    }
    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(var(--side-w), 86vw);
        z-index: 40;
        transform: translateX(-100%);
        transition: transform 0.22s ease;
    }
    body.nav-open .sidebar {
        transform: none;
    }
    body.nav-open .scrim {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(5, 10, 20, 0.5);
        z-index: 30;
    }
    .topbar {
        display: flex;
        align-items: center;
        gap: 12px;
        position: sticky;
        top: 0;
        z-index: 20;
        padding: 10px 16px;
        background: var(--side-bg);
        color: var(--side-ink);
    }
    .topbar img {
        width: 30px;
        height: 30px;
    }
    .topbar .brand-name {
        font-size: 1rem;
    }
    .topbar button {
        background: none;
        border: none;
        color: var(--side-ink);
        padding: 6px;
        cursor: pointer;
    }
    .main {
        padding-top: 20px;
    }
}
@media (prefers-reduced-motion: reduce) {
    .sidebar {
        transition: none;
    }
    .spin {
        animation: none;
    }
}

/* ---------- page header ---------- */

.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
}
.page-head .titles {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}
.crumbs {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    color: var(--ink-3);
}
.crumbs a {
    color: var(--ink-2);
}
.page-head .sub {
    color: var(--ink-2);
    max-width: 65ch;
}
.page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* ---------- surfaces ---------- */

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
}
.panel-head h3 {
    display: flex;
    align-items: center;
    gap: 10px;
}
.panel-head h3 .icon {
    color: var(--ink-3);
}
.panel-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.panel-body.flush {
    padding: 0;
    gap: 0;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    align-items: start;
}
.grid-main {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}
@media (max-width: 1100px) {
    .grid-main {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 760px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }
}
.stack {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}
.row.between {
    justify-content: space-between;
}

/* ---------- stats ---------- */

.stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}
@media (max-width: 1000px) {
    .stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
.stat {
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.stat-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--ink-2);
    font-weight: 500;
    font-size: 0.86rem;
}
.stat-top .icon {
    color: var(--ink-3);
}
.stat-value {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 600;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}
.stat-value small {
    font-size: 0.95rem;
    color: var(--ink-3);
    font-weight: 500;
}
.stat-foot {
    font-size: 0.8rem;
    color: var(--ink-3);
}

/* ---------- status tiles (color + icon, meaning on hover) ---------- */

.tile {
    --c: var(--idle);
    --cs: var(--idle-soft);
    width: 36px;
    height: 36px;
    border-radius: 9px;
    display: inline-grid;
    place-items: center;
    background: var(--cs);
    color: var(--c);
    flex: none;
    position: relative;
}
.tile.sm {
    width: 28px;
    height: 28px;
    border-radius: 7px;
}
.tile.lg {
    width: 48px;
    height: 48px;
    border-radius: 12px;
}
.tile.is-ok,
.tile.st-connected,
.tile.st-replied {
    --c: var(--ok);
    --cs: var(--ok-soft);
}
.tile.is-warn,
.tile.st-starting,
.tile.st-qr,
.tile.st-invalid {
    --c: var(--warn);
    --cs: var(--warn-soft);
}
.tile.is-bad,
.tile.st-error,
.tile.st-disconnected,
.tile.st-failed {
    --c: var(--bad);
    --cs: var(--bad-soft);
}
.tile.is-brand,
.tile.st-sent {
    --c: var(--brand);
    --cs: var(--brand-soft);
}
.tile.st-stopped,
.tile.st-pending,
.tile.st-opted_out {
    --c: var(--idle);
    --cs: var(--idle-soft);
}
.tile.st-connected::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: inherit;
    border: 2px solid var(--ok);
    opacity: 0;
    animation: live 2.4s ease-out infinite;
}
@keyframes live {
    0% {
        opacity: 0.55;
        transform: scale(0.92);
    }
    100% {
        opacity: 0;
        transform: scale(1.18);
    }
}
@media (prefers-reduced-motion: reduce) {
    .tile.st-connected::after {
        animation: none;
    }
}

/* sidebar number indicator: a short color bar, meaning on hover */
.bar {
    width: 4px;
    height: 18px;
    border-radius: 2px;
    background: var(--idle);
    flex: none;
}
.bar.st-connected {
    background: #2bd49a;
}
.bar.st-starting,
.bar.st-qr {
    background: #f2b347;
}
.bar.st-error,
.bar.st-disconnected {
    background: #ff5c73;
}
.bar.st-stopped {
    background: #4a5670;
}

/* tooltip */
[data-tip] {
    position: relative;
}
[data-tip]:hover::before,
[data-tip]:focus-visible::before {
    content: attr(data-tip);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translateX(-50%);
    background: var(--tip-bg);
    color: var(--tip-ink);
    font: 500 0.75rem/1.35 var(--font-body);
    letter-spacing: 0;
    text-transform: none;
    white-space: nowrap;
    padding: 6px 9px;
    border-radius: 6px;
    box-shadow: var(--shadow-md);
    z-index: 50;
    pointer-events: none;
}
[data-tip].tip-right:hover::before,
[data-tip].tip-right:focus-visible::before {
    left: calc(100% + 10px);
    bottom: auto;
    top: 50%;
    transform: translateY(-50%);
}

/* ---------- buttons ---------- */

button,
.btn {
    font: 500 0.88rem/1 var(--font-body);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line-strong);
    background: var(--surface);
    color: var(--ink);
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
button:hover,
.btn:hover {
    background: var(--surface-2);
    border-color: var(--ink-3);
    text-decoration: none;
}
.btn-primary,
button.btn-primary {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
    box-shadow: 0 1px 2px rgba(31, 91, 255, 0.25);
}
.btn-primary:hover,
button.btn-primary:hover {
    background: var(--brand-hover);
    border-color: var(--brand-hover);
    color: #fff;
}
.btn-danger,
button.btn-danger {
    color: var(--bad);
    border-color: color-mix(in srgb, var(--bad) 35%, transparent);
    background: transparent;
}
.btn-danger:hover,
button.btn-danger:hover {
    background: var(--bad-soft);
    border-color: var(--bad);
}
.btn-ghost,
button.btn-ghost {
    border-color: transparent;
    background: transparent;
    color: var(--ink-2);
}
.btn-ghost:hover,
button.btn-ghost:hover {
    background: var(--surface-2);
    color: var(--ink);
    border-color: transparent;
}
.btn-icon {
    padding: 8px;
}
.btn-sm {
    padding: 6px 10px;
    font-size: 0.8rem;
}
form.inline {
    display: inline-flex;
}

/* ---------- forms ---------- */

.form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.field > label,
.field > .label {
    font-weight: 600;
    font-size: 0.88rem;
}
.hint {
    color: var(--ink-3);
    font-size: 0.8rem;
    font-weight: 400;
}
.fields-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 14px;
}
input,
select,
textarea {
    font: 400 0.92rem/1.45 var(--font-body);
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    width: 100%;
    max-width: 100%;
    transition: border-color 0.15s, box-shadow 0.15s;
}
input:hover,
select:hover,
textarea:hover {
    border-color: var(--ink-3);
}
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-soft);
}
textarea {
    resize: vertical;
    min-height: 90px;
}
input[type='checkbox'] {
    width: 17px;
    height: 17px;
    accent-color: var(--brand);
    flex: none;
    margin: 2px 0 0;
}
input[type='file'] {
    padding: 7px;
    background: var(--surface-2);
}
.check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.88rem;
    color: var(--ink-2);
    cursor: pointer;
}
.inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
}
.inline-form .field {
    flex: 1 1 200px;
}

/* switch */
.switch {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    cursor: pointer;
}
.switch input {
    appearance: none;
    width: 40px;
    height: 22px;
    border-radius: 11px;
    background: var(--line-strong);
    border: none;
    position: relative;
    cursor: pointer;
    padding: 0;
    flex: none;
    margin: 0;
    transition: background 0.15s;
}
.switch input::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s;
}
.switch input:checked {
    background: var(--brand);
}
.switch input:checked::after {
    transform: translateX(18px);
}
.switch .switch-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.switch .switch-text strong {
    font-size: 0.9rem;
}

/* ---------- flash ---------- */

.flash {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid;
    font-weight: 500;
}
.flash.success {
    background: var(--ok-soft);
    border-color: color-mix(in srgb, var(--ok) 35%, transparent);
    color: var(--ok);
}
.flash.error {
    background: var(--bad-soft);
    border-color: color-mix(in srgb, var(--bad) 35%, transparent);
    color: var(--bad);
}

/* ---------- lists & tables ---------- */

.list-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--line);
}
.list-item:last-child {
    border-bottom: none;
}
.list-item .grow {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.list-item .title {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}
.list-item .meta {
    color: var(--ink-3);
    font-size: 0.82rem;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
}
.list-item .meta span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.list-item .actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
@media (max-width: 640px) {
    .list-item {
        flex-wrap: wrap;
    }
    .list-item .actions {
        width: 100%;
        justify-content: flex-start;
    }
}

.table-wrap {
    overflow-x: auto;
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
th {
    text-align: left;
    font-weight: 500;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-3);
    padding: 10px 20px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
td {
    padding: 12px 20px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}
tr:last-child td {
    border-bottom: none;
}
tbody tr:hover td {
    background: var(--surface-2);
}
td.actions {
    text-align: right;
    white-space: nowrap;
}
td.actions > * {
    margin-left: 4px;
}

.empty {
    padding: 36px 20px;
    text-align: center;
    color: var(--ink-3);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.empty .tile {
    margin-bottom: 4px;
}
.empty strong {
    color: var(--ink);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1rem;
}

/* ---------- number cards (dashboard) ---------- */

.numbers {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}
.number-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 18px 20px;
    color: var(--ink);
    text-decoration: none;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.number-card:hover {
    border-color: color-mix(in srgb, var(--brand) 45%, var(--line));
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
    text-decoration: none;
}
.number-card .head {
    display: flex;
    align-items: center;
    gap: 12px;
}
.number-card .head .grow {
    min-width: 0;
    flex: 1;
}
.number-card .name {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.05rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.number-card .phone {
    color: var(--ink-3);
    font-family: var(--font-mono);
    font-size: 0.8rem;
}
.facts {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px 12px;
    font-size: 0.86rem;
    margin: 0;
}
.facts dt {
    color: var(--ink-3);
    display: flex;
    align-items: center;
    gap: 7px;
}
.facts dd {
    margin: 0;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---------- connection panel ---------- */

.conn {
    display: flex;
    align-items: center;
    gap: 16px;
}
.conn .grow {
    flex: 1;
    min-width: 0;
}
.conn-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.1rem;
}
.qr-box {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 20px;
    align-items: center;
    padding: 16px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius);
    background: var(--surface-2);
}
@media (max-width: 560px) {
    .qr-box {
        grid-template-columns: 1fr;
        justify-items: center;
    }
}
.qr-box img {
    width: 220px;
    max-width: 100%;
    background: #fff;
    padding: 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
}
.steps {
    margin: 0;
    padding-left: 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: var(--ink-2);
}
.error-text {
    color: var(--bad);
    font-size: 0.86rem;
}

/* campaign rows */
.campaign-row.running {
    background: linear-gradient(90deg, var(--ok-soft), transparent 55%);
}

/* tabs */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
}
.tabs a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    color: var(--ink-2);
    font-weight: 500;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
    text-decoration: none;
}
.tabs a:hover {
    color: var(--ink);
}
.tabs a.active {
    color: var(--brand-ink);
    border-bottom-color: var(--brand);
}

/* filter chips */
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 11px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink-2);
    font-size: 0.82rem;
    font-weight: 500;
    text-decoration: none;
}
.chip:hover {
    border-color: var(--line-strong);
    color: var(--ink);
    text-decoration: none;
}
.chip.active {
    background: var(--brand-soft);
    border-color: color-mix(in srgb, var(--brand) 40%, transparent);
    color: var(--brand-ink);
}
.chip .count {
    font-variant-numeric: tabular-nums;
    color: var(--ink-3);
}
.chip.active .count {
    color: inherit;
}
.chip .swatch {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    background: var(--c, var(--idle));
}

/* progress meter */
.meter {
    height: 6px;
    border-radius: 3px;
    background: var(--idle-soft);
    overflow: hidden;
}
.meter span {
    display: block;
    height: 100%;
    background: var(--brand);
    border-radius: inherit;
}

.kv {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.kv > div {
    display: flex;
    align-items: center;
    gap: 12px;
}
.kv .k {
    color: var(--ink-3);
    font-size: 0.82rem;
}
.kv .v {
    font-weight: 600;
}

/* ---------- chat ---------- */

.chat-list a {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--line);
    color: var(--ink);
    text-decoration: none;
}
.chat-list a:last-child {
    border-bottom: none;
}
.chat-list a:hover {
    background: var(--surface-2);
    text-decoration: none;
}
.avatar {
    width: 42px;
    height: 42px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    background: var(--brand-soft);
    color: var(--brand-ink);
    font-family: var(--font-display);
    font-weight: 700;
    flex: none;
}
.avatar.group {
    background: var(--idle-soft);
    color: var(--ink-2);
}
.chat-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.chat-main .top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}
.chat-main strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.chat-main .preview {
    color: var(--ink-3);
    font-size: 0.86rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.unread {
    background: var(--ok);
    color: #fff;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 7px;
    font-variant-numeric: tabular-nums;
}

.thread {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 20px;
    max-height: 62vh;
    overflow-y: auto;
    background:
        radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--ink-3) 18%, transparent) 1px, transparent 0) 0 0 / 18px 18px,
        var(--surface-2);
}
.bubble {
    max-width: min(560px, 80%);
    padding: 9px 13px;
    border-radius: 12px;
    overflow-wrap: anywhere;
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
    font-size: 0.92rem;
}
.bubble .text {
    white-space: pre-wrap;
}
.bubble.user {
    align-self: flex-start;
    background: var(--bubble-them);
    border-top-left-radius: 4px;
}
.bubble.assistant {
    align-self: flex-end;
    background: var(--bubble-me);
    border-color: color-mix(in srgb, var(--brand) 22%, var(--line));
    border-top-right-radius: 4px;
}
.bubble .meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    color: var(--ink-3);
    margin-top: 4px;
}
.bubble .author {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--brand-ink);
    margin-bottom: 2px;
}
.composer {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    padding: 14px 16px;
    border-top: 1px solid var(--line);
}
.composer textarea {
    min-height: 44px;
}
.preview-bubble {
    max-width: 100%;
    align-self: stretch;
}

/* ---------- login ---------- */

.auth {
    min-height: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    background: var(--surface);
}
@media (max-width: 860px) {
    .auth {
        grid-template-columns: 1fr;
    }
    .auth-art {
        display: none !important;
    }
}
.auth-art {
    position: relative;
    overflow: hidden;
    background: #070d1a;
    color: #eaf0fa;
    padding: 48px clamp(32px, 5vw, 64px);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 40px;
}
.auth-art::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(60% 50% at 85% 10%, rgba(122, 28, 245, 0.35), transparent 70%),
        radial-gradient(55% 45% at 10% 90%, rgba(0, 194, 247, 0.28), transparent 70%),
        linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px) 0 0 / 44px 44px,
        linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px) 0 0 / 44px 44px;
    pointer-events: none;
}
.auth-art > * {
    position: relative;
}
.auth-logo {
    display: flex;
    align-items: center;
    gap: 14px;
}
.auth-logo img {
    width: 56px;
    height: 56px;
}
.auth-logo .brand-name {
    font-size: 1.5rem;
}
.auth-logo .brand-sub {
    color: #97a3bb;
}
.auth-pitch h1 {
    font-size: clamp(2rem, 3.4vw, 2.9rem);
    line-height: 1.08;
    letter-spacing: -0.02em;
    max-width: 14ch;
}
.auth-pitch h1 em {
    font-style: normal;
    background: var(--grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.auth-pitch p {
    margin-top: 16px;
    color: #a9b5cb;
    max-width: 44ch;
    font-size: 1rem;
}
.auth-demo {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 380px;
}
.auth-demo .bubble {
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: none;
    font-size: 0.86rem;
}
.auth-demo .bubble.user {
    background: rgba(255, 255, 255, 0.07);
    color: #eaf0fa;
}
.auth-demo .bubble.assistant {
    background: rgba(31, 91, 255, 0.3);
    color: #fff;
}
.auth-demo .bubble .meta {
    color: #97a3bb;
}
.auth-form {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
}
.auth-card {
    width: min(380px, 100%);
    display: flex;
    flex-direction: column;
    gap: 24px;
}
.auth-card .mobile-logo {
    display: none;
    width: 52px;
}
@media (max-width: 860px) {
    .auth-card .mobile-logo {
        display: block;
    }
}
.auth-card h2 {
    font-size: 1.6rem;
}
.auth-card .sub {
    color: var(--ink-2);
    margin-top: 6px;
}
.auth-card .btn-primary {
    padding: 11px 14px;
    width: 100%;
}
.pw-wrap {
    position: relative;
}
.pw-wrap input {
    padding-right: 42px;
}
.pw-wrap button {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    padding: 6px;
    border: none;
    background: transparent;
    color: var(--ink-3);
}
.theme-float {
    position: fixed;
    right: 16px;
    top: calc(16px + env(safe-area-inset-top, 0px));
}

.memory {
    white-space: pre-wrap;
    line-height: 1.7;
    color: var(--ink-2);
}

.count-pill {
    font-size: 0.72rem;
    padding: 1px 6px;
    border-radius: 5px;
    background: var(--idle-soft);
    color: var(--ink-2);
}
.tabs a.active .count-pill {
    background: var(--brand-soft);
    color: var(--brand-ink);
}
.poll-options {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 4px 0 2px;
}
.poll-options span {
    font-size: 0.8rem;
    padding: 3px 9px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface-2);
    color: var(--ink-2);
}
.banner {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border-radius: var(--radius);
    border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent);
    background: var(--warn-soft);
}
.banner .grow {
    flex: 1;
    min-width: 0;
}
.banner strong {
    display: block;
}

/* ---------- analytics ---------- */

.segmented {
    display: inline-flex;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--surface);
}
.segmented a {
    padding: 8px 12px;
    font-size: 0.84rem;
    font-weight: 500;
    color: var(--ink-2);
    text-decoration: none;
    border-right: 1px solid var(--line);
}
.segmented a:last-child {
    border-right: none;
}
.segmented a.active {
    background: var(--brand-soft);
    color: var(--brand-ink);
}
.banner.info {
    border-color: color-mix(in srgb, var(--brand) 35%, transparent);
    background: var(--brand-soft);
}
.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    font-size: 0.8rem;
    color: var(--ink-2);
}
.legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.sw {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex: none;
}
.chart {
    position: relative;
}
.chart svg {
    width: 100%;
    height: auto;
    display: block;
    overflow: visible;
}
.chart .grid {
    stroke: var(--line);
    stroke-width: 1;
}
.chart .baseline {
    stroke: var(--line-strong);
    stroke-width: 1;
}
.chart .axis {
    fill: var(--ink-3);
    font: 11px var(--font-body);
    font-variant-numeric: tabular-nums;
}
.chart .col.s1 {
    fill: var(--series-1);
}
.chart .col.s2 {
    fill: var(--series-2);
}
.chart .hit {
    fill: transparent;
    cursor: crosshair;
}
.chart .hit.on {
    fill: color-mix(in srgb, var(--ink) 6%, transparent);
}
.chart-tip {
    position: absolute;
    top: 0;
    transform: translateX(-50%);
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    padding: 8px 10px;
    font-size: 0.8rem;
    color: var(--ink);
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 3px;
    white-space: nowrap;
    z-index: 5;
}
.chart-tip div {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--ink-2);
    font-variant-numeric: tabular-nums;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    align-items: start;
}
@media (max-width: 1100px) {
    .grid-3 {
        grid-template-columns: 1fr;
    }
}
.hbars,
.funnel,
.mood-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.hbar,
.funnel-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.88rem;
}
.track {
    display: block;
    height: 8px;
    border-radius: 4px;
    background: var(--idle-soft);
    overflow: hidden;
}
.track .fill {
    display: block;
    height: 100%;
    border-radius: 4px;
    background: var(--brand);
}
.fill.int-hot {
    background: var(--brand);
}
.fill.int-warm {
    background: color-mix(in srgb, var(--brand) 65%, var(--surface));
}
.fill.int-cold {
    background: color-mix(in srgb, var(--brand) 35%, var(--surface));
}
.fill.int-not_interested {
    background: var(--idle);
}
.mood {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
}
.mood .grow {
    flex: 1;
}
.cell-bar {
    display: grid;
    grid-template-columns: 2.5ch minmax(60px, 1fr);
    align-items: center;
    gap: 10px;
    min-width: 140px;
}
.tag {
    --c: var(--ink-2);
    --cs: var(--idle-soft);
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 5px;
    background: var(--cs);
    color: var(--c);
    vertical-align: middle;
}
.tag.is-ok {
    --c: var(--ok);
    --cs: var(--ok-soft);
}
.tag.is-warn {
    --c: var(--warn);
    --cs: var(--warn-soft);
}
.tag.is-brand {
    --c: var(--brand-ink);
    --cs: var(--brand-soft);
}
.list-item.attention {
    background: linear-gradient(90deg, var(--bad-soft), transparent 45%);
}
.mark-lead {
    position: relative;
}
.mark-lead summary {
    list-style: none;
    cursor: pointer;
}
.mark-lead summary::-webkit-details-marker {
    display: none;
}
.mark-lead[open] form {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    width: min(320px, 80vw);
    z-index: 20;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 16px;
    gap: 12px;
}
.summaries .summary-cell {
    min-width: 280px;
    max-width: 520px;
}
.nowrap {
    white-space: nowrap;
}

/* ---------- calendar ---------- */

.cal {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
}
.cal-head {
    padding: 8px 10px;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-3);
    border-bottom: 1px solid var(--line);
    background: var(--surface-2);
}
.cal-day {
    min-height: 104px;
    padding: 6px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.cal-day:nth-child(7n + 7) {
    border-right: none;
}
.cal-day.out {
    background: var(--surface-2);
}
.cal-num {
    font-size: 0.8rem;
    color: var(--ink-2);
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    border-radius: 6px;
}
.cal-day.today .cal-num {
    background: var(--brand);
    color: #fff;
    font-weight: 600;
}
.cal-event {
    --c: var(--ink-2);
    --cs: var(--idle-soft);
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    padding: 3px 5px;
    border-radius: 5px;
    background: var(--cs);
    color: var(--c);
    min-width: 0;
    cursor: default;
}
.cal-event .ev-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
.cal-event.is-brand {
    --c: var(--brand-ink);
    --cs: var(--brand-soft);
}
.cal-event.is-ok {
    --c: var(--ok);
    --cs: var(--ok-soft);
}
.cal-event.is-warn {
    --c: var(--warn);
    --cs: var(--warn-soft);
}
.cal-event.struck .ev-name {
    text-decoration: line-through;
}
.cal-event .icon {
    width: 12px;
    height: 12px;
}
@media (max-width: 700px) {
    .cal-day {
        min-height: 64px;
        padding: 3px;
    }
    .cal-event .ev-name,
    .cal-event .icon {
        display: none;
    }
    .cal-head {
        padding: 6px 2px;
        text-align: center;
        letter-spacing: 0;
    }
}

.day-picks {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.day-pick input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}
.day-pick span {
    display: inline-block;
    padding: 7px 12px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    font-size: 0.84rem;
    font-weight: 500;
    color: var(--ink-2);
    cursor: pointer;
    user-select: none;
}
.day-pick input:checked + span {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}
.day-pick input:focus-visible + span {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}
.insight-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
}
.insight-grid > div {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ticket-row {
    color: var(--ink);
    text-decoration: none;
}
.ticket-row:hover {
    background: var(--surface-2);
    text-decoration: none;
}
.timeline {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.tl-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}
.tl-item .grow {
    flex: 1;
    min-width: 0;
}
.tl-item .text {
    white-space: pre-wrap;
    margin-top: 2px;
}

.audience {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin: 0;
    background: var(--surface-2);
}
.audience legend {
    font-weight: 600;
    padding: 0 6px;
}
.audience-count {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--ink-2);
}
.promo .grow {
    gap: 6px;
}

.thumb {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: cover;
    background: var(--surface-2);
    border: 1px solid var(--line);
    flex: none;
}

.notify-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}
input[type='radio'] {
    width: 16px;
    height: 16px;
    accent-color: var(--brand);
    flex: none;
    margin: 3px 0 0;
}

/* ---------- Layout: symmetric grids and pop-up forms ----------
   Side-by-side panels share one height and width; lists run full width and their
   "Add…" forms open in a pop-up instead of a narrow side column. */
.grid-2,
.grid-3 {
    align-items: stretch;
}
.grid-main {
    grid-template-columns: minmax(0, 1fr);
}
.stats {
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}
.numbers {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}
.tabs {
    scrollbar-width: none;
}
.tabs::-webkit-scrollbar {
    display: none;
}
.panel-head .head-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-left: auto;
}
.empty.compact {
    padding: 22px 20px;
    gap: 4px;
}
.section-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}
.section-title h2 {
    margin: 0;
}

dialog.modal {
    border: none;
    padding: 0;
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--ink);
    width: min(560px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    box-shadow: 0 24px 64px rgba(11, 20, 38, 0.28);
    overflow: hidden;
}
dialog.modal.wide {
    width: min(760px, calc(100vw - 32px));
}
dialog.modal[open] {
    display: flex;
    flex-direction: column;
    animation: modal-in 0.16s ease-out;
}
dialog.modal::backdrop {
    background: rgba(11, 20, 38, 0.45);
}
dialog.modal .panel-head {
    flex: none;
}
dialog.modal .modal-body {
    padding: 20px;
    overflow: auto;
}
@keyframes modal-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
}
@media (prefers-reduced-motion: reduce) {
    dialog.modal[open] {
        animation: none;
    }
}

/* voice notes */
.voice-row audio {
    height: 34px;
    max-width: 260px;
}
.recorder {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}
.recorder .rec-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--bad);
    visibility: hidden;
}
.recorder.recording .rec-dot {
    visibility: visible;
    animation: rec-blink 1s steps(2, start) infinite;
}
@keyframes rec-blink {
    to {
        visibility: hidden;
    }
}
.recorder audio {
    height: 34px;
    flex: 1;
    min-width: 0;
}
.or-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--ink-3);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.or-divider::before,
.or-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--line);
}

textarea.tall {
    height: 380px;
}

/* ---------- Email marketing ---------- */
.nav-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.nav .nav-add {
    padding: 2px 6px;
    color: var(--side-ink-2);
    border-radius: 6px;
}
.nav .nav-add:hover {
    color: var(--side-ink);
    background: var(--side-hover);
}
.list-item .preview {
    color: var(--ink-3);
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* preview of a campaign email */
.email-preview {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    overflow: hidden;
}
.email-preview .ep-head {
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 8px;
    align-items: baseline;
}
.email-preview .ep-subject {
    padding: 12px 14px 0;
    font-weight: 600;
}
.email-preview .ep-body {
    padding: 10px 14px 14px;
    white-space: pre-wrap;
    font-size: 0.9rem;
    max-height: 340px;
    overflow: auto;
}

/* check results */
.check-list {
    display: flex;
    flex-direction: column;
}
.check-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px 20px;
    border-bottom: 1px solid var(--line);
    font-size: 0.9rem;
}
.check-row:last-child {
    border-bottom: none;
}
.check-list.compact .check-row {
    padding: 8px 0;
}
.check-row .fix {
    margin-top: 4px;
    color: var(--ink-2);
}
.check-row .fix::before {
    content: 'Fix: ';
    font-weight: 600;
    color: var(--ink);
}
.check-row.st-pass .tile {
    background: var(--ok-soft);
    color: var(--ok);
}
.check-row.st-warn .tile {
    background: var(--warn-soft);
    color: var(--warn);
}
.check-row.st-fail .tile {
    background: var(--bad-soft);
    color: var(--bad);
}
.check-row.st-info .tile {
    background: var(--brand-soft);
    color: var(--brand-ink);
}
.fix-list {
    margin: 0;
    padding: 14px 20px 14px 40px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.fix-list li.st-fail::marker {
    color: var(--bad);
    font-weight: 700;
}
.fix-list li.st-warn::marker {
    color: var(--warn);
    font-weight: 700;
}

.score-wrap {
    display: flex;
    align-items: center;
    gap: 24px;
}
.score-ring {
    width: 128px;
    height: 128px;
    flex: none;
}
.score-ring .track {
    fill: none;
    stroke: var(--line);
    stroke-width: 10;
}
.score-ring .fill {
    fill: none;
    stroke-width: 10;
    stroke-linecap: round;
    stroke: var(--brand);
}
.score-ring.st-ok .fill {
    stroke: var(--ok);
}
.score-ring.st-warn .fill {
    stroke: var(--warn);
}
.score-ring.st-bad .fill {
    stroke: var(--bad);
}
.score-ring .score-num {
    font-family: var(--font-display);
    font-size: 34px;
    font-weight: 700;
    fill: var(--ink);
}
.score-ring .score-of {
    font-size: 11px;
    fill: var(--ink-3);
}
.score-grade {
    font-family: var(--font-display);
    font-size: 1.4rem;
}

/* conversation */
.email-thread {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 20px;
    max-height: 72vh;
    overflow: auto;
}
.email-msg {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    background: var(--surface);
}
.email-msg.out {
    background: var(--bubble-me);
    border-color: transparent;
    margin-left: 24px;
}
.email-msg.in {
    margin-right: 24px;
}
.email-msg.auto {
    opacity: 0.6;
}
.email-msg header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 4px;
}
.email-msg .email-text {
    white-space: pre-wrap;
    font-size: 0.9rem;
    margin-top: 8px;
    overflow-wrap: anywhere;
}
.code-sample {
    margin: 0;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    border: 1px solid var(--line);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    overflow-x: auto;
}
.steps.two-col {
    columns: 2;
    column-gap: 32px;
}
@media (max-width: 760px) {
    .steps.two-col {
        columns: 1;
    }
    .score-wrap {
        flex-direction: column;
        align-items: flex-start;
    }
}
.banner.error {
    border-color: color-mix(in srgb, var(--bad) 40%, transparent);
    background: var(--bad-soft);
}

/* ---------- sign-up, Google, approvals ---------- */
.btn-google {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 10px 16px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--ink);
    font-weight: 600;
    text-decoration: none;
}
.btn-google:hover {
    background: var(--surface-2);
}
.auth-message {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
}
.auth-card .fields-row {
    gap: 12px;
}
.limits-form {
    flex-wrap: nowrap;
    gap: 8px;
}
.limit {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--ink-3);
}
.limit input {
    width: 64px;
    padding: 6px 8px;
}
.nav-badge {
    margin-left: auto;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: var(--warn);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: inline-grid;
    place-items: center;
}
@media (max-width: 760px) {
    .request-row {
        flex-wrap: wrap;
    }
}

/* campaign brief */
.brief-steps {
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: step;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.brief-steps li {
    counter-increment: step;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}
.brief-steps li::before {
    content: counter(step);
    flex: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--brand-soft);
    color: var(--brand-ink);
    font-weight: 700;
}
.brief-steps .grow {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
input.filled,
textarea.filled,
select.filled {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 35%, transparent);
    transition: box-shadow 0.3s;
}
