/* Facet Admin Dashboard Styles */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --facet-main-black: rgb(0,0,0);
    --facet-ui-bg: rgb(14,14,14);
    --facet-txt-white: rgb(255,255,255);
    --facet-txt-dim: rgb(166,166,166);
    --facet-master-accent: #c1ff72;
    --facet-border: rgb(26,26,26);
    --facet-border-mid: rgb(56,56,56);
    --sidebar-w: 220px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--facet-main-black);
    color: var(--facet-txt-white);
    font-size: 14px;
    line-height: 1.5;
    min-height: 100vh;
}

/* ── Layout ─────────────────────────────────────────── */
.admin-layout { display: flex; min-height: 100vh; }

/* ── Sidebar ─────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    background: rgb(8,8,8);
    border-right: 1px solid var(--facet-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
}

.sidebar-logo {
    padding: 1.5rem 1.25rem 1.25rem;
    border-bottom: 1px solid var(--facet-border);
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar-logo .logo-text {
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--facet-txt-white);
}
.sidebar-logo .logo-badge {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--facet-master-accent);
    background: rgba(193,255,114,0.1);
    border: 1px solid rgba(193,255,114,0.2);
    border-radius: 4px;
    padding: 2px 5px;
    text-transform: uppercase;
}

.sidebar-nav { flex: 1; padding: 0.75rem 0; overflow-y: auto; }

.nav-section-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgb(80,80,80);
    padding: 1rem 1.25rem 0.4rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.8rem 1.25rem;
    color: var(--facet-txt-dim);
    text-decoration: none;
    font-size: 0.83rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 0;
    transition: color 0.15s, background 0.15s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    margin: 1px 0;
}
.nav-item:hover { color: var(--facet-txt-white); background: rgba(255,255,255,0.04); }
.nav-item.active {
    color: var(--facet-master-accent);
    background: rgba(193,255,114,0.06);
}
.nav-item .nav-icon { width: 16px; height: 16px; opacity: 0.7; flex-shrink: 0; }
.nav-item.active .nav-icon { opacity: 1; }

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--facet-border);
}
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 0.75rem;
}
.user-avatar {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: rgba(193,255,114,0.15);
    border: 1px solid rgba(193,255,114,0.25);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--facet-master-accent);
    flex-shrink: 0;
}
.user-email { font-size: 0.72rem; color: var(--facet-txt-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logout-btn {
    width: 100%;
    padding: 0.5rem;
    background: rgba(255,60,60,0.07);
    border: 1px solid rgba(255,60,60,0.15);
    border-radius: 8px;
    color: rgba(255,100,100,0.8);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    letter-spacing: 0.02em;
}
.logout-btn:hover { background: rgba(255,60,60,0.14); color: rgb(255,100,100); }

/* ── Main Content ─────────────────────────────────────── */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.topbar {
    padding: 1.25rem 2rem;
    border-bottom: 1px solid var(--facet-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(8,8,8,0.6);
    backdrop-filter: blur(8px);
    position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-size: 1rem; font-weight: 700; color: var(--facet-txt-white); }
.topbar-sub { font-size: 0.75rem; color: var(--facet-txt-dim); margin-top: 1px; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }

.page-body { padding: 2.5rem; flex: 1; max-width: 1280px; margin-left: auto; margin-right: auto; width: 100%; }

/* ── Stat Cards ─────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}
.stat-card {
    background: rgb(10,10,10);
    border: 1px solid var(--facet-border);
    border-radius: 28px;
    padding: 1.75rem 2rem;
}
.stat-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--facet-txt-dim); margin-bottom: 0.5rem; }
.stat-value { font-size: 2rem; font-weight: 800; letter-spacing: -0.04em; color: var(--facet-txt-white); }
.stat-value.accent { color: var(--facet-master-accent); }
.stat-value.red { color: rgb(255,90,90); }

/* ── Table ─────────────────────────────────────────── */
.table-wrap {
    background: rgb(10,10,10);
    border: 1px solid var(--facet-border);
    border-radius: 28px;
    overflow: hidden;
}
.table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--facet-border);
    gap: 1rem;
}
.table-search {
    background: rgb(14,14,14);
    border: 2px solid rgb(26,26,26);
    border-radius: 18px;
    padding: 0.5rem 0.875rem;
    color: var(--facet-txt-white);
    font-size: 0.82rem;
    outline: none;
    width: 220px;
    min-height: 3rem;
    transition: border-color 0.15s;
}
.table-search:focus { border-color: #c1ff72; outline: none; }
.table-search::placeholder { color: rgb(80,80,80); }

table { width: 100%; border-collapse: collapse; }
thead th {
    text-align: left;
    padding: 0.9rem 1.5rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgb(80,80,80);
    border-bottom: 1px solid var(--facet-border);
    font-weight: 600;
}
tbody tr { border-bottom: 1px solid rgba(26,26,26,0.6); transition: background 0.1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,0.02); }
tbody td { padding: 1rem 1.5rem; font-size: 0.83rem; color: var(--facet-txt-white); }
td.dim { color: var(--facet-txt-dim); }

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 100px;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.04em;
}
.badge-green { background: rgba(60,210,110,0.12); color: rgb(60,210,110); border: 1px solid rgba(60,210,110,0.2); }
.badge-red { background: rgba(255,80,80,0.1); color: rgb(255,100,100); border: 1px solid rgba(255,80,80,0.2); }
.badge-grey { background: rgba(120,120,120,0.1); color: rgb(140,140,140); border: 1px solid rgba(120,120,120,0.2); }
.badge-accent { background: rgba(193,255,114,0.1); color: var(--facet-master-accent); border: 1px solid rgba(193,255,114,0.2); }

