/* ============================================================
   Licky — Dealer Outreach Pipeline
   Light product theme — OKLCH color system, Restrained
   Scene: outreach operator triaging dense dealer tables at a
   bright desk mid-morning. Light surfaces reduce eye strain,
   one blue accent marks primary actions and selection only.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');


/* --- Custom Properties (OKLCH, blue-tinted light) --- */
:root {
    /* Background layers — blue-tinted light neutrals, never pure white */
    --bg-base:       oklch(0.955 0.007 275);
    --bg-raised:     oklch(0.985 0.005 275);
    --bg-surface:    oklch(0.99 0.004 275);
    --bg-surface-hover: oklch(0.94 0.008 275);
    --bg-input:      oklch(0.995 0.003 275);
    --bg-sidebar:    oklch(0.99 0.004 275);

    /* Accent — royal blue #2243AA */
    --accent:        oklch(0.46 0.145 278);
    --accent-hover:  oklch(0.41 0.145 278);
    --accent-soft:   oklch(0.46 0.145 278 / 0.10);
    --accent-muted:  oklch(0.46 0.145 278 / 0.06);

    /* Text — blue-tinted ink */
    --text-primary:  oklch(0.27 0.02 275);
    --text-secondary: oklch(0.48 0.018 275);
    --text-muted:    oklch(0.60 0.014 275);
    --text-link:     oklch(0.46 0.145 278);

    /* Borders — blue-tinted */
    --border:        oklch(0.89 0.012 275);
    --border-hover:  oklch(0.81 0.014 275);
    --border-focus:  var(--accent);

    /* Semantic — dark enough for light surfaces */
    --color-success: oklch(0.55 0.13 165);
    --color-warning: oklch(0.60 0.12 85);
    --color-danger:  oklch(0.55 0.15 25);
    --color-info:    oklch(0.50 0.12 260);

    /* Score colors */
    --color-good:    oklch(0.55 0.13 165);
    --color-average: oklch(0.60 0.12 85);
    --color-poor:    oklch(0.55 0.15 25);

    /* Badge semantic backgrounds — light tint, dark text */
    --badge-draft-bg:     oklch(0.60 0.012 275 / 0.12);
    --badge-draft-text:   oklch(0.48 0.018 275);
    --badge-scheduled-bg: oklch(0.46 0.145 278 / 0.10);
    --badge-scheduled-text: oklch(0.46 0.145 278);
    --badge-sent-bg:      oklch(0.55 0.13 165 / 0.12);
    --badge-sent-text:    oklch(0.50 0.12 165);
    --badge-failed-bg:    oklch(0.55 0.15 25 / 0.10);
    --badge-failed-text:  oklch(0.52 0.14 25);
    --badge-valid-bg:     oklch(0.55 0.13 165 / 0.12);
    --badge-valid-text:   oklch(0.50 0.12 165);
    --badge-invalid-bg:   oklch(0.55 0.15 25 / 0.10);
    --badge-invalid-text: oklch(0.52 0.14 25);
    --badge-catchall-bg:  oklch(0.60 0.12 85 / 0.16);
    --badge-catchall-text: oklch(0.52 0.11 85);
    --badge-risky-bg:     oklch(0.60 0.12 55 / 0.14);
    --badge-risky-text:   oklch(0.52 0.12 55);
    --badge-unknown-bg:   oklch(0.60 0.012 275 / 0.12);
    --badge-unknown-text: oklch(0.55 0.014 275);
    --badge-scored-bg:    oklch(0.46 0.145 278 / 0.10);
    --badge-scored-text:  oklch(0.46 0.145 278);
    --badge-skipped-bg:   oklch(0.55 0.13 165 / 0.12);
    --badge-skipped-text: oklch(0.50 0.12 165);

    /* Dimensions */
    --sidebar-width: 220px;
    --sidebar-collapsed: 56px;
    --radius-sm: 5px;
    --radius-md: 8px;
    --radius-lg: 12px;

    /* Transitions — functional only, 150-200ms */
    --transition-fast: 150ms ease-out;
    --transition-normal: 200ms ease-out;

    /* Shadows — blue-tinted, subtle for light surfaces */
    --shadow-sm: 0 1px 2px oklch(0.30 0.02 275 / 0.08);
    --shadow-md: 0 2px 8px oklch(0.30 0.02 275 / 0.10);
}


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

