/* =====================================================
   GBU Multi-Tenant V19 - Redesign Design System
   Aesthetic: Modern Industrial / Professional Trust
   ===================================================== */

/* =====================================================
   CSS CUSTOM PROPERTIES
   ===================================================== */
:root {
    /* Color Palette - Sophisticated Navy + Emerald */
    --primary: #0f172a;
    --primary-light: #1e293b;
    --primary-dark: #020617;
    --accent: #10b981;
    --accent-light: #34d399;
    --accent-dark: #059669;
    --accent-glow: rgba(16, 185, 129, 0.15);

    /* Risk Colors - Refined */
    --risk-low: #22c55e;
    --risk-low-bg: rgba(34, 197, 94, 0.1);
    --risk-medium: #f59e0b;
    --risk-medium-bg: rgba(245, 158, 11, 0.1);
    --risk-high: #ef4444;
    --risk-high-bg: rgba(239, 68, 68, 0.1);
    --risk-extreme: #7c3aed;
    --risk-extreme-bg: rgba(124, 58, 237, 0.1);

    /* Status Colors */
    --status-draft: #f59e0b;
    --status-draft-bg: rgba(245, 158, 11, 0.1);
    --status-completed: #22c55e;
    --status-completed-bg: rgba(34, 197, 94, 0.1);
    --status-archived: #64748b;
    --status-archived-bg: rgba(100, 116, 139, 0.1);

    /* Semantic Colors */
    --success: #22c55e;
    --success-bg: rgba(34, 197, 94, 0.1);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.1);
    --info: #3b82f6;
    --info-bg: rgba(59, 130, 246, 0.1);

    /* Neutrals */
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --border-dark: #cbd5e1;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-light: #cbd5e1;

    /* Typography */
    --font-display: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Shadows - Layered depth */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.03);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.06), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    --shadow-inner: inset 0 2px 4px rgba(0, 0, 0, 0.04);

    /* Focus ring */
    --focus-ring: 0 0 0 3px var(--accent-glow);

    /* Border radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 20px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Spacing scale */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;

    /* Z-index scale */
    --z-dropdown: 100;
    --z-sticky: 500;
    --z-modal-backdrop: 900;
    --z-modal: 1000;
    --z-toast: 1100;
}

/* =====================================================
   RESET & BASE STYLES
   ===================================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    background-image:
        radial-gradient(at 40% 20%, rgba(16, 185, 129, 0.03) 0px, transparent 50%),
        radial-gradient(at 80% 0%, rgba(15, 23, 42, 0.02) 0px, transparent 50%),
        radial-gradient(at 0% 50%, rgba(16, 185, 129, 0.02) 0px, transparent 50%);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 15px;
    display: flex;
    flex-direction: column;
}

/* Selection styling */
::selection {
    background: var(--accent);
    color: white;
}

::-moz-selection {
    background: var(--accent);
    color: white;
}

/* =====================================================
   TYPOGRAPHY
   ===================================================== */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.3;
    color: var(--text-primary);
}

h1 { font-size: 2rem; font-weight: 700; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

p {
    margin-bottom: var(--space-4);
}

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

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

/* =====================================================
   LAYOUT
   ===================================================== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-6);
}

.main-content {
    padding: var(--space-8) var(--space-10);
    max-width: 1400px;
    margin: 0 auto;
    flex: 1;
    width: 100%;
}

/* =====================================================
   HEADER
   ===================================================== */
.header {
    background: var(--primary);
    padding: 0 var(--space-10);
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    box-shadow: var(--shadow-lg);
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--space-6);
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    text-decoration: none;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: var(--accent);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    font-family: var(--font-display);
    font-size: 18px;
}

.logo-text {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 600;
    color: white;
    letter-spacing: -0.02em;
}

.header-nav {
    display: flex;
    gap: var(--space-2);
}

.nav-link {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition-fast);
}

.nav-link:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.nav-link.active {
    color: white;
    background: rgba(255, 255, 255, 0.15);
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.user-badge {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 6px 14px 6px 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
    transition: var(--transition-fast);
    cursor: pointer;
}

.user-badge:hover {
    background: rgba(255, 255, 255, 0.15);
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    color: white;
}

.user-name {
    color: white;
    font-size: 14px;
    font-weight: 500;
}

.user-plan {
    font-size: 11px;
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-full);
    color: rgba(255, 255, 255, 0.9);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.05em;
}

/* =====================================================
   FOOTER
   ===================================================== */
.footer {
    background: var(--primary);
    padding: 0 var(--space-10);
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
}

.footer-left {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.footer-brand {
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 600;
    color: white;
}

.footer-separator {
    color: rgba(255, 255, 255, 0.3);
}

.footer-copyright {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
}

.footer-right {
    display: flex;
    align-items: center;
    gap: var(--space-5);
}

.footer-link {
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition-fast);
}

