/* ============================================================
   WISENDER — Design System v2
   Fonts: Syne (headings) · DM Sans (body) · DM Mono (data)
   Theme: Dark · Accent: #00D67D
   ============================================================ */

*, *::before, *::after {
    box-sizing: border-box;
}

:root {
    --bg:        #0A0F0B;
    --surface:   #111814;
    --surface-2: #161E18;
    --surface-3: #1C2620;
    --surface-4: #232E27;

    --green:       #00D67D;
    --green-dark:  #00B868;
    --green-dim:   rgba(0, 214, 125, .08);
    --green-glow:  rgba(0, 214, 125, .18);
    --green-ring:  rgba(0, 214, 125, .22);

    --text:    #DFF0E6;
    --muted:   #6B8C77;
    --muted-2: #4A6355;

    --border:        rgba(0, 214, 125, .10);
    --border-bright: rgba(0, 214, 125, .20);

    --danger:       #FF5252;
    --danger-bg:    rgba(255, 82, 82, .08);
    --danger-ring:  rgba(255, 82, 82, .20);
    --success:      #00D67D;
    --success-bg:   rgba(0, 214, 125, .08);
    --warning:      #FFB020;
    --warning-bg:   rgba(255, 176, 32, .08);
    --warning-ring: rgba(255, 176, 32, .22);

    --radius:    14px;
    --radius-lg: 18px;
    --shadow:    0 24px 60px rgba(0,0,0,.55);

    --sidebar-w: 240px;
}

html, body {
    margin: 0; padding: 0;
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }

h1,h2,h3,h4,h5 {
    font-family: 'Syne', sans-serif;
    letter-spacing: -.025em;
    line-height: 1.15;
    margin: 0;
}

/* ─── AUTH LAYOUT ─────────────────────────── */
body.auth-screen { min-height: 100vh; }