html {
    font-size: 14px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.55;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--text-link);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-hover);
}

a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 2px;
}


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


/* --- Sidebar Navigation --- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    height: 100vh;
    transition: width var(--transition-normal);
}

.sidebar-header {
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-logo {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
    white-space: nowrap;
    transition: opacity var(--transition-fast);
}

.sidebar-logo span {
    font-weight: 400;
    color: var(--text-secondary);
}

.sidebar-toggle-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    width: 26px;
    height: 26px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background var(--transition-fast), color var(--transition-fast), transform var(--transition-normal);
}

.sidebar-toggle-btn:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.sidebar-toggle-btn svg {
    width: 15px;
    height: 15px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sidebar-nav {
    flex: 1 1 auto;
    padding: 8px 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.sidebar-nav::-webkit-scrollbar {
    display: none;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.86rem;
    font-weight: 500;
    white-space: nowrap;
    text-decoration: none;
    line-height: 1.2;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.nav-link:hover {
    background: var(--accent-muted);
    color: var(--text-primary);
}

.nav-link.active {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
}

.nav-icon {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nav-icon svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.nav-text {
    transition: opacity var(--transition-fast);
}

/* Sidebar Footer (User Card & Actions) */
.sidebar-footer {
    flex-shrink: 0;
    padding: 8px;
    border-top: 1px solid var(--border);
    background: oklch(0.965 0.006 275);
}

.user-card {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.user-card-top {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.user-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    border: 1px solid var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
    flex: 1;
    overflow: hidden;
}

.user-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-badge {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 1px 4px;
    border-radius: 3px;
    background: var(--accent-soft);
    color: var(--accent);
    letter-spacing: 0.3px;
    flex-shrink: 0;
}

.user-card-actions {
    display: flex;
    align-items: center;
    gap: 5px;
}

.footer-action-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 5px 8px;
    font-size: 0.76rem;
    font-weight: 500;
    font-family: inherit;
    border-radius: var(--radius-sm);
    text-decoration: none;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--bg-surface);
    color: var(--text-secondary);
    line-height: 1;
    transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

.footer-action-btn svg {
    width: 13px;
    height: 13px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    flex-shrink: 0;
}

.admin-btn:hover {
    background: var(--accent-soft);
    color: var(--accent);
    border-color: var(--accent);
}

.logout-form {
    flex: 1;
    margin: 0;
    display: flex;
}

.logout-btn {
    width: 100%;
}

.logout-btn:hover {
    background: var(--badge-failed-bg);
    color: var(--color-danger);
    border-color: oklch(0.55 0.15 25 / 0.35);
}

/* Collapsed Sidebar State */
body.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed);
}

body.sidebar-collapsed .main-content {
    margin-left: var(--sidebar-collapsed);
}

body.sidebar-collapsed .sidebar-header {
    padding: 0 10px;
    justify-content: center;
}

body.sidebar-collapsed .sidebar-logo {
    display: none;
}

body.sidebar-collapsed .sidebar-toggle-btn svg {
    transform: rotate(180deg);
}

body.sidebar-collapsed .nav-link {
    justify-content: center;
    padding: 8px 0;
}

body.sidebar-collapsed .nav-text {
    display: none;
}

body.sidebar-collapsed .sidebar-footer {
    padding: 8px 4px;
}

body.sidebar-collapsed .user-card {
    background: transparent;
    border: none;
    padding: 0;
    align-items: center;
    gap: 6px;
}

