/* ══════════════════════════════════════════════════════════
   Email Sender Pro V2 — style.css
   Font: Plus Jakarta Sans + DM Mono
   ══════════════════════════════════════════════════════════ */

/* ── TOKENS ─────────────────────────────────────────────── */
:root {
    --red:         #e03131;
    --red-dk:      #c92a2a;
    --red-lt:      #fff5f5;
    --red-muted:   #fcc2c2;
    --green:       #2f9e44;
    --green-lt:    #ebfbee;
    --green-badge: #40c057;
    --blue:        #1971c2;
    --blue-lt:     #e7f5ff;
    --amber:       #f59f00;
    --amber-lt:    #fff9db;
    --gray-50:     #f8f9fa;
    --gray-100:    #f1f3f5;
    --gray-200:    #e9ecef;
    --gray-300:    #dee2e6;
    --gray-400:    #ced4da;
    --gray-500:    #adb5bd;
    --gray-600:    #868e96;
    --gray-700:    #495057;
    --gray-800:    #343a40;
    --gray-900:    #212529;
    --white:       #ffffff;
    --nav-h:       58px;

    /* Light theme */
    --bg:          #f0f2f5;
    --surface:     #ffffff;
    --surface-alt: #f8f9fa;
    --border:      #e9ecef;
    --text:        #212529;
    --text-sub:    #868e96;
    --text-muted:  #adb5bd;
    --sidebar-bg:  #ffffff;
    --sidebar-border: #e9ecef;
    --nav-bg:      #1a1d23;
    --nav-text:    #ffffff;
    --shadow-sm:   0 1px 3px rgba(0,0,0,.08);
    --shadow-md:   0 4px 16px rgba(0,0,0,.10);
    --shadow-lg:   0 8px 32px rgba(0,0,0,.12);
    --radius:      10px;
    --radius-sm:   6px;
    --radius-lg:   14px;
}

[data-theme="dark"] {
    --bg:          #0f1117;
    --surface:     #1a1d24;
    --surface-alt: #22262f;
    --border:      #2d3039;
    --text:        #e9ecef;
    --text-sub:    #868e96;
    --text-muted:  #495057;
    --sidebar-bg:  #1a1d24;
    --sidebar-border: #2d3039;
    --nav-bg:      #0d0f13;
    --nav-text:    #e9ecef;
    --shadow-sm:   0 1px 3px rgba(0,0,0,.3);
    --shadow-md:   0 4px 16px rgba(0,0,0,.4);
    --shadow-lg:   0 8px 32px rgba(0,0,0,.5);
    --red-lt:      #2c1516;
    --green-lt:    #162320;
    --blue-lt:     #0f1f35;
    --amber-lt:    #2a2210;
}

/* ── RESET ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ── PAGE SYSTEM ─────────────────────────────────────────── */
.page { display: none; }
.page.active { display: block; }

/* ── TOP NAV ─────────────────────────────────────────────── */
.top-nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--nav-h);
    background: var(--nav-bg);
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.nav-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}
.brand-icon {
    width: 36px; height: 36px;
    background: var(--red);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    font-size: 16px;
}
.brand-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--nav-text);
    letter-spacing: -0.3px;
}
.brand-pro {
    color: var(--red);
}
.nav-right { display: flex; align-items: center; gap: 10px; }
.theme-toggle {
    width: 36px; height: 36px;
    border: 1px solid rgba(255,255,255,.15);
    border-radius: 8px;
    background: rgba(255,255,255,.07);
    color: var(--nav-text);
    font-size: 15px;
    display: flex; align-items: center; justify-content: center;
    transition: background .2s;
}
.theme-toggle:hover { background: rgba(255,255,255,.14); }

/* ── HOME PAGE ───────────────────────────────────────────── */
.home-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: calc(var(--nav-h) + 32px) 24px 48px;
}
.home-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}
.home-title {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text);
}
.home-subtitle {
    font-size: 14px;
    color: var(--text-sub);
    margin-top: 2px;
}

