/* MDB Panel — design system */
:root {
    --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: "JetBrains Mono", "Cascadia Code", Consolas, monospace;

    --bg: #f1f5f9;
    --bg-elevated: #ffffff;
    --bg-sidebar: #0f172a;
    --bg-sidebar-hover: #1e293b;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;

    --text: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-on-dark: #f8fafc;

    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-soft: #eef2ff;
    --success: #059669;
    --success-soft: #d1fae5;
    --warning: #d97706;
    --warning-soft: #fef3c7;
    --danger: #dc2626;
    --danger-soft: #fee2e2;
    --info: #0284c7;
    --info-soft: #e0f2fe;

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 20px 25px -5px rgba(15, 23, 42, 0.1);

    --sidebar-w: 260px;
    --topbar-h: 60px;
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --content-max: 1440px;
    --transition: 0.2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body.app-body {
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    min-height: 100dvh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); text-decoration: underline; }

/* Layout */
.app-layout { display: flex; min-height: 100dvh; }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    background: var(--bg-sidebar);
    color: var(--text-on-dark);
    display: flex;
    flex-direction: column;
    z-index: 300;
    transform: translateX(0);
    transition: transform var(--transition);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-5) var(--space-4);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    min-height: var(--topbar-h);
}

.sidebar-logo {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 14px;
    flex-shrink: 0;
}

.sidebar-brand-text { font-weight: 700; font-size: 15px; line-height: 1.2; }
.sidebar-brand-sub { font-size: 11px; color: #94a3b8; font-weight: 400; }

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-3) var(--space-2);
}

.nav-group { margin-bottom: var(--space-4); }

.nav-group-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    padding: var(--space-2) var(--space-3);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 10px var(--space-3);
    border-radius: var(--radius-sm);
    color: #cbd5e1;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: background var(--transition), color var(--transition);
}

.nav-link:hover {
    background: var(--bg-sidebar-hover);
    color: #fff;
    text-decoration: none;
}

.nav-link.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.4);
}

.nav-icon { width: 20px; text-align: center; font-size: 16px; flex-shrink: 0; opacity: 0.9; }

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 250;
    backdrop-filter: blur(2px);
}

.app-main {
    flex: 1;
    margin-left: var(--sidebar-w);
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: var(--space-4);
    min-height: var(--topbar-h);
    padding: var(--space-3) var(--space-5);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.sidebar-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    cursor: pointer;
    font-size: 18px;
    color: var(--text);
}

.sidebar-toggle:hover { background: var(--bg); }

.page-title {
    font-size: clamp(1.1rem, 2.5vw, 1.35rem);
    font-weight: 700;
    color: var(--text);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.page-content {
    flex: 1;
    padding: var(--space-5);
}

.container {
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
}

.container--narrow { max-width: 900px; }
.container--medium { max-width: 1100px; }
.container--wide { max-width: 1280px; }

.page-desc, .subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: var(--space-5);
}

/* Cards & panels */
.card, .panel {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: var(--space-5);
    margin-bottom: var(--space-5);
}

.card h2, .panel h2 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: var(--space-4);
    color: var(--text);
}

.card h3, .panel h3 { font-size: 0.95rem; font-weight: 600; margin-bottom: var(--space-3); }

/* Stat cards */
.stat-grid, .cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-5);
}

.stat-card, .card.stat-link {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-5) var(--space-4);
    text-align: center;
    text-decoration: none;
    color: inherit;
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
    display: block;
}

.stat-card:hover, .card.stat-link:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: var(--primary-soft);
    text-decoration: none;
}

.stat-card .value, .stat-link .value {
    font-size: clamp(1.5rem, 4vw, 1.75rem);
    font-weight: 800;
    line-height: 1.2;
}

.stat-card .label, .stat-link .label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-top: var(--space-2);
}

.stat-card.blue .value, .card.blue .value { color: var(--info); }
.stat-card.green .value, .card.green .value { color: var(--success); }
.stat-card.purple .value, .card.purple .value { color: #7c3aed; }

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-5);
    margin-bottom: var(--space-5);
}

.page-stats .grid-2 > .card {
    min-width: 0;
    overflow: hidden;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background var(--transition), color var(--transition), border-color var(--transition), transform 0.1s;
}

.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); color: #fff; }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #047857; color: #fff; }

