/* ═══════════════════════════════════════════════════════════════════
   ReportIQ — Main Stylesheet
   Design: Clean, professional SaaS — slate/white/blue
   ═══════════════════════════════════════════════════════════════════ */

/* ── Reset & Base ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --sidebar-w:       240px;
    --color-brand:     #2563eb;
    --color-brand-dk:  #1d4ed8;
    --color-brand-lt:  #eff6ff;
    --color-text:      #1e293b;
    --color-text-2:    #475569;
    --color-text-3:    #94a3b8;
    --color-border:    #e2e8f0;
    --color-bg:        #f8fafc;
    --color-bg-card:   #ffffff;
    --color-success:   #16a34a;
    --color-success-bg:#f0fdf4;
    --color-error:     #dc2626;
    --color-error-bg:  #fef2f2;
    --color-warning:   #d97706;
    --color-warning-bg:#fffbeb;
    --radius-sm:       6px;
    --radius:          10px;
    --radius-lg:       14px;
    --shadow-sm:       0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow:          0 4px 16px rgba(0,0,0,0.06);
    --shadow-lg:       0 8px 32px rgba(0,0,0,0.08);
    --font:            'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono:       'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    --transition:      0.18s ease;
}

html { font-size: 15px; }

body {
    font-family: var(--font);
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--color-brand); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    background: #f1f5f9;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: 0.15em 0.4em;
    color: var(--color-brand);
}

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

/* ── Sidebar ─────────────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    background: #0f172a;
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform var(--transition);
}

.sidebar-header {
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}

.sidebar-wordmark {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.3px;
}

.sidebar-logo {
    max-height: 36px;
    max-width: 160px;
    object-fit: contain;
}

.sidebar-nav {
    flex: 1;
    padding: 0.75rem 0.625rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-sm);
    color: #94a3b8;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background var(--transition), color var(--transition);
    text-decoration: none;
}

.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }

.nav-item:hover {
    background: rgba(255,255,255,0.06);
    color: #e2e8f0;
    text-decoration: none;
}

.nav-item.active {
    background: var(--color-brand);
    color: #fff;
}

.sidebar-footer {
    padding: 0.875rem 1rem;
    border-top: 1px solid rgba(255,255,255,0.07);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color-brand);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-email { font-size: 0.78rem; color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }

.btn-logout {
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    transition: color var(--transition);
}
.btn-logout:hover { color: #e2e8f0; }

/* ── Mobile Header ───────────────────────────────────────────────── */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: #0f172a;
    align-items: center;
    padding: 0 1rem;
    gap: 1rem;
    z-index: 99;
}

.mobile-menu-btn {
    background: none;
    border: none;
    color: #e2e8f0;
    cursor: pointer;
    padding: 4px;
    display: flex;
}

.mobile-title {
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 99;
}

/* ── Main Content ────────────────────────────────────────────────── */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-w);
    padding: 2rem;
    min-width: 0;
}

/* ── Page Header ─────────────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.75rem;
    flex-wrap: wrap;
}

.page-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: -0.4px;
    line-height: 1.2;
}

.page-subtitle {
    color: var(--color-text-3);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    color: var(--color-text-3);
    margin-bottom: 0.25rem;
}

.breadcrumb a { color: var(--color-text-3); }
.breadcrumb a:hover { color: var(--color-brand); }

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.4;
}

.btn:hover { text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary   { background: var(--color-brand); color: #fff; border-color: var(--color-brand); }
.btn-primary:hover { background: var(--color-brand-dk); border-color: var(--color-brand-dk); color: #fff; }

.btn-secondary { background: #fff; color: var(--color-text); border-color: var(--color-border); }
.btn-secondary:hover { background: #f1f5f9; color: var(--color-text); }

.btn-ghost { background: transparent; color: var(--color-text-2); border-color: transparent; }
.btn-ghost:hover { background: #f1f5f9; color: var(--color-text); }

.btn-danger { background: var(--color-error); color: #fff; border-color: var(--color-error); }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; color: #fff; }

.btn-block { width: 100%; justify-content: center; }

.btn-sm { padding: 0.325rem 0.75rem; font-size: 0.8rem; }

.action-group { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

/* ── Forms ────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }

label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-2);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.4rem;
}

input[type=text],
input[type=email],
input[type=password],
input[type=url],
input[type=number],
input[type=search],
textarea,
.select-input {
    width: 100%;
    padding: 0.6rem 0.875rem;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    color: var(--color-text);
    background: #fff;
    font-family: var(--font);
    transition: border-color var(--transition), box-shadow var(--transition);
    appearance: none;
    -webkit-appearance: none;
}

input:focus, textarea:focus, .select-input:focus {
    outline: none;
    border-color: var(--color-brand);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

textarea { resize: vertical; min-height: 80px; line-height: 1.6; }

.select-input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.25rem;
    cursor: pointer;
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.form-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-text-3);
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 0.5rem;
    margin: 1.75rem 0 1.25rem;
}

.field-hint {
    font-size: 0.78rem;
    color: var(--color-text-3);
    margin-top: 0.35rem;
    line-height: 1.5;
}

.form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--color-border);
}

/* Toggle switch */
.toggle-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text);
    text-transform: none;
    letter-spacing: 0;
}