body.sidebar-collapsed .user-info,
body.sidebar-collapsed .admin-btn,
body.sidebar-collapsed .logout-btn span {
    display: none;
}

body.sidebar-collapsed .logout-btn {
    padding: 6px;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
}

/* --- Main Content --- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left var(--transition-normal);
}

.page-header {
    padding: 20px 28px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-raised);
}

.page-header h1 {
    font-size: 1.35rem;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.2px;
}

.page-header p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 2px;
}

.page-body {
    padding: 28px;
}


/* --- Inline Stats Bar (replaces stat cards — no hero-metric template) --- */
.stats-bar {
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0;
    margin-bottom: 24px;
    overflow: hidden;
}

.stats-bar .stat-item {
    display: flex;
    align-items: baseline;
    gap: 6px;
    padding: 14px 18px;
    border-right: 1px solid var(--border);
    white-space: nowrap;
}

.stats-bar .stat-item:last-child {
    border-right: none;
}

.stats-bar .stat-value {
    font-size: 1.15rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.stats-bar .stat-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Stat value colors */
.stat-accent  { color: var(--accent); }
.stat-success { color: var(--color-success); }
.stat-warning { color: var(--color-warning); }
.stat-danger  { color: var(--color-danger); }
.stat-info    { color: var(--color-info); }
.stat-muted   { color: var(--text-secondary); }


/* --- Legacy stat cards (kept for backward compat, restyled) --- */
.stats-row {
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0;
    margin-bottom: 24px;
    overflow: hidden;
}

.stat-card {
    display: flex;
    align-items: baseline;
    gap: 6px;
    padding: 14px 18px;
    border-right: 1px solid var(--border);
    background: transparent;
    border-radius: 0;
    white-space: nowrap;
}

.stat-card:last-child {
    border-right: none;
}

/* No hover effect — decorative motion banned */
.stat-card:hover {
    transform: none;
    box-shadow: none;
}

.stat-card .stat-value {
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.stat-card .stat-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 500;
}


/* --- Cards --- */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.card-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h2 {
    font-size: 0.9rem;
    font-weight: 600;
}

.card-body {
    padding: 18px;
}


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

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    padding: 10px 14px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    user-select: none;
}

thead th a {
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

thead th a:hover {
    color: var(--text-secondary);
}

thead th a.sorted {
    color: var(--accent);
}

tbody tr {
    transition: background var(--transition-fast);
}

tbody tr:nth-child(even) {
    background: oklch(0.965 0.006 275 / 0.6);
}

tbody tr:hover {
    background: var(--bg-surface-hover);
}

tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid oklch(0.89 0.012 275 / 0.7);
    font-size: 0.88rem;
}

tbody td.text-muted {
    color: var(--text-muted);
}

.table-empty {
    text-align: center;
    padding: 44px 16px;
    color: var(--text-muted);
}

.table-empty .empty-icon {
    width: 40px;
    height: 40px;
    margin: 0 auto 12px;
    opacity: 0.3;
    color: var(--text-muted);
}

.table-empty .empty-icon svg {
    width: 40px;
    height: 40px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.5;
}

.table-empty p {
    font-size: 0.88rem;
    max-width: 360px;
    margin: 0 auto;
    line-height: 1.5;
}