/* ── Pagination ──────────────────────────────────── */
.pagination { display: flex; align-items: center; gap: 8px; padding: 1rem 1.25rem; border-top: 1px solid var(--facet-border); }
.page-btn {
    padding: 4px 12px;
    border-radius: 6px;
    border: 1px solid var(--facet-border-mid);
    background: transparent;
    color: var(--facet-txt-dim);
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.15s;
}
.page-btn:hover:not(:disabled) { background: rgba(255,255,255,0.06); color: var(--facet-txt-white); }
.page-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.page-info { font-size: 0.78rem; color: var(--facet-txt-dim); margin: 0 4px; }

/* ── Buttons ─────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
    letter-spacing: 0.01em;
    white-space: nowrap;
}
.btn-primary {
    border-radius: 100px;
    background: rgb(37,37,37);
    border: 1px solid #000;
    outline: 1px solid rgb(89,89,89);
    color: white;
}
.btn-primary:hover { background: white; color: black; }
.btn-secondary {
    border-radius: 16px;
    background: rgb(28,28,28);
    border: 1px solid rgba(0,0,0,1);
    color: rgb(212,212,212);
}
.btn-secondary:hover { background: #000; color: white; }
.btn-danger {
    border-radius: 16px;
    background: rgba(255,60,60,0.1);
    color: rgb(255,100,100);
    border: 1px solid rgba(255,60,60,0.2);
}
.btn-danger:hover { background: rgba(255,60,60,0.18); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-sm { padding: 0.45rem 0.9rem; font-size: 0.75rem; }
.btn-icon { width: 32px; height: 32px; padding: 0; justify-content: center; border-radius: 8px; }

/* ── Modal ──────────────────────────────────────── */
.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: flex; align-items: center; justify-content: center;
    padding: 1rem;
    border-radius: 28px;
    opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.modal-backdrop.open { opacity: 1; pointer-events: all; }
.modal {
    background: rgb(12,12,12);
    border: 1px solid var(--facet-border-mid);
    border-radius: 28px;
    width: 100%;
    max-width: 540px;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(12px) scale(0.98);
    transition: transform 0.2s;
}
.modal-backdrop.open .modal { transform: translateY(0) scale(1); }
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--facet-border);
}
.modal-title { font-size: 0.95rem; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--facet-txt-dim); cursor: pointer; font-size: 1.2rem; padding: 4px; line-height: 1; transition: color 0.15s; }
.modal-close:hover { color: var(--facet-txt-white); }
.modal-body { padding: 2rem; }
.modal-footer { display: flex; gap: 8px; justify-content: flex-end; padding: 1rem 1.5rem; border-top: 1px solid var(--facet-border); }