.toggle-label input { position: absolute; opacity: 0; width: 0; height: 0; }

.toggle-track {
    width: 40px;
    height: 22px;
    background: #cbd5e1;
    border-radius: 999px;
    position: relative;
    flex-shrink: 0;
    transition: background var(--transition);
}

.toggle-track::after {
    content: '';
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    position: absolute;
    top: 3px;
    left: 3px;
    transition: transform var(--transition);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-label input:checked ~ .toggle-track { background: var(--color-brand); }
.toggle-label input:checked ~ .toggle-track::after { transform: translateX(18px); }

/* ── Cards ────────────────────────────────────────────────────────── */
.card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.125rem 1.25rem;
    border-bottom: 1px solid var(--color-border);
    gap: 1rem;
}

.card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-text);
}

/* ── Stats Grid ─────────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.stat-card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow-sm);
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-3);
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--color-text);
    letter-spacing: -1px;
    line-height: 1;
}

/* ── Tables ─────────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.data-table th {
    padding: 0.75rem 1.25rem;
    text-align: left;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-3);
    border-bottom: 1px solid var(--color-border);
    background: #f8fafc;
    white-space: nowrap;
}

.data-table td {
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: #f8fafc; }

.table-search {
    max-width: 240px;
    padding: 0.45rem 0.75rem;
    font-size: 0.85rem;
}

/* ── Badges ─────────────────────────────────────────────────────── */
.badge-group { display: flex; gap: 4px; flex-wrap: wrap; }

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1;
}

.badge-success { background: var(--color-success-bg); color: var(--color-success); }
.badge-muted   { background: #f1f5f9; color: #94a3b8; }
.badge-outline { background: transparent; color: var(--color-text-2); border: 1px solid var(--color-border); font-weight: 600; }

/* ── Alerts ─────────────────────────────────────────────────────── */
.alert {
    padding: 0.875rem 1.125rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
    line-height: 1.5;
}

.alert p { margin-bottom: 0.25rem; }
.alert p:last-child { margin-bottom: 0; }
.alert-success { background: var(--color-success-bg); color: #15803d; border: 1px solid #bbf7d0; }
.alert-error   { background: var(--color-error-bg);   color: #b91c1c; border: 1px solid #fecaca; }
.alert-warning { background: var(--color-warning-bg); color: #92400e; border: 1px solid #fde68a; }

/* ── Empty State ────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 1.25rem;
    color: var(--color-text-3);
}

.empty-state h3 { font-size: 1.25rem; margin-bottom: 0.5rem; }
.empty-state p  { color: var(--color-text-3); margin-bottom: 1.25rem; }

/* ── Client Name Cell ───────────────────────────────────────────── */
.client-name-cell {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.client-color-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ── Connection Status ──────────────────────────────────────────── */
.connection-status {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
}

.connection-status.connected {
    background: var(--color-success-bg);
    color: var(--color-success);
}

/* ── Edit Layout (client edit page) ────────────────────────────── */
.edit-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 1.5rem;
    align-items: start;
}

.report-list { padding: 0; }

.report-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--color-border);
    gap: 1rem;
}

.report-list-item:last-child { border-bottom: none; }
.report-list-title { font-size: 0.85rem; font-weight: 600; }
.report-list-date  { font-size: 0.78rem; color: var(--color-text-3); margin-top: 2px; }

/* ── Modal ──────────────────────────────────────────────────────── */
.modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.4);
    backdrop-filter: blur(2px);
}