/* --- Badges --- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.2px;
    white-space: nowrap;
}

.badge-draft     { background: var(--badge-draft-bg); color: var(--badge-draft-text); }
.badge-scheduled { background: var(--badge-scheduled-bg); color: var(--badge-scheduled-text); }
.badge-sent      { background: var(--badge-sent-bg); color: var(--badge-sent-text); }
.badge-failed    { background: var(--badge-failed-bg); color: var(--badge-failed-text); }
.badge-valid     { background: var(--badge-valid-bg); color: var(--badge-valid-text); }
.badge-invalid   { background: var(--badge-invalid-bg); color: var(--badge-invalid-text); }
.badge-catchall  { background: var(--badge-catchall-bg); color: var(--badge-catchall-text); }
.badge-risky     { background: var(--badge-risky-bg); color: var(--badge-risky-text); }
.badge-unknown   { background: var(--badge-unknown-bg); color: var(--badge-unknown-text); }
.badge-scored    { background: var(--badge-scored-bg); color: var(--badge-scored-text); }
.badge-skipped   { background: var(--badge-skipped-bg); color: var(--badge-skipped-text); }

.badge-tier {
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.72rem;
    font-weight: 600;
}

.badge-tier.dupont {
    background: var(--accent-soft);
    color: var(--accent);
    border: 1px solid oklch(0.46 0.145 278 / 0.30);
}

.badge-tier.jamesedition {
    background: #eef4ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

.badge-tier.carscom {
    background: #fef3ec;
    color: #c2410c;
    border: 1px solid #fed7aa;
}


/* --- Score Indicators --- */
.score-gauge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    background: var(--bg-input);
}

.score-good    { color: var(--color-good); }
.score-average { color: var(--color-average); }
.score-poor    { color: var(--color-poor); }
.score-na      { color: var(--text-muted); }

.score-bar {
    height: 4px;
    background: var(--bg-input);
    border-radius: 2px;
    overflow: hidden;
    width: 100%;
}

.score-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width var(--transition-normal);
}

.score-bar-fill.good    { background: var(--color-good); }
.score-bar-fill.average { background: var(--color-average); }
.score-bar-fill.poor    { background: var(--color-poor); }


/* --- Forms --- */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.form-control {
    width: 100%;
    padding: 9px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.88rem;
    transition: border-color var(--transition-fast);
    outline: none;
}

.form-control:hover {
    border-color: var(--border-hover);
}

.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-soft);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-control:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath fill='%23777' d='M5 6L0 0h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px;
}

textarea.form-control {
    resize: vertical;
    min-height: 72px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
}

.form-inline {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.form-inline .form-control {
    width: auto;
    min-width: 160px;
}


/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
}

/* No translateY on hover — decorative motion banned */
.btn:hover {
    transform: none;
}

.btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.btn:active {
    opacity: 0.85;
}

.btn-primary {
    background: var(--accent);
    color: oklch(0.99 0.004 275);
}

.btn-primary:hover {
    background: var(--accent-hover);
    color: oklch(0.99 0.004 275);
}

.btn-secondary {
    background: var(--bg-surface);
    border-color: var(--border);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--bg-surface-hover);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.btn-danger {
    background: var(--badge-failed-bg);
    border-color: oklch(0.55 0.15 25 / 0.30);
    color: var(--badge-failed-text);
}

.btn-danger:hover {
    background: oklch(0.55 0.15 25 / 0.16);
    border-color: oklch(0.55 0.15 25 / 0.45);
    color: var(--badge-failed-text);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 0.80rem;
}

.btn-disabled,
.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-group {
    display: flex;
    gap: 6px;
}


/* --- Toolbar --- */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}


/* --- Provider Picker --- */
.provider-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 8px;
}

.provider-option {
    position: relative;
}

.provider-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.provider-option label {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: border-color var(--transition-fast), color var(--transition-fast), background var(--transition-fast);
    text-align: center;
}

.provider-option input[type="radio"]:checked + label {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
}

.provider-option label:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.provider-option input[type="radio"]:focus-visible + label {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}


/* --- Messages (Django) --- */
.messages-container {
    padding: 0 28px;
    margin-top: 14px;
}

