/* ======================================================================
   Timber v2 — CSS Framework
   Improvements: Dark mode, responsive, accessible, component-based
   ====================================================================== */

/* ===== CSS Custom Properties (Light Theme) ===== */
:root {
    --color-bg: #f8fafc;
    --color-surface: #ffffff;
    --color-surface-alt: #f1f5f9;
    --color-border: #e2e8f0;
    --color-border-light: #f1f5f9;
    --color-text: #1e293b;
    --color-text-secondary: #64748b;
    --color-text-muted: #94a3b8;
    --color-primary: #2563eb;
    --color-primary-light: #dbeafe;
    --color-primary-dark: #1d4ed8;
    --color-success: #16a34a;
    --color-success-light: #f0fdf4;
    --color-danger: #dc2626;
    --color-danger-light: #fef2f2;
    --color-warning: #d97706;
    --color-warning-light: #fffbeb;
    --color-info: #0891b2;
    --color-info-light: #ecfeff;
    --color-sidebar-bg: #0f172a;
    --color-sidebar-text: #cbd5e1;
    --color-sidebar-hover: #1e293b;
    --color-sidebar-active: #2563eb;
    --color-topbar-bg: #ffffff;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --transition: 0.2s ease;
}

/* ===== Dark Theme ===== */
[data-theme="dark"] {
    --color-bg: #0f172a;
    --color-surface: #1e293b;
    --color-surface-alt: #334155;
    --color-border: #475569;
    --color-border-light: #334155;
    --color-text: #e2e8f0;
    --color-text-secondary: #94a3b8;
    --color-text-muted: #64748b;
    --color-primary: #60a5fa;
    --color-primary-light: rgba(96,165,250,0.15);
    --color-primary-dark: #3b82f6;
    --color-success: #4ade80;
    --color-success-light: rgba(74,222,128,0.15);
    --color-danger: #f87171;
    --color-danger-light: rgba(248,113,113,0.15);
    --color-warning: #fbbf24;
    --color-warning-light: rgba(251,191,36,0.15);
    --color-info: #22d3ee;
    --color-info-light: rgba(34,211,238,0.15);
    --color-sidebar-bg: #0f172a;
    --color-sidebar-text: #94a3b8;
    --color-sidebar-hover: #1e293b;
    --color-sidebar-active: #60a5fa;
    --color-topbar-bg: #1e293b;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.3);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.4);
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body {
    font-family: var(--font-sans);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
    transition: background var(--transition), color var(--transition);
}

/* ===== Skip Link (Accessibility) ===== */
.skip-link {
    position: absolute; top: -100px; left: 0;
    background: var(--color-primary); color: #fff;
    padding: 8px 16px; z-index: 9999;
    border-radius: 0 0 var(--radius-md) 0;
    text-decoration: none; font-weight: 600;
}
.skip-link:focus { top: 0; }

/* ===== Layout ===== */
.app-layout {
    display: flex; min-height: 100vh;
    transition: margin-left var(--transition);
}

/* ===== Sidebar ===== */
.sidebar {
    width: 260px; background: var(--color-sidebar-bg);
    color: var(--color-sidebar-text); display: flex;
    flex-direction: column; position: fixed; top: 0; left: 0;
    height: 100vh; z-index: 100; transition: transform var(--transition);
    border-right: 1px solid var(--color-border);
    overflow-y: auto; scrollbar-width: thin;
}
.sidebar.collapsed { transform: translateX(-260px); }
.sidebar-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--space-4) var(--space-4); border-bottom: 1px solid var(--color-border);
    min-height: 60px;
}
.logo { display: flex; align-items: center; gap: var(--space-2); }
.logo-icon { font-size: var(--text-2xl); }
.logo-text { font-size: var(--text-lg); font-weight: 700; color: #fff; }
.logo-text .version { font-size: var(--text-xs); color: var(--color-text-muted); font-weight: 400; }
.sidebar-toggle { display: none; background: none; border: none; color: var(--color-sidebar-text); font-size: var(--text-lg); cursor: pointer; }

.sidebar-search { padding: var(--space-4); border-bottom: 1px solid var(--color-border); }
.search-input { position: relative; }
.search-input input {
    width: 100%; padding: 8px 12px 8px 36px; background: var(--color-surface-alt);
    border: 1px solid var(--color-border); border-radius: var(--radius-md);
    color: var(--color-text); font-size: var(--text-sm); outline: none;
    transition: border-color var(--transition);
}
.search-input input:focus { border-color: var(--color-primary); }
.search-input i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--color-text-muted); font-size: var(--text-sm); }
.search-shortcut { font-size: var(--text-xs); color: var(--color-text-muted); float: right; margin-top: 4px; }

