/* =============================================
   Insyte Agent — Design System
   ============================================= */

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

/* ── Variables ───────────────────────────────── */
:root {
    --primary:        #7c3aed;
    --primary-hover:  #6d28d9;
    --primary-2:      #4f46e5;
    --primary-light:  #ede9fe;
    --primary-glow:   rgba(124,58,237,0.15);
    --primary-gradient: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%);

    --sidebar-bg:     #0f0f10;
    --sidebar-border: #1f1f23;
    --sidebar-text:   #a1a1aa;
    --sidebar-hover:  #1f1f24;
    --sidebar-active: #ffffff;

    --bg:             #f8f8fb;
    --surface:        #ffffff;
    --surface-2:      #f4f4f8;
    --border:         #e4e4e7;
    --border-light:   #f0f0f3;

    --text:           #0f0f10;
    --text-2:         #52525b;
    --text-3:         #a1a1aa;

    --success:        #10b981;
    --success-light:  #d1fae5;
    --warning:        #f59e0b;
    --warning-light:  #fef3c7;
    --danger:         #ef4444;
    --danger-light:   #fee2e2;
    --info:           #3b82f6;
    --info-light:     #dbeafe;

    --radius-sm:  6px;
    --radius:     10px;
    --radius-lg:  16px;
    --radius-xl:  24px;

    --shadow-sm:  0 1px 2px rgba(16,24,40,.04), 0 1px 3px rgba(16,24,40,.06);
    --shadow:     0 4px 10px rgba(16,24,40,.06), 0 2px 4px rgba(16,24,40,.04);
    --shadow-lg:  0 18px 48px rgba(16,24,40,.12), 0 6px 16px rgba(16,24,40,.06);

    --sidebar-w:  240px;
    --header-h:   60px;
    --transition: .18s ease;
}

/* ── Reset ───────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
input, textarea, select, button { font-family: inherit; }

/* ── Scrollbar ───────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

/* =============================================
   AUTH PAGES
   ============================================= */
.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #0f0f10 0%, #1a0a2e 50%, #0f0f10 100%);
    padding: 24px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border-radius: var(--radius-xl);
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

.auth-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 32px;
}

.auth-logo-icon {
    width: 40px;
    height: 40px;
    background: url('../img/icon.png') center/contain no-repeat;
}

.auth-logo-icon svg { display: none; }

.auth-logo-text {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
}

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

.auth-subtitle {
    font-size: .9rem;
    color: var(--text-2);
    margin-bottom: 28px;
}

.auth-footer {
    text-align: center;
    font-size: .85rem;
    color: var(--text-3);
    margin-top: 24px;
}

.auth-footer a {
    color: var(--primary);
    font-weight: 500;
}

.auth-footer a:hover { text-decoration: underline; }

/* ── Alert ───────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: .875rem;
    margin-bottom: 20px;
    display: none;
}
.alert.show { display: block; }
.alert-error   { background: var(--danger-light);  color: #b91c1c; }
.alert-success { background: var(--success-light); color: #065f46; }
.alert-info    { background: var(--info-light);    color: #1e40af; }

/* =============================================
   FORM ELEMENTS
   ============================================= */
.form-group { margin-bottom: 18px; }

.form-label {
    display: block;
    font-size: .8rem;
    font-weight: 600;
    color: var(--text-2);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: .9rem;
    color: var(--text);
    background: var(--surface);
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-control::placeholder { color: var(--text-3); }
.form-control.is-error { border-color: var(--danger); }

.form-control-icon {
    position: relative;
}
.form-control-icon .icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-3);
    width: 16px;
    height: 16px;
}
.form-control-icon .form-control { padding-left: 40px; }

.form-hint {
    font-size: .78rem;
    color: var(--text-3);
    margin-top: 4px;
}

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

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* ── Password toggle ─────────────────────────── */
.input-password { position: relative; }
.input-password .form-control { padding-right: 44px; }
.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-3);
    padding: 4px;
    display: flex;
    align-items: center;
    transition: color var(--transition);
}
.password-toggle:hover { color: var(--text-2); }

