:root {
    --bg-page:      #eef2f7;
    --bg-card:      #ffffff;
    --bg-input:     #f0f4f8;
    --text-main:    #1a2435;
    --text-muted:   #6b7a8d;
    --text-label:   #0087a9;
    --brand:        #0087a9;
    --brand-dark:   #006d88;
    --orange:       #f47c1f;
    --orange-dark:  #d96a10;
    --border:       #e2e9f0;
    --shadow-card:  0 2px 16px rgba(0, 0, 0, 0.07);
    --shadow-nav:   0 1px 4px rgba(0, 0, 0, 0.08);
    --radius-card:  0.875rem;
    --radius-btn:   0.5rem;
    --radius-input: 0.5rem;
}

/* ── Base ─────────────────────────────────────────── */
body {
    background: var(--bg-page);
    color: var(--text-main);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    min-height: 100vh;
}

/* ── Top Navbar ───────────────────────────────────── */
.app-navbar {
    background: var(--bg-card);
    box-shadow: var(--shadow-nav);
    height: 60px;
    display: flex;
    align-items: center;
    padding: 0 2rem;
    gap: 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}
.app-navbar .brand {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
    text-decoration: none;
    white-space: nowrap;
}
.app-navbar .brand:hover { color: var(--text-main); }

.app-nav-links {
    display: flex;
    gap: 0.25rem;
    flex: 1;
    align-items: center;
}
.app-nav-links .nav-link {
    color: var(--text-muted);
    font-size: 0.875rem;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-btn);
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}
.app-nav-links .nav-link:hover,
.app-nav-links .nav-link.active {
    color: var(--brand);
    background: rgba(0, 135, 169, 0.08);
}

.navbar-actions { display: flex; align-items: center; gap: 0.75rem; }

/* ── Page Content ─────────────────────────────────── */
.page-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* ── Cards ────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
}
.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border);
    padding: 1.1rem 1.5rem;
}
.card-body { padding: 1.5rem; }

/* ── Stat Cards ───────────────────────────────────── */
.stat-card .stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-label);
    margin-bottom: 0.4rem;
}
.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.1;
}

/* ── Section Label (small caps above headings) ────── */
.section-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-label);
    margin-bottom: 0.4rem;
}

/* ── Buttons ──────────────────────────────────────── */
.btn {
    border-radius: var(--radius-btn);
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.5rem 1.1rem;
    transition: background 0.15s, box-shadow 0.15s;
}
.btn-primary {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}
.btn-primary:hover, .btn-primary:focus {
    background: var(--brand-dark);
    border-color: var(--brand-dark);
    color: #fff;
}
.btn-action {
    background: var(--orange);
    border: none;
    color: #fff;
}
.btn-action:hover, .btn-action:focus {
    background: var(--orange-dark);
    color: #fff;
}
.btn-outline-secondary {
    border-color: var(--border);
    color: var(--text-muted);
}
.btn-outline-secondary:hover {
    background: var(--bg-input);
    color: var(--text-main);
    border-color: var(--border);
}

/* ── Forms ────────────────────────────────────────── */
.form-control, .form-select {
    background: var(--bg-input);
    border: 1px solid transparent;
    border-radius: var(--radius-input);
    color: var(--text-main);
    font-size: 0.9rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.form-control:focus, .form-select:focus {
    background: var(--bg-input);
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(0, 135, 169, 0.12);
    color: var(--text-main);
}
.form-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

/* ── Tables ───────────────────────────────────────── */
.table {
    color: var(--text-main);
    font-size: 0.875rem;
}
.table thead th {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-label);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1rem;
    background: transparent;
}
.table tbody td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table-hover tbody tr:hover { background: rgba(0, 135, 169, 0.04); }

/* ── Badges ───────────────────────────────────────── */
.badge-status {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0.3em 0.7em;
    border-radius: 999px;
}
.badge-sent     { background: #dcfce7; color: #166534; }
.badge-draft    { background: #fef9c3; color: #854d0e; }
.badge-sending  { background: #dbeafe; color: #1e40af; }
.badge-failed   { background: #fee2e2; color: #991b1b; }
.badge-partial  { background: #ffedd5; color: #9a3412; }

/* ── Flash alerts ─────────────────────────────────── */
.alert {
    border: none;
    border-radius: var(--radius-card);
    font-size: 0.875rem;
}
.alert-success  { background: #dcfce7; color: #166534; }
.alert-danger   { background: #fee2e2; color: #991b1b; }
.alert-warning  { background: #fef9c3; color: #854d0e; }
.alert-info     { background: #dbeafe; color: #1e40af; }

/* ── Login page ───────────────────────────────────── */
.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-page);
    padding: 2rem;
}
.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    padding: 2.5rem;
}

/* ── Email preview frame ──────────────────────────── */
.preview-frame {
    min-height: 320px;
    padding: 1.5rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    overflow: auto;
}

/* ── Public pages (unsubscribe) ───────────────────── */
.public-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-page);
    padding: 2rem;
}

/* ── Page headings ────────────────────────────────── */
.page-heading { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.25rem; }
.page-subhead  { font-size: 0.875rem; color: var(--text-muted); }

/* ── Responsive ───────────────────────────────────── */
@media (max-width: 768px) {
    .app-nav-links { display: none; }
    .page-content { padding: 1rem; }
}