.sidebar-nav { flex: 1; padding: var(--space-2) 0; }
.nav-section { margin-bottom: var(--space-2); }
.nav-section-label { padding: 8px 16px 4px; font-size: var(--text-xs); font-weight: 700; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.nav-item {
    display: flex; align-items: center; gap: var(--space-3);
    padding: 8px 16px; cursor: pointer; transition: all var(--transition);
    border-radius: var(--radius-sm); margin: 2px 8px; font-size: var(--text-sm);
    color: var(--color-sidebar-text); text-decoration: none; position: relative;
}
.nav-item:hover { background: var(--color-sidebar-hover); }
.nav-item.active { background: var(--color-sidebar-active); color: #fff; font-weight: 500; }
.nav-item i { width: 20px; text-align: center; font-size: var(--text-base); }
.nav-badge {
    margin-left: auto; background: var(--color-danger); color: #fff;
    font-size: var(--text-xs); padding: 2px 6px; border-radius: 999px;
    font-weight: 600; min-width: 20px; text-align: center;
}
.nav-item:focus-visible { outline: 2px solid var(--color-primary); outline-offset: -2px; }

.sidebar-footer { padding: var(--space-4); border-top: 1px solid var(--color-border); }

/* ===== Main Content ===== */
.main-content {
    margin-left: 260px; flex: 1; display: flex;
    flex-direction: column; min-height: 100vh;
    transition: margin-left var(--transition);
}
.sidebar.collapsed ~ .main-content { margin-left: 0; }

/* ===== Top Bar ===== */
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--space-3) var(--space-6); background: var(--color-topbar-bg);
    border-bottom: 1px solid var(--color-border); position: sticky; top: 0; z-index: 50;
    min-height: 60px; transition: background var(--transition);
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: var(--space-3); }
.mobile-menu-toggle { display: none !important; background: none; border: none; font-size: var(--text-xl); cursor: pointer; color: var(--color-text); }
.breadcrumb { display: flex; align-items: center; gap: var(--space-1); font-size: var(--text-sm); color: var(--color-text-secondary); }
.breadcrumb span + span::before { content: '/'; margin: 0 var(--space-1); color: var(--color-text-muted); }

.topbar-actions { display: flex; align-items: center; gap: var(--space-2); }
.btn-fab {
    width: 36px; height: 36px; border-radius: 50%; padding: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: var(--text-lg);
}

/* User Menu */
.user-menu { position: relative; }
.user-avatar {
    width: 36px; height: 36px; border-radius: 50%; background: var(--color-primary);
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: var(--text-sm); cursor: pointer;
}
.user-dropdown {
    display: none; position: absolute; right: 0; top: calc(100% + 8px);
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
    min-width: 220px; z-index: 200; overflow: hidden;
}
.user-dropdown.open { display: block; }
.user-info { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--color-border); }
.user-dropdown-item {
    display: flex; align-items: center; gap: var(--space-2);
    padding: var(--space-2) var(--space-4); font-size: var(--text-sm);
    color: var(--color-text); text-decoration: none; transition: background var(--transition);
}
.user-dropdown-item:hover { background: var(--color-surface-alt); }