.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #b45309; color: #fff; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; color: #fff; }

.btn-secondary { background: #64748b; color: #fff; }
.btn-secondary:hover { background: #475569; color: #fff; }

.btn-outline {
    background: transparent;
    border-color: var(--border-strong);
    color: var(--text);
}
.btn-outline:hover { background: var(--bg); color: var(--text); }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-disabled, .btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

.btn-group { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }

/* Forms */
.form-row, .form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    align-items: flex-end;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-5);
}

.form-col { display: flex; flex-direction: column; gap: var(--space-4); }
.form-col.full { grid-column: 1 / -1; }

.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    background: var(--bg-elevated);
    color: var(--text);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.form-group .hint, .form-hint {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

.form-group textarea { min-height: 120px; resize: vertical; }
.html-editor, textarea.code {
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.55;
    min-height: 360px;
}

.radio-row, .radio-stack, .checkbox-row {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.radio-row label, .radio-stack label, .checkbox-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
}

.radio-row input, .radio-stack input, .checkbox-row input { width: auto; accent-color: var(--primary); }

.inline-input {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-left: var(--space-6);
    flex-wrap: wrap;
}

.inline-input input { width: 88px; max-width: 100%; }

.section-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    padding-bottom: var(--space-2);
    margin-bottom: var(--space-3);
    border-bottom: 2px solid var(--primary-soft);
}

/* Alerts */
.alert {
    padding: var(--space-4);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-4);
    font-size: 14px;
    border: 1px solid transparent;
}