.auth-layout {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.auth-brand-panel {
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 64px 56px;
    position: relative;
    overflow: hidden;
}
.auth-brand-panel::before {
    content:'';
    position:absolute; bottom:-100px; left:-100px;
    width:420px; height:420px;
    background:radial-gradient(circle,rgba(0,214,125,.15) 0%,transparent 70%);
    pointer-events:none;
}
.auth-brand-panel::after {
    content:'';
    position:absolute; top:-60px; right:-60px;
    width:260px; height:260px;
    background:radial-gradient(circle,rgba(0,214,125,.06) 0%,transparent 70%);
    pointer-events:none;
}

.brand-logo-row {
    display:flex; align-items:center; gap:12px;
    margin-bottom:52px; position:relative;
}
.brand-mark {
    width:40px; height:40px;
    background:var(--green);
    border-radius:11px;
    display:grid; place-items:center;
    font-family:'Syne',sans-serif;
    font-weight:800; font-size:19px; color:#000;
    flex-shrink:0;
}
.brand-name {
    font-family:'Syne',sans-serif;
    font-weight:700; font-size:18px;
    letter-spacing:-.02em;
}
.auth-tagline {
    font-family:'Syne',sans-serif;
    font-size:clamp(26px,3vw,36px);
    font-weight:700; letter-spacing:-.03em;
    margin-bottom:14px; position:relative;
}
.auth-tagline em { font-style:normal; color:var(--green); }
.auth-brand-sub {
    color:var(--muted); font-size:14.5px;
    line-height:1.65; max-width:320px; position:relative;
}
.auth-brand-features { margin-top:36px; display:grid; gap:10px; position:relative; }
.auth-feature { display:flex; align-items:center; gap:10px; font-size:13.5px; color:var(--muted); }
.auth-feature-dot { width:6px; height:6px; border-radius:50%; background:var(--green); flex-shrink:0; }

.auth-form-panel {
    display:flex; flex-direction:column; justify-content:center;
    padding:64px 56px; background:var(--bg);
}
.auth-form-panel h2 { font-size:22px; font-weight:700; margin-bottom:6px; }
.auth-form-panel > p { color:var(--muted); font-size:13.5px; margin-bottom:28px; }

/* Legacy single-col auth card */
.auth-card {
    width:100%; max-width:460px;
    background:var(--surface);
    border:1px solid var(--border);
    border-radius:var(--radius-lg);
    padding:36px;
}
.auth-card-wide { max-width:560px; }
.auth-card-header { margin-bottom:28px; }
.auth-card-header h2 { font-size:22px; font-weight:700; margin-bottom:6px; }
.auth-card-header p { color:var(--muted); font-size:13.5px; }

/* ─── BADGE ───────────────────────────────── */
.badge-soft {
    display:inline-flex; align-items:center;
    background:var(--green-dim);
    border:1px solid var(--green-ring);
    color:var(--green);
    border-radius:999px;
    padding:5px 12px;
    font-family:'DM Mono',monospace;
    font-size:11px; letter-spacing:.07em;
    text-transform:uppercase;
    margin-bottom:12px;
}

/* ─── FORM ────────────────────────────────── */
.form-grid { display:grid; gap:18px; }
.two-columns { grid-template-columns:repeat(2,minmax(0,1fr)); }
.full-width  { grid-column:1/-1; }

.form-group { display:flex; flex-direction:column; gap:7px; }
.form-group label {
    font-size:11.5px; font-weight:600;
    letter-spacing:.04em; text-transform:uppercase;
    color:var(--muted);
}
.form-group input,
.form-group select {
    width:100%; padding:12px 14px;
    background:var(--surface-2);
    border:1px solid var(--border-bright);
    border-radius:var(--radius);
    color:var(--text);
    font-family:'DM Sans',sans-serif; font-size:14px;
    outline:none;
    transition:border-color .2s,box-shadow .2s;
    appearance:none; -webkit-appearance:none;
}
.form-group input::placeholder { color:var(--muted-2); }
.form-group input:focus,
.form-group select:focus {
    border-color:var(--green);
    box-shadow:0 0 0 3px var(--green-glow);
}
.form-group select {
    background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236B8C77' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat:no-repeat; background-position:right 14px center;
    padding-right:36px;
}
.form-group select option { background:var(--surface-2); }

.is-invalid,
.form-group input.is-invalid,
.form-group select.is-invalid {
    border-color:var(--danger);
    box-shadow:0 0 0 3px var(--danger-ring);
}
.field-error { color:var(--danger); font-size:12.5px; }
.help-text { color:var(--muted); font-size:12px; line-height:1.5; }

.form-actions { display:flex; justify-content:flex-end; gap:10px; }
.form-actions-between { justify-content:space-between; align-items:center; }

/* ─── BUTTONS ─────────────────────────────── */
.btn {
    display:inline-flex; align-items:center;
    justify-content:center; gap:8px;
    border:none; border-radius:var(--radius);
    padding:11px 18px;
    font-family:'DM Sans',sans-serif;
    font-weight:600; font-size:13.5px;
    cursor:pointer;
    transition:transform .15s,opacity .2s,background-color .2s;
    text-decoration:none; white-space:nowrap;
}
.btn:hover { text-decoration:none; transform:translateY(-1px); }
.btn-primary  { background:var(--green); color:#000; }
.btn-primary:hover { background:var(--green-dark); }
.btn-secondary {
    background:var(--surface-3); color:var(--text);
    border:1px solid var(--border-bright);
}
.btn-secondary:hover { background:var(--surface-4); }
.btn-danger {
    background:var(--danger-bg); color:var(--danger);
    border:1px solid var(--danger-ring);
}
.btn-danger:hover { background:rgba(255,82,82,.14); }
.btn-block { width:100%; }
.btn-sm { padding:8px 12px; font-size:12.5px; }

/* ─── ALERTS ──────────────────────────────── */
.alert {
    border-radius:var(--radius); padding:13px 16px;
    margin-bottom:18px; border:1px solid transparent;
    font-size:13.5px; font-weight:500;
}
.alert-success { background:var(--success-bg); border-color:rgba(0,214,125,.25); color:var(--green); }
.alert-error   { background:var(--danger-bg); border-color:var(--danger-ring); color:var(--danger); }

.auth-footer-links {
    display:flex; justify-content:center; gap:8px;
    margin-top:20px; flex-wrap:wrap;
    font-size:13.5px; color:var(--muted);
}

/* ─── APP SHELL ───────────────────────────── */
.app-shell {
    display:grid;
    grid-template-columns:var(--sidebar-w) 1fr;
    min-height:100vh;
}

/* ─── SIDEBAR ─────────────────────────────── */
.sidebar {
    background:var(--surface);
    border-right:1px solid var(--border);
    padding:20px 14px;
    display:flex; flex-direction:column; gap:0;
    position:sticky; top:0; height:100vh; overflow-y:auto;
}
.sidebar::-webkit-scrollbar { width:4px; }
.sidebar::-webkit-scrollbar-track { background:transparent; }
.sidebar::-webkit-scrollbar-thumb { background:var(--surface-4); border-radius:2px; }

.brand { display:flex; align-items:center; gap:10px; padding:6px 10px; margin-bottom:20px; }
.brand-badge {
    width:34px; height:34px;
    background:var(--green); border-radius:9px;
    display:grid; place-items:center;
    font-family:'Syne',sans-serif;
    font-weight:800; font-size:16px; color:#000; flex-shrink:0;
}
.brand-logo {
    width:34px; height:34px;
    object-fit:contain; border-radius:9px;
    background:var(--surface-3); padding:3px;
}
.brand h1 { font-family:'Syne',sans-serif; font-size:16px; font-weight:700; color:var(--text); }
.brand p  { font-size:11px; color:var(--muted); margin:2px 0 0; }

.user-card {
    background:var(--surface-2);
    border:1px solid var(--border);
    border-radius:var(--radius);
    padding:14px; margin-bottom:20px;
}
.user-card strong { display:block; font-size:13.5px; font-weight:600; margin-bottom:2px; color:var(--text); }
.user-card small  { font-size:12px; color:var(--muted); }

.nav-section-label {
    font-family:'DM Mono',monospace;
    font-size:10px; letter-spacing:.12em; text-transform:uppercase;
    color:var(--muted-2); padding:0 10px; margin:14px 0 5px;
}
.nav-menu { display:flex; flex-direction:column; gap:2px; }
.nav-menu a {
    display:flex; align-items:center; gap:9px;
    padding:9px 10px; border-radius:10px;
    color:var(--muted); font-size:13.5px; font-weight:500;
    transition:background .15s,color .15s; text-decoration:none;
}
.nav-menu a:hover { background:var(--surface-3); color:var(--text); text-decoration:none; }
.nav-menu a.active {
    background:var(--green-dim); color:var(--green);
    border:1px solid var(--green-ring);
}
.nav-icon { width:15px; height:15px; opacity:.65; flex-shrink:0; }
.nav-menu a.active .nav-icon,
.nav-menu a:hover .nav-icon { opacity:1; }

.logout-form { margin-top:auto; padding-top:14px; }

/* ─── CONTENT AREA ────────────────────────── */
.content-area { padding:28px 32px; background:var(--bg); }

/* ─── PAGE HEADER ─────────────────────────── */
.page-header { margin-bottom:24px; }
.page-header h2 { font-size:26px; font-weight:700; margin-bottom:5px; }
.page-header p  { color:var(--muted); font-size:13.5px; }

.between { display:flex; align-items:center; justify-content:space-between; gap:16px; }

/* ─── CARD ────────────────────────────────── */
.card {
    background:var(--surface);
    border:1px solid var(--border);
    border-radius:var(--radius-lg);
    overflow:hidden;
}
.card + .card,
.stats-grid + .card { margin-top:18px; }
.card-form { max-width:960px; }
.card-spaced { margin-top:18px; }

.card-header {
    padding:18px 22px;
    border-bottom:1px solid var(--border);
    display:flex; align-items:flex-start;
    justify-content:space-between; gap:16px;
}
.card-header h3 { font-size:15px; font-weight:600; margin-bottom:3px; }
.card-header p  { color:var(--muted); font-size:12.5px; }

.card-body   { padding:22px; }
.card-footer {
    padding:14px 22px;
    border-top:1px solid var(--border);
    display:flex; justify-content:flex-end; gap:10px;
}

/* ─── STATS GRID ──────────────────────────── */
.stats-grid {
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:16px; margin-bottom:20px;
}
.stat-card {
    background:var(--surface);
    border:1px solid var(--border);
    border-radius:var(--radius-lg);
    padding:20px 22px;
    position:relative; overflow:hidden;
}
.stat-card::before {
    content:'';
    position:absolute; top:0; left:0; right:0; height:2px;
    background:linear-gradient(90deg,transparent 0%,var(--green) 50%,transparent 100%);
    opacity:.45;
}
.stat-card span   { display:block; font-size:12px; color:var(--muted); margin-bottom:8px; font-weight:500; }
.stat-card strong {
    display:block;
    font-family:'Syne',sans-serif;
    font-size:32px; font-weight:700;
    letter-spacing:-.02em; color:var(--text);
}

/* ─── TABLE ───────────────────────────────── */
.table-responsive { overflow-x:auto; }
.table { width:100%; border-collapse:collapse; }
.table th {
    padding:11px 16px; text-align:left;
    font-family:'DM Mono',monospace;
    font-size:10.5px; letter-spacing:.09em; text-transform:uppercase;
    color:var(--muted-2); border-bottom:1px solid var(--border); white-space:nowrap;
}
.table td {
    padding:13px 16px; font-size:13.5px;
    border-bottom:1px solid rgba(0,214,125,.05); vertical-align:middle;
}
.table tr:last-child td { border-bottom:none; }
.table tbody tr { transition:background .12s; }
.table tbody tr:hover { background:var(--surface-2); }
.table-actions { display:flex; gap:8px; flex-wrap:wrap; }

/* ─── ROLE PILLS ──────────────────────────── */
.role-pill {
    display:inline-flex; align-items:center;
    border-radius:999px; padding:4px 10px;
    font-family:'DM Mono',monospace;
    font-size:10.5px; font-weight:500;
    letter-spacing:.07em; text-transform:uppercase;
}
.role-admin { background:var(--warning-bg); color:var(--warning); border:1px solid var(--warning-ring); }
.role-user  { background:var(--green-dim);  color:var(--green);   border:1px solid var(--green-ring); }

/* ─── STATUS PILLS ────────────────────────── */
.status-pill {
    display:inline-flex; align-items:center; gap:6px;
    border-radius:999px; padding:5px 11px;
    font-family:'DM Mono',monospace;
    font-size:11px; font-weight:500;
    letter-spacing:.07em; text-transform:uppercase;
}
.status-pill::before { content:''; width:6px; height:6px; border-radius:50%; flex-shrink:0; }

.status-connected,.status-pill.status-connected {
    background:var(--success-bg); color:var(--green); border:1px solid var(--green-ring);
}
.status-connected::before,.status-pill.status-connected::before { background:var(--green); }

.status-not_configured,.status-pill.status-not_configured {
    background:var(--warning-bg); color:var(--warning); border:1px solid var(--warning-ring);
}
.status-not_configured::before,.status-pill.status-not_configured::before { background:var(--warning); }

.status-disconnected,.status-error,
.status-pill.status-disconnected,.status-pill.status-error {
    background:var(--danger-bg); color:var(--danger); border:1px solid var(--danger-ring);
}
.status-disconnected::before,.status-error::before,
.status-pill.status-disconnected::before,.status-pill.status-error::before { background:var(--danger); }

.status-badge { font-size:14px; font-weight:700; }

/* ─── LABEL ───────────────────────────────── */
.label {
    display:block; font-size:11.5px; font-weight:600;
    letter-spacing:.04em; text-transform:uppercase;
    color:var(--muted); margin-bottom:6px;
}

/* ─── PROFILE GRID ────────────────────────── */
.profile-grid {
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:16px; padding:22px;
}
.profile-grid div {
    background:var(--surface-2);
    border:1px solid var(--border);
    border-radius:var(--radius); padding:16px;
}
.profile-grid div .label { margin-bottom:5px; }
.profile-grid div strong { font-size:14.5px; font-weight:500; }

.mt-24 { margin-top:24px; }

/* ─── UTILS ───────────────────────────────── */
.divider      { height:1px; background:var(--border); margin:22px 0; }
.button-group { display:flex; gap:10px; flex-wrap:wrap; }
.inline-info  { display:flex; align-items:center; }

.mini-code {
    display:inline-flex; align-items:center;
    padding:9px 12px; border-radius:10px;
    background:var(--surface-3); color:var(--green);
    font-family:'DM Mono',monospace; font-size:12px;
    border:1px solid var(--border);
    overflow-wrap:anywhere; max-width:100%;
}

.demo-box {
    margin-top:20px; padding:14px 16px;
    border-radius:var(--radius);
    background:var(--surface-2); border:1px solid var(--border);
    font-size:13px; color:var(--muted);
}

/* ════════════════════════════════════════════
   SETTINGS PAGE
════════════════════════════════════════════ */
.settings-hero { margin-bottom:22px; }
.settings-hero h2 { font-size:26px; font-weight:700; margin-bottom:5px; }
.settings-hero p  { color:var(--muted); font-size:13.5px; max-width:680px; }

.settings-hero-actions { display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin-top:6px; }

.settings-overview {
    display:grid;
    grid-template-columns:repeat(4,minmax(0,1fr));
    gap:14px; margin-bottom:20px;
}
.settings-summary-card {
    background:var(--surface); border:1px solid var(--border);
    border-radius:var(--radius-lg); padding:18px 20px;
}
.settings-summary-card strong { display:block; font-size:15px; font-weight:600; margin-bottom:6px; }
.settings-summary-card p { margin:6px 0 0; color:var(--muted); font-size:12.5px; line-height:1.55; }
.summary-inline { display:flex; align-items:center; gap:8px; margin-bottom:6px; }
.settings-summary-card code {
    display:inline-block; margin-top:6px;
    font-family:'DM Mono',monospace; font-size:12px;
    color:var(--green); background:var(--green-dim);
    border-radius:6px; padding:4px 8px;
}

.settings-section-card {
    background:var(--surface); border:1px solid var(--border);
    border-radius:var(--radius-lg); overflow:hidden;
}
.settings-section-card-spaced { margin-top:18px; }

.settings-section-header {
    padding:20px 24px; border-bottom:1px solid var(--border);
    display:flex; align-items:flex-start;
    justify-content:space-between; gap:16px;
}
.section-kicker {
    display:inline-flex; align-items:center;
    padding:4px 10px; border-radius:999px;
    background:var(--green-dim); color:var(--green);
    border:1px solid var(--green-ring);
    font-family:'DM Mono',monospace;
    font-size:10.5px; letter-spacing:.08em; text-transform:uppercase;
    margin-bottom:10px;
}
.settings-section-header h3 { font-size:17px; font-weight:600; margin-bottom:5px; }
.settings-section-header p  { color:var(--muted); font-size:13px; max-width:600px; }
.header-badge-box { display:flex; align-items:flex-start; padding-top:4px; }

.settings-split {
    display:grid;
    grid-template-columns:minmax(0,1.3fr) minmax(280px,0.9fr);
    gap:0; align-items:start;
}
.settings-split-api { grid-template-columns:minmax(0,1.2fr) minmax(280px,0.8fr); }
.settings-form-pane { padding:22px 24px; border-right:1px solid var(--border); min-width:0; }
.settings-side-pane { padding:22px 24px; min-width:0; }

.brand-showcase,.integration-card {
    background:var(--surface-2); border:1px solid var(--border);
    border-radius:var(--radius); padding:18px;
}
.brand-showcase-top,.integration-card-header {
    display:flex; flex-direction:column; gap:4px; margin-bottom:16px;
}
.brand-showcase-top strong,.integration-card-header strong { font-size:15px; font-weight:600; }

.brand-visual-grid {
    display:grid; grid-template-columns:repeat(2,minmax(0,1fr));
    gap:12px; margin-bottom:14px;
}
.brand-asset-card {
    background:var(--surface-3); border:1px solid var(--border);
    border-radius:var(--radius); padding:14px;
}
.branding-preview-box {
    margin-top:10px; min-height:110px; border-radius:10px;
    border:1px dashed var(--border-bright);
    display:grid; place-items:center; background:var(--surface-4);
}
.small-preview-box { min-height:80px; }
.preview-image  { max-width:100%; max-height:90px; object-fit:contain; display:block; }
.preview-logo   { max-height:72px; }
.preview-favicon{ max-height:38px; }

.preview-placeholder {
    width:64px; height:64px; border-radius:14px;
    display:grid; place-items:center;
    font-family:'Syne',sans-serif;
    font-size:26px; font-weight:800; color:#000; background:var(--green);
}
.preview-placeholder-small { width:42px; height:42px; font-size:18px; border-radius:10px; }

.app-mini-preview {
    overflow:hidden; border:1px solid var(--border);
    border-radius:var(--radius); background:var(--surface-3); margin-bottom:14px;
}
.app-mini-topbar {
    display:flex; align-items:center; gap:6px;
    padding:10px 12px; background:var(--surface-4); border-bottom:1px solid var(--border);
}
.mini-dot { width:9px; height:9px; border-radius:50%; background:var(--surface-4); border:1px solid var(--border-bright); }
.app-mini-body { padding:14px; }
.app-mini-brand { display:flex; align-items:center; gap:10px; }
.mini-brand-logo,.mini-brand-fallback {
    width:42px; height:42px; border-radius:10px; object-fit:contain;
    background:var(--green); color:#000;
    display:grid; place-items:center;
    font-family:'Syne',sans-serif; font-weight:800; font-size:18px;
    padding:6px; flex-shrink:0;
}
.app-mini-brand small { display:block; margin-top:3px; color:var(--muted); font-size:11px; }
.app-mini-brand strong { font-size:14px; }

.soft-note {
    background:var(--surface-3); border:1px solid var(--border);
    border-radius:var(--radius); padding:14px;
}
.soft-note strong { display:block; margin-bottom:8px; font-size:13px; }
.security-list { margin:0; padding-left:16px; color:var(--muted); font-size:12.5px; line-height:1.7; }
.security-list code {
    font-family:'DM Mono',monospace; font-size:11.5px;
    color:var(--green); background:var(--green-dim); padding:1px 5px; border-radius:4px;
}

.integration-status-panel {
    display:grid; grid-template-columns:repeat(3,minmax(0,1fr));
    gap:12px; margin-bottom:18px;
}
.integration-status-item {
    background:var(--surface-3); border:1px solid var(--border);
    border-radius:var(--radius); padding:14px;
}
.integration-status-item strong { display:block; margin-top:5px; font-size:16px; font-weight:600; }

.api-endpoint-box,.compact-box {
    background:var(--surface-3); border:1px solid var(--border);
    border-radius:var(--radius); padding:14px; margin-bottom:12px;
}
.api-endpoint-box code,.settings-summary-card code,
.help-text code,.soft-note code {
    font-family:'DM Mono',monospace; font-size:12px;
    color:var(--green); background:var(--green-dim); border-radius:5px; padding:2px 6px;
}
.api-endpoint-box > code {
    display:block; margin-top:6px; padding:8px 10px;
    overflow-wrap:anywhere; border-radius:8px;
}

.status-message-box {
    background:var(--surface-3); border:1px solid var(--border);
    border-radius:var(--radius); padding:14px;
}
.status-message-box p,.muted-paragraph { color:var(--muted); margin:6px 0 0; font-size:13px; }
.integration-check-form { margin-top:14px; }

/* ─── RESPONSIVE ──────────────────────────── */
@media (max-width:1200px) {
    .settings-overview { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .settings-split,.settings-split-api,.integration-status-panel { grid-template-columns:1fr; }
    .settings-form-pane { border-right:none; border-bottom:1px solid var(--border); }
}

@media (max-width:1024px) {
    .auth-layout { grid-template-columns:1fr; }
    .auth-brand-panel { display:none; }
    .auth-form-panel { min-height:100vh; align-items:center; }
    .auth-form-panel > * { width:100%; max-width:460px; margin:0 auto; }

    .app-shell { grid-template-columns:1fr; }
    .sidebar {
        position:sticky; top:0; height:auto;
        flex-direction:row; flex-wrap:wrap; gap:12px;
        z-index:50; border-right:none; border-bottom:1px solid var(--border);
        padding:12px 16px;
    }
    .brand { margin-bottom:0; }
    .user-card { display:none; }
    .nav-section-label { display:none; }
    .nav-menu { flex-direction:row; flex-wrap:wrap; gap:4px; }
    .nav-menu a { padding:7px 10px; font-size:13px; }
    .logout-form { margin-top:0; padding-top:0; }

    .stats-grid { grid-template-columns:repeat(2,1fr); }
    .two-columns { grid-template-columns:1fr; }
    .profile-grid { grid-template-columns:1fr; padding:16px; }
}

@media (max-width:768px) {
    .content-area { padding:20px 16px; }
    .stats-grid { grid-template-columns:1fr; }
    .between { flex-direction:column; align-items:flex-start; }
    .table th,.table td { white-space:nowrap; }
    .form-actions,.form-actions-between { flex-direction:column; align-items:flex-start; }
    .btn,.btn-block { width:100%; text-align:center; }
    .settings-overview { grid-template-columns:1fr; }
    .brand-visual-grid { grid-template-columns:1fr; }
    .button-group { flex-direction:column; width:100%; }
    .inline-info,.mini-code { width:100%; overflow-x:auto; }
    .settings-section-header,.card-header { flex-direction:column; align-items:flex-start; }
    .settings-hero-actions { flex-direction:column; width:100%; }
    .settings-hero-actions .btn { width:100%; }
}

/* ════════════════════════════════════════════
   INSTANCES PAGE
════════════════════════════════════════════ */

/* ─── Error state ─── */
.instances-error-card {
    background: var(--danger-bg);
    border: 1px solid var(--danger-ring);
    border-radius: var(--radius-lg);
    padding: 40px 32px;
    text-align: center;
    max-width: 560px;
    margin: 0 auto;
}
.instances-error-icon {
    width: 64px; height: 64px;
    border-radius: 50%;
    background: rgba(255,82,82,.12);
    display: grid; place-items: center;
    margin: 0 auto 18px;
    color: var(--danger);
}
.instances-error-card h3 {
    font-size: 18px; font-weight: 600;
    margin-bottom: 10px;
}
.instances-error-card p { color: var(--muted); font-size: 14px; line-height: 1.6; }
.instances-error-card a { color: var(--green); }

/* ─── Empty state ─── */
.instances-empty {
    background: var(--surface);
    border: 1px dashed var(--border-bright);
    border-radius: var(--radius-lg);
    padding: 56px 32px;
    text-align: center;
}
.instances-empty-icon {
    width: 72px; height: 72px;
    border-radius: 50%;
    background: var(--surface-3);
    display: grid; place-items: center;
    margin: 0 auto 18px;
    color: var(--muted);
}
.instances-empty h3 { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.instances-empty p  { color: var(--muted); font-size: 14px; }

/* ─── Stat card variants ─── */
.stat-card--connected::before  { background: linear-gradient(90deg, transparent, var(--green), transparent); opacity: .5; }
.stat-card--disconnected::before { background: linear-gradient(90deg, transparent, var(--danger), transparent); opacity: .4; }
.stat-card--disconnected strong { color: var(--danger); }

/* ─── Instance cards grid ─── */
.instances-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.instance-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: border-color .2s, transform .15s;
    box-sizing: border-box;
    overflow: hidden;
    isolation: isolate; /* guarantees overflow:hidden works with transforms */
}
.instance-card:hover { border-color: var(--border-bright); box-shadow: 0 6px 24px rgba(0,0,0,.4); }

/* top accent line via a real div inside the card (.instance-card-accent) */
.instance-card-accent {
    height: 2px;
    width: 100%;
    flex-shrink: 0;
}
.instance-card--connected { border-color: rgba(0,214,125,.20); }
.instance-card--connected .instance-card-accent {
    background: linear-gradient(90deg, transparent, var(--green), transparent);
}
.instance-card--disconnected .instance-card-accent {
    background: linear-gradient(90deg, transparent, var(--danger), transparent);
    opacity: .5;
}

/* inner padding wrapper */
.instance-card-inner {
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    flex: 1;
}

/* Card top bar with badges */
.instance-card-top {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
}

/* Platform & Business badges */
.instance-badge-biz {
    display: inline-flex; align-items: center;
    padding: 3px 9px; border-radius: 999px;
    font-family: 'DM Mono', monospace;
    font-size: 10px; letter-spacing: .07em; text-transform: uppercase;
    background: rgba(100,116,255,.10);
    color: #8090FF;
    border: 1px solid rgba(100,116,255,.22);
}
.instance-badge-platform {
    display: inline-flex; align-items: center;
    padding: 3px 9px; border-radius: 999px;
    font-family: 'DM Mono', monospace;
    font-size: 10px; letter-spacing: .07em; text-transform: uppercase;
    background: var(--surface-3);
    color: var(--muted);
    border: 1px solid var(--border-bright);
}

/* Profile section */
.instance-profile {
    display: flex;
    align-items: center;
    gap: 14px;
}
.instance-avatar {
    width: 52px; height: 52px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-bright);
    flex-shrink: 0;
}
.instance-avatar-fallback {
    width: 52px; height: 52px;
    border-radius: 50%;
    background: var(--surface-3);
    border: 2px solid var(--border-bright);
    display: grid; place-items: center;
    font-family: 'Syne', sans-serif;
    font-weight: 700; font-size: 17px;
    color: var(--muted);
    flex-shrink: 0;
}
.instance-card--connected .instance-avatar-fallback { color: var(--green); background: var(--green-dim); border-color: var(--green-ring); }

.instance-profile-info { min-width: 0; }
.instance-profile-name {
    display: block;
    font-size: 15px; font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    margin-bottom: 4px;
}
.instance-phone {
    display: inline-flex; align-items: center; gap: 5px;
    font-family: 'DM Mono', monospace;
    font-size: 12px; color: var(--muted);
}

/* Details grid */
.instance-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.instance-detail-item {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 10px 12px;
}
.instance-detail-label {
    display: block;
    font-size: 10.5px;
    font-family: 'DM Mono', monospace;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted-2);
    margin-bottom: 4px;
}
.instance-detail-value {
    display: block;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
code.instance-detail-value {
    font-family: 'DM Mono', monospace;
    font-size: 11.5px;
    color: var(--green);
    background: var(--green-dim);
    padding: 2px 5px;
    border-radius: 5px;
}

/* Disconnect reason — footer strip with explicit bottom radius */
.instance-disconnect-reason {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--danger-bg);
    border-top: 1px solid var(--danger-ring);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    padding: 10px 20px;
    font-size: 12px;
    color: var(--danger);
    line-height: 1.5;
    flex-shrink: 0;
    /* explicit radius as belt-and-suspenders alongside overflow:hidden */
}
.instance-disconnect-reason svg { flex-shrink: 0; }

/* ─── Table view ─── */
.instances-table-section { margin-top: 0; }

.table-avatar-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}
.table-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border-bright);
    flex-shrink: 0;
}
.table-avatar-fallback {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--surface-3);
    border: 1px solid var(--border-bright);
    display: grid; place-items: center;
    font-family: 'Syne', sans-serif;
    font-weight: 700; font-size: 12px;
    color: var(--muted);
    flex-shrink: 0;
}
code.instance-id-code {
    font-family: 'DM Mono', monospace;
    font-size: 11.5px;
    color: var(--green);
    background: var(--green-dim);
    padding: 3px 7px;
    border-radius: 5px;
    white-space: nowrap;
}
.text-muted { color: var(--muted); }

