:root {
  --primary: #1a56db;
  --primary-dark: #1244b4;
  --primary-light: #e8f0fe;
  --secondary: #374151;
  --success: #059669;
  --danger: #dc2626;
  --warning: #d97706;
  --info: #0891b2;
  --bg: #f3f4f6;
  --surface: #ffffff;
  --border: #e5e7eb;
  --border-dark: #d1d5db;
  --text: #111827;
  --text-muted: #6b7280;
  --text-light: #9ca3af;
  --sidebar-w: 260px;
  --header-h: 60px;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -1px rgba(0,0,0,.04);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; overflow-x: hidden; max-width: 100%; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); line-height: 1.5; min-height: 100vh; overflow-x: hidden; max-width: 100%; }
body.sidebar-open { overflow: hidden; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
svg { display: inline-block; vertical-align: middle; }
button { cursor: pointer; }

/* Layout */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; z-index: 200; overflow-y: auto; }
.main-content { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; min-width: 0; max-width: 100%; overflow-x: hidden; }
.header { height: var(--header-h); background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; position: sticky; top: 0; z-index: 90; box-shadow: var(--shadow); }
.page-content { flex: 1; padding: 24px; min-width: 0; overflow-x: hidden; }

/* Sidebar */
.sidebar-logo { padding: 20px 20px 16px; border-bottom: 1px solid var(--border); }
.sidebar-logo h2 { font-size: 1.25rem; font-weight: 700; color: var(--primary); letter-spacing: -.5px; }
.sidebar-logo span { font-size: .75rem; color: var(--text-muted); }
.sidebar-nav { flex: 1; padding: 12px 0; }
.nav-section { padding: 8px 16px 4px; font-size: .7rem; font-weight: 600; color: var(--text-light); text-transform: uppercase; letter-spacing: .08em; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 16px; color: var(--text-muted); font-size: .875rem; font-weight: 500; border-left: 3px solid transparent; transition: all .15s; }
.nav-item:hover, .nav-item.active { background: var(--primary-light); color: var(--primary); border-left-color: var(--primary); text-decoration: none; }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-badge { margin-left: auto; background: var(--danger); color: #fff; font-size: .65rem; font-weight: 700; padding: 2px 6px; border-radius: 20px; min-width: 18px; text-align: center; }
.sidebar-user { padding: 16px; border-top: 1px solid var(--border); }
.sidebar-user-info { display: flex; align-items: center; gap: 10px; }
.user-avatar { width: 36px; height: 36px; background: var(--primary); color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .875rem; flex-shrink: 0; }
.user-avatar-sm { width: 28px; height: 28px; font-size: .75rem; }
.user-name { font-weight: 600; font-size: .875rem; color: var(--text); line-height: 1.2; }
.user-role { font-size: .7rem; color: var(--text-muted); }

/* Header */
.header-left { display: flex; align-items: center; gap: 16px; }
.page-title { font-size: 1.05rem; font-weight: 600; color: var(--text); }
.header-right { display: flex; align-items: center; gap: 12px; }
.btn-icon { background: none; border: 1px solid var(--border); border-radius: var(--radius); width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; color: var(--text-muted); transition: all .15s; position: relative; }
.btn-icon:hover { border-color: var(--primary); color: var(--primary); }

/* Sidebar close button — ONLY on mobile */
.sidebar-close-btn { display: none !important; }
#menu-toggle { display: none !important; background: none; border: 1px solid var(--border); border-radius: var(--radius); width: 36px; height: 36px; align-items: center; justify-content: center; color: var(--text-muted); cursor: pointer; flex-shrink: 0; transition: border-color .15s, color .15s; }
#menu-toggle:hover { border-color: var(--primary); color: var(--primary); }
#menu-toggle svg { width: 20px; height: 20px; }
#sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 150; opacity: 0; transition: opacity .25s; }
#sidebar-overlay.visible { opacity: 1; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-title { font-size: .95rem; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 8px; }
.card-body { padding: 20px; }

/* Stats */
.stats-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); padding: 20px; box-shadow: var(--shadow); display: flex; align-items: flex-start; gap: 14px; }
.stat-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon.blue { background: #dbeafe; color: #1d4ed8; }
.stat-icon.green { background: #d1fae5; color: #065f46; }
.stat-icon.yellow { background: #fef3c7; color: #92400e; }
.stat-icon.red { background: #fee2e2; color: #991b1b; }
.stat-icon.purple { background: #ede9fe; color: #5b21b6; }
.stat-icon.cyan { background: #cffafe; color: #155e75; }
.stat-icon.warning { background: #fef3c7; color: #92400e; }
.stat-icon.danger { background: #fee2e2; color: #991b1b; }
.stat-icon.success { background: #d1fae5; color: #065f46; }
.stat-info { flex: 1; }
.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--text); line-height: 1; }
.stat-label { font-size: .75rem; color: var(--text-muted); margin-top: 4px; }
.stat-sub { font-size: .7rem; color: var(--text-light); margin-top: 2px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: var(--radius); font-size: .875rem; font-weight: 500; border: 1px solid transparent; transition: all .15s; cursor: pointer; white-space: nowrap; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); text-decoration: none; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-dark); }
.btn-secondary:hover { background: var(--bg); text-decoration: none; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-sm { padding: 5px 11px; font-size: .8rem; }
.btn-xs { padding: 3px 8px; font-size: .75rem; }
.btn-outline-primary { border-color: var(--primary); color: var(--primary); background: transparent; }
.btn-outline-primary:hover { background: var(--primary-light); text-decoration: none; }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg); border-color: var(--border); color: var(--text); text-decoration: none; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: .875rem; font-weight: 500; color: var(--secondary); margin-bottom: 6px; }
.form-control { width: 100%; padding: 9px 12px; border: 1px solid var(--border-dark); border-radius: var(--radius); font-size: .875rem; color: var(--text); background: var(--surface); transition: border-color .15s; outline: none; }
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,86,219,.1); }
.form-control::placeholder { color: var(--text-light); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-hint { font-size: .75rem; color: var(--text-muted); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-check { display: flex; align-items: center; gap: 8px; }
.form-check input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }
.form-check label { font-size: .875rem; color: var(--text); cursor: pointer; }

/* Tables */
.table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
table th { padding: 11px 14px; text-align: left; font-size: .75rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; background: var(--bg); border-bottom: 1px solid var(--border); white-space: nowrap; }
table td { padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: .875rem; color: var(--text); vertical-align: middle; }
table tr:last-child td { border-bottom: none; }
table tr:hover td { background: var(--bg); }
.table-actions { display: flex; gap: 6px; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 20px; font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.badge-active, .badge-completed, .badge-paid { background: #d1fae5; color: #065f46; }
.badge-pending, .badge-open, .badge-waiting { background: #fef3c7; color: #92400e; }
.badge-blocked, .badge-cancelled, .badge-expired, .badge-failed { background: #fee2e2; color: #991b1b; }
.badge-frozen, .badge-suspended { background: #dbeafe; color: #1e40af; }
.badge-draft { background: #f3f4f6; color: #6b7280; }
.badge-monthly { background: #ede9fe; color: #5b21b6; }
.badge-annual { background: #cffafe; color: #155e75; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: .875rem; display: flex; align-items: flex-start; gap: 10px; border: 1px solid transparent; }
.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: #d1fae5; color: #065f46; border-color: #6ee7b7; }
.alert-danger { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }
.alert-warning { background: #fef3c7; color: #92400e; border-color: #fcd34d; }
.alert-info { background: #dbeafe; color: #1e40af; border-color: #93c5fd; }

/* Page header */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.page-header-left h1 { font-size: 1.35rem; font-weight: 700; color: var(--text); }
.page-header-left p { font-size: .875rem; color: var(--text-muted); margin-top: 2px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.page-subtitle { font-size: .875rem; color: var(--text-muted); margin-top: 4px; }

/* Section grid */
.section-grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 1fr 1fr 1fr; }

/* Progress bar */
.progress-bar-wrap { height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden; }
.progress-bar-fill { height: 100%; border-radius: 3px; transition: width .3s ease; }

/* Metric block */
.metric-block { }
.metric-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.metric-label { display: flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 600; color: var(--text-muted); }
.metric-label svg { width: 14px; height: 14px; }
.metric-value { font-size: .95rem; font-weight: 700; }
.metric-sub { font-size: .7rem; color: var(--text-light); margin-top: 4px; }

/* Info chip */
.info-chip { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; }
.info-chip-label { font-size: .7rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; display: flex; align-items: center; gap: 4px; margin-bottom: 4px; }
.info-chip-label svg { width: 12px; height: 12px; }
.info-chip-value { font-size: .8rem; font-weight: 500; color: var(--text); word-break: break-all; }

/* Node mini card */
.node-mini-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; transition: border-color .15s; }
.node-mini-card:hover { border-color: var(--primary); }

/* Empty state */
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.empty-state svg { width: 48px; height: 48px; margin: 0 auto 12px; color: var(--border-dark); display: block; }
.empty-state h3 { font-size: 1rem; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.empty-state p { font-size: .875rem; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px; opacity: 0; pointer-events: none; transition: opacity .2s; }
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal { background: var(--surface); border-radius: 12px; width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.2); transform: scale(.95); transition: transform .2s; }
.modal-overlay.open .modal { transform: scale(1); }
.modal-header { padding: 20px 24px 0; display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 1rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.modal-close { background: none; border: none; font-size: 1.25rem; color: var(--text-muted); cursor: pointer; padding: 4px; border-radius: 4px; }
.modal-close:hover { color: var(--danger); }
.modal-body { padding: 20px 24px; }
.modal-footer { padding: 0 24px 20px; display: flex; gap: 10px; justify-content: flex-end; }

/* Pagination */
.pagination { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.page-btn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: var(--radius); font-size: .875rem; border: 1px solid var(--border); color: var(--text); }
.page-btn:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Category filter */
.cat-filter { display: flex; gap: 8px; flex-wrap: wrap; }
.cat-btn { padding: 6px 14px; border-radius: 20px; font-size: .8rem; font-weight: 500; border: 1px solid var(--border-dark); background: var(--surface); color: var(--text-muted); cursor: pointer; transition: all .15s; }
.cat-btn.active, .cat-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-dark); border-radius: 3px; }

/* Toast */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #1f2937; color: #fff; padding: 12px 16px; border-radius: var(--radius); font-size: .875rem; max-width: 320px; box-shadow: var(--shadow-md); display: flex; align-items: center; gap: 10px; animation: slideIn .25s ease; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }
.toast.info { background: var(--info); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Utilities */
.text-muted { color: var(--text-muted) !important; }
.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-center { text-align: center; }
.fw-bold { font-weight: 700; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
.flex { display: flex; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }
.d-none { display: none; }
.p-0 { padding: 0 !important; }

/* ═══ RESPONSIVE ═══ */
@media (max-width: 768px) {
  #menu-toggle { display: flex !important; }
  #sidebar-overlay { display: block; }
  .sidebar { transform: translateX(-100%); transition: transform .25s ease; box-shadow: none; }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,.18); }
  .main-content { margin-left: 0; max-width: 100vw; }
  .layout { max-width: 100vw; overflow-x: hidden; }
  .header { padding: 0 12px; gap: 8px; }
  .page-content { padding: 12px; }
  .form-row { grid-template-columns: 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .page-header-left h1 { font-size: 1.1rem; }
  .page-actions { width: 100%; }
  .card { overflow: hidden; }
  .table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
  table { min-width: 500px; }
  table th, table td { padding: 9px 10px; font-size: .8rem; }
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal { max-width: 100%; width: 100%; border-radius: 16px 16px 0 0; max-height: 88vh; }
  .toast-container { left: 12px; right: 12px; bottom: 16px; }
  .toast { max-width: 100%; }
  .sidebar-close-btn { display: flex !important; align-items: center; justify-content: center; position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; background: none; border: 1px solid var(--border); border-radius: var(--radius); color: var(--text-muted); cursor: pointer; z-index: 1; }
  .sidebar-close-btn:hover { border-color: var(--danger); color: var(--danger); }
  .section-grid.grid-2, .section-grid.grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-header-left h1 { font-size: 1rem; }
  table th, table td { padding: 8px 8px; font-size: .75rem; }
}

/* ═══ DARK THEME ═══ */
[data-theme="dark"] {
  --bg:          #111827;
  --surface:     #1f2937;
  --border:      #374151;
  --border-dark: #4b5563;
  --text:        #f9fafb;
  --text-muted:  #9ca3af;
  --text-light:  #6b7280;
  --secondary:   #d1d5db;
  --primary-light: rgba(26,86,219,.18);
  --shadow:    0 1px 3px rgba(0,0,0,.4), 0 1px 2px rgba(0,0,0,.25);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.4), 0 2px 4px -1px rgba(0,0,0,.25);
}

@media (prefers-color-scheme: dark) {
  [data-theme="system"] {
    --bg:          #111827;
    --surface:     #1f2937;
    --border:      #374151;
    --border-dark: #4b5563;
    --text:        #f9fafb;
    --text-muted:  #9ca3af;
    --text-light:  #6b7280;
    --secondary:   #d1d5db;
    --primary-light: rgba(26,86,219,.18);
    --shadow:    0 1px 3px rgba(0,0,0,.4), 0 1px 2px rgba(0,0,0,.25);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,.4), 0 2px 4px -1px rgba(0,0,0,.25);
  }
}

[data-theme="dark"] .form-control,
[data-theme="dark"] select,
[data-theme="dark"] textarea,
[data-theme="dark"] input:not([type="radio"]):not([type="checkbox"]) { background: #111827; color: #f9fafb; border-color: #374151; }
@media (prefers-color-scheme: dark) {
  [data-theme="system"] .form-control,
  [data-theme="system"] select,
  [data-theme="system"] textarea,
  [data-theme="system"] input:not([type="radio"]):not([type="checkbox"]) { background: #111827; color: #f9fafb; border-color: #374151; }
}

[data-theme="dark"] .btn-secondary { background: #374151; color: #f9fafb; border-color: #4b5563; }
[data-theme="dark"] .btn-secondary:hover { background: #4b5563; }
[data-theme="dark"] .btn-outline-primary { color: #60a5fa; border-color: #60a5fa; }
[data-theme="dark"] .btn-outline-primary:hover { background: rgba(96,165,250,.12); }
@media (prefers-color-scheme: dark) {
  [data-theme="system"] .btn-secondary { background: #374151; color: #f9fafb; border-color: #4b5563; }
  [data-theme="system"] .btn-secondary:hover { background: #4b5563; }
}

[data-theme="dark"] .stat-icon.blue   { background: #1e3a5f; color: #93c5fd; }
[data-theme="dark"] .stat-icon.green  { background: #064e3b; color: #6ee7b7; }
[data-theme="dark"] .stat-icon.yellow,
[data-theme="dark"] .stat-icon.warning { background: #78350f; color: #fcd34d; }
[data-theme="dark"] .stat-icon.red,
[data-theme="dark"] .stat-icon.danger  { background: #7f1d1d; color: #fca5a5; }
[data-theme="dark"] .stat-icon.purple { background: #3b0764; color: #c4b5fd; }
[data-theme="dark"] .stat-icon.cyan   { background: #164e63; color: #67e8f9; }
[data-theme="dark"] .stat-icon.success { background: #064e3b; color: #6ee7b7; }
@media (prefers-color-scheme: dark) {
  [data-theme="system"] .stat-icon.blue   { background: #1e3a5f; color: #93c5fd; }
  [data-theme="system"] .stat-icon.green  { background: #064e3b; color: #6ee7b7; }
  [data-theme="system"] .stat-icon.yellow,
  [data-theme="system"] .stat-icon.warning { background: #78350f; color: #fcd34d; }
  [data-theme="system"] .stat-icon.red,
  [data-theme="system"] .stat-icon.danger  { background: #7f1d1d; color: #fca5a5; }
  [data-theme="system"] .stat-icon.purple { background: #3b0764; color: #c4b5fd; }
  [data-theme="system"] .stat-icon.cyan   { background: #164e63; color: #67e8f9; }
}

[data-theme="dark"] .badge-active, [data-theme="dark"] .badge-completed { background: #064e3b; color: #6ee7b7; }
[data-theme="dark"] .badge-pending, [data-theme="dark"] .badge-open { background: #78350f; color: #fcd34d; }
[data-theme="dark"] .badge-blocked, [data-theme="dark"] .badge-cancelled { background: #7f1d1d; color: #fca5a5; }
[data-theme="dark"] .badge-frozen, [data-theme="dark"] .badge-suspended { background: #1e3a5f; color: #93c5fd; }
[data-theme="dark"] .badge-draft { background: #374151; color: #9ca3af; }
[data-theme="dark"] .badge-monthly { background: #3b0764; color: #c4b5fd; }
[data-theme="dark"] .badge-annual   { background: #164e63; color: #67e8f9; }
@media (prefers-color-scheme: dark) {
  [data-theme="system"] .badge-active { background: #064e3b; color: #6ee7b7; }
  [data-theme="system"] .badge-pending { background: #78350f; color: #fcd34d; }
  [data-theme="system"] .badge-blocked { background: #7f1d1d; color: #fca5a5; }
  [data-theme="system"] .badge-frozen { background: #1e3a5f; color: #93c5fd; }
  [data-theme="system"] .badge-draft  { background: #374151; color: #9ca3af; }
  [data-theme="system"] .badge-monthly { background: #3b0764; color: #c4b5fd; }
  [data-theme="system"] .badge-annual  { background: #164e63; color: #67e8f9; }
}

[data-theme="dark"] .alert-success { background: #064e3b; color: #6ee7b7; border-color: #065f46; }
[data-theme="dark"] .alert-danger  { background: #7f1d1d; color: #fca5a5; border-color: #991b1b; }
[data-theme="dark"] .alert-warning { background: #78350f; color: #fcd34d; border-color: #92400e; }
[data-theme="dark"] .alert-info    { background: #1e3a5f; color: #93c5fd; border-color: #1e40af; }
@media (prefers-color-scheme: dark) {
  [data-theme="system"] .alert-success { background: #064e3b; color: #6ee7b7; border-color: #065f46; }
  [data-theme="system"] .alert-danger  { background: #7f1d1d; color: #fca5a5; border-color: #991b1b; }
  [data-theme="system"] .alert-warning { background: #78350f; color: #fcd34d; border-color: #92400e; }
  [data-theme="system"] .alert-info    { background: #1e3a5f; color: #93c5fd; border-color: #1e40af; }
}

[data-theme="dark"] .nav-item:hover,
[data-theme="dark"] .nav-item.active { background: rgba(26,86,219,.2); }
[data-theme="dark"] .cat-btn { background: #374151; border-color: #4b5563; color: #9ca3af; }
[data-theme="dark"] .node-mini-card { background: #111827; border-color: #374151; }
[data-theme="dark"] .info-chip { background: #111827; border-color: #374151; }
[data-theme="dark"] .progress-bar-wrap { background: #374151; }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #4b5563; }
@media (prefers-color-scheme: dark) {
  [data-theme="system"] .nav-item:hover,
  [data-theme="system"] .nav-item.active { background: rgba(26,86,219,.2); }
  [data-theme="system"] .cat-btn { background: #374151; border-color: #4b5563; color: #9ca3af; }
  [data-theme="system"] .node-mini-card { background: #111827; border-color: #374151; }
  [data-theme="system"] .info-chip { background: #111827; border-color: #374151; }
  [data-theme="system"] .progress-bar-wrap { background: #374151; }
  [data-theme="system"] ::-webkit-scrollbar-thumb { background: #4b5563; }
}

/* Theme toggle */
.theme-toggle-btn { background: none; border: 1px solid var(--border); border-radius: var(--radius); width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; color: var(--text-muted); cursor: pointer; transition: border-color .15s, color .15s; flex-shrink: 0; }
.theme-toggle-btn:hover { border-color: var(--primary); color: var(--primary); }
.theme-toggle-btn svg { width: 18px; height: 18px; }