.alert-success { background: var(--success-soft); color: #065f46; border-color: #a7f3d0; }
.alert-error { background: var(--danger-soft); color: #991b1b; border-color: #fecaca; }
.alert-info { background: var(--info-soft); color: #075985; border-color: #bae6fd; }

/* Tables */
.table-wrap, .table-wrapper {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: var(--space-4);
}

table, .data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 480px;
    font-size: 13px;
}

th, td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: #f8fafc;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

th a { color: inherit; text-decoration: none; }
th a:hover { color: var(--primary); }

tbody tr:hover { background: #f8fafc; }
tbody tr:last-child td { border-bottom: none; }

.cell-truncate {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Badges & status */
.badge, .tag, .status {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
}

.tag-badge, .tag { color: #fff; }

.status-done { background: var(--success-soft); color: #065f46; }
.status-error { background: var(--danger-soft); color: #991b1b; }
.status-processing { background: var(--warning-soft); color: #92400e; }

.unsub-badge { background: var(--danger-soft); color: #991b1b; margin-left: 4px; }
.domain-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 4px;
    vertical-align: middle;
}
.domain-badge-free { background: #dbeafe; color: #1e40af; }
.domain-badge-custom { background: #e0e7ff; color: #3730a3; }
.acc-badge { background: var(--success-soft); color: #065f46; margin-left: 4px; }

.badge-ok { background: var(--success-soft); color: #065f46; }
.badge-err { background: var(--danger-soft); color: #991b1b; }

.text-muted { color: var(--text-muted); font-size: 13px; }
.empty {
    text-align: center;
    color: var(--text-muted);
    padding: var(--space-8) var(--space-4);
}

/* Filters (contacts) */
.filters-panel {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: var(--space-4);
    overflow: hidden;
}

.filters-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    flex-wrap: wrap;
    padding: var(--space-3) var(--space-4);
    background: linear-gradient(180deg, var(--bg) 0%, var(--bg-elevated) 100%);
    border-bottom: 1px solid var(--border);
}

.filters-panel__title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

.filters-panel__actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.filters-fast-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
}

.filters-fast-toggle input { margin: 0; }

.filters-section {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border);
}

.filters-section:last-child { border-bottom: none; }

.filters-section__title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: var(--space-2);
}

.filters-grid {
    display: grid;
    gap: var(--space-3);
}

.filters-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.filters-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.filters-grid--auto { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }

.filter-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.filter-field__label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
}

.filter-field input,
.filter-field select,
.filters-panel input,
.filters-panel select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 13px;
    background: var(--bg-elevated);
    box-sizing: border-box;
}

.filters-advanced,
.filters-admin {
    border-bottom: 1px solid var(--border);
}

.filters-advanced > summary,
.filters-admin > summary {
    padding: var(--space-3) var(--space-4);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    list-style: none;
    user-select: none;
}

.filters-advanced > summary::-webkit-details-marker,
.filters-admin > summary::-webkit-details-marker { display: none; }

.filters-advanced > summary::before,
.filters-admin > summary::before {
    content: '▸ ';
    display: inline-block;
    transition: transform 0.15s ease;
}

.filters-advanced[open] > summary::before,
.filters-admin[open] > summary::before {
    transform: rotate(90deg);
}

.filters-advanced .filters-grid,
.filters-admin__body {
    padding: 0 var(--space-4) var(--space-4);
}

.filters-admin__hint {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0 0 var(--space-2);
}

.filters-admin__list {
    margin: 0 0 var(--space-3);
    padding-left: 1.2rem;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.filters-admin__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.tag-select { width: 100%; }

.filter-results-bar {
    background: var(--primary-soft);
    border: 1px solid #c7d2fe;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.filter-results-bar__count {
    font-size: 14px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.filter-results-bar__time {
    font-size: 12px;
    color: var(--text-muted);
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 999px;
}

.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid #c7d2fe;
    color: #3730a3;
    font-size: 12px;
    text-decoration: none;
    transition: background 0.15s ease;
}

.filter-chip:hover {
    background: #eef2ff;
    text-decoration: none;
}

@media (max-width: 900px) {
    .filters-grid--2,
    .filters-grid--4 { grid-template-columns: 1fr; }
}

/* Segment filters (schedule) */
.segment-filters {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}

.segment-filters__row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: var(--space-3);
}

.segment-audience-note { margin-bottom: var(--space-3); }

.segment-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

.segment-count-result {
    font-size: 13px;
    margin-left: auto;
}

.segment-save-row { margin-top: var(--space-2); }

.page-schedule .segment-filters .filter-field input,
.page-schedule .segment-filters .filter-field select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 13px;
    background: var(--bg-elevated);
    box-sizing: border-box;
}

.filters,
.filters-row,
.filters-label,
.filters-row--spaced { /* legacy aliases */ }

.card + .card,
.card + .panel,
.panel + .card { margin-top: 0; }

.card .subtitle:last-of-type { margin-bottom: var(--space-4); }

.section-title + .form-group,
.section-title + .option-block,
.section-title + .info-box { margin-top: 0; }

button:not([class]),
input[type="submit"]:not([class]) {
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    border: 1px solid var(--border-strong);
    background: var(--bg-elevated);
    cursor: pointer;
}

button:not([class]):hover,
input[type="submit"]:not([class]):hover {
    background: var(--bg);
}
.filters input[type="date"] { width: 140px; }

.filter-info { /* deprecated: use .filter-results-bar */ }

.bulk-actions {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-4);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.bulk-actions .selected-count { font-weight: 700; color: var(--primary); font-size: 13px; }

.attrs { font-size: 11px; color: var(--text-secondary); max-width: 240px; line-height: 1.45; word-break: break-word; }
.email-link { cursor: pointer; color: var(--primary); font-weight: 500; }
.email-link:hover { text-decoration: underline; }

/* Pagination */
.pagination-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-3);
    margin-top: var(--space-4);
    font-size: 13px;
}

.pagination { display: flex; flex-wrap: wrap; gap: 4px; }

.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
}

.pagination a {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--primary);
    text-decoration: none;
}

.pagination a:hover { background: var(--primary); color: #fff; border-color: var(--primary); text-decoration: none; }
.pagination .current { background: var(--primary); color: #fff; border: 1px solid var(--primary); }

/* Modals */
.modal-overlay, .confirm-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: var(--space-4);
}

.modal-overlay.active, .confirm-overlay.active { display: flex; }

.modal, .confirm-box {
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    max-width: 520px;
    width: 100%;
    max-height: 90dvh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.modal h3, .confirm-box h3 { margin-bottom: var(--space-4); font-size: 1.1rem; }
.modal-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); justify-content: flex-end; margin-top: var(--space-5); }

.modal-close {
    float: right;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin: -4px -4px var(--space-2) var(--space-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text-muted);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}

.modal-close:hover {
    background: var(--danger-soft);
    color: var(--danger);
    border-color: #fecaca;
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.modal-header h3 { margin-bottom: 0; flex: 1; }

.modal-intro {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: var(--space-4);
    line-height: 1.5;
}

.info-text {
    font-size: 13px;
    color: var(--text-secondary);
    background: #f8fafc;
    padding: var(--space-3);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-4);
    border: 1px solid var(--border);
}

.tag-checkboxes { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-4); }
.tag-checkboxes label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--bg);
    border: 1px solid var(--border);
    cursor: pointer;
}