/* ── CARD ────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.form-card { overflow: visible; }
.card-header {
    padding: 14px 20px;
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--text-sub);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
}
.card-body { padding: 20px; }

/* ── TABLE ───────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.data-table th {
    text-align: left;
    padding: 12px 16px;
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--text-sub);
    background: var(--surface-alt);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.data-table td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr {
    transition: background .15s;
}
.data-table tbody tr:hover { background: var(--surface-alt); }
.empty-row {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 20px !important;
    font-size: 14px;
    line-height: 2;
}
.sortable { cursor: pointer; user-select: none; }
.sortable:hover { color: var(--text); }

/* ── BUTTONS ─────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    border: none;
    transition: all .18s;
    white-space: nowrap;
}
.btn-primary   { background: var(--red); color: #fff; }
.btn-primary:hover   { background: var(--red-dk); }
.btn-secondary { background: var(--surface-alt); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-danger    { background: var(--red); color: #fff; }
.btn-danger:hover    { background: var(--red-dk); }
.btn-ghost     { background: transparent; color: var(--text-sub); border: 1px solid var(--border); }
.btn-ghost:hover     { background: var(--surface-alt); color: var(--text); }
.btn-sm  { padding: 6px 14px; font-size: 13px; }
.btn-xl  { padding: 14px 20px; font-size: 16px; width: 100%; justify-content: center; border-radius: var(--radius); }
.btn-full { width: 100%; justify-content: center; }
.icon-btn {
    width: 30px; height: 30px;
    border: none;
    background: transparent;
    color: var(--text-sub);
    border-radius: 6px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 13px;
    transition: all .15s;
}
.icon-btn:hover { background: var(--surface-alt); color: var(--text); }
.icon-btn.red:hover { background: var(--red-lt); color: var(--red); }
.icon-only { padding: 6px 9px; }

/* ── QUICK LINK ICONS ────────────────────────────────────── */
.quick-links { display: flex; align-items: center; gap: 4px; }
.ql-btn {
    position: relative;
    width: 32px; height: 32px;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-sub);
    font-size: 14px;
    cursor: pointer;
    transition: all .15s;
}
.ql-btn:hover { background: var(--surface-alt); color: var(--red); border-color: var(--red-muted); }
.ql-tooltip {
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--gray-800);
    color: #fff;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity .15s;
    z-index: 10;
}
.ql-btn:hover .ql-tooltip { opacity: 1; }

/* ── BADGES ──────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.badge-green { background: var(--green-lt); color: var(--green); }
.badge-red   { background: var(--red-lt); color: var(--red); }
.badge-blue  { background: var(--blue-lt); color: var(--blue); }
.badge-amber { background: var(--amber-lt); color: var(--amber); }
.badge-gray  { background: var(--gray-100); color: var(--gray-600); }

/* ── SECONDARY LAYOUT ────────────────────────────────────── */
.secondary-layout {
    display: flex;
    min-height: 100vh;
    padding-top: var(--nav-h);
}
.sidebar {
    width: 224px;
    flex-shrink: 0;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    position: fixed;
    top: var(--nav-h);
    bottom: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
.sidebar-profile {
    padding: 20px 18px;
    border-bottom: 1px solid var(--border);
}
.sidebar-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--red);
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 10px;
}
.sidebar-email {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    word-break: break-all;
    line-height: 1.4;
}
.sidebar-nav { padding: 10px 8px; flex: 1; }
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-sub);
    cursor: pointer;
    transition: all .15s;
    margin-bottom: 2px;
    user-select: none;
}
.sidebar-link:hover { background: var(--surface-alt); color: var(--text); }
.sidebar-link.active { background: var(--red-lt); color: var(--red); font-weight: 700; }
.sidebar-link i { width: 18px; text-align: center; font-size: 15px; }
.main-panel {
    margin-left: 224px;
    flex: 1;
    padding: 32px 36px 60px;
    min-width: 0;
}

/* ── SUBPAGES ────────────────────────────────────────────── */
.subpage { display: none; }
.subpage.active { display: block; }
.subpage-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 12px;
    flex-wrap: wrap;
}
.subpage-title {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.4px;
    color: var(--text);
}
.subpage-sub {
    font-size: 13px;
    color: var(--text-sub);
    margin-top: 3px;
}
.profile-label-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}
.profile-label {
    font-size: 13px;
    color: var(--text-sub);
    font-weight: 500;
}

