/* ==========================================================================
   Mailpro: one stylesheet for the admin app and the public pages.
   Layout: dark sidebar + content on desktop, slide-out menu on phones. No external fonts or libraries.
   ========================================================================== */

:root {
    --bg: #f4f6fb;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --border: #e4e8f1;
    --text: #172033;
    --muted: #64718a;
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-soft: #eef0ff;
    --success: #059669;
    --success-soft: #d9f7ea;
    --warn: #b45309;
    --warn-soft: #fef0c7;
    --danger: #dc2626;
    --danger-soft: #fee4e2;
    --info: #2563eb;
    --info-soft: #dfeaff;
    --neutral-soft: #eceff5;
    --sidebar: #0f1530;
    --sidebar-text: #aab3cf;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(23, 32, 51, .05), 0 6px 20px rgba(23, 32, 51, .05);
    --ring: 0 0 0 3px rgba(79, 70, 229, .22);
    --sidebar-w: 248px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: var(--neutral-soft); padding: 1px 6px; border-radius: 6px; font-size: .88em; word-break: break-word; }
hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }

/* ---- icons ---- */
.i { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.22em; }
.btn .i { margin-right: 7px; margin-left: -2px; }
.btn.small .i { margin-right: 5px; }

/* ==========================================================================
   Layout: sidebar (admin)
   ========================================================================== */
.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    background: linear-gradient(180deg, #131a3d 0%, var(--sidebar) 100%);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    padding: 18px 14px;
    z-index: 40;
    overflow-y: auto;
}

.brand { display: flex; align-items: center; gap: 10px; font-weight: 750; font-size: 18px; letter-spacing: -.01em; color: #fff; }
.logo {
    display: inline-grid; place-items: center;
    width: 34px; height: 34px; border-radius: 10px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6 55%, #ec4899);
    color: #fff; box-shadow: 0 4px 12px rgba(99, 102, 241, .45);
}
.logo .i { width: 18px; height: 18px; vertical-align: 0; }

.sidebar .brand { padding: 4px 8px 22px; }
.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar nav a {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 12px; border-radius: 10px;
    color: var(--sidebar-text); font-weight: 550; font-size: 14.5px;
    transition: background .15s, color .15s;
}
.sidebar nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; text-decoration: none; }
.sidebar nav a.active { background: rgba(99, 102, 241, .22); color: #fff; box-shadow: inset 3px 0 0 #818cf8; }
.sidebar nav a .i { width: 19px; height: 19px; vertical-align: 0; }
.sidebar nav .count, .mobile-replies .count {
    margin-left: auto; min-width: 22px; padding: 1px 7px; text-align: center;
    background: #ef4444; color: #fff; border-radius: 999px; font-size: 12px; font-weight: 700;
}
.side-foot { margin: auto 0 0; padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, .08); }
.side-foot button {
    display: flex; align-items: center; gap: 12px; width: 100%;
    background: none; border: 0; cursor: pointer; font: inherit; font-weight: 550; font-size: 14.5px;
    color: var(--sidebar-text); padding: 11px 12px; border-radius: 10px;
}
.side-foot button:hover { background: rgba(255, 255, 255, .07); color: #fff; }

.main { margin-left: var(--sidebar-w); min-height: 100vh; }
.mobilebar { display: none; }
.scrim { display: none; }

.container { max-width: 1180px; margin: 0 auto; padding: 30px 32px 56px; }

/* ---- phones and small tablets: the sidebar becomes a slide-out menu ---- */
@media (max-width: 960px) {
    .sidebar { transform: translateX(-105%); transition: transform .22s ease, box-shadow .22s ease; }
    .nav-toggle:checked ~ .app .sidebar { transform: none; box-shadow: 8px 0 30px rgba(0, 0, 0, .3); }
    .nav-toggle:checked ~ .app .scrim { display: block; position: fixed; inset: 0; background: rgba(15, 21, 48, .55); z-index: 35; }
    .main { margin-left: 0; }
    .mobilebar {
        display: flex; align-items: center; gap: 12px;
        position: sticky; top: 0; z-index: 30;
        background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px);
        border-bottom: 1px solid var(--border); padding: 10px 16px;
    }
    .mobilebar .brand { color: var(--text); font-size: 17px; }
    .menu-btn { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border); background: #fff; cursor: pointer; color: var(--text); }
    .menu-btn .i { width: 22px; height: 22px; vertical-align: 0; }
    .mobile-replies { margin-left: auto; position: relative; color: var(--text); display: grid; place-items: center; width: 40px; height: 40px; }
    .mobile-replies .count { position: absolute; top: 0; right: -2px; margin: 0; }
    .container { padding: 20px 16px 48px; }
}