/* ─── Responsive instances ─── */
@media (max-width: 768px) {
    .instances-grid { grid-template-columns: 1fr; }
    .instance-details { grid-template-columns: 1fr; }
    .instances-table-section { display: none; } /* hide table on mobile, cards are enough */
}

/* ════════════════════════════════════════════
   PUBLISH STATUS PAGE
════════════════════════════════════════════ */

/* ─── Two-col layout ─── */
.publish-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 24px;
    align-items: start;
}

/* ─── Sections inside form ─── */
.publish-form { display: flex; flex-direction: column; gap: 0; }

.publish-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 22px;
    margin-bottom: 14px;
}

.publish-section-label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-family: 'DM Mono', monospace;
    font-size: 10.5px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 14px;
}

/* ─── Instance selector ─── */
.instance-selector-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.instance-option {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface-2);
    border: 1px solid var(--border-bright);
    border-radius: var(--radius);
    padding: 12px 14px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.instance-option input[type="radio"] { display: none; }
.instance-option:hover { border-color: var(--green-ring); background: var(--surface-3); }
.instance-option--selected {
    border-color: var(--green);
    background: var(--green-dim);
    box-shadow: 0 0 0 1px var(--green-ring);
}
.instance-option-avatar {
    width: 38px; height: 38px;
    border-radius: 50%; object-fit: cover;
    border: 2px solid var(--border-bright);
    flex-shrink: 0;
}
.instance-option-avatar-fb {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: var(--surface-3);
    border: 2px solid var(--border-bright);
    display: grid; place-items: center;
    font-family: 'Syne', sans-serif;
    font-weight: 700; font-size: 13px;
    color: var(--muted);
    flex-shrink: 0;
}
.instance-option--selected .instance-option-avatar-fb { color: var(--green); background: var(--green-dim); border-color: var(--green-ring); }
.instance-option-info { min-width: 0; }
.instance-option-info strong { display: block; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.instance-option-info span  { font-size: 12px; color: var(--muted); font-family: 'DM Mono', monospace; }

/* ─── Type selector ─── */
.type-selector {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.type-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    background: var(--surface-2);
    border: 1px solid var(--border-bright);
    border-radius: var(--radius);
    padding: 12px 16px;
    cursor: pointer;
    font-size: 12px;
    color: var(--muted);
    transition: border-color .15s, color .15s, background .15s;
    min-width: 68px;
}
.type-option input[type="radio"] { display: none; }
.type-option:hover { border-color: var(--green-ring); color: var(--text); }
.type-option--active {
    border-color: var(--green);
    background: var(--green-dim);
    color: var(--green);
    box-shadow: 0 0 0 1px var(--green-ring);
}

/* ─── Status textarea ─── */
.status-textarea {
    width: 100%;
    min-height: 110px;
    resize: vertical;
    background: var(--surface-2);
    border: 1px solid var(--border-bright);
    border-radius: var(--radius);
    padding: 12px 14px;
    color: var(--text);
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
    line-height: 1.6;
}
.status-textarea::placeholder { color: var(--muted-2); }
.status-textarea:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px var(--green-glow);
}
.char-counter {
    text-align: right;
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    color: var(--muted-2);
    margin-top: 5px;
}