/* =============================================
   BUTTONS
   ============================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: .9rem;
    font-weight: 600;
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    outline: none;
}

.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn-primary {
    background: var(--primary-gradient);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(124,58,237,.25);
}
.btn-primary:hover {
    box-shadow: 0 6px 18px rgba(124,58,237,.4);
    transform: translateY(-1px);
    filter: brightness(1.05);
}

.btn-outline {
    background: transparent;
    color: var(--text-2);
    border-color: var(--border);
}
.btn-outline:hover {
    background: var(--surface-2);
    border-color: var(--text-3);
    color: var(--text);
}

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

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

.btn-sm { padding: 6px 14px; font-size: .82rem; }
.btn-lg { padding: 13px 28px; font-size: 1rem; }
.btn-full { width: 100%; }

.btn:disabled {
    opacity: .6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.btn-loading .btn-text { opacity: 0; }
.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px; height: 16px;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .6s linear infinite;
}

/* =============================================
   DASHBOARD LAYOUT
   ============================================= */
.layout {
    display: flex;
    min-height: 100vh;
}

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

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 18px;
    border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-logo-icon {
    width: 34px; height: 34px;
    background: url('../img/icon.png') center/contain no-repeat;
    flex-shrink: 0;
}
.sidebar-logo-icon svg { display: none; }

.sidebar-logo-name {
    font-size: .95rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -.01em;
}

.sidebar-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }

.sidebar-section {
    margin-bottom: 8px;
}

.sidebar-section-label {
    font-size: .65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: #71717a;
    padding: 10px 10px 4px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 12px;
    border-radius: var(--radius);
    color: var(--sidebar-text);
    font-size: .875rem;
    font-weight: 500;
    transition: all var(--transition);
    cursor: pointer;
    margin-bottom: 2px;
    position: relative;
}

.sidebar-link svg { width: 18px; height: 18px; flex-shrink: 0; transition: color var(--transition); }

.sidebar-link:hover {
    background: var(--sidebar-hover);
    color: #f4f4f5;
}

.sidebar-link.active {
    background: linear-gradient(135deg, rgba(124,58,237,.25), rgba(79,70,229,.15));
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(124,58,237,.3);
}
.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: -10px; top: 50%; transform: translateY(-50%);
    width: 3px; height: 20px;
    background: var(--primary-gradient);
    border-radius: 0 3px 3px 0;
}

.sidebar-link.active svg { color: #a78bfa; }

.sidebar-link .badge {
    margin-left: auto;
    background: var(--primary);
    color: #fff;
    font-size: .65rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 99px;
}

.sidebar-bottom {
    border-top: 1px solid var(--sidebar-border);
    padding: 12px 10px;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition);
}
.sidebar-user:hover { background: var(--sidebar-hover); }

.sidebar-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--primary-gradient);
    display: grid;
    place-items: center;
    color: #fff;
    font-size: .78rem;
    font-weight: 700;
    flex-shrink: 0;
    overflow: hidden;
}
.sidebar-avatar img { width: 100%; height: 100%; object-fit: cover; }

.sidebar-user-info { flex: 1; overflow: hidden; }
.sidebar-user-name {
    font-size: .82rem;
    font-weight: 600;
    color: #d4d4d8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-user-plan {
    font-size: .72rem;
    color: var(--sidebar-text);
}

/* ── Main Content ────────────────────────────── */
.main {
    margin-left: var(--sidebar-w);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Header ──────────────────────────────────── */
.header {
    height: var(--header-h);
    background: rgba(255,255,255,.8);
    backdrop-filter: saturate(180%) blur(10px);
    -webkit-backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
}
body.dark-theme .header { background: rgba(24,24,27,.8); }

.header-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    flex: 1;
}

.header-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface-2);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 7px 14px;
    flex: 0 0 260px;
    transition: border-color var(--transition);
}
.header-search:focus-within { border-color: var(--primary); }
.header-search svg { width: 15px; height: 15px; color: var(--text-3); }
.header-search input {
    border: none;
    background: none;
    outline: none;
    font-size: .875rem;
    color: var(--text);
    width: 100%;
}

.header-actions { display: flex; align-items: center; gap: 8px; }

.header-icon-btn {
    width: 36px; height: 36px;
    border-radius: var(--radius);
    display: grid;
    place-items: center;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-2);
    transition: all var(--transition);
    position: relative;
}
.header-icon-btn:hover { background: var(--surface-2); color: var(--text); }
.header-icon-btn svg { width: 18px; height: 18px; }