/* ===== Page Content ===== */
.page-content {
    flex: 1; padding: var(--space-6);
    max-width: 1400px; margin: 0 auto; width: 100%;
}

/* ===== Loading ===== */
.loading-screen { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 400px; gap: var(--space-4); }
.spinner-lg { width: 40px; height: 40px; border: 3px solid var(--color-border); border-top-color: var(--color-primary); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, var(--color-surface-alt) 25%, var(--color-border-light) 50%, var(--color-surface-alt) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}
.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-title { height: 24px; margin-bottom: 12px; width: 60%; }
.skeleton-card { height: 200px; border-radius: var(--radius-md); }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ===== Cards ===== */
.card {
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius-lg); overflow: hidden;
    transition: box-shadow var(--transition), border-color var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header {
    padding: var(--space-4) var(--space-6); border-bottom: 1px solid var(--color-border);
    display: flex; align-items: center; justify-content: space-between;
    font-weight: 600; font-size: var(--text-base);
}
.card-body { padding: var(--space-6); }

/* ===== Data Table ===== */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table {
    width: 100%; border-collapse: collapse; font-size: var(--text-sm);
}
.data-table th {
    text-align: left; padding: 10px var(--space-4); font-weight: 600;
    color: var(--color-text-secondary); border-bottom: 2px solid var(--color-border);
    font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.05em;
    white-space: nowrap; position: sticky; top: 0; background: var(--color-surface);
}
.data-table td {
    padding: 10px var(--space-4); border-bottom: 1px solid var(--color-border-light);
    white-space: nowrap; max-width: 300px; overflow: hidden; text-overflow: ellipsis;
}
.data-table tr { transition: background var(--transition); }
.data-table tr.clickable { cursor: pointer; }
.data-table tr.clickable:hover { background: var(--color-surface-alt); }
.data-table tr.row-low-stock { background: var(--color-danger-light); }