/* ─── Color picker ─── */
.color-picker-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.color-option {
    cursor: pointer;
    border-radius: 50%;
    padding: 2px;
    border: 2px solid transparent;
    transition: border-color .15s, transform .1s;
    display: block;
}
.color-option:hover { transform: scale(1.15); }
.color-option--active { border-color: var(--text); }
.color-option input[type="radio"] { display: none; }
.color-swatch {
    display: block;
    width: 26px; height: 26px;
    border-radius: 50%;
}

/* ─── Font picker ─── */
.font-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
}
.font-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: var(--surface-2);
    border: 1px solid var(--border-bright);
    border-radius: 10px;
    padding: 10px 8px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    text-align: center;
}
.font-option input[type="radio"] { display: none; }
.font-option:hover { border-color: var(--green-ring); }
.font-option--active { border-color: var(--green); background: var(--green-dim); }
.font-option-label {
    font-family: 'Syne', sans-serif;
    font-size: 15px; font-weight: 700;
    color: var(--text);
}
.font-option--active .font-option-label { color: var(--green); }
.font-option-name { font-size: 10.5px; color: var(--muted); }

/* ─── Advanced section ─── */
.publish-advanced {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 14px;
}
.publish-advanced-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 20px;
    cursor: pointer;
    list-style: none;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    transition: color .15s;
    user-select: none;
}
.publish-advanced-toggle::-webkit-details-marker { display: none; }
.publish-advanced-toggle:hover { color: var(--text); }
.publish-advanced[open] .publish-advanced-toggle { color: var(--text); border-bottom: 1px solid var(--border); }
.publish-advanced[open] .chevron { transform: rotate(180deg); }
.chevron { margin-left: auto; transition: transform .2s; }
.publish-advanced-body { padding: 18px 20px; }