.modal-dialog {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 520px;
    position: relative;
    z-index: 1;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--color-border);
}

.modal-title { font-size: 1.05rem; font-weight: 700; }

.modal-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--color-text-3);
    line-height: 1;
    padding: 2px 6px;
    border-radius: 4px;
}
.modal-close:hover { background: #f1f5f9; color: var(--color-text); }

.modal-body { padding: 1.5rem; }

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.625rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--color-border);
}

/* Modal states */
.progress-state, .success-state, .error-state {
    text-align: center;
    padding: 1.5rem 0;
}

.progress-state p, .success-state p { margin-top: 1rem; color: var(--color-text-2); }

/* ── Spinner ─────────────────────────────────────────────────────── */
.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-brand);
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
    margin: 0 auto;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Reports Grid ────────────────────────────────────────────────── */
.report-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.report-card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow var(--transition), transform var(--transition);
}

.report-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

.report-card-accent { height: 4px; }

.report-card-body { padding: 1.125rem 1.25rem; flex: 1; }

.report-card-client {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--color-text-3);
    margin-bottom: 0.35rem;
}

.report-card-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.report-card-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.78rem;
    color: var(--color-text-3);
    margin-bottom: 0.75rem;
}

.report-card-sources { display: flex; gap: 4px; flex-wrap: wrap; }

.report-card-actions {
    display: flex;
    gap: 0.5rem;
    padding: 0.875rem 1.25rem;
    border-top: 1px solid var(--color-border);
    background: #f8fafc;
}

/* ── Report View ─────────────────────────────────────────────────── */
.report-view-wrapper {
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1rem;
}

.report-wrapper { }

.report-cover {
    position: relative;
    overflow: hidden;
}

.report-cover-accent {
    height: 6px;
}

.report-cover-body {
    padding: 2.5rem 2.5rem 2rem;
    border-bottom: 1px solid var(--color-border);
}

.report-agency {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-text-3);
    margin-bottom: 0.5rem;
}

.report-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--color-text);
    letter-spacing: -0.5px;
    line-height: 1.2;
    margin-bottom: 0.75rem;
}

.report-meta-row { margin-bottom: 0.5rem; }

.report-period-badge {
    display: inline-block;
    background: var(--color-brand-lt);
    color: var(--color-brand);
    border-radius: 4px;
    padding: 0.25rem 0.75rem;
    font-size: 0.82rem;
    font-weight: 600;
}

.report-client-url { font-size: 0.85rem; color: var(--color-text-3); }
.report-generated  { font-size: 0.78rem; color: var(--color-text-3); margin-top: 0.25rem; }

.report-source-error {
    background: var(--color-warning-bg);
    border-left: 4px solid var(--color-warning);
    padding: 0.875rem 1.25rem;
    font-size: 0.85rem;
    color: #92400e;
}

/* Report content typography */
.report-content {
    padding: 2rem 2.5rem 2.5rem;
}

.report-content h2 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--color-text);
    margin: 2rem 0 0.875rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--color-brand);
}

.report-content h2:first-child { margin-top: 0; }

.report-content p {
    margin-bottom: 0.875rem;
    line-height: 1.75;
    color: #334155;
    font-size: 0.95rem;
}

.report-content ul,
.report-content ol {
    margin: 0.5rem 0 1.125rem 1.25rem;
}

.report-content li {
    margin-bottom: 0.4rem;
    line-height: 1.6;
    color: #334155;
    font-size: 0.95rem;
}

/* Metric table inside report */
.report-content .metric-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    margin: 0.5rem 0 1.25rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.report-content .metric-table th {
    background: #0f172a;
    color: #fff;
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.report-content .metric-table td {
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text);
}