/* ===== Badges ===== */
.badge {
    display: inline-flex; align-items: center; padding: 2px 8px;
    border-radius: 999px; font-size: var(--text-xs); font-weight: 500; line-height: 1.6;
    white-space: nowrap;
}
.badge-primary { background: var(--color-primary-light); color: var(--color-primary-dark); }
.badge-success { background: var(--color-success-light); color: #166534; }
.badge-danger { background: var(--color-danger-light); color: #991b1b; }
.badge-warning { background: var(--color-warning-light); color: #92400e; }
.badge-info { background: var(--color-info-light); color: #155e75; }
.badge-muted { background: var(--color-surface-alt); color: var(--color-text-muted); }
.badge-source { background: var(--color-info-light); color: var(--color-info); }

/* ===== Buttons ===== */
.btn {
    display: inline-flex; align-items: center; gap: var(--space-2);
    padding: 8px 16px; border: none; border-radius: var(--radius-sm);
    font-size: var(--text-sm); font-weight: 500; cursor: pointer;
    transition: all var(--transition); text-decoration: none; line-height: 1.4;
    white-space: nowrap;
}
.btn:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-dark); }
.btn-secondary { background: var(--color-surface-alt); color: var(--color-text); border: 1px solid var(--color-border); }
.btn-secondary:hover { background: var(--color-border-light); }
.btn-danger { background: var(--color-danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-success { background: var(--color-success); color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-ghost { background: none; color: var(--color-text-secondary); }
.btn-ghost:hover { background: var(--color-surface-alt); }
.btn-sm { padding: 4px 10px; font-size: var(--text-xs); }
.btn-lg { padding: 12px 24px; font-size: var(--text-base); }
.btn-icon { width: 36px; height: 36px; padding: 0; justify-content: center; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

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

/* ===== Modal ===== */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000; opacity: 0; visibility: hidden;
    transition: opacity var(--transition), visibility var(--transition);
    backdrop-filter: blur(4px);
}
.modal-overlay.open { opacity: 1; visibility: visible; }
.modal {
    background: var(--color-surface); border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg); width: 90%; max-width: 560px;
    max-height: 90vh; overflow-y: auto; transform: translateY(20px);
    transition: transform var(--transition);
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--space-4) var(--space-6); border-bottom: 1px solid var(--color-border);
}
.modal-header h2 { font-size: var(--text-lg); }
.modal-body { padding: var(--space-6); }
.modal-footer {
    display: flex; justify-content: flex-end; gap: var(--space-2);
    padding: var(--space-4) var(--space-6); border-top: 1px solid var(--color-border);
}

/* ===== Slide Panel (new in v2) ===== */
.slide-panel {
    position: fixed; top: 0; right: -540px; width: 540px; height: 100vh;
    background: var(--color-surface); z-index: 200; display: flex;
    flex-direction: column; box-shadow: var(--shadow-lg);
    transition: right var(--transition); border-left: 1px solid var(--color-border);
    max-width: 90vw;
}
.slide-panel.open { right: 0; }
.slide-panel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--space-4) var(--space-6); border-bottom: 1px solid var(--color-border);
    min-height: 60px;
}
.slide-panel-header h3 { font-size: var(--text-base); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.slide-panel-body { flex: 1; overflow-y: auto; padding: var(--space-6); }

/* ===== Form Controls ===== */
.form-group { margin-bottom: var(--space-4); }
.form-group label {
    display: block; margin-bottom: var(--space-1); font-weight: 500;
    font-size: var(--text-sm); color: var(--color-text-secondary);
}
.form-control {
    width: 100%; padding: 8px 12px; border: 1px solid var(--color-border);
    border-radius: var(--radius-sm); background: var(--color-surface);
    color: var(--color-text); font-size: var(--text-sm); font-family: var(--font-sans);
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}
.form-control:focus { border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-light); }
.form-control.error { border-color: var(--color-danger); }
.form-control.error:focus { box-shadow: 0 0 0 3px var(--color-danger-light); }
.form-control::placeholder { color: var(--color-text-muted); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.form-inline { display: flex; gap: var(--space-3); align-items: flex-end; }

.field-label { font-size: var(--text-xs); color: var(--color-text-muted); margin-bottom: 2px; text-transform: uppercase; letter-spacing: 0.05em; }
.field-value { font-size: var(--text-sm); }

/* Input with feedback */
.input-feedback { font-size: var(--text-xs); color: var(--color-danger); margin-top: 4px; }
.input-feedback.valid { color: var(--color-success); }

/* ===== Page Header ===== */
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: var(--space-6); flex-wrap: wrap; gap: var(--space-3);
}
.page-header h1 { font-size: var(--text-2xl); font-weight: 700; }
.page-actions { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
.page-tabs { display: flex; gap: var(--space-1); margin-bottom: var(--space-6); border-bottom: 2px solid var(--color-border); padding-bottom: 0; }
.page-tabs .tab {
    padding: var(--space-2) var(--space-4); cursor: pointer;
    font-size: var(--text-sm); color: var(--color-text-muted);
    border-bottom: 2px solid transparent; margin-bottom: -2px;
    transition: all var(--transition); font-weight: 500;
}
.page-tabs .tab:hover { color: var(--color-text); }
.page-tabs .tab.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }

/* ===== Detail Grid ===== */
.detail-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--space-4);
}
.detail-field { padding: var(--space-2); background: var(--color-surface-alt); border-radius: var(--radius-sm); }