/* ─── Submit row ─── */
.publish-submit-row {
    display: flex;
    justify-content: flex-end;
    margin-top: 4px;
}
.publish-submit-btn {
    padding: 13px 28px;
    font-size: 14px;
    gap: 9px;
}

/* ─── Preview column ─── */
.preview-sticky { position: sticky; top: 24px; }

/* Phone mockup */
.phone-mockup {
    background: #0A0A0A;
    border-radius: 36px;
    padding: 12px;
    border: 2px solid #2A2A2A;
    box-shadow: 0 20px 60px rgba(0,0,0,.7), inset 0 0 0 1px rgba(255,255,255,.04);
    margin-bottom: 14px;
    width: 100%;
    max-width: 260px;
    margin-left: auto;
    margin-right: auto;
}
.phone-screen {
    background: #000;
    border-radius: 26px;
    overflow: hidden;
    position: relative;
    aspect-ratio: 9/17;
}
.phone-status-bar {
    position: absolute;
    top: 0; left: 0; right: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    font-size: 11px;
    font-weight: 600;
    color: rgba(255,255,255,.85);
}
.phone-status-icons { display: flex; gap: 5px; align-items: center; }
.phone-home-bar {
    height: 4px;
    background: rgba(255,255,255,.25);
    border-radius: 2px;
    width: 80px;
    margin: 8px auto 0;
}