.alert {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.alert-success {
    background: oklch(0.55 0.13 165 / 0.08);
    border: 1px solid oklch(0.55 0.13 165 / 0.30);
    color: oklch(0.48 0.12 165);
}

.alert-danger,
.alert-error {
    background: oklch(0.55 0.15 25 / 0.08);
    border: 1px solid oklch(0.55 0.15 25 / 0.30);
    color: oklch(0.50 0.14 25);
}

.alert-warning {
    background: oklch(0.60 0.12 85 / 0.12);
    border: 1px solid oklch(0.60 0.12 85 / 0.32);
    color: oklch(0.50 0.11 85);
}

.alert-info {
    background: oklch(0.46 0.145 278 / 0.08);
    border: 1px solid oklch(0.46 0.145 278 / 0.30);
    color: oklch(0.46 0.145 278);
}


/* --- Detail Page --- */
.detail-grid {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 20px;
}

.detail-section {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 18px;
}

.detail-section h3 {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 0;
    border-bottom: 1px solid oklch(0.89 0.012 275 / 0.7);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-row .label {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.detail-row .value {
    font-size: 0.85rem;
    font-weight: 500;
    text-align: right;
    max-width: 60%;
    word-break: break-word;
}


/* --- PSI Scores Grid --- */
.psi-scores-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}

.psi-score-item {
    text-align: center;
    padding: 10px 6px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
}

.psi-score-item .score-label {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 4px;
}


/* --- Confirm Delete --- */
.confirm-delete {
    max-width: 460px;
    margin: 56px auto;
    text-align: center;
}

.confirm-delete .warning-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 14px;
    color: var(--color-warning);
}

.confirm-delete .warning-icon svg {
    width: 48px;
    height: 48px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.confirm-delete h2 {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.confirm-delete p {
    color: var(--text-secondary);
    font-size: 0.88rem;
    margin-bottom: 22px;
    line-height: 1.5;
}


/* --- Empty States --- */
.empty-state {
    text-align: center;
    padding: 52px 20px;
}

.empty-state .empty-icon {
    width: 40px;
    height: 40px;
    margin: 0 auto 14px;
    opacity: 0.3;
    color: var(--text-muted);
}

.empty-state .empty-icon svg {
    width: 40px;
    height: 40px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.5;
}

.empty-state h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 18px;
}


/* --- Responsive --- */
@media (max-width: 1024px) {
    .sidebar {
        width: var(--sidebar-collapsed);
    }

    .sidebar .nav-text,
    .sidebar-logo span {
        display: none;
    }

    .sidebar-logo {
        font-size: 1rem;
    }

    .main-content {
        margin-left: var(--sidebar-collapsed);
    }

    .psi-scores-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .stats-row,
    .stats-bar {
        flex-wrap: wrap;
    }

    .stat-card {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
}

@media (max-width: 768px) {
    .page-header,
    .page-body,
    .messages-container {
        padding-left: 14px;
        padding-right: 14px;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .stats-row,
    .stats-bar {
        flex-direction: column;
    }

    .stat-card,
    .stats-bar .stat-item {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
}


/* --- Stats dashboard charts --- */
.chart-card {
    margin-bottom: 24px;
}
.chart-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}
.chart-grid .chart-card {
    margin-bottom: 0;
}
.chart-wrap {
    position: relative;
    height: 260px;
}
.chart-wrap.chart-tall {
    height: 320px;
}
@media (max-width: 900px) {
    .chart-grid {
        grid-template-columns: 1fr;
    }
}

/* --- Utilities --- */
.text-center   { text-align: center; }.text-right    { text-align: right; }
.text-muted    { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-success  { color: var(--color-success); }
.text-danger   { color: var(--color-danger); }
.text-warning  { color: var(--color-warning); }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --- Batch progress (bulk runs: numbers + bar, no page refresh) --- */
.batch-progress {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin-bottom: 16px;
}
.batch-progress[hidden] { display: none; }
.batch-progress-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}
.batch-progress-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}
.batch-progress-track {
    height: 8px;
    border-radius: 999px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    overflow: hidden;
}
.batch-progress-fill {
    height: 100%;
    width: 0%;
    border-radius: 999px;
    background: var(--accent);
    transition: width 200ms ease-out;
}
.batch-progress-stats {
    margin-top: 6px;
    font-size: 0.78rem;
    color: var(--text-secondary);
}