/* Profile modal */
.modal--preview {
    max-width: 920px;
    width: min(920px, 96vw);
}

.email-preview-frame-wrap {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
    overflow: hidden;
    min-height: 360px;
}

.email-preview-frame {
    display: block;
    width: 100%;
    height: min(70vh, 640px);
    border: 0;
    background: #fff;
}

.profile-modal { max-width: 560px; }
.profile-header {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin-bottom: var(--space-5);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--border);
}

.profile-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 800;
    flex-shrink: 0;
}

.profile-name { font-size: 1.15rem; font-weight: 700; }
.profile-email { font-size: 13px; color: var(--primary); }
.profile-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: var(--space-2); }

.attr-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.attr-item {
    background: #f8fafc;
    padding: var(--space-3);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.attr-item.full { grid-column: 1 / -1; }
.attr-item .attr-key { font-size: 10px; color: var(--text-muted); text-transform: uppercase; font-weight: 700; }
.attr-item .attr-value { font-size: 13px; margin-top: 4px; word-break: break-word; }

.profile-footer { font-size: 12px; color: var(--text-muted); padding-top: var(--space-3); border-top: 1px solid var(--border); }

/* Toast */
.toast {
    position: fixed;
    bottom: var(--space-5);
    right: var(--space-5);
    left: var(--space-5);
    max-width: 420px;
    margin-left: auto;
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius);
    z-index: 2000;
    display: none;
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    box-shadow: var(--shadow-lg);
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--info); }
.toast.active { display: block; animation: slideUp 0.25s ease; }

@keyframes slideUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.stat-card.red .value, .stat-card.red .num { color: var(--danger); }

.input-with-btn {
    display: flex;
    gap: var(--space-2);
    align-items: stretch;
}

.input-with-btn input {
    flex: 1;
    min-width: 0;
}

.input-with-btn .btn {
    flex-shrink: 0;
    align-self: stretch;
    min-width: 44px;
    padding-left: 12px;
    padding-right: 12px;
}

/* Stats dashboard */
.page-stats .stat-grid--6 {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.stats-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-5);
}

.stats-toolbar__hint {
    font-size: 13px;
    color: var(--text-muted);
}

.segmented-control--compact {
    display: inline-flex;
    padding: 3px;
}

.segmented-control__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-decoration: none;
    transition: background var(--transition), color var(--transition);
}

.segmented-control__link:hover {
    color: var(--text);
    text-decoration: none;
    background: var(--bg);
}

.segmented-control__link.is-active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 6px rgba(79, 70, 229, 0.35);
}

.card-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    flex-wrap: wrap;
    margin-bottom: var(--space-4);
}

.card-header-row h2 {
    margin-bottom: 0;
}

.text-empty {
    color: var(--text-muted);
    font-size: 14px;
    padding: var(--space-4) 0;
}

.chart-scroll {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.chart-bars {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 2px;
    height: 200px;
    width: 100%;
    padding: var(--space-2) 0 var(--space-1);
    box-sizing: border-box;
}

.chart-bar-col {
    flex: 1 1 0;
    min-width: 0;
    max-width: 56px;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    overflow: hidden;
}

.chart-bar-value {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-secondary);
    min-height: 14px;
    margin-bottom: 2px;
}

.chart-bar-track {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    min-height: 120px;
}

.chart-bar-fill {
    width: 70%;
    max-width: 28px;
    min-height: 4px;
    border-radius: 4px 4px 0 0;
    background: var(--primary);
    transition: height 0.3s ease;
}