/* Story preview (text) */
.phone-story-preview {
    position: absolute; inset: 0;
    display: flex; flex-direction: column;
}
.story-bg {
    flex: 1;
    display: flex; align-items: center; justify-content: center;
    padding: 24px 16px;
    transition: background .3s;
}
.story-text {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    text-align: center;
    text-shadow: 0 1px 4px rgba(0,0,0,.4);
    word-break: break-word;
    max-width: 100%;
    margin: 0;
}
.story-bottom-bar {
    padding: 10px 14px;
    background: linear-gradient(transparent, rgba(0,0,0,.5));
}
.story-avatar-row {
    display: flex; align-items: center; gap: 8px;
    font-size: 12px; color: #fff; font-weight: 600;
}
.story-avatar {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--green);
    display: grid; place-items: center;
    font-family: 'Syne', sans-serif;
    font-weight: 800; font-size: 11px; color: #000;
    border: 2px solid rgba(255,255,255,.5);
}

/* Media preview */
.phone-story-media {
    position: absolute; inset: 0;
    background: #111;
    display: flex; align-items: center; justify-content: center;
}
.media-placeholder {
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    color: rgba(255,255,255,.3);
    font-size: 13px; font-family: 'DM Mono', monospace;
    letter-spacing: .06em; text-transform: uppercase;
}

/* Preview info card */
.preview-info-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.preview-info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 12.5px;
}
.preview-info-row:last-child { border-bottom: none; }
.preview-info-label { color: var(--muted); font-size: 12px; }
.preview-info-value { font-weight: 500; display: flex; align-items: center; gap: 7px; }
.preview-color-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.required-star { color: var(--danger); }