.notif-dot {
    position: absolute;
    top: 6px; right: 6px;
    width: 7px; height: 7px;
    background: var(--danger);
    border-radius: 50%;
    border: 1.5px solid var(--surface);
}

.header-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--primary-gradient);
    display: grid;
    place-items: center;
    color: #fff;
    font-size: .8rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform var(--transition);
}
.header-avatar:hover { transform: scale(1.05); }

/* ── Page Content ────────────────────────────── */
.page-content {
    padding: 28px 28px;
    flex: 1;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
}

.page-title {
    font-size: 1.55rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1.25;
    letter-spacing: -.02em;
}

.page-subtitle {
    font-size: .875rem;
    color: var(--text-2);
    margin-top: 3px;
}

/* =============================================
   CARDS
   ============================================= */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition), border-color var(--transition);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.card-title {
    font-size: .95rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -.01em;
}

/* ── Stat Cards ──────────────────────────────── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
}
.stat-card:hover { border-color: rgba(124,58,237,.25); }

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

.stat-icon {
    width: 40px; height: 40px;
    border-radius: var(--radius);
    display: grid;
    place-items: center;
}
.stat-icon svg { width: 20px; height: 20px; }
.stat-icon.purple { background: var(--primary-light); color: var(--primary); }
.stat-icon.green  { background: var(--success-light); color: var(--success); }
.stat-icon.amber  { background: var(--warning-light); color: var(--warning); }
.stat-icon.blue   { background: var(--info-light);    color: var(--info); }

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

.stat-label {
    font-size: .82rem;
    color: var(--text-3);
    font-weight: 500;
}

.stat-change {
    font-size: .78rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 3px;
}
.stat-change.up   { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* =============================================
   TABLES
   ============================================= */
.table-wrap { overflow-x: auto; }

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

thead th {
    text-align: left;
    padding: 10px 14px;
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-3);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

tbody td {
    padding: 14px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-2);
    vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }

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

/* =============================================
   BADGES & PILLS
   ============================================= */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 99px;
    font-size: .75rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-green   { background: var(--success-light); color: #065f46; }
.badge-red     { background: var(--danger-light);  color: #b91c1c; }
.badge-amber   { background: var(--warning-light); color: #92400e; }
.badge-blue    { background: var(--info-light);    color: #1e40af; }
.badge-purple  { background: var(--primary-light); color: var(--primary); }
.badge-gray    { background: var(--surface-2);     color: var(--text-3); }

/* ── Toggle Switch ───────────────────────────── */
.toggle {
    position: relative;
    width: 40px; height: 22px;
    display: inline-block;
    flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--border);
    border-radius: 99px;
    cursor: pointer;
    transition: background var(--transition);
}
.toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px; height: 16px;
    left: 3px; bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform var(--transition);
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ── Dropdown ────────────────────────────────── */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
    display: none;
    position: absolute;
    right: 0; top: calc(100% + 6px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    z-index: 200;
    overflow: hidden;
    animation: fadeDown .15s ease;
}
.dropdown-menu.show { display: block; }
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-size: .875rem;
    color: var(--text-2);
    cursor: pointer;
    transition: background var(--transition);
}
.dropdown-item:hover { background: var(--surface-2); color: var(--text); }
.dropdown-item svg { width: 15px; height: 15px; }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger:hover { background: var(--danger-light); }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ── Empty State ─────────────────────────────── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
    text-align: center;
    gap: 14px;
}
.empty-icon {
    width: 64px; height: 64px;
    background: var(--surface-2);
    border-radius: var(--radius-lg);
    display: grid;
    place-items: center;
    color: var(--text-3);
}
.empty-icon svg { width: 28px; height: 28px; }
.empty-title { font-size: 1rem; font-weight: 600; color: var(--text); }
.empty-desc  { font-size: .875rem; color: var(--text-3); max-width: 300px; }

/* ── Divider ─────────────────────────────────── */
.divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
    color: var(--text-3);
    font-size: .8rem;
}
.divider::before, .divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* =============================================
   ANIMATIONS
   ============================================= */