/* ── FORMS ───────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group:last-child { margin-bottom: 0; }
.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}
.label-hint { font-weight: 400; color: var(--text-sub); }
.required { color: var(--red); }
.form-input, .form-select {
    width: 100%;
    padding: 9px 13px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-size: 14px;
    transition: border-color .15s, box-shadow .15s;
    outline: none;
}
.form-input:focus, .form-select:focus {
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(224,49,49,.1);
}
.form-textarea {
    width: 100%;
    padding: 10px 13px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-size: 14px;
    resize: vertical;
    outline: none;
    transition: border-color .15s;
    line-height: 1.6;
}
.form-textarea.mono { font-family: 'DM Mono', monospace; font-size: 13px; }
.form-textarea:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(224,49,49,.1); }
.field-hint { font-size: 12px; color: var(--text-sub); margin-top: 5px; }
.password-wrap { position: relative; }
.pw-toggle {
    position: absolute;
    right: 10px; top: 50%;
    transform: translateY(-50%);
    border: none;
    background: none;
    color: var(--text-sub);
    font-size: 14px;
    padding: 4px;
}
.pw-toggle:hover { color: var(--text); }

/* ── CAMPAIGN GRID ───────────────────────────────────────── */
.campaign-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}
.campaign-col { display: flex; flex-direction: column; gap: 20px; }
.delay-row { display: flex; gap: 12px; }
.delay-row .half { flex: 1; margin-bottom: 0; }

/* ── UPLOAD ZONE ─────────────────────────────────────────── */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 32px 20px;
    text-align: center;
    cursor: pointer;
    transition: all .2s;
}
.upload-zone:hover { border-color: var(--red); background: var(--red-lt); }
.upload-icon { font-size: 28px; color: var(--text-muted); margin-bottom: 10px; }
.upload-text { font-size: 14px; font-weight: 500; color: var(--text); }
.upload-link { color: var(--red); font-weight: 700; }
.upload-hint { font-size: 12px; color: var(--text-sub); margin-top: 4px; }
.csv-info { margin-top: 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.csv-row { display: flex; padding: 8px 12px; border-bottom: 1px solid var(--border); font-size: 13px; }
.csv-row:last-child { border-bottom: none; }
.csv-key { font-weight: 600; color: var(--text-sub); min-width: 90px; }
.csv-val { color: var(--text); }
.csv-val.mono { font-family: 'DM Mono', monospace; font-size: 12px; }

/* ── TEMPLATE TABS ───────────────────────────────────────── */
.template-row { display: flex; align-items: flex-end; gap: 8px; margin-bottom: 12px; }
.template-row .form-group { margin-bottom: 0; }
.tab-bar {
    display: flex;
    gap: 4px;
    background: var(--surface-alt);
    padding: 4px;
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
}
.tab-btn {
    flex: 1;
    padding: 6px 12px;
    border: none;
    background: none;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-sub);
    transition: all .15s;
}
.tab-btn.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.tab-content { display: none; }
.tab-content.active { display: block; }
.save-template-row { display: flex; gap: 8px; margin-top: 12px; }
.save-template-row input { flex: 1; }

/* ── PROGRESS CARD ───────────────────────────────────────── */
.progress-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}
.pstat {
    background: var(--surface-alt);
    border-radius: var(--radius-sm);
    padding: 12px;
    text-align: center;
    border: 1px solid var(--border);
}
.pstat-val { font-size: 22px; font-weight: 800; color: var(--text); }
.pstat-val.green { color: var(--green); }
.pstat-val.red   { color: var(--red); }
.pstat-lbl { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; color: var(--text-sub); margin-top: 2px; }
.progress-bar-wrap { background: var(--surface-alt); border-radius: 20px; height: 10px; overflow: hidden; margin-bottom: 6px; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--red) 0%, #ff6b6b 100%); border-radius: 20px; transition: width .3s ease; }
.progress-pct { font-size: 13px; font-weight: 700; color: var(--text-sub); margin-bottom: 4px; }
.progress-status { font-size: 13px; color: var(--text-sub); margin-bottom: 14px; }
.progress-actions { display: flex; gap: 8px; }