.chart-bar-fill--danger { background: linear-gradient(180deg, #f87171, var(--danger)); }
.chart-bar-fill--success { background: linear-gradient(180deg, #34d399, var(--success)); }

.chart-bar-label {
    font-size: 9px;
    line-height: 1.1;
    color: var(--text-muted);
    margin-top: 4px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

@media (max-width: 768px) {
    .chart-bars {
        height: 180px;
    }

    .chart-bar-label {
        font-size: 8px;
    }

    .chart-bar-value {
        font-size: 9px;
    }
}

.badge-manual {
    background: var(--info-soft);
    color: #075985;
}

.badge-cron {
    background: var(--primary-soft);
    color: #4338ca;
}

.data-table--compact th,
.data-table--compact td {
    padding: 8px 12px;
}

.nowrap { white-space: nowrap; }

.stat-card.red .value { color: var(--danger); }

/* Scheduler */
.status-bar {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding: var(--space-4);
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-5);
}

.status-bar__main {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-3);
}

.status-bar__meta {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}

.status-bar__actions {
    padding-top: var(--space-2);
    border-top: 1px solid var(--border);
}

.status-bar--empty {
    align-items: center;
    justify-content: center;
    min-height: 56px;
}

.status-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.status-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.status-dot.active { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.status-dot.paused { background: var(--warning); }

.status-text { font-weight: 700; font-size: 14px; }

/* Schedule page — tabbed layout */
.schedule-card { padding-bottom: 0; overflow: hidden; }

.schedule-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}

.schedule-header h2 { margin-bottom: var(--space-2); }

.schedule-header__lead {
    margin: 0;
    font-size: 14px;
    color: var(--text-secondary);
    max-width: 52rem;
    line-height: 1.5;
}

.schedule-help {
    margin-bottom: var(--space-4);
    padding: var(--space-3) var(--space-4);
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-secondary);
}

.schedule-help summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--text);
}

.schedule-help p { margin: var(--space-3) 0 0; line-height: 1.5; }

.status-bar--compact { margin-bottom: var(--space-4); }
.status-bar--compact .status-bar__actions { display: none; }

.schedule-form { display: flex; flex-direction: column; }

.schedule-tabs {
    display: flex;
    flex-wrap: nowrap;
    gap: 2px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 calc(-1 * var(--space-5)) var(--space-4);
    padding: 0 var(--space-5);
    border-bottom: 1px solid var(--border);
    scrollbar-width: thin;
}

.schedule-tab {
    flex: 0 0 auto;
    padding: 12px 18px;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    background: transparent;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    white-space: nowrap;
    transition: color var(--transition), border-color var(--transition), background var(--transition);
}

.schedule-tab:hover { color: var(--text); background: #f8fafc; }

.schedule-tab.is-active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: var(--primary-soft);
}

.schedule-panels { min-height: 200px; padding-bottom: var(--space-4); }

.schedule-panel { display: none; animation: scheduleFadeIn 0.2s ease; }
.schedule-panel.is-active { display: block; }

@keyframes scheduleFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.schedule-field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-4) var(--space-5);
    margin-bottom: var(--space-4);
}

.schedule-field-grid--narrow { max-width: 640px; }

.schedule-field-grid__full { grid-column: 1 / -1; }

.schedule-subsection {
    margin-top: var(--space-2);
    padding: var(--space-4);
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.schedule-subsection--muted {
    background: var(--bg-elevated);
    margin-top: var(--space-4);
}

.schedule-subsection__title {
    margin: 0 0 var(--space-3);
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
}

.schedule-audience-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3) var(--space-4);
    padding: var(--space-4);
    margin-bottom: var(--space-4);
    background: linear-gradient(135deg, var(--primary-soft) 0%, #f0fdf4 100%);
    border: 1px solid #c7d2fe;
    border-radius: var(--radius);
}

.schedule-audience-summary__count {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--space-2);
    flex: 1;
    min-width: 200px;
}

.schedule-audience-summary__label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.schedule-audience-summary__count strong {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1;
}

.schedule-audience-summary__actions { margin-left: auto; }

.schedule-options {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin: var(--space-4) 0;
    padding: var(--space-4);
    background: #f8fafc;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.schedule-form-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
    margin: 0 calc(-1 * var(--space-5));
    padding: var(--space-4) var(--space-5);
    background: #f8fafc;
    border-top: 1px solid var(--border);
    position: sticky;
    bottom: 0;
    z-index: 5;
}

.schedule-form-footer__links { margin-left: auto; }

.schedule-danger-zone {
    margin-top: var(--space-5);
    padding-top: var(--space-4);
    border-top: 1px dashed var(--border);
}

.radio-row--compact { gap: var(--space-4); }

.radio-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: var(--space-3);
}