/* ─── Selected instance preview card ─── */
.selected-instance-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--green-dim);
    border: 1px solid var(--green-ring);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-top: 12px;
}
.sel-inst-avatar {
    width: 40px; height: 40px;
    border-radius: 50%; object-fit: cover;
    border: 2px solid var(--green-ring);
    flex-shrink: 0;
}
.sel-inst-avatar-fb {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--surface-3);
    border: 2px solid var(--green-ring);
    display: grid; place-items: center;
    font-family: 'Syne', sans-serif;
    font-weight: 700; font-size: 14px;
    color: var(--green);
    flex-shrink: 0;
}
.selected-instance-card > div strong { display: block; font-size: 13.5px; font-weight: 600; }
.selected-instance-card > div span   { font-size: 12px; color: var(--muted); font-family: 'DM Mono', monospace; }
/* ─── Responsive ─── */
@media (max-width: 1100px) {
    .publish-layout { grid-template-columns: 1fr; }
    .preview-sticky { position: static; }
    .phone-mockup { max-width: 220px; }
}
@media (max-width: 768px) {
    .type-selector { gap: 6px; }
    .type-option { min-width: 58px; padding: 10px 10px; }
    .font-picker-grid { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); }
}

/* ─── Caption textarea variant ─── */
.status-textarea--caption {
    min-height: 90px;
    max-height: 220px;
    resize: vertical;
    font-size: 13.5px;
    line-height: 1.65;
}
.caption-counter-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 5px;
}
.caption-counter-row .char-counter {
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    color: var(--muted-2);
    white-space: nowrap;
}

/* ─── Publish success state ─── */
.publish-success-state {
    background: var(--surface);
    border: 1px solid var(--green-ring);
    border-radius: var(--radius-lg);
    padding: 48px 32px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    animation: successFadeIn .4s ease;
}
@keyframes successFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
.publish-success-icon {
    width: 72px; height: 72px;
    border-radius: 50%;
    background: var(--success-bg);
    border: 2px solid var(--green-ring);
    display: grid; place-items: center;
    color: var(--green);
}
.publish-success-state h3 {
    font-family: 'Syne', sans-serif;
    font-size: 22px; font-weight: 700;
    margin-bottom: 4px;
}
.publish-success-state p { color: var(--muted); font-size: 14px; }

/* ─── Caption textarea with line breaks ─── */
.status-textarea--caption {
    min-height: 90px;
    resize: vertical;
    white-space: pre-wrap;
}
.caption-counter-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 6px;
}
.caption-counter-row .help-text { margin: 0; }
.caption-counter-row .char-counter { margin: 0; font-size: 11px; }

/* ════════════════════════════════════════════
   SCHEDULED STATUSES PAGE
════════════════════════════════════════════ */

.sched-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}

/* ─── Toggle switch ─── */
.repeat-toggle-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 4px;
}
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px; height: 24px;
    flex-shrink: 0;
}
.toggle-switch input { display: none; }
.toggle-slider {
    position: absolute; inset: 0;
    background: var(--surface-3);
    border: 1px solid var(--border-bright);
    border-radius: 999px;
    cursor: pointer;
    transition: background .2s, border-color .2s;
}
.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: var(--muted);
    top: 2px; left: 2px;
    transition: transform .2s, background .2s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--green-dim); border-color: var(--green-ring); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); background: var(--green); }
.toggle-label { font-size: 13px; color: var(--muted); }

/* ─── Sched list col ─── */
.sched-list-col { display: flex; flex-direction: column; gap: 16px; }

/* ─── Sched item ─── */
.sched-items { display: flex; flex-direction: column; }
.sched-empty {
    padding: 48px 24px;
    text-align: center;
    color: var(--muted);
    display: flex; flex-direction: column; align-items: center; gap: 12px;
    font-size: 13.5px;
}

.sched-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    transition: background .12s;
}
.sched-item:last-child { border-bottom: none; }
.sched-item:hover { background: var(--surface-2); }
.sched-item--cancelled,
.sched-item--sent { opacity: .6; }

.sched-type-bubble {
    width: 42px; height: 42px;
    border-radius: 10px;
    display: grid; place-items: center;
    font-size: 18px;
    flex-shrink: 0;
}
.sched-type-bubble--media { background: var(--surface-3); border: 1px solid var(--border-bright); }

.sched-item-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }

.sched-item-top { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }

/* Status badges */
.sched-badge {
    display: inline-flex; align-items: center;
    padding: 3px 9px; border-radius: 999px;
    font-family: 'DM Mono', monospace;
    font-size: 10.5px; font-weight: 500;
    letter-spacing: .06em;
}
.sched-badge--pending   { background: var(--warning-bg);  color: var(--warning);  border: 1px solid var(--warning-ring); }
.sched-badge--sent      { background: var(--success-bg);  color: var(--green);    border: 1px solid var(--green-ring); }
.sched-badge--failed    { background: var(--danger-bg);   color: var(--danger);   border: 1px solid var(--danger-ring); }
.sched-badge--paused    { background: var(--surface-3);   color: var(--muted);    border: 1px solid var(--border-bright); }
.sched-badge--cancelled { background: var(--surface-3);   color: var(--muted-2);  border: 1px solid var(--border); }

.sched-type-tag {
    font-family: 'DM Mono', monospace;
    font-size: 10.5px; color: var(--muted);
    background: var(--surface-3);
    padding: 3px 8px; border-radius: 999px;
    border: 1px solid var(--border);
}
.sched-repeat-tag {
    font-size: 11px; color: var(--green);
    background: var(--green-dim);
    padding: 3px 8px; border-radius: 999px;
    border: 1px solid var(--green-ring);
}

.sched-item-content { font-size: 13.5px; }
.sched-preview-text { color: var(--text); }
.sched-preview-url  { color: var(--muted); font-family: 'DM Mono', monospace; font-size: 12px; }

.sched-item-meta {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    font-size: 12px; color: var(--muted);
}
.sched-item-meta span { display: flex; align-items: center; gap: 4px; }
.sched-error-hint { color: var(--danger) !important; cursor: help; }

.sched-item-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }

/* ─── Cron info card ─── */
.cron-info-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    font-size: 13px;
    color: var(--muted);
    line-height: 1.6;
}
.cron-info-header {
    display: flex; align-items: center; gap: 7px;
    font-family: 'DM Mono', monospace;
    font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase;
    color: var(--green); margin-bottom: 10px;
}
.cron-code {
    display: block;
    background: var(--surface-3);
    border: 1px solid var(--border-bright);
    border-radius: 9px;
    padding: 12px 14px;
    font-family: 'DM Mono', monospace;
    font-size: 11.5px;
    color: var(--green);
    overflow-x: auto;
    white-space: nowrap;
    margin: 10px 0;
}

/* ─── datetime-local input ─── */
input[type="datetime-local"] {
    width: 100%;
    padding: 12px 14px;
    background: var(--surface-2);
    border: 1px solid var(--border-bright);
    border-radius: var(--radius);
    color: var(--text);
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
    color-scheme: dark;
}
input[type="datetime-local"]:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px var(--green-glow);
}