.footer-link:hover {
    color: white;
}

.footer-version {
    font-size: 11px;
    padding: 2px 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
    color: rgba(255, 255, 255, 0.8);
    font-weight: 600;
    font-family: var(--font-display);
}

/* Responsive Footer */
@media (max-width: 768px) {
    .footer {
        height: auto;
        padding: var(--space-4) var(--space-5);
        flex-direction: column;
        gap: var(--space-3);
        text-align: center;
    }

    .footer-right {
        gap: var(--space-4);
    }
}

/* =====================================================
   BUTTONS
   ===================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-lg);
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font-body);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    text-decoration: none;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

/* Subtle shine effect on hover */
.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
    pointer-events: none;
}

.btn:hover::before {
    left: 100%;
}

/* Active/Press state */
.btn:active:not(:disabled) {
    transform: scale(0.97);
    transition-duration: 0.1s;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn:disabled::before {
    display: none;
}

.btn-sm {
    padding: var(--space-2) var(--space-3);
    font-size: 13px;
    border-radius: var(--radius-md);
}

.btn-lg {
    padding: var(--space-4) var(--space-6);
    font-size: 16px;
}

.btn-primary {
    background: var(--accent);
    color: white;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-light);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
    transform: translateY(-1px);
}

.btn-secondary {
    background: white;
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-primary);
    border-color: var(--border-dark);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-outline:hover:not(:disabled) {
    background: var(--primary);
    color: white;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #16a34a;
}

.btn-logout {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.8);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    color: white;
}

/* =====================================================
   CARDS
   ===================================================== */
.card {
    background: white;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

/* Subtle accent glow on hover */
.card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius-xl);
    padding: 1px;
    background: linear-gradient(135deg, transparent 0%, transparent 50%, var(--accent-glow) 100%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
    border-color: var(--border-dark);
}

.card:hover::before {
    opacity: 1;
}

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

.card-title {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    padding: var(--space-6);
}

.card-footer {
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--border);
    background: var(--bg-primary);
}

/* =====================================================
   FORMS
   ===================================================== */
.form-group {
    margin-bottom: var(--space-5);
}

.form-label {
    display: block;
    margin-bottom: var(--space-2);
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    font-size: 15px;
    font-family: var(--font-body);
    color: var(--text-primary);
    background: white;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-input:hover:not(:focus),
.form-select:hover:not(:focus),
.form-textarea:hover:not(:focus) {
    border-color: var(--border-dark);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow);
    background: white;
}

.form-input::placeholder {
    color: var(--text-muted);
    transition: opacity 0.2s ease;
}

.form-input:focus::placeholder {
    opacity: 0.5;
}

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

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-5);
}

.form-row-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-5);
}

.form-hint {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: var(--space-1);
}

.form-error {
    font-size: 13px;
    color: var(--danger);
    margin-top: var(--space-1);
}

/* =====================================================
   TABLES
   ===================================================== */
.table-card {
    background: white;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    overflow: hidden;
}

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

.table-title {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.table-controls {
    display: flex;
    gap: var(--space-3);
    align-items: center;
}

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

.data-table thead {
    background: var(--bg-primary);
}

.data-table th {
    padding: var(--space-4) var(--space-5);
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
}

.data-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: var(--transition-fast);
}

.data-table th.sortable:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.data-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: all 0.2s ease;
    position: relative;
}

.data-table tbody tr:last-child {
    border-bottom: none;
}

.data-table tbody tr:hover {
    background: linear-gradient(90deg, var(--bg-primary) 0%, rgba(16, 185, 129, 0.03) 100%);
}

/* Accent indicator on hover - disabled due to table column issues
.data-table tbody tr::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%) scaleY(0);
    width: 3px;
    height: 60%;
    background: var(--accent);
    border-radius: 0 3px 3px 0;
    transition: transform 0.2s ease;
}

.data-table tbody tr:hover::before {
    transform: translateY(-50%) scaleY(1);
}
*/

.data-table td {
    padding: var(--space-4) var(--space-5);
    font-size: 14px;
}

.table-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--border);
    background: var(--bg-primary);
}

.table-info {
    font-size: 13px;
    color: var(--text-muted);
}