/* ── Form Fields ─────────────────────────────────── */
.field { margin-bottom: 1.1rem; }
.field label { display: block; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--facet-txt-dim); margin-bottom: 0.4rem; font-weight: 600; }
.field input, .field select, .field textarea {
    width: 100%;
    background: rgb(14,14,14);
    border: 2px solid rgb(26,26,26);
    border-radius: 18px;
    padding: 0.6rem 0.875rem;
    color: var(--facet-txt-white);
    font-size: 0.85rem;
    outline: none;
    min-height: 3rem;
    transition: border-color 0.15s;
    font-family: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: #c1ff72; outline: none; }
.field input::placeholder, .field textarea::placeholder { color: rgb(70,70,70); }
.field textarea { resize: vertical; min-height: 120px; line-height: 1.5; }
.field select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

/* ── Send Campaign ───────────────────────────────── */
.send-steps { display: flex; flex-direction: column; gap: 1.5rem; max-width: 720px; }
.send-step {
    background: rgb(10,10,10);
    border: 1px solid var(--facet-border);
    border-radius: 28px;
    padding: 1.25rem 1.5rem;
}
.send-step-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--facet-master-accent);
    margin-bottom: 0.75rem;
    font-weight: 700;
}
.template-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.7rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--facet-border);
    background: rgb(14,14,14);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    margin-bottom: 6px;
}
.template-option:hover { border-color: var(--facet-border-mid); }
.template-option.selected { border-color: var(--facet-master-accent); background: rgba(193,255,114,0.04); }
.template-option-name { font-weight: 600; font-size: 0.85rem; }
.template-option-vars { font-size: 0.73rem; color: var(--facet-txt-dim); }
.radio-dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--facet-border-mid); flex-shrink: 0; transition: all 0.15s; }
.template-option.selected .radio-dot { border-color: var(--facet-master-accent); background: var(--facet-master-accent); }

.audience-options { display: flex; gap: 8px; flex-wrap: wrap; }
.audience-chip {
    padding: 0.4rem 1rem;
    border-radius: 100px;
    border: 1px solid var(--facet-border-mid);
    background: rgb(14,14,14);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s;
    color: var(--facet-txt-dim);
}
.audience-chip:hover { border-color: var(--facet-border-mid); color: var(--facet-txt-white); }
.audience-chip.selected { border-color: var(--facet-master-accent); color: var(--facet-master-accent); background: rgba(193,255,114,0.06); }

.preview-frame {
    background: #fff;
    border-radius: 10px;
    width: 100%;
    height: 400px;
    border: none;
    margin-top: 0.75rem;
}

/* ── Section header ──────────────────────────────── */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2rem; }
.section-title { font-size: 0.9rem; font-weight: 700; color: var(--facet-txt-white); }

/* ── Variable tags ──────────────────────────────── */
.var-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 0.5rem; }
.var-tag {
    display: inline-flex; align-items: center; gap: 4px;
    background: rgba(193,255,114,0.08); border: 1px solid rgba(193,255,114,0.2);
    border-radius: 6px; padding: 3px 8px; font-size: 0.72rem; color: var(--facet-master-accent);
}
.var-tag-remove { background: none; border: none; color: rgba(193,255,114,0.5); cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 0 0 2px; }
.var-tag-remove:hover { color: var(--facet-master-accent); }