.radio-cards--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.radio-card {
    display: block;
    cursor: pointer;
    margin: 0;
}

.radio-card input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.radio-card__body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    height: 100%;
    padding: var(--space-3) var(--space-4);
    background: var(--bg-elevated);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.radio-card__body strong { font-size: 13px; color: var(--text); }
.radio-card__body small { font-size: 11px; color: var(--text-muted); }

.radio-card__body input[type="number"],
.radio-card__body input[type="text"] {
    width: 100%;
    max-width: 88px;
    margin-top: 4px;
    padding: 6px 8px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 13px;
}

.radio-card input:checked + .radio-card__body {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
    background: var(--primary-soft);
}

.radio-card:hover .radio-card__body { border-color: #94a3b8; }

.log-block--scroll { max-height: 280px; overflow-y: auto; }

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.page-schedule .segment-filters {
    padding: var(--space-4);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

@media (max-width: 768px) {
    .schedule-field-grid,
    .radio-cards--3 { grid-template-columns: 1fr; }
    .schedule-form-footer__links { margin-left: 0; width: 100%; }
    .schedule-audience-summary__actions { margin-left: 0; width: 100%; }
}

.text-empty, .log-empty { color: var(--text-muted); font-size: 13px; }

.form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
    margin-top: var(--space-2);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border);
}

.select-inline,
select.select-inline {
    padding: 8px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    background: var(--bg-elevated);
    color: var(--text);
    min-width: 130px;
}

.select-inline:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.info-box {
    background: var(--primary-soft);
    border: 1px solid #c7d2fe;
    border-radius: var(--radius-sm);
    padding: var(--space-3) var(--space-4);
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: var(--space-3);
}

.info-box--compact { margin-bottom: var(--space-4); }

.option-block {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-4);
    margin-bottom: var(--space-3);
}

.option-block:last-child { margin-bottom: 0; }

.option-block__label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: var(--space-3);
}

.segmented-control {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 4px;
}

.segmented-control__item {
    flex: 1 1 140px;
    position: relative;
    cursor: pointer;
}

.segmented-control__item input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.segmented-control__item span {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: center;
    transition: background var(--transition), color var(--transition), box-shadow var(--transition);
}

.segmented-control__item input:checked + span {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 6px rgba(79, 70, 229, 0.35);
}

.segmented-control__item input:focus-visible + span {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.segmented-control__item:hover span {
    color: var(--text);
}

.section-title--spaced { margin-top: var(--space-4); }

.log-block {
    background: #0f172a;
    color: #86efac;
    padding: var(--space-4);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 1.6;
    max-height: 220px;
    overflow-y: auto;
    word-break: break-all;
}

.log-block span { display: block; }
.log-block .error-line { color: #fca5a5; }
.log-block .done-line { color: #86efac; }
.log-block .separator { color: #475569; }

.step-list { margin: var(--space-4) 0; }
.step-item { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) 0; font-size: 14px; }
.step-icon { width: 28px; text-align: center; flex-shrink: 0; }
.step-text { flex: 1; }
.step-status { font-size: 12px; color: var(--text-muted); }
.step-active .step-icon { animation: pulse 1s infinite; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.error-detail {
    background: var(--danger-soft);
    border: 1px solid #fecaca;
    padding: var(--space-3);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: #991b1b;
    max-height: 160px;
    overflow-y: auto;
    word-break: break-all;
    margin-top: var(--space-3);
    display: none;
}

/* Export tag cards */
.tag-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--space-4);
}

.tag-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-5);
    transition: box-shadow var(--transition);
}

.tag-card:hover { box-shadow: var(--shadow); }

.tag-count { font-size: 1.75rem; font-weight: 800; }
.tag-count-label { font-size: 12px; color: var(--text-muted); margin-bottom: var(--space-4); }

/* Crypto page tabs */
.tabs { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-4); }

.tab-btn {
    padding: 10px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition);
}

.tab-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }

.panel .grid-2 label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.panel .grid-2 textarea {
    width: 100%;
    min-height: 220px;
    padding: 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 12px;
    resize: vertical;
}

.panel .actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-4); }
.panel .hint { font-size: 12px; color: var(--text-muted); margin: var(--space-3) 0; }

.crypto-wrap { max-width: 1100px; }