/* =====================================================
   BADGES & STATUS
   ===================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
}

.status-badge .status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.status-badge.draft {
    background: var(--status-draft-bg);
    color: var(--status-draft);
}

.status-badge.completed {
    background: var(--status-completed-bg);
    color: var(--status-completed);
}

.status-badge.archived {
    background: var(--status-archived-bg);
    color: var(--status-archived);
}

.risk-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 600;
}

.risk-badge.risk-low {
    background: var(--risk-low-bg);
    color: var(--risk-low);
}

.risk-badge.risk-medium {
    background: var(--risk-medium-bg);
    color: var(--risk-medium);
}

.risk-badge.risk-high {
    background: var(--risk-high-bg);
    color: var(--risk-high);
}

.risk-badge.risk-extreme {
    background: var(--risk-extreme-bg);
    color: var(--risk-extreme);
}

/* =====================================================
   SEARCH INPUT
   ===================================================== */
.search-input {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-2) var(--space-4);
    min-width: 280px;
    transition: var(--transition-fast);
}

.search-input:focus-within {
    border-color: var(--accent);
    box-shadow: var(--focus-ring);
}

.search-input input {
    border: none;
    background: transparent;
    font-size: 14px;
    width: 100%;
    outline: none;
    font-family: var(--font-body);
    color: var(--text-primary);
}

.search-input input::placeholder {
    color: var(--text-muted);
}

.search-input svg {
    color: var(--text-muted);
    flex-shrink: 0;
}

/* =====================================================
   VIEW TOGGLE
   ===================================================== */
.view-toggle {
    display: flex;
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 4px;
    border: 1px solid var(--border);
}

.view-toggle-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: var(--space-2) var(--space-4);
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-fast);
}

.view-toggle-btn:hover {
    color: var(--text-secondary);
}

.view-toggle-btn.active {
    background: white;
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

/* =====================================================
   PAGINATION
   ===================================================== */
.pagination {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.pagination-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    background: white;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
}

.pagination-btn:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
}

.pagination-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* =====================================================
   MODALS
   ===================================================== */
/* Modal.js Structure: .modal (backdrop) > .modal-content (white box) */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: var(--z-modal);
    display: none;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: var(--radius-2xl);
    box-shadow:
        0 25px 50px -12px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    animation: modalSlideUp 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-origin: center bottom;
}

.modal-content.modal-small { max-width: 400px; }
.modal-content.modal-medium { max-width: 600px; }
.modal-content.modal-large { max-width: 800px; }
.modal-content.modal-xlarge { max-width: 1100px; }
.modal-content.modal-full { max-width: 95vw; }

/* Legacy support for modal-backdrop structure */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: var(--z-modal-backdrop);
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-backdrop.show {
    display: flex;
}

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

.modal-title {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-fast);
}

.modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-body {
    padding: var(--space-6);
    overflow-y: auto;
    max-height: calc(90vh - 150px);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--border);
    background: var(--bg-primary);
}

/* =====================================================
   TOAST NOTIFICATIONS
   ===================================================== */
.toast-container {
    position: fixed;
    top: var(--space-5);
    right: var(--space-5);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.toast {
    background: white;
    border-radius: var(--radius-lg);
    padding: var(--space-4) var(--space-5);
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    min-width: 320px;
    max-width: 420px;
    animation: slideInRight 0.3s ease-out;
    border-left: 4px solid var(--text-muted);
}

.toast.toast-success { border-left-color: var(--success); }
.toast.toast-error { border-left-color: var(--danger); }
.toast.toast-warning { border-left-color: var(--warning); }
.toast.toast-info { border-left-color: var(--info); }

.toast-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.toast-message {
    font-size: 13px;
    color: var(--text-secondary);
}

/* =====================================================
   TABS
   ===================================================== */
.tabs {
    display: flex;
    gap: var(--space-1);
    border-bottom: 2px solid var(--border);
    margin-bottom: var(--space-6);
    position: relative;
}

.tab {
    padding: var(--space-4) var(--space-5);
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-muted);
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s ease;
    font-family: var(--font-body);
    position: relative;
}

.tab:hover:not(:disabled) {
    color: var(--text-primary);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--accent);
    font-weight: 600;
    background: transparent;
}

/* Subtle glow on active tab */
.tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
}

.tab:disabled {
    color: var(--text-light);
    cursor: not-allowed;
    opacity: 0.6;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

/* =====================================================
   LOADING STATES
   ===================================================== */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-sm {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-4);
    z-index: var(--z-modal);
}

.skeleton {
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-primary) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

/* =====================================================
   METRIC CARDS
   ===================================================== */
.metric-card {
    background: white;
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    border: 1px solid var(--border);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

/* Subtle gradient overlay on hover */
.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    background: linear-gradient(135deg, transparent 0%, var(--accent-glow) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.metric-card:hover {
    box-shadow: var(--shadow-lg), 0 0 0 1px var(--accent-glow);
    transform: translateY(-4px);
    border-color: rgba(16, 185, 129, 0.2);
}

.metric-card:hover::before {
    opacity: 0.5;
}

.metric-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-4);
}

.metric-label {
    font-size: 13px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    margin-bottom: var(--space-2);
}