/* ── Toast ───────────────────────────────────────── */
#facet-toast-wrap {
    position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
    z-index: 999999; display: flex; flex-direction: column-reverse; align-items: center; gap: 8px; pointer-events: none;
}
.facet-toast {
    display: flex; align-items: center;
    background: #141414; color: #ececec;
    padding: 11px 20px 15px;
    border-radius: 100px; font-size: 13px; font-weight: 450;
    white-space: normal; text-align: center; word-break: break-word;
    max-width: calc(100vw - 48px);
    position: relative; overflow: hidden; pointer-events: all;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.07);
    animation: ft-in 0.32s cubic-bezier(0.34,1.45,0.64,1) both;
}
.facet-toast.ft-error { border-color: rgba(255,75,75,0.35); }
.facet-toast.ft-success { border-color: rgba(60,210,110,0.35); }
.facet-toast.ft-exit { animation: ft-out 0.22s ease forwards; }
.ft-bar { position: absolute; bottom: 0; left: 0; height: 3px; width: 100%; border-radius: 0 0 100px 100px; transform-origin: left; background: rgba(255,255,255,0.18); }
.facet-toast.ft-error .ft-bar { background: rgba(255,90,90,0.7); }
.facet-toast.ft-success .ft-bar { background: rgba(60,210,110,0.7); }
@keyframes ft-in { from { opacity:0; transform: translateY(14px) scale(0.93); } to { opacity:1; transform: translateY(0) scale(1); } }
@keyframes ft-out { from { opacity:1; transform: translateY(0) scale(1); } to { opacity:0; transform: translateY(10px) scale(0.94); } }
@keyframes ft-shrink { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* ── Loader ──────────────────────────────────────── */
.page-loader {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 4rem; gap: 1rem; color: var(--facet-txt-dim); font-size: 0.82rem;
}
.facet-blob-loader { width: 4rem; height: 4rem; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.facet-blob-loader::after {
    content: ''; width: 6px; height: 6px; border-radius: 50%; background: #fff;
    box-shadow: 22px 0 0 0 rgba(255,255,255,0.35);
    animation: facet-blob-spin 0.8s linear infinite;
}
@keyframes facet-blob-spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* ── Empty state ─────────────────────────────────── */
.empty-state { text-align: center; padding: 3rem 2rem; color: var(--facet-txt-dim); }
.empty-state-icon { font-size: 2rem; margin-bottom: 0.75rem; opacity: 0.4; }
.empty-state-text { font-size: 0.85rem; }

/* ── Send result ─────────────────────────────────── */
.send-result {
    background: rgba(193,255,114,0.06);
    border: 1px solid rgba(193,255,114,0.2);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    display: flex; gap: 2rem; align-items: center; flex-wrap: wrap;
}
.send-result-item { text-align: center; }
.send-result-num { font-size: 1.75rem; font-weight: 800; color: var(--facet-master-accent); }
.send-result-label { font-size: 0.72rem; color: var(--facet-txt-dim); text-transform: uppercase; letter-spacing: 0.07em; }

/* ── Checkbox toggle ─────────────────────────────── */
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.toggle-label { font-size: 0.83rem; color: var(--facet-txt-white); }
.toggle-sub { font-size: 0.73rem; color: var(--facet-txt-dim); }
input[type="checkbox"].toggle {
    appearance: none; width: 36px; height: 20px; border-radius: 100px;
    background: rgb(40,40,40); border: 1px solid var(--facet-border-mid);
    cursor: pointer; position: relative; transition: background 0.2s, border-color 0.2s;
    flex-shrink: 0;
}
input[type="checkbox"].toggle::after {
    content: ''; position: absolute; top: 2px; left: 2px;
    width: 14px; height: 14px; border-radius: 50%; background: #fff;
    transition: transform 0.2s; transform: translateX(0);
}
input[type="checkbox"].toggle:checked { background: var(--facet-master-accent); border-color: var(--facet-master-accent); }
input[type="checkbox"].toggle:checked::after { transform: translateX(16px); }

/* ── Log table status ────────────────────────────── */
.status-sent { color: rgb(60,210,110); }
.status-failed { color: rgb(255,90,90); }

/* ── Recipient rows ──────────────────────────────── */
.recipient-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.55rem 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.1s;
}
.recipient-row:hover { background: rgba(255,255,255,0.03); }
.recipient-row.excluded { opacity: 0.4; }
.recipient-row input[type="checkbox"] {
    width: 15px; height: 15px; flex-shrink: 0;
    accent-color: var(--facet-master-accent);
    cursor: pointer;
}
.recipient-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.recipient-name { font-size: 0.82rem; font-weight: 600; color: var(--facet-txt-white); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recipient-email { font-size: 0.75rem; color: var(--facet-txt-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Subject variable pills ──────────────────────── */
.var-pill {
    padding: 3px 10px;
    border-radius: 100px;
    border: 1px solid rgba(193,255,114,0.25);
    background: rgba(193,255,114,0.07);
    color: var(--facet-master-accent);
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.var-pill:hover { background: rgba(193,255,114,0.14); border-color: rgba(193,255,114,0.5); }

/* ── Sidebar toggle button ───────────────────────── */
.sidebar-toggle {
    display: none;
    align-items: center; justify-content: center;
    width: 36px; height: 36px;
    background: rgb(18,18,18);
    border: 1px solid var(--facet-border-mid);
    border-radius: 8px;
    color: var(--facet-txt-dim);
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}
.sidebar-toggle:hover { background: rgb(26,26,26); color: var(--facet-txt-white); }

/* ── Sidebar overlay (mobile) ────────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 99;
    backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

/* ── Chart ──────────────────────────────────────── */
.overview-chart-wrap { background: rgb(10,10,10); border: 1px solid rgb(18,18,18); border-radius: 28px; padding: 1.75rem 2rem; margin-bottom: 2rem; }
.chart-title { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: rgb(80,80,80); margin-bottom: 1.25rem; font-weight: 600; }
.chart-bars { display: flex; gap: 12px; align-items: flex-end; height: 100px; }
.chart-col { display: flex; flex-direction: column; align-items: center; flex: 1; gap: 4px; height: 100%; }
.chart-bar-wrap { flex: 1; width: 100%; display: flex; align-items: flex-end; }
.chart-bar { width: 100%; background: var(--facet-master-accent); border-radius: 6px 6px 0 0; min-height: 3px; transition: height 0.4s; opacity: 0.85; }
.chart-label { font-size: 0.65rem; color: rgb(100,100,100); }
.chart-val { font-size: 0.7rem; color: var(--facet-txt-dim); font-weight: 600; }

/* ── Template cards cinematic ───────────────────── */
.templates-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1.25rem; margin-top: 1.5rem; }
.template-card { background: rgb(10,10,10); border: 1px solid rgb(26,26,26); border-radius: 28px; overflow: hidden; transition: border-color 0.2s; cursor: default; display: flex; flex-direction: column; height: 300px; }
.template-card:hover { border-color: rgb(56,56,56); }
.tmpl-preview-area { flex: 1; overflow: hidden; position: relative; background: rgb(6,6,6); }
.tmpl-preview-frame { width: 286%; height: 286%; transform: scale(0.35); transform-origin: top left; border: none; pointer-events: none; display: block; }
.tmpl-no-preview { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; opacity: 0.08; }
.tmpl-card-body { padding: 1rem 1.25rem 1.25rem; border-top: 1px solid rgb(18,18,18); display: flex; flex-direction: column; gap: 8px; }
.template-card-name { font-weight: 700; font-size: 0.88rem; }
.tmpl-card-vars { display: flex; flex-wrap: wrap; gap: 4px; min-height: 20px; }
.var-pill-sm { padding: 2px 8px; border-radius: 100px; background: rgba(193,255,114,0.07); border: 1px solid rgba(193,255,114,0.18); color: var(--facet-master-accent); font-size: 0.68rem; font-weight: 600; }
.template-card-actions { display: flex; gap: 6px; margin-top: 2px; }
.template-card-vars-text { font-size: 0.75rem; color: var(--facet-txt-dim); margin-bottom: 1rem; }

/* ── Bulk bar ────────────────────────────────────── */
.bulk-bar { position: fixed; bottom: 0; left: var(--sidebar-w); right: 0; z-index: 150; padding: 0 1.5rem 1.5rem; pointer-events: none; }
.bulk-bar-inner { background: rgb(12,12,12); border: 1px solid rgb(40,40,40); border-radius: 20px 20px 0 0; padding: 1rem 1.25rem; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; pointer-events: all; box-shadow: 0 -8px 40px rgba(0,0,0,0.6); animation: slide-up 0.2s ease; }
@keyframes slide-up { from { transform: translateY(100%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.bulk-count { font-size: 0.82rem; color: var(--facet-txt-dim); flex: 1; }
.bulk-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.btn.active { background: rgba(193,255,114,0.12); border-color: rgba(193,255,114,0.3); color: var(--facet-master-accent); }
.row-selected td { background: rgba(193,255,114,0.04); }
tbody tr.row-selected { cursor: pointer; }
tbody tr[onclick] { cursor: pointer; }

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 768px) {
    :root { --sidebar-w: 240px; }

    .sidebar-toggle { display: flex; }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.25s cubic-bezier(0.4,0,0.2,1);
        z-index: 200;
    }
    .sidebar.open { transform: translateX(0); }

    .main-content { margin-left: 0; overflow-x: hidden; max-width: 100vw; }

    .topbar { padding: 0.875rem 1rem; }

    .page-body { padding: 1rem; overflow-x: hidden; }

    /* Stats stack to 2 cols on mobile */
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; width: 100%; }

    /* Tables scroll horizontally */
    .table-wrap { overflow-x: auto; max-width: 100%; }
    table { min-width: 520px; }

    .table-header { flex-wrap: wrap; gap: 0.5rem; }
    .table-search { width: 100%; }

    /* Templates grid single col */
    .templates-grid { grid-template-columns: 1fr; width: 100%; }

    /* Send steps full width */
    .send-steps { max-width: 100%; width: 100%; }

    /* Section header wraps */
    .section-header { flex-wrap: wrap; gap: 0.75rem; width: 100%; }

    /* Modal full-width on small screens */
    .modal { border-radius: 16px; }

    /* Subscriber table — hide joined col on small screens */
    thead th:nth-child(5), tbody td:nth-child(5) { display: none; }

    .bulk-bar { left: 0; }
    .bulk-bar-inner { gap: 6px; }
    .bulk-actions { gap: 4px; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 0.5rem; }
    .stat-value { font-size: 1.5rem; }

    /* Hide Marketing col too, keep Name/Email/Waitlist/Actions */
    thead th:nth-child(3), tbody td:nth-child(3) { display: none; }

    .audience-options { flex-direction: column; }
    .audience-chip { text-align: center; }
}

/* ── Helpdesk ──────────────────────────────────────── */
.hd-status-tabs { display: flex; gap: 4px; }
.hd-tab { padding: 6px 14px; border-radius: 100px; background: transparent; border: 1px solid rgb(30,30,30); color: var(--facet-txt-dim); font-size: 0.78rem; cursor: pointer; transition: all 0.15s; }
.hd-tab:hover { border-color: rgb(60,60,60); color: #fff; }
.hd-tab.active { background: rgb(20,20,20); border-color: rgb(60,60,60); color: #fff; }

.ticket-row { display: flex; align-items: center; padding: 1rem 1.25rem; border-bottom: 1px solid var(--facet-border); cursor: pointer; transition: background 0.12s; gap: 1rem; }
.ticket-row:hover { background: rgb(10,10,10); }
.ticket-row:first-child { border-top: 1px solid var(--facet-border); }
.ticket-ref { font-size: 0.72rem; color: var(--facet-txt-dim); font-family: monospace; min-width: 70px; }
.ticket-subject { flex: 1; font-weight: 500; font-size: 0.88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ticket-user { font-size: 0.78rem; color: var(--facet-txt-dim); min-width: 120px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ticket-time { font-size: 0.72rem; color: rgb(90,90,90); white-space: nowrap; }
.ticket-unread { width: 7px; height: 7px; border-radius: 50%; background: var(--facet-master-accent); flex-shrink: 0; }
.ticket-unread-placeholder { width: 7px; flex-shrink: 0; }

.hd-status-badge { display: inline-block; padding: 2px 10px; border-radius: 100px; font-size: 0.7rem; font-weight: 600; text-transform: capitalize; }
.hd-status-badge.open { background: rgba(255,180,60,0.12); color: rgb(255,180,60); border: 1px solid rgba(255,180,60,0.25); }
.hd-status-badge.assigned { background: rgba(100,160,255,0.12); color: rgb(100,160,255); border: 1px solid rgba(100,160,255,0.25); }
.hd-status-badge.resolved { background: rgba(193,255,114,0.10); color: var(--facet-master-accent); border: 1px solid rgba(193,255,114,0.2); }
.hd-status-badge.closed { background: rgb(18,18,18); color: var(--facet-txt-dim); border: 1px solid rgb(30,30,30); }

.hd-detail-header { display: flex; align-items: center; gap: 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--facet-border); margin-bottom: 1.5rem; flex-wrap: wrap; }
.hd-ticket-meta { display: flex; align-items: center; gap: 10px; flex: 1; }
.hd-ref { font-family: monospace; font-size: 0.85rem; color: var(--facet-txt-dim); }
.hd-select { background: rgb(14,14,14); border: 1px solid rgb(36,36,36); border-radius: 10px; padding: 6px 10px; color: #fff; font-size: 0.8rem; outline: none; cursor: pointer; }
.hd-select:focus { border-color: var(--facet-border-mid); }

.hd-detail-body { display: flex; flex-direction: column; gap: 1.5rem; }
.hd-thread { display: flex; flex-direction: column; gap: 1rem; }

.hd-msg { display: flex; flex-direction: column; gap: 4px; }
.hd-msg-header { display: flex; align-items: baseline; gap: 8px; }
.hd-msg-sender { font-size: 0.8rem; font-weight: 600; }
.hd-msg-time { font-size: 0.7rem; color: var(--facet-txt-dim); }
.hd-msg-body { padding: 0.875rem 1rem; border-radius: 14px; font-size: 0.875rem; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.hd-msg.user .hd-msg-body { background: rgb(14,14,14); border: 1px solid rgb(24,24,24); border-radius: 4px 14px 14px 14px; }
.hd-msg.admin .hd-msg-body { background: rgba(193,255,114,0.05); border: 1px solid rgba(193,255,114,0.1); border-radius: 14px 4px 14px 14px; }
.hd-msg.admin .hd-msg-sender { color: var(--facet-master-accent); }

.hd-reply-box { background: rgb(10,10,10); border: 1px solid rgb(28,28,28); border-radius: 18px; overflow: hidden; }
.hd-reply-toolbar { display: flex; align-items: center; justify-content: space-between; padding: 0.75rem 1rem 0; }
.hd-reply-editor { min-height: 100px; padding: 0.75rem 1rem; outline: none; font-size: 0.875rem; line-height: 1.6; color: #fff; }
.hd-reply-editor:empty:before { content: attr(data-placeholder); color: rgb(70,70,70); pointer-events: none; }
.hd-reply-footer { display: flex; align-items: center; justify-content: space-between; padding: 0.75rem 1rem; border-top: 1px solid rgb(20,20,20); }

.hd-typing-indicator { display: flex; align-items: center; gap: 8px; padding: 0.5rem 1rem; font-size: 0.75rem; color: var(--facet-txt-dim); border-bottom: 1px solid rgb(18,18,18); }
.hd-typing-dots { display: flex; gap: 3px; align-items: center; }
.hd-typing-dots span { width: 5px; height: 5px; border-radius: 50%; background: var(--facet-txt-dim); animation: dot-pulse 1.2s infinite ease-in-out; }
.hd-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.hd-typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dot-pulse { 0%,60%,100% { opacity: 0.3; } 30% { opacity: 1; } }

.hd-spell-underline { text-decoration: underline wavy rgba(255,100,100,0.7); cursor: pointer; }
.hd-spell-lang-toggle { font-size: 0.7rem; font-weight: 700; padding: 3px 8px; border-radius: 6px; border: 1px solid rgb(40,40,40); background: rgb(18,18,18); color: var(--facet-txt-dim); cursor: pointer; letter-spacing: 0.05em; transition: all 0.15s; }
.hd-spell-lang-toggle:hover { border-color: rgb(60,60,60); color: #fff; }
.hd-spell-errors { display: flex; flex-wrap: wrap; gap: 4px; }
.hd-spell-chip { font-size: 0.7rem; padding: 2px 7px; border-radius: 6px; background: rgba(255,80,80,0.08); border: 1px solid rgba(255,80,80,0.2); color: rgba(255,120,120,0.9); }

/* ── Team ──────────────────────────────────────────── */
.team-member-row { display: flex; align-items: center; padding: 1rem 1.25rem; border-bottom: 1px solid var(--facet-border); gap: 1rem; }
.team-member-row:first-child { border-top: 1px solid var(--facet-border); }
.team-avatar { width: 36px; height: 36px; border-radius: 50%; background: rgb(24,24,24); border: 1px solid rgb(36,36,36); display: flex; align-items: center; justify-content: center; font-size: 0.78rem; font-weight: 700; color: var(--facet-txt-dim); flex-shrink: 0; }
.team-info { flex: 1; }
.team-name { font-size: 0.88rem; font-weight: 600; }
.team-email { font-size: 0.75rem; color: var(--facet-txt-dim); }
.team-role-badge { padding: 3px 10px; border-radius: 100px; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.team-role-badge.master { background: rgba(193,255,114,0.1); border: 1px solid rgba(193,255,114,0.2); color: var(--facet-master-accent); }
.team-role-badge.mailer { background: rgba(100,160,255,0.1); border: 1px solid rgba(100,160,255,0.2); color: rgb(120,175,255); }
.team-role-badge.helper { background: rgba(255,200,80,0.1); border: 1px solid rgba(255,200,80,0.2); color: rgb(255,200,80); }
.team-role-badge.pending { background: rgb(18,18,18); border: 1px solid rgb(30,30,30); color: var(--facet-txt-dim); }
.team-status-badge { font-size: 0.7rem; color: rgba(255,80,80,0.8); font-weight: 600; }
.nav-badge { background: rgba(255,100,80,0.2); border: 1px solid rgba(255,100,80,0.35); color: rgb(255,110,90); border-radius: 100px; padding: 1px 7px; font-size: 0.65rem; font-weight: 700; margin-left: auto; }