/* ===== Filter Bar ===== */
.filter-bar {
    display: flex; gap: var(--space-1); flex-wrap: wrap;
    margin-bottom: var(--space-4); align-items: center;
}
.filter-chip {
    padding: 6px 14px; border-radius: 999px; cursor: pointer;
    font-size: var(--text-sm); transition: all var(--transition);
    background: var(--color-surface-alt); color: var(--color-text-secondary);
    border: 1px solid transparent;
}
.filter-chip:hover { background: var(--color-border-light); }
.filter-chip.active { background: var(--color-primary); color: #fff; }

.filter-bar input[type="text"] {
    flex: 1; min-width: 200px; max-width: 360px;
}

/* ===== Tabs ===== */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--color-border); margin-bottom: var(--space-6); }
.tab {
    padding: 10px 20px; cursor: pointer; font-size: var(--text-sm);
    color: var(--color-text-muted); font-weight: 500;
    border-bottom: 2px solid transparent; margin-bottom: -2px;
    transition: all var(--transition);
}
.tab:hover { color: var(--color-text); }
.tab.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== Progress Bar ===== */
.progress-bar {
    height: 6px; background: var(--color-border-light);
    border-radius: 999px; overflow: hidden;
}
.progress-bar-fill {
    height: 100%; border-radius: 999px;
    transition: width 0.5s ease;
}

/* ===== Toast ===== */
.toast-container { position: fixed; top: var(--space-4); right: var(--space-4); z-index: 9999; display: flex; flex-direction: column; gap: var(--space-2); }
.toast {
    padding: var(--space-3) var(--space-5); border-radius: var(--radius-md);
    font-size: var(--text-sm); font-weight: 500; color: #fff;
    box-shadow: var(--shadow-lg); animation: slideIn 0.3s ease;
    display: flex; align-items: center; gap: var(--space-2);
    max-width: 400px;
}
.toast-success { background: #16a34a; }
.toast-error { background: #dc2626; }
.toast-warning { background: #d97706; }
.toast-info { background: #2563eb; }
.toast-exit { animation: slideOut 0.3s ease forwards; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideOut { from { transform: translateX(0); opacity: 1; } to { transform: translateX(100%); opacity: 0; } }

/* ===== Search Modal ===== */
.search-modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.6);
    display: flex; align-items: flex-start; justify-content: center;
    z-index: 500; padding: var(--space-8) var(--space-4); opacity: 0;
    visibility: hidden; transition: all var(--transition);
}
.search-modal-overlay.open { opacity: 1; visibility: visible; }
.search-modal {
    background: var(--color-surface); border-radius: var(--radius-xl);
    width: 100%; max-width: 600px; margin-top: 40px;
    box-shadow: var(--shadow-lg); overflow: hidden;
    transform: translateY(-20px); transition: transform var(--transition);
}
.search-modal-overlay.open .search-modal { transform: translateY(0); }
.search-modal-header {
    display: flex; align-items: center; gap: var(--space-3);
    padding: var(--space-4) var(--space-6); border-bottom: 1px solid var(--color-border);
}
.search-modal-header i { color: var(--color-text-muted); }
.search-modal-input {
    flex: 1; border: none; padding: 12px 0; font-size: var(--text-lg);
    background: transparent; color: var(--color-text); outline: none;
}
.search-modal-results { max-height: 400px; overflow-y: auto; }
.search-result-item {
    padding: var(--space-3) var(--space-6); cursor: pointer;
    transition: background var(--transition); display: flex;
    align-items: center; gap: var(--space-3);
}
.search-result-item:hover { background: var(--color-surface-alt); }
.search-result-type {
    font-size: var(--text-xs); font-weight: 600; text-transform: uppercase;
    padding: 2px 6px; border-radius: 4px; color: #fff;
}
.search-empty { text-align: center; padding: var(--space-8); color: var(--color-text-muted); }

/* ===== Confirm Dialog ===== */
.confirm-dialog-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    display: none; align-items: center; justify-content: center; z-index: 1001;
    backdrop-filter: blur(4px);
}
.confirm-dialog-overlay.active { display: flex; }
.confirm-dialog {
    background: var(--color-surface); border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg); width: 90%; max-width: 440px;
}
.confirm-dialog-body { padding: var(--space-6); }
.confirm-dialog-footer {
    display: flex; justify-content: flex-end; gap: var(--space-2);
    padding: var(--space-4) var(--space-6); border-top: 1px solid var(--color-border);
}
.confirm-dialog-undo {
    padding: var(--space-3) var(--space-6); border-top: 1px solid var(--color-border);
    display: flex; align-items: center; justify-content: space-between;
    background: var(--color-success-light);
}

/* ===== Notification Panel ===== */
.notification-panel {
    position: fixed; top: 0; right: -380px; width: 380px; height: 100vh;
    background: var(--color-surface); z-index: 300; box-shadow: var(--shadow-lg);
    transition: right var(--transition); border-left: 1px solid var(--color-border);
    display: flex; flex-direction: column;
}
.notification-panel.open { right: 0; }
.notification-panel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--space-4) var(--space-6); border-bottom: 1px solid var(--color-border);
}
.notification-list { flex: 1; overflow-y: auto; }
.notification-item {
    padding: var(--space-3) var(--space-6); border-bottom: 1px solid var(--color-border-light);
    cursor: pointer; transition: background var(--transition);
}
.notification-item:hover { background: var(--color-surface-alt); }
.notification-item.unread { border-left: 3px solid var(--color-primary); }
.notification-empty { text-align: center; padding: var(--space-8); color: var(--color-text-muted); }