/* ─── Responsive ─── */
@media (max-width: 1100px) {
    .sched-layout { grid-template-columns: 1fr; }
}

/* ─── Dashboard improvements ─── */
.dash-section-label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-family: 'DM Mono', monospace;
    font-size: 10.5px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 10px;
}
.dash-next-sched {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--green-dim);
    border: 1px solid var(--green-ring);
    border-radius: var(--radius);
    padding: 10px 16px;
    font-size: 13px;
    color: var(--text);
    margin-bottom: 20px;
}
.dash-next-sched svg { color: var(--green); flex-shrink: 0; }
.dash-alert-failed {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--danger-bg);
    border: 1px solid var(--danger-ring);
    border-radius: var(--radius);
    padding: 10px 16px;
    font-size: 13px;
    color: var(--danger);
    margin-bottom: 20px;
}
.dash-alert-failed a { color: var(--danger); font-weight: 600; }

/* ════════════════════════════════════════════
   ENVIAR MENSAJE PAGE
════════════════════════════════════════════ */
.msg-layout {
    display: grid;
    grid-template-columns: 1fr 260px;
    gap: 20px;
    align-items: start;
}
.msg-form-col { min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.msg-side-col { min-width: 0; }

/* Card sections inside form */
.msg-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 22px;
}
.msg-card-label {
    display: flex; align-items: center; gap: 7px;
    font-family: 'DM Mono', monospace;
    font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase;
    color: var(--muted); margin-bottom: 16px;
}

/* Type tabs — horizontal scrollable row */
.msg-type-tabs {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
}
.msg-tab {
    display: flex; flex-direction: column; align-items: center; gap: 5px;
    background: var(--surface-2);
    border: 1px solid var(--border-bright);
    border-radius: 10px;
    padding: 10px 6px 9px;
    cursor: pointer;
    font-size: 11px;
    color: var(--muted);
    transition: border-color .15s, color .15s, background .15s;
    text-align: center;
    user-select: none;
}
.msg-tab input[type="radio"] { display: none; }
.msg-tab:hover { border-color: var(--green-ring); color: var(--text); background: var(--surface-3); }
.msg-tab--active {
    border-color: var(--green);
    background: var(--green-dim);
    color: var(--green);
    box-shadow: 0 0 0 1px var(--green-ring);
}
.msg-tab svg { flex-shrink: 0; }

/* Submit row */
.msg-submit-row { display: flex; justify-content: flex-end; }
.msg-submit-btn { padding: 13px 32px; font-size: 14px; gap: 9px; }

/* Misc form elements */
.req { color: var(--danger); }
.msg-hint-box {
    display: flex; align-items: flex-start; gap: 7px;
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: 9px; padding: 10px 14px;
    font-size: 12.5px; color: var(--muted); line-height: 1.6;
}
.msg-toggle-row {
    display: flex; align-items: center; gap: 10px;
    font-size: 13px; cursor: pointer;
}

/* Side panel cards */
.msg-type-info-card {
    display: flex; align-items: flex-start; gap: 12px;
    background: var(--surface);
    border: 1px solid var(--green-ring);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 12px;
}
.msg-type-info-icon {
    width: 40px; height: 40px; flex-shrink: 0;
    background: var(--green-dim);
    border-radius: 10px;
    display: grid; place-items: center;
    color: var(--green);
}
.msg-type-info-title { font-family: 'Syne', sans-serif; font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.msg-type-info-desc  { font-size: 12.5px; color: var(--muted); line-height: 1.5; }

.msg-tips-card, .msg-instances-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 12px;
}
.msg-tips-header {
    display: flex; align-items: center; gap: 6px;
    font-family: 'DM Mono', monospace;
    font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
    color: var(--muted); margin-bottom: 10px;
}
.msg-tips-list {
    margin: 0; padding-left: 16px;
    font-size: 12.5px; color: var(--muted); line-height: 1.7;
}
.msg-tips-list code {
    font-family: 'DM Mono', monospace; font-size: 11.5px;
    color: var(--green); background: var(--green-dim);
    padding: 1px 5px; border-radius: 4px;
}

.msg-inst-row {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 0; border-bottom: 1px solid var(--border);
    font-size: 12.5px;
}
.msg-inst-row:last-child { border-bottom: none; }
.msg-inst-avatar {
    width: 30px; height: 30px; border-radius: 50%;
    object-fit: cover; border: 1px solid var(--border-bright); flex-shrink: 0;
}
.msg-inst-avatar-fb {
    width: 30px; height: 30px; border-radius: 50%;
    background: var(--green-dim); border: 1px solid var(--green-ring);
    display: grid; place-items: center;
    font-family: 'Syne', sans-serif; font-weight: 700; font-size: 11px; color: var(--green);
    flex-shrink: 0;
}
.msg-inst-info { flex: 1; min-width: 0; }
.msg-inst-info strong { display: block; font-size: 12.5px; font-weight: 600; }
.msg-inst-info span   { font-size: 11px; color: var(--muted); font-family: 'DM Mono', monospace; }

/* Emoji picker */
.emoji-picker-row {
    display: flex; flex-wrap: wrap; gap: 5px;
    padding: 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.emoji-btn {
    font-size: 20px; background: none;
    border: 2px solid transparent; border-radius: 8px;
    cursor: pointer; padding: 3px 5px;
    transition: border-color .15s, background .15s; line-height: 1;
}
.emoji-btn:hover { background: var(--surface-3); }
.emoji-btn--active { border-color: var(--green); background: var(--green-dim); }

/* ════════════════════════════════════════════
   GRUPOS PAGE
════════════════════════════════════════════ */
.groups-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}

.group-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background .12s;
}
.group-item:hover { background: var(--surface-2); }
.group-item--active { background: var(--green-dim); border-left: 3px solid var(--green); }
.group-item:last-child { border-bottom: none; }

.group-avatar {
    width: 42px; height: 42px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border-bright);
    flex-shrink: 0;
}
.group-avatar-fb {
    width: 42px; height: 42px;
    border-radius: 50%;
    background: var(--surface-3);
    border: 1px solid var(--border-bright);
    display: grid; place-items: center;
    font-family: 'Syne', sans-serif;
    font-weight: 700; font-size: 14px;
    color: var(--muted);
    flex-shrink: 0;
}
.group-item-info { flex: 1; min-width: 0; }
.group-item-info strong { display: block; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.group-item-info span   { font-size: 11.5px; color: var(--muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 1100px) {
    .msg-layout    { grid-template-columns: 1fr; }
    .groups-layout { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
    .msg-type-tabs { grid-template-columns: repeat(5, 1fr); gap: 4px; }
    .msg-tab { padding: 8px 4px; font-size: 10px; }
}
@media (max-width: 480px) {
    .msg-type-tabs { grid-template-columns: repeat(4, 1fr); }
}