/* ── CAMPAIGN REPORT ─────────────────────────────────────── */
.report-hero {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px 32px;
    margin-bottom: 20px;
}
.report-title { font-size: 22px; font-weight: 800; letter-spacing: -0.4px; color: var(--text); margin-bottom: 6px; }
.report-meta { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 12px; }
.report-meta-item { font-size: 13px; color: var(--text-sub); display: flex; align-items: center; gap: 6px; }
.report-meta-item strong { color: var(--text); }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}
.stat-tile {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
}
.stat-tile .stat-val { font-size: 28px; font-weight: 800; color: var(--text); }
.stat-tile .stat-lbl { font-size: 12px; font-weight: 600; color: var(--text-sub); margin-top: 4px; text-transform: uppercase; letter-spacing: .5px; }
.stat-tile.highlight     { border-color: var(--green); background: var(--green-lt); }
.stat-tile.highlight .stat-val { color: var(--green); }
.stat-tile.highlight-red       { border-color: var(--red); background: var(--red-lt); }
.stat-tile.highlight-red .stat-val { color: var(--red); }

.charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}
.chart-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; }
.chart-title { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 18px; }
.chart-wrap { position: relative; height: 200px; }

.report-tables { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.report-table-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.report-table-title { padding: 14px 18px; font-size: 13px; font-weight: 700; border-bottom: 1px solid var(--border); color: var(--text-sub); text-transform: uppercase; letter-spacing: .6px; }
.mini-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mini-table td { padding: 9px 18px; border-bottom: 1px solid var(--border); }
.mini-table tr:last-child td { border-bottom: none; }
.mini-table .em-name { font-weight: 600; color: var(--text); }
.mini-table .em-addr { color: var(--text-sub); font-size: 12px; }
.mini-table .em-time { color: var(--text-muted); font-size: 12px; white-space: nowrap; }

/* ── MODALS ──────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s;
    backdrop-filter: blur(3px);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
    background: var(--surface);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    transform: translateY(16px);
    transition: transform .2s;
    border: 1px solid var(--border);
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-sm { max-width: 380px; }
.modal-header {
    padding: 20px 24px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 16px; font-weight: 800; color: var(--text); }
.modal-close {
    width: 28px; height: 28px;
    border: none;
    background: none;
    color: var(--text-sub);
    border-radius: 6px;
    font-size: 15px;
    display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: var(--surface-alt); color: var(--text); }
.modal-body { padding: 20px 24px; }
.modal-footer {
    padding: 14px 24px 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border-top: 1px solid var(--border);
}
.modal-warn-text { font-size: 14px; color: var(--text); line-height: 1.7; }

/* ── TOAST ───────────────────────────────────────────────── */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    box-shadow: var(--shadow-md);
    animation: toastIn .25s ease;
    min-width: 250px;
    max-width: 380px;
}
.toast.success { background: var(--green); }
.toast.error   { background: var(--red); }
.toast.info    { background: var(--blue); }
@keyframes toastIn {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: translateX(0); }
}
.toast.out {
    animation: toastOut .2s ease forwards;
}
@keyframes toastOut {
    to { opacity: 0; transform: translateX(20px); }
}

/* ── SENDS VIA CELL ──────────────────────────────────────── */
.sends-via {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-sub);
}
.sends-via i { color: var(--red); font-size: 15px; }