.report-content .metric-table tr:last-child td { border-bottom: none; }
.report-content .metric-table tbody tr:nth-child(even) td { background: #f8fafc; }

.report-meta-footer {
    display: flex;
    gap: 1.25rem;
    font-size: 0.75rem;
    color: var(--color-text-3);
    padding: 0.5rem 0;
}

/* ── Pagination ──────────────────────────────────────────────────── */
.pagination {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin-top: 1.5rem;
}

.pagination-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text-2);
    border: 1px solid var(--color-border);
    background: #fff;
    text-decoration: none;
    transition: all var(--transition);
}

.pagination-item:hover,
.pagination-item.active {
    background: var(--color-brand);
    color: #fff;
    border-color: var(--color-brand);
}

/* ── Settings Layout ─────────────────────────────────────────────── */
.settings-layout {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 1.5rem;
    align-items: start;
}

.settings-tabs {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
    position: sticky;
    top: 1.5rem;
}

.settings-tab-item {
    display: block;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-2);
    border-bottom: 1px solid var(--color-border);
    text-decoration: none;
    transition: background var(--transition), color var(--transition);
}

.settings-tab-item:last-child { border-bottom: none; }
.settings-tab-item:hover { background: #f8fafc; color: var(--color-text); text-decoration: none; }
.settings-tab-item.active { background: var(--color-brand-lt); color: var(--color-brand); font-weight: 700; }

/* ── Filter bar ──────────────────────────────────────────────────── */
.filter-bar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

/* ── Text utilities ─────────────────────────────────────────────── */
.text-sm   { font-size: 0.82rem; }
.text-muted { color: var(--color-text-3); }
.text-error { color: var(--color-error); }
.link-muted { color: var(--color-text-3); }
.link-muted:hover { color: var(--color-brand); }

/* ── Auth page ───────────────────────────────────────────────────── */
.auth-page {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-container { width: 100%; max-width: 420px; }

.auth-card {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    padding: 2.5rem;
}

.auth-logo { margin-bottom: 1.75rem; }

.auth-wordmark {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--color-text);
    letter-spacing: -0.5px;
}

.auth-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 1.5rem;
}

.auth-form { display: flex; flex-direction: column; gap: 1rem; }
.auth-footer {
    margin-top: 1.75rem;
    font-size: 0.78rem;
    color: var(--color-text-3);
    text-align: center;
}

/* ── Flash message ───────────────────────────────────────────────── */
.flash-message { margin-bottom: 1.25rem; }

/* ── Report page specific ────────────────────────────────────────── */
.report-page-header {
    flex-wrap: nowrap;
    gap: 1.5rem;
}

/* ── Print styles ────────────────────────────────────────────────── */
@media print {
    .sidebar,
    .mobile-header,
    .page-header .action-group,
    .page-header .btn,
    .breadcrumb,
    .page-subtitle,
    .report-meta-footer,
    .sidebar-overlay {
        display: none !important;
    }

    .main-content { margin-left: 0 !important; padding: 0 !important; }
    .app-layout   { display: block !important; }

    .report-view-wrapper {
        border: none;
        box-shadow: none;
        border-radius: 0;
    }

    .report-content { padding: 0; }
    .report-cover-body { padding: 1rem 0 1.5rem; }

    .report-content h2 { page-break-after: avoid; }
    .report-content .metric-table { page-break-inside: avoid; }

    body { font-size: 12pt; color: #000; }
}

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .edit-layout { grid-template-columns: 1fr; }
    .settings-layout { grid-template-columns: 1fr; }
    .settings-tabs { display: flex; flex-wrap: wrap; position: static; }
    .settings-tab-item { border-bottom: none; border-right: 1px solid var(--color-border); }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(calc(-1 * var(--sidebar-w)));
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }

    .sidebar-overlay.open { display: block; }

    .mobile-header { display: flex; }

    .main-content {
        margin-left: 0;
        padding: 1rem;
        margin-top: 56px;
    }

    .page-header { flex-direction: column; align-items: flex-start; }
    .stats-grid  { grid-template-columns: 1fr 1fr; }
    .form-row    { grid-template-columns: 1fr; }
    .report-grid { grid-template-columns: 1fr; }

    .report-content { padding: 1.25rem; }
    .report-cover-body { padding: 1.5rem; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
}