/* Imports upload */
.upload-box {
    border: 2px dashed var(--primary);
    border-radius: var(--radius);
    padding: var(--space-8) var(--space-4);
    text-align: center;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition);
    margin-bottom: var(--space-5);
    background: var(--primary-soft);
}

.upload-box:hover,
.upload-box.dragover {
    background: #e0e7ff;
    border-color: var(--primary-hover);
}

.upload-box p { color: var(--text-secondary); font-size: 14px; margin-top: var(--space-2); }
.upload-box .icon { font-size: 2.5rem; margin-bottom: var(--space-3); }
.upload-box input[type="file"] { display: none; }
.upload-box .filename { color: var(--primary); font-weight: 600; margin-top: var(--space-2); word-break: break-all; }

.queue-info { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-bottom: var(--space-4); }
.queue-badge { padding: 8px 14px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; }
.queue-pending { background: var(--warning-soft); color: #92400e; }
.queue-error { background: var(--danger-soft); color: #991b1b; }

.cell-filename, .cell-error { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Contacts table density */
.page-contacts .table-wrap table { min-width: 960px; font-size: 12px; }
.page-contacts th, .page-contacts td { padding: 8px 10px; }

.log-viewer {
    background: #0f172a;
    color: #cbd5e1;
    padding: var(--space-4);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 12px;
    max-height: 360px;
    overflow-y: auto;
    white-space: pre-wrap;
    line-height: 1.55;
    word-break: break-all;
    margin-top: var(--space-3);
}

.log-list { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-3); }
.log-list a {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    text-decoration: none;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
}
.log-list a:hover, .log-list a.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.opts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-3);
    margin-top: var(--space-3);
}

.opts.hidden { display: none; }

/* Login */
.login-page {
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-5);
    background: linear-gradient(145deg, #0f172a 0%, #1e293b 50%, #312e81 100%);
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg-elevated);
    padding: var(--space-8) var(--space-6);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.login-card h1 { font-size: 1.5rem; margin-bottom: var(--space-2); }
.login-card p { color: var(--text-secondary); margin-bottom: var(--space-5); font-size: 14px; }
.login-card input { margin-bottom: var(--space-4); }
.login-card .btn { width: 100%; }

/* Progress */
.progress-wrap, .progress-bar-wrap {
    background: var(--border);
    border-radius: 999px;
    height: 8px;
    margin-top: var(--space-2);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #7c3aed);
    border-radius: 999px;
    transition: width 0.3s ease;
}

.toolbar {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.delete-form { display: inline; }

.stat-card .num { font-size: clamp(1.5rem, 4vw, 2rem); font-weight: 800; }
.stat-card .lbl { font-size: 11px; font-weight: 600; text-transform: uppercase; color: var(--text-muted); margin-top: var(--space-2); }
.stat-card.blue .num { color: var(--info); }
.stat-card.green .num { color: var(--success); }
.stat-card.red .num { color: var(--danger); }

/* Utilities */
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mb-0 { margin-bottom: 0 !important; }
.mb-4 { margin-bottom: var(--space-4); }
.gap-2 { gap: var(--space-2); }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }

code {
    font-family: var(--font-mono);
    font-size: 0.88em;
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
}

/* Responsive */
@media (max-width: 1024px) {
    .grid-2, .form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open { transform: translateX(0); }

    .sidebar-overlay.active { display: block; }

    .app-main { margin-left: 0; }

    .sidebar-toggle { display: flex; }

    .topbar { padding: var(--space-3) var(--space-4); }

    .page-content { padding: var(--space-4); }

    .stat-grid, .cards { grid-template-columns: repeat(2, 1fr); }

    .card, .panel { padding: var(--space-4); }

    .filters input[type="text"] { min-width: 100%; flex: 1 1 100%; }

    .inline-input { margin-left: 0; }

    .attr-grid { grid-template-columns: 1fr; }

    table { min-width: 640px; font-size: 12px; }
    th, td { padding: 8px 10px; }

    .pagination-bar { flex-direction: column; align-items: stretch; }
    .pagination { justify-content: center; }

    .toast { left: var(--space-4); right: var(--space-4); }
}

@media (max-width: 480px) {
    .stat-grid, .cards { grid-template-columns: 1fr; }

    .tag-cards { grid-template-columns: 1fr; }

    .btn-group .btn { flex: 1 1 auto; }
}