/* ── DONUT MINI ──────────────────────────────────────────── */
.donut-wrap { position: relative; display: inline-flex; align-items: center; justify-content: center; }
.donut-label { position: absolute; font-size: 9px; font-weight: 700; color: var(--text); }

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 900px) {
    .campaign-grid { grid-template-columns: 1fr; }
    .charts-row { grid-template-columns: 1fr; }
    .report-tables { grid-template-columns: 1fr; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 700px) {
    .sidebar { width: 100%; position: static; }
    .main-panel { margin-left: 0; padding: 20px; }
    .secondary-layout { flex-direction: column; }
}

/* ── RICH TEXT EDITOR ────────────────────────────────────── */
.rte-wrap {
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: border-color .15s;
}
.rte-wrap:focus-within {
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(224,49,49,.1);
}
.rte-toolbar {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 6px 8px;
    background: var(--surface-alt);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.rte-btn {
    min-width: 30px;
    height: 28px;
    padding: 0 7px;
    border: 1px solid transparent;
    background: transparent;
    border-radius: 5px;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all .15s;
}
.rte-btn:hover {
    background: var(--surface);
    border-color: var(--border);
    color: var(--red);
}
.rte-btn.active {
    background: var(--red-lt);
    border-color: var(--red-muted);
    color: var(--red);
}
.rte-sep {
    width: 1px;
    height: 20px;
    background: var(--border);
    margin: 0 4px;
}
.rte-body {
    min-height: 220px;
    max-height: 400px;
    overflow-y: auto;
    padding: 12px 14px;
    font-size: 14px;
    line-height: 1.7;
    color: var(--text);
    background: var(--surface);
    outline: none;
    white-space: pre-wrap;
    word-break: break-word;
}
.rte-body:empty::before {
    content: attr(data-placeholder);
    color: var(--text-muted);
    pointer-events: none;
}
.rte-body a {
    color: var(--red);
    text-decoration: underline;
}
.rte-body ul, .rte-body ol {
    padding-left: 22px;
    margin: 6px 0;
}

/* ── SCHEDULE TOGGLE ─────────────────────────────────────── */
.schedule-toggle-row {
    margin-top: 14px;
}
.schedule-toggle {
    display: flex;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 3px;
    gap: 3px;
}
.stog-btn {
    flex: 1;
    padding: 7px 12px;
    border: none;
    background: transparent;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-sub);
    cursor: pointer;
    transition: all .15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.stog-btn.active {
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-sm);
}
.stog-btn:not(.active):hover {
    color: var(--text);
}
.schedule-picker-row {
    display: flex;
    gap: 12px;
    margin-top: 14px;
}
.schedule-picker-row .half {
    flex: 1;
    margin-bottom: 0;
}
.schedule-info-box {
    margin-top: 10px;
    padding: 9px 13px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--blue-lt);
    color: var(--blue);
    border: 1px solid var(--border);
}
.schedule-info-box.ok {
    background: var(--green-lt);
    color: var(--green);
}
.schedule-info-box.error {
    background: var(--red-lt);
    color: var(--red);
}

/* ── PAGINATION ──────────────────────────────────────────── */
.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 16px 20px 12px;
    flex-wrap: wrap;
}
.pag-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--card);
    color: var(--text-sub);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    user-select: none;
    line-height: 1;
}
.pag-btn:hover:not(:disabled):not(.pag-active) {
    background: var(--red-lt);
    color: var(--red);
    border-color: var(--red-muted);
}
.pag-btn.pag-active {
    background: var(--red);
    color: #fff;
    border-color: var(--red);
    font-weight: 700;
    pointer-events: none;
}
.pag-btn:disabled {
    opacity: 0.35;
    cursor: default;
}
.pag-sep {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 10px;
    color: var(--text-muted);
    font-size: 13px;
    user-select: none;
}

/* ═══════════════════════════════════════════════════════════
   SMTP PROVIDER TABS
════════════════════════════════════════════════════════════ */
.smtp-provider-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 4px;
}
.smtp-tab {
    flex: 1;
    padding: 9px 12px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text-sub);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    transition: all 0.15s;
}
.smtp-tab:hover {
    border-color: var(--red-muted);
    color: var(--red);
}
.smtp-tab.active {
    background: var(--red-lt);
    border-color: var(--red);
    color: var(--red);
    font-weight: 600;
}
.smtp-section-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin: 14px 0 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.smtp-row {
    display: flex;
    gap: 12px;
}
.smtp-row .form-group {
    margin-bottom: 14px;
}

/* ═══════════════════════════════════════════════════════════
   API KEYS PAGE
════════════════════════════════════════════════════════════ */
.api-endpoint-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.api-ep {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}
.api-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    min-width: 42px;
    text-align: center;
}
.api-badge.post {
    background: #fff3e0;
    color: #e65100;
}
.api-badge.get {
    background: #e8f5e9;
    color: #2e7d32;
}
[data-theme="dark"] .api-badge.post { background: #3e2000; color: #ffb74d; }
[data-theme="dark"] .api-badge.get  { background: #002200; color: #66bb6a; }
.api-desc {
    color: var(--text-sub);
}
.inline-code {
    background: var(--surface-alt, var(--hover));
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 6px;
    font-family: 'DM Mono', monospace;
    font-size: 12px;
    color: var(--text);
}

/* API Key reveal box (shown after generation) */
.api-key-reveal-box {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: 16px;
}
.api-key-reveal-warning {
    font-size: 13px;
    color: var(--amber, #f59e0b);
    margin-bottom: 12px;
    display: flex;
    align-items: flex-start;
    gap: 6px;
}
.api-key-reveal-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.api-key-reveal-code {
    flex: 1;
    background: var(--hover);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 10px;
    font-family: 'DM Mono', monospace;
    font-size: 12px;
    word-break: break-all;
    color: var(--text);
}