/* ===== Grid Layouts ===== */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--space-6); }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--space-6); }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--space-6); }

/* ===== Stat Cards ===== */
.stat-card {
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius-lg); padding: var(--space-5);
    display: flex; align-items: center; gap: var(--space-4);
}
.stat-icon {
    width: 48px; height: 48px; border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    font-size: var(--text-xl);
}
.stat-icon.blue { background: var(--color-primary-light); color: var(--color-primary-dark); }
.stat-icon.green { background: var(--color-success-light); color: #166534; }
.stat-icon.red { background: var(--color-danger-light); color: #991b1b; }
.stat-icon.orange { background: var(--color-warning-light); color: #92400e; }
.stat-value { font-size: var(--text-2xl); font-weight: 700; }
.stat-label { font-size: var(--text-xs); color: var(--color-text-muted); text-transform: uppercase; }

/* ===== Activity Feed ===== */
.activity-feed { max-height: 400px; overflow-y: auto; }
.activity-item {
    display: flex; gap: var(--space-3); padding: var(--space-3) 0;
    border-bottom: 1px solid var(--color-border-light);
}
.activity-icon { width: 32px; height: 32px; border-radius: 50%; background: var(--color-surface-alt); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: var(--text-sm); }
.activity-body { flex: 1; }
.activity-text { font-size: var(--text-sm); }
.activity-meta { font-size: var(--text-xs); color: var(--color-text-muted); margin-top: 2px; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-260px); z-index: 300; }
    .sidebar.mobile-open { transform: translateX(0); }
    .main-content { margin-left: 0 !important; }
    .mobile-menu-toggle { display: block !important; }
    .page-content { padding: var(--space-4); }
    .form-row { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .topbar { padding: var(--space-2) var(--space-4); }
    .data-table { font-size: var(--text-xs); }
    .data-table td, .data-table th { padding: 8px var(--space-2); }
}
@media (max-width: 480px) {
    .page-content { padding: var(--space-3); }
    .filter-bar { flex-direction: column; }
    .filter-bar input[type="text"] { max-width: 100%; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ===== Print Styles ===== */
@media print {
    .sidebar, .topbar, .fab, .slide-panel, .notification-panel { display: none !important; }
    .main-content { margin-left: 0 !important; }
    body { font-size: 12pt; }
    .card { break-inside: avoid; box-shadow: none; border: 1px solid #ccc; }
}

/* ===== Scrollbar Styling ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-text-muted); }