@keyframes spin     { to { transform: rotate(360deg); } }
@keyframes fadeDown { from { opacity:0; transform:translateY(-6px); } to { opacity:1; transform:translateY(0); } }
@keyframes fadeIn   { from { opacity:0; } to { opacity:1; } }
@keyframes slideUp  { from { opacity:0; transform:translateY(16px); } to { opacity:1; transform:translateY(0); } }

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 768px) {
    .sidebar {
        position: fixed; top: 0; left: 0; bottom: 0;
        transform: translateX(-100%);
        z-index: 1000;
        box-shadow: 0 0 40px rgba(0,0,0,.3);
        transition: transform .25s ease;
    }
    .sidebar.open { transform: translateX(0); }
    /* Backdrop when sidebar is open */
    .sidebar.open::after {
        content: ''; position: fixed; top: 0; left: var(--sidebar-w); right: -100vw; bottom: 0;
        background: rgba(0,0,0,.4);
    }
    .main { margin-left: 0; }

    /* Show the hamburger toggle (hidden by default inline) */
    #sidebarToggle { display: flex !important; }

    .stat-grid { grid-template-columns: 1fr 1fr; }
    .page-content { padding: 16px; }
    .header-search { display: none; }
    .header { padding: 0 14px; }
    .header-title { font-size: .95rem; }

    /* Stack common inline-styled grids on mobile */
    [style*="grid-template-columns:repeat(4"],
    [style*="grid-template-columns:repeat(3"],
    [style*="grid-template-columns: repeat(4"],
    [style*="grid-template-columns: repeat(3"] {
        grid-template-columns: 1fr 1fr !important;
    }
    [style*="grid-template-columns:1fr 1fr"],
    [style*="grid-template-columns: 1fr 1fr"],
    [style*="grid-template-columns:280px"],
    [style*="grid-template-columns:1fr 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
    .settings-tabs { overflow-x: auto; }
}

@media (max-width: 480px) {
    [style*="grid-template-columns:repeat(4"],
    [style*="grid-template-columns: repeat(4"],
    [style*="grid-template-columns:repeat(3"] {
        grid-template-columns: 1fr !important;
    }
    .page-content { padding: 12px; }
}

/* ── Settings Tabs ───────────────────────────── */
.settings-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
    overflow-x: auto;
}
.settings-tab {
    padding: 10px 16px;
    font-size: .85rem;
    font-weight: 600;
    color: var(--text-3);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
    transition: color var(--transition), border-color var(--transition);
}
.settings-tab:hover { color: var(--text-2); }
.settings-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* ── Dark Theme ───────────────────────────────── */
body.dark-theme {
    --bg:             #0f0f12;
    --surface:        #18181b;
    --surface-2:      #232327;
    --border:         #2e2e33;
    --border-light:   #26262a;

    --text:           #f4f4f5;
    --text-2:         #a1a1aa;
    --text-3:         #71717a;

    --primary-light:  #2a1e4a;

    --success-light:  #0f3a2c;
    --warning-light:  #3d2f0a;
    --danger-light:   #3d1f1f;
    --info-light:     #1a2f4a;

    --shadow-sm:  0 1px 3px rgba(0,0,0,.4), 0 1px 2px rgba(0,0,0,.3);
    --shadow:     0 4px 12px rgba(0,0,0,.45), 0 2px 4px rgba(0,0,0,.3);
    --shadow-lg:  0 12px 40px rgba(0,0,0,.55), 0 4px 12px rgba(0,0,0,.35);

    color-scheme: dark;
}

/* Inline-styled surfaces that don't use variables */
body.dark-theme .card { background: var(--surface); }
body.dark-theme input,
body.dark-theme textarea,
body.dark-theme select {
    background: var(--surface-2);
    color: var(--text);
    border-color: var(--border);
}
body.dark-theme input::placeholder,
body.dark-theme textarea::placeholder { color: var(--text-3); }

/* Badge contrast fixes for dark */
body.dark-theme .badge-green  { background: var(--success-light); color: #4ade80; }
body.dark-theme .badge-purple { background: var(--primary-light); color: #c4b5fd; }
body.dark-theme .badge-gray   { background: var(--surface-2);     color: var(--text-3); }

/* Hardcoded light backgrounds in inline styles → soften in dark */
body.dark-theme [style*="background:#f8fafc"],
body.dark-theme [style*="background:#fff"],
body.dark-theme [style*="background:#ffffff"] { background: var(--surface) !important; }
body.dark-theme [style*="background:#fef2f2"],
body.dark-theme [style*="background:#fee2e2"] { background: var(--danger-light) !important; }
body.dark-theme [style*="background:#dcfce7"] { background: var(--success-light) !important; }