.metric-value {
    font-family: var(--font-display);
    font-size: 36px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: 1;
}

.metric-change {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 600;
    margin-top: var(--space-3);
    padding: 4px 10px;
    border-radius: var(--radius-full);
}

.metric-change.positive {
    background: var(--success-bg);
    color: var(--success);
}

.metric-change.negative {
    background: var(--danger-bg);
    color: var(--danger);
}

.metric-change.neutral {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

/* Hero Metric Card */
.metric-card.hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    border: none;
}

.metric-card.hero .hero-value {
    font-family: var(--font-display);
    font-size: 56px;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1;
    margin-bottom: 4px;
    background: linear-gradient(135deg, #fff 0%, #94ffc8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.metric-card.hero .hero-unit {
    font-size: 18px;
    font-weight: 500;
    opacity: 0.9;
    margin-bottom: var(--space-4);
}

.metric-card.hero .hero-details {
    display: flex;
    gap: var(--space-6);
    font-size: 14px;
    opacity: 0.8;
}

.metric-card.hero .hero-detail strong {
    color: var(--accent-light);
}

.progress-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-top: var(--space-5);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent) 0%, var(--accent-light) 100%);
    border-radius: var(--radius-full);
    transition: width 1s ease-out;
}

.progress-label {
    font-size: 13px;
    margin-top: var(--space-2);
    opacity: 0.7;
}

/* =====================================================
   AUTH SCREENS
   ===================================================== */
.auth-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-6);
    background: var(--bg-primary);
    background-image:
        radial-gradient(at 0% 0%, rgba(16, 185, 129, 0.08) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(15, 23, 42, 0.05) 0px, transparent 50%);
}

.auth-card {
    background: white;
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-xl);
    padding: var(--space-10);
    width: 100%;
    max-width: 440px;
    animation: fadeInUp 0.5s ease-out;
}

.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    margin-bottom: var(--space-8);
}

.auth-logo .logo-icon {
    width: 48px;
    height: 48px;
    font-size: 22px;
}

.auth-logo .logo-text {
    color: var(--text-primary);
    font-size: 24px;
}

.auth-title {
    text-align: center;
    margin-bottom: var(--space-2);
    font-size: 24px;
}

.auth-subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: var(--space-8);
}

.auth-error {
    background: var(--danger-bg);
    color: var(--danger);
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-5);
    font-size: 14px;
    display: none;
}

.auth-error.show {
    display: block;
}

.auth-form .form-group {
    margin-bottom: var(--space-5);
}

.auth-form .btn {
    width: 100%;
    padding: var(--space-4);
    font-size: 16px;
}

.auth-footer {
    text-align: center;
    margin-top: var(--space-6);
    padding-top: var(--space-6);
    border-top: 1px solid var(--border);
    font-size: 14px;
    color: var(--text-secondary);
}

.auth-footer a {
    font-weight: 600;
}

/* =====================================================
   ANIMATIONS
   ===================================================== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes gentlePulse {
    0%, 100% {
        box-shadow: 0 0 0 0 var(--accent-glow);
    }
    50% {
        box-shadow: 0 0 0 6px transparent;
    }
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-6px); }
}

/* Staggered animations for lists */
.animate-in {
    animation: fadeInUp 0.5s ease-out backwards;
}

.animate-in:nth-child(1) { animation-delay: 0.05s; }
.animate-in:nth-child(2) { animation-delay: 0.1s; }
.animate-in:nth-child(3) { animation-delay: 0.15s; }
.animate-in:nth-child(4) { animation-delay: 0.2s; }
.animate-in:nth-child(5) { animation-delay: 0.25s; }
.animate-in:nth-child(6) { animation-delay: 0.3s; }

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 1200px) {
    .main-content {
        padding: var(--space-6);
    }

    .header {
        padding: 0 var(--space-6);
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: var(--space-5);
    }

    .header {
        padding: 0 var(--space-4);
        height: 64px;
    }

    .header-nav {
        display: none;
    }

    .form-row,
    .form-row-3 {
        grid-template-columns: 1fr;
    }

    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .search-input {
        min-width: 100%;
    }

    .metric-card.hero .hero-value {
        font-size: 40px;
    }

    .auth-card {
        padding: var(--space-6);
    }
}

@media (max-width: 480px) {
    body {
        font-size: 14px;
    }

    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }

    .btn {
        width: 100%;
    }

    .modal-content {
        width: 95%;
        margin: var(--space-4);
    }
}

/* =====================================================
   UTILITY CLASSES
   ===================================================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }

.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mt-6 { margin-top: var(--space-6); }

.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }
.mb-6 { margin-bottom: var(--space-6); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-5 { gap: var(--space-5); }

.hidden { display: none; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}