/* ==========================================================================
   Public pages (home, privacy, terms, login, unsubscribe)
   ========================================================================== */
.pubbar {
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
    padding: 12px 24px; background: #fff; border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 20;
}
.pubbar .brand { color: var(--text); }
.pubbar .brand a { color: inherit; display: flex; align-items: center; gap: 10px; text-decoration: none; }
.pubnav { margin-left: auto; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pubnav a { padding: 8px 12px; border-radius: 10px; color: var(--muted); font-weight: 550; font-size: 14px; }
.pubnav a:hover, .pubnav a.active { background: var(--neutral-soft); color: var(--text); text-decoration: none; }
.pubnav a.signin { background: var(--primary); color: #fff; display: inline-flex; align-items: center; gap: 7px; }
.pubnav a.signin:hover { background: var(--primary-dark); }
.is-public .container { max-width: 1040px; }

.hero {
    padding: 52px 24px 44px; text-align: center; margin: 4px 0 26px;
    border-radius: 22px; color: #fff;
    background: radial-gradient(1200px 400px at 85% -10%, rgba(236, 72, 153, .45), transparent 60%), linear-gradient(135deg, #3730a3, #4f46e5 45%, #7c3aed);
    box-shadow: 0 18px 40px rgba(79, 70, 229, .28);
}
.hero h1 { font-size: clamp(26px, 4.4vw, 40px); line-height: 1.15; margin: 0 auto 14px; max-width: 800px; color: #fff; letter-spacing: -.02em; }
.hero .lead { font-size: clamp(15px, 2vw, 18px); color: rgba(255, 255, 255, .88); max-width: 740px; margin: 0 auto 24px; line-height: 1.6; }
.hero .btn { background: #fff; color: var(--primary-dark); font-weight: 700; padding: 12px 22px; }
.hero .btn:hover { background: #f1f1ff; }

.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; margin-bottom: 20px; }
.grid3 .card { margin-bottom: 0; }
.grid3 h2 { font-size: 16px; display: flex; align-items: center; gap: 10px; }
.grid3 p { margin: 0; color: var(--muted); line-height: 1.6; font-size: 14px; }
.feature-ic { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: var(--primary-soft); color: var(--primary); flex: none; }
.feature-ic .i { width: 19px; height: 19px; vertical-align: 0; }

.doc { max-width: 780px; margin: 0 auto; line-height: 1.7; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px 32px; box-shadow: var(--shadow); }
.doc h1 { margin-bottom: 4px; }
.doc h2 { margin-top: 26px; }
.doc ul { padding-left: 20px; }
.doc .updated { color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.site-footer { text-align: center; color: var(--muted); font-size: 13px; padding: 28px 0 8px; }
.site-footer a { color: var(--muted); }
#sign-in { scroll-margin-top: 80px; }
@media (max-width: 640px) {
    .pubbar { padding: 10px 14px; }
    .hero { padding: 36px 18px 32px; border-radius: 18px; }
    .doc { padding: 20px 18px; }
}

/* ==========================================================================
   Cards, headings
   ========================================================================== */
h1 { font-size: 26px; line-height: 1.2; margin: 0 0 20px; letter-spacing: -.02em; }
h2 { font-size: 17px; margin: 0 0 14px; letter-spacing: -.01em; }
h3 { font-size: 15px; margin: 0 0 8px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin: 0; }
.page-sub { margin: 6px 0 0; color: var(--muted); font-size: 14px; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}
.card > h2 { display: flex; align-items: center; gap: 9px; }
.card > h2 .i { color: var(--primary); }
@media (max-width: 640px) { .card { padding: 16px; border-radius: 12px; } h1 { font-size: 22px; } }

.muted { color: var(--muted); font-size: 13.5px; }
p { margin: 0 0 12px; }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--primary); color: #fff;
    border: 1px solid transparent;
    padding: 9px 16px; border-radius: 10px;
    font: inherit; font-size: 14px; font-weight: 600; line-height: 1.3;
    cursor: pointer; text-decoration: none; white-space: nowrap;
    box-shadow: 0 1px 2px rgba(23, 32, 51, .12);
    transition: background .15s, box-shadow .15s, transform .05s, border-color .15s;
}
.btn:hover { background: var(--primary-dark); text-decoration: none; color: #fff; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border); box-shadow: 0 1px 2px rgba(23, 32, 51, .05); }
.btn.secondary:hover { background: var(--surface-2); border-color: #cfd6e6; color: var(--text); }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #b91c1c; }
.btn.success { background: var(--success); }
.btn.success:hover { background: #047857; }
.btn.small { padding: 6px 11px; font-size: 12.5px; border-radius: 9px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn[disabled]:hover { background: var(--primary); }
.btn.secondary[disabled]:hover { background: var(--surface); }
.btn.danger[disabled]:hover { background: var(--danger); }

.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; display: inline-flex; }

/* ==========================================================================
   Forms
   ========================================================================== */
input[type=text], input[type=email], input[type=number], input[type=password], input[type=file], input[type=date], input[type=time], select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font: inherit; font-size: 14.5px;
    background: #fff; color: var(--text);
    transition: border-color .15s, box-shadow .15s;
}
textarea { line-height: 1.5; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
input[type=file] { padding: 8px; background: var(--surface-2); }
input[type=checkbox], input[type=radio] { accent-color: var(--primary); width: 16px; height: 16px; vertical-align: -3px; margin-right: 4px; }
::placeholder { color: #9aa5ba; }

label { font-size: 13px; font-weight: 600; color: #46526b; display: block; margin-bottom: 5px; }
.field { margin-bottom: 16px; }
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row .field { flex: 1 1 200px; min-width: 0; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form input { min-width: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    display: inline-flex !important; align-items: center; gap: 6px; margin: 0 !important;
    padding: 7px 13px; border: 1px solid var(--border); border-radius: 999px;
    font-weight: 550 !important; color: var(--text) !important; background: #fff; cursor: pointer;
    transition: background .15s, border-color .15s;
}
.chip:hover { border-color: #c7cdf5; }
.chip:has(input:checked) { background: var(--primary-soft); border-color: #b7bcf5; color: var(--primary-dark) !important; }
.chip input { margin: 0; }

/* ==========================================================================
   Badges and messages
   ========================================================================== */
.badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 2px 10px; border-radius: 999px;
    font-size: 12px; font-weight: 650; line-height: 1.6; white-space: nowrap;
    background: var(--neutral-soft); color: var(--muted);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.active, .badge.sent, .badge.running { background: var(--success-soft); color: var(--success); }
.badge.draft, .badge.pending { background: var(--warn-soft); color: var(--warn); }
.badge.failed, .badge.bounced, .badge.disconnected, .badge.unsubscribed { background: var(--danger-soft); color: var(--danger); }
.badge.completed, .badge.paused, .badge.skipped { background: var(--neutral-soft); color: var(--muted); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.failed:empty::before { display: none; }

.flash {
    display: flex; gap: 11px; align-items: flex-start;
    padding: 13px 16px; border-radius: 12px; margin-bottom: 18px; font-size: 14.5px;
    border: 1px solid transparent;
}
.flash .i { width: 20px; height: 20px; margin-top: 1px; }
.flash.success { background: var(--success-soft); color: #065f46; border-color: #a7ebd0; }
.flash.error { background: var(--danger-soft); color: #991b1b; border-color: #fbc3bf; }

.empty { text-align: center; color: var(--muted); padding: 28px 12px; }
.empty .i { width: 34px; height: 34px; color: #b6bfd3; margin-bottom: 8px; }

/* ==========================================================================
   Stat tiles
   ========================================================================== */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat {
    position: relative;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 16px 16px 14px; box-shadow: var(--shadow);
    display: block; color: inherit;
}
a.stat { transition: transform .15s, box-shadow .15s; }
a.stat:hover { transform: translateY(-2px); text-decoration: none; box-shadow: 0 10px 26px rgba(23, 32, 51, .1); }
.stat .ic { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; margin-bottom: 10px; background: var(--primary-soft); color: var(--primary); }
.stat .ic .i { width: 18px; height: 18px; vertical-align: 0; }
.stat .ic.green { background: var(--success-soft); color: var(--success); }
.stat .ic.amber { background: var(--warn-soft); color: var(--warn); }
.stat .ic.red { background: var(--danger-soft); color: var(--danger); }
.stat .ic.blue { background: var(--info-soft); color: var(--info); }
.stat .ic.violet { background: #f1e8ff; color: #7c3aed; }
.stat .num { font-size: 28px; font-weight: 750; line-height: 1.1; letter-spacing: -.02em; }
.stat .label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-top: 3px; font-weight: 600; }

/* ==========================================================================
   Tables: scroll inside their card, never the page. Long ones turn into cards on phones.
   ========================================================================== */
.table-wrap { overflow-x: auto; margin: 0 -2px; border-radius: 10px; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--muted); font-weight: 650; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; background: var(--surface-2); white-space: nowrap; }
th:first-child { border-top-left-radius: 10px; }
th:last-child { border-top-right-radius: 10px; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td, table tr:hover > td { background: #fafbff; }
td .actions { flex-wrap: wrap; }

@media (max-width: 900px) {
    table.stack, table.stack tbody { display: block; }
    table.stack tr:first-child { display: none; }
    table.stack tr { display: block; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 12px; padding: 6px 4px; background: #fff; }
    table.stack td { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; border: 0; padding: 7px 12px; text-align: right; background: transparent !important; }
    table.stack td::before { content: attr(data-label); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; font-weight: 650; color: var(--muted); text-align: left; flex: none; max-width: 42%; padding-top: 2px; }
    table.stack td[data-label=""]::before { display: none; }
    table.stack td > * { max-width: 100%; }
    table.stack td .actions { justify-content: flex-end; }
    .table-wrap:has(table.stack) { overflow: visible; }
}

/* ==========================================================================
   Page-specific pieces
   ========================================================================== */
.step-card { border: 1px solid var(--border); border-left: 4px solid var(--primary); border-radius: 12px; padding: 16px; margin-bottom: 14px; background: var(--surface-2); }
.step-card details { margin-top: 10px; }
summary { cursor: pointer; font-weight: 600; color: var(--text); padding: 4px 0; }
summary.muted { font-weight: 550; }
details[open] > summary { margin-bottom: 8px; }

/* senders */
.sender-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 430px), 1fr)); gap: 18px; }
.sender-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; }
.sender-card.off { opacity: .8; }
.sender-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px; background: linear-gradient(135deg, #f5f6ff, #fff 70%); border-bottom: 1px solid var(--border); }
.avatar { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff; font-weight: 700; font-size: 17px; flex: none; text-transform: uppercase; }
.sender-title { min-width: 0; flex: 1; }
.sender-title strong { display: block; font-size: 15px; overflow-wrap: anywhere; }
.sender-title .muted { display: block; margin-top: 1px; }
.sender-body { padding: 4px 18px 8px; display: grid; gap: 0; }
.kv { padding: 14px 0; border-bottom: 1px dashed var(--border); }
.kv:last-child { border-bottom: 0; }
.kv-label { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 8px; }
.kv-label .i { color: var(--primary); width: 15px; height: 15px; }
.sender-foot { padding: 14px 18px; border-top: 1px solid var(--border); background: var(--surface-2); display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: auto; }
.mini-stats { display: flex; gap: 18px; flex-wrap: wrap; }
.mini-stats div strong { display: block; font-size: 20px; line-height: 1.1; }
.mini-stats div span { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.warn-box { display: flex; gap: 9px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: var(--danger-soft); color: #991b1b; font-size: 13px; margin-top: 8px; }
.warn-box .i { margin-top: 2px; }

/* review drafts */
.draft-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.draft-card textarea { line-height: 1.5; }
.draft-card .facts { font-size: 13px; line-height: 1.5; margin: 6px 0; white-space: normal; }
.draft-card .facts a { word-break: break-all; }

/* replies */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.row-attn td { background: #fffbea !important; }
.snippet { max-width: 420px; overflow-wrap: anywhere; }

@media (max-width: 640px) {
    .btn { padding: 10px 14px; }
    .btn.small { padding: 8px 12px; }
    .actions .btn { flex: 1 1 auto; }
    .sender-grid { grid-template-columns: 1fr; }
    .stat .num { font-size: 24px; }
}

/* campaigns list */
.camp-list { display: grid; gap: 14px; }
.camp-card { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 16px 18px; border: 1px solid var(--border); border-radius: 12px; background: #fff; transition: border-color .15s, box-shadow .15s; }
.camp-card:hover { border-color: #cdd3f3; box-shadow: 0 6px 18px rgba(79, 70, 229, .08); }
.camp-main { min-width: 260px; flex: 1 1 320px; }
.camp-name { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.camp-name a { color: var(--text); }
.camp-name a:hover { color: var(--primary); text-decoration: none; }
.camp-meta { display: flex; gap: 8px 18px; flex-wrap: wrap; color: var(--muted); font-size: 13px; margin-top: 8px; }
.camp-meta span { display: inline-flex; gap: 6px; align-items: center; }
.camp-meta .i { color: #94a0ba; }
.camp-wait { display: flex; gap: 8px; align-items: flex-start; margin-top: 10px; padding: 8px 12px; border-radius: 10px; background: var(--warn-soft); color: #7c4a03; font-size: 13px; }
.camp-wait .i { margin-top: 2px; }
@media (max-width: 640px) { .camp-card { padding: 14px; } .camp-main { min-width: 0; flex-basis: 100%; } }

/* filter bars and pagers (report, replies) */
.filter-bar { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; padding: 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; }
.filter-bar .field { margin: 0; flex: 1 1 200px; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin: 16px 0 6px; flex-wrap: wrap; }

/* mailbox list (replies page) */
.mailbox-list { display: grid; gap: 10px; }
.mailbox-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.mailbox-main { min-width: 220px; flex: 1 1 260px; }

/* sign-in and unsubscribe cards */
.auth-card { max-width: 400px; margin: 48px auto; padding: 30px 28px; }
.auth-card h1 { text-align: center; font-size: 22px; margin-bottom: 18px; }
.auth-logo { display: flex; justify-content: center; margin-bottom: 14px; }
.auth-logo .logo { width: 50px; height: 50px; border-radius: 14px; }
.auth-logo .logo .i { width: 26px; height: 26px; }

/* ---- Senders: list + settings popup ---- */
.sender-table td { vertical-align: middle; }
.who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.who strong { overflow-wrap: anywhere; }
.avatar.sm { width: 34px; height: 34px; border-radius: 10px; font-size: 14px; }
tr.row-off td { opacity: .72; }
tr.row-off td:last-child { opacity: 1; }
.usage { min-width: 120px; }
.usage .meter { height: 6px; border-radius: 99px; background: var(--border); margin-top: 5px; overflow: hidden; }
.usage .meter > div { height: 100%; background: linear-gradient(90deg, #6366f1, #8b5cf6); border-radius: 99px; }
@media (max-width: 900px) { .usage { min-width: 0; width: 150px; text-align: right; } }

dialog.modal { border: 0; padding: 0; border-radius: 16px; width: min(580px, calc(100vw - 24px)); max-height: calc(100vh - 32px); background: var(--surface); color: var(--text, inherit); box-shadow: 0 24px 60px rgba(15, 23, 42, .35); overflow: hidden; }
dialog.modal[open] { display: flex; flex-direction: column; }
dialog.modal::backdrop { background: rgba(15, 23, 42, .55); }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px; background: linear-gradient(135deg, #f5f6ff, #fff 70%); border-bottom: 1px solid var(--border); flex: none; }
.modal-head .sender-title strong { display: block; font-size: 15px; overflow-wrap: anywhere; }
.modal-head .sender-title .muted { display: block; margin-top: 1px; font-size: 12.5px; }
.modal-body { padding: 4px 20px 10px; overflow-y: auto; flex: 1 1 auto; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); display: flex; justify-content: space-between; gap: 10px; align-items: center; flex: none; }
.modal-foot form { margin: 0; }
.icon-btn { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--surface-2); color: inherit; }
.modal-body .inline-form { flex-wrap: wrap; }
.modal-body .inline-form input[type=text] { flex: 1 1 220px; }

/* ---- Replies: collapsible mailbox list ---- */
details.fold { padding: 0; }
details.fold > summary { list-style: none; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 15px 18px; cursor: pointer; border-radius: var(--radius); user-select: none; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary:hover { background: var(--surface-2); }
.fold-title { display: inline-flex; align-items: center; gap: 8px; font-weight: 650; font-size: 15px; flex: 1 1 auto; }
.fold-badges { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.fold-arrow { width: 9px; height: 9px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .15s; margin: 0 4px 3px 2px; flex: none; }
details.fold[open] > summary .fold-arrow { transform: rotate(-135deg); margin-bottom: -3px; }
details.fold[open] > summary { border-bottom: 1px solid var(--border); border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.fold-body { padding: 14px 18px 18px; }
.sender-table td:first-child { min-width: 230px; }
.sender-table .who strong { overflow-wrap: break-word; word-break: normal; }
.sender-table td, .sender-table th { padding-left: 12px; padding-right: 12px; }
.sender-table td:last-child .actions { justify-content: flex-end; flex-wrap: nowrap; }
.sender-table td:last-child .btn { white-space: nowrap; }

/* The list sits next to the sidebar, so it adapts to ITS OWN width (container query), not to the screen width. */
.sl { container: sl / inline-size; }
@container sl (min-width: 701px) and (max-width: 900px) { .sender-table .col-camp { display: none; } }
@container sl (max-width: 700px) {
    .sender-table, .sender-table tbody { display: block; }
    .sender-table tr:first-child { display: none; }
    .sender-table tr { display: flex; flex-wrap: wrap; align-items: center; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 12px; padding: 6px 4px; background: #fff; }
    .sender-table td { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; border: 0; padding: 7px 12px; text-align: left; background: transparent !important; min-width: 0; flex: none; }
    .sender-table td::before { content: attr(data-label); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; font-weight: 650; color: var(--muted); }
    .sender-table td[data-label="Mailbox"] { flex: 1 1 100%; }
    .sender-table td[data-label="Mailbox"]::before, .sender-table td[data-label=""]::before { display: none; }
    .sender-table td[data-label=""] { margin-left: auto; }
    .sender-table .usage { width: 120px; min-width: 0; }
    .sl .table-wrap { overflow: visible; }
}

/* ---- Campaign page: tabs inside each step ---- */
.step-tabs { display: flex; gap: 2px; flex-wrap: wrap; margin-top: 14px; border-bottom: 1px solid var(--border); }
.step-tab { display: inline-flex; align-items: center; gap: 7px; background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; padding: 9px 14px; font: inherit; font-weight: 600; font-size: 13.5px; color: var(--muted); cursor: pointer; border-radius: 8px 8px 0 0; }
.step-tab .i { width: 15px; height: 15px; }
.step-tab:hover { color: var(--text); background: var(--surface-2); }
.step-tab[aria-selected="true"] { color: var(--primary); border-bottom-color: var(--primary); background: transparent; }
.step-tab:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.step-panel { padding: 14px 2px 4px; }
.step-panel[hidden] { display: none; }
.step-foot { display: flex; justify-content: flex-end; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--border); }
.step-foot form { margin: 0; }
@media (max-width: 520px) { .step-tab { padding: 9px 10px; font-size: 13px; } }
