/* ============================================================
   IBS Pro - Business Management System
   Complete CSS Stylesheet
   Version: 2.0.0
   ============================================================ */

/* ============================================================
   1. CSS VARIABLES (Design Tokens)
   ============================================================ */
:root {
    /* Primary */
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #dbeafe;
    --primary-dark: #1e40af;
    --primary-50: #eff6ff;
    --primary-100: #dbeafe;
    --primary-200: #bfdbfe;
    --primary-600: #2563eb;
    --primary-700: #1d4ed8;
    --primary-800: #1e40af;

    /* Secondary */
    --secondary: #64748b;
    --secondary-hover: #475569;
    --secondary-light: #f1f5f9;

    /* Semantic Colors */
    --success: #16a34a;
    --success-hover: #15803d;
    --success-light: #dcfce7;
    --success-dark: #166534;

    --warning: #d97706;
    --warning-hover: #b45309;
    --warning-light: #fef3c7;
    --warning-dark: #92400e;

    --danger: #dc2626;
    --danger-hover: #b91c1c;
    --danger-light: #fee2e2;
    --danger-dark: #991b1b;

    --info: #0891b2;
    --info-hover: #0e7490;
    --info-light: #cffafe;
    --info-dark: #155e75;

    /* Backgrounds */
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --bg-sidebar: #0f172a;
    --bg-sidebar-hover: #1e293b;
    --bg-sidebar-active: #2563eb;
    --bg-input: #ffffff;
    --bg-hover: #f1f5f9;

    /* Text */
    --text: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-sidebar: #cbd5e1;
    --text-sidebar-active: #ffffff;
    --text-on-primary: #ffffff;
    --text-on-dark: #f8fafc;

    /* Borders */
    --border: #e2e8f0;
    --border-focus: #2563eb;
    --border-input: #d1d5db;
    --border-input-focus: #2563eb;

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

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --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 -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --shadow-primary: 0 4px 14px rgba(37, 99, 235, 0.3);

    /* Layout */
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 72px;
    --topbar-height: 64px;

    /* Typography */
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', 'Consolas', monospace;

    /* Transitions */
    --transition-fast: all 0.15s ease;
    --transition: all 0.2s ease;
    --transition-slow: all 0.3s ease;
    --transition-bounce: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Z-index layers */
    --z-sidebar: 100;
    --z-topbar: 90;
    --z-overlay: 200;
    --z-modal: 300;
    --z-toast: 400;
    --z-tooltip: 500;
}


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

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

body {
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    font-weight: 400;
    line-height: 1.6;
    color: var(--text);
    background-color: var(--bg);
    min-height: 100vh;
    overflow-x: hidden;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

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

a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

ul, ol {
    list-style: none;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--text);
    margin: 0;
}

h1 { font-size: 1.875rem; }
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: 0 0 0.75rem;
    color: var(--text-secondary);
}

p:last-child {
    margin-bottom: 0;
}

hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 1.5rem 0;
}

code, pre {
    font-family: var(--font-mono);
    font-size: 0.875rem;
}

code {
    background: var(--secondary-light);
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius-xs);
    color: var(--danger);
}

pre {
    background: var(--bg-sidebar);
    color: var(--text-on-dark);
    padding: 1rem;
    border-radius: var(--radius);
    overflow-x: auto;
    line-height: 1.5;
}

pre code {
    background: none;
    color: inherit;
    padding: 0;
}


/* ============================================================
   3. TYPOGRAPHY
   ============================================================ */
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.8125rem; }
.text-base { font-size: 0.9375rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }

.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.text-primary { color: var(--primary); }
.text-secondary { color: var(--secondary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-info { color: var(--info); }
.text-muted { color: var(--text-muted); }

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.text-uppercase { text-transform: uppercase; letter-spacing: 0.05em; }
.text-capitalize { text-transform: capitalize; }


/* ============================================================
   4. LAYOUT — App Shell
   ============================================================ */
.app-shell {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--transition-slow);
}

.page-content {
    flex: 1;
    padding: 1.5rem;
    max-width: 1400px;
    width: 100%;
}


/* ============================================================
   5. SIDEBAR
   ============================================================ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    color: var(--text-sidebar);
    display: flex;
    flex-direction: column;
    z-index: var(--z-sidebar);
    transition: transform var(--transition-slow), width var(--transition-slow);
    overflow: hidden;
}

.sidebar-header {
    padding: 1.25rem 1.25rem 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.sidebar-header .logo {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.sidebar-header .logo h2 {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--text-on-dark);
    margin: 0;
    letter-spacing: -0.02em;
}

.logo-img {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    object-fit: contain;
}

.company-name {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    padding-bottom: 0.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem 0.625rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.15) transparent;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}
.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.15);
    border-radius: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    border-radius: var(--radius);
    color: var(--text-sidebar);
    font-size: 0.875rem;
    font-weight: 450;
    transition: var(--transition-fast);
    text-decoration: none;
    margin-bottom: 2px;
    position: relative;
    white-space: nowrap;
    overflow: hidden;
}

.nav-item:hover {
    background: var(--bg-sidebar-hover);
    color: var(--text-on-dark);
    text-decoration: none;
}

.nav-item.active {
    background: var(--bg-sidebar-active);
    color: var(--text-sidebar-active);
    font-weight: 500;
    box-shadow: var(--shadow-primary);
}

.nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    font-size: 1rem;
    flex-shrink: 0;
}

.nav-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.06);
    margin: 0.5rem 0.75rem;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.user-info {
    display: flex;
    flex-direction: column;
    padding: 0.375rem 0;
    margin-bottom: 0.5rem;
}

.user-role {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--primary-200);
    font-weight: 600;
}

.user-name {
    font-size: 0.875rem;
    color: var(--text-on-dark);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-logout {
    width: 100%;
    color: var(--text-muted);
    font-size: 0.8125rem;
    justify-content: flex-start;
    padding: 0.5rem 0.75rem;
}

.btn-logout:hover {
    color: var(--danger-light);
    background: rgba(220, 38, 38, 0.1);
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: calc(var(--z-sidebar) - 1);
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity var(--transition);
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}


/* ============================================================
   6. TOPBAR
   ============================================================ */
.topbar {
    position: sticky;
    top: 0;
    height: var(--topbar-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 1rem;
    z-index: var(--z-topbar);
    flex-shrink: 0;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text);
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.menu-toggle:hover {
    background: var(--bg-hover);
}

.page-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.lang-select {
    padding: 0.375rem 0.625rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text);
    font-size: 0.8125rem;
    cursor: pointer;
    transition: var(--transition-fast);
    outline: none;
}

.lang-select:hover {
    border-color: var(--primary);
}

.lang-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}


/* ============================================================
   7. AUTH / LOGIN PAGE
   ============================================================ */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background:
        linear-gradient(135deg, #0f172a 0%, #1e3a5f 40%, #2563eb 100%);
    position: relative;
    overflow: hidden;
}

/* Subtle pattern overlay */
.auth-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(circle at 20% 50%, rgba(37, 99, 235, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(139, 92, 246, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 60% 80%, rgba(8, 145, 178, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

/* Animated dots pattern */
.auth-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: radial-gradient(rgba(255,255,255,0.06) 1px, transparent 1px);
    background-size: 30px 30px;
    pointer-events: none;
}

.auth-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-2xl);
    padding: 2.5rem;
    width: 100%;
    max-width: 440px;
    position: relative;
    z-index: 1;
    animation: authCardEntry 0.6s ease-out;
}

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

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.25rem;
    letter-spacing: -0.03em;
}

.auth-header p {
    color: var(--text-muted);
    font-size: 0.9375rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.125rem;
}

.auth-switch {
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.auth-switch a {
    color: var(--primary);
    font-weight: 600;
}

.auth-message {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    animation: animate-fade-in 0.3s ease;
}

.auth-message.success {
    background: var(--success-light);
    color: var(--success-dark);
    border: 1px solid rgba(22, 163, 74, 0.2);
}

.auth-message.error {
    background: var(--danger-light);
    color: var(--danger-dark);
    border: 1px solid rgba(220, 38, 38, 0.2);
}


/* ============================================================
   8. BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5625rem 1.125rem;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.4;
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
    font-family: var(--font-sans);
    outline: none;
    user-select: none;
    position: relative;
    overflow: hidden;
}

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

.btn:focus-visible {
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* Primary */
.btn-primary {
    background: var(--primary);
    color: var(--text-on-primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    box-shadow: var(--shadow-primary);
    transform: translateY(-1px);
}

.btn-primary:active {
    background: var(--primary-dark);
    transform: translateY(0);
}

/* Secondary */
.btn-secondary {
    background: var(--bg-card);
    color: var(--text);
    border-color: var(--border);
}

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

.btn-secondary:active {
    background: var(--secondary-light);
}

/* Danger */
.btn-danger {
    background: var(--danger);
    color: var(--text-on-primary);
    border-color: var(--danger);
}

.btn-danger:hover {
    background: var(--danger-hover);
    border-color: var(--danger-hover);
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.3);
    transform: translateY(-1px);
}

/* Success */
.btn-success {
    background: var(--success);
    color: var(--text-on-primary);
    border-color: var(--success);
}

.btn-success:hover {
    background: var(--success-hover);
    border-color: var(--success-hover);
    transform: translateY(-1px);
}

/* Warning */
.btn-warning {
    background: var(--warning);
    color: var(--text-on-primary);
    border-color: var(--warning);
}

.btn-warning:hover {
    background: var(--warning-hover);
    border-color: var(--warning-hover);
}

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

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

/* Outline variants */
.btn-outline-primary {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline-primary:hover {
    background: var(--primary);
    color: var(--text-on-primary);
}

.btn-outline-danger {
    background: transparent;
    color: var(--danger);
    border-color: var(--danger);
}

.btn-outline-danger:hover {
    background: var(--danger);
    color: var(--text-on-primary);
}

/* Button Sizes */
.btn-xs {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border-radius: var(--radius-xs);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    border-radius: var(--radius-lg);
}

.btn-xl {
    padding: 0.875rem 2rem;
    font-size: 1.0625rem;
    border-radius: var(--radius-lg);
}

/* Full width */
.btn-full {
    width: 100%;
}

/* Icon only button */
.btn-icon {
    padding: 0.5rem;
    min-width: 36px;
    min-height: 36px;
}

.btn-icon.btn-sm {
    padding: 0.375rem;
    min-width: 30px;
    min-height: 30px;
}

/* Loading state */
.btn-loading {
    color: transparent !important;
    pointer-events: none;
    position: relative;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: btn-spinner 0.6s linear infinite;
}

.btn-secondary.btn-loading::after,
.btn-outline-primary.btn-loading::after,
.btn-ghost.btn-loading::after {
    border-color: rgba(0, 0, 0, 0.15);
    border-top-color: var(--text);
}

@keyframes btn-spinner {
    to { transform: rotate(360deg); }
}

/* Button Group */
.btn-group {
    display: inline-flex;
    gap: 0;
}

.btn-group .btn {
    border-radius: 0;
    margin-left: -1px;
}

.btn-group .btn:first-child {
    border-radius: var(--radius) 0 0 var(--radius);
    margin-left: 0;
}

.btn-group .btn:last-child {
    border-radius: 0 var(--radius) var(--radius) 0;
}


/* ============================================================
   9. FORMS
   ============================================================ */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.form-group label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="url"],
input[type="date"],
input[type="datetime-local"],
input[type="time"],
input[type="search"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: 0.5625rem 0.75rem;
    font-size: 0.875rem;
    font-family: var(--font-sans);
    color: var(--text);
    background: var(--bg-input);
    border: 1px solid var(--border-input);
    border-radius: var(--radius);
    transition: var(--transition-fast);
    outline: none;
    line-height: 1.5;
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
}

input:hover,
select:hover,
textarea:hover {
    border-color: var(--secondary);
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--border-input-focus);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Disabled */
input:disabled,
select:disabled,
textarea:disabled {
    background: var(--secondary-light);
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.7;
}

/* Read-only */
input[readonly],
textarea[readonly] {
    background: var(--secondary-light);
}

/* Select */
select {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.625rem center;
    padding-right: 2rem;
}

/* Textarea */
textarea {
    resize: vertical;
    min-height: 100px;
}

/* File input */
input[type="file"] {
    padding: 0.5rem;
    cursor: pointer;
}

/* Checkbox / Radio */
.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    width: 1.0625rem;
    height: 1.0625rem;
    accent-color: var(--primary);
    cursor: pointer;
}

.form-check label {
    font-size: 0.875rem;
    cursor: pointer;
    color: var(--text-secondary);
}

/* Form hint */
.form-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.125rem;
}

/* Validation states */
.form-group.has-error input,
.form-group.has-error select,
.form-group.has-error textarea {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.form-group.has-success input,
.form-group.has-success select,
.form-group.has-success textarea {
    border-color: var(--success);
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1);
}

.form-error {
    font-size: 0.75rem;
    color: var(--danger);
    font-weight: 500;
    margin-top: 0.125rem;
}

.form-success {
    font-size: 0.75rem;
    color: var(--success);
    font-weight: 500;
    margin-top: 0.125rem;
}

/* Input group */
.input-group {
    display: flex;
}

.input-group input,
.input-group select,
.input-group .btn {
    border-radius: 0;
}

.input-group input:first-child,
.input-group select:first-child,
.input-group .btn:first-child {
    border-radius: var(--radius) 0 0 var(--radius);
}

.input-group input:last-child,
.input-group select:last-child,
.input-group .btn:last-child {
    border-radius: 0 var(--radius) var(--radius) 0;
}

.input-group .input-addon {
    display: flex;
    align-items: center;
    padding: 0 0.75rem;
    background: var(--secondary-light);
    border: 1px solid var(--border);
    border-radius: 0;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.input-group .input-addon:first-child {
    border-radius: var(--radius) 0 0 var(--radius);
}

.input-group .input-addon:last-child {
    border-radius: 0 var(--radius) var(--radius) 0;
}

/* Inline form */
.form-inline {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    flex-wrap: wrap;
}

.form-inline .form-group {
    flex: 1;
    min-width: 180px;
}


/* ============================================================
   10. CARDS
   ============================================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow);
}

.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.card-body {
    padding: 1.25rem;
}

.card-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border);
    background: var(--secondary-light);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
}

.card-title {
    font-size: 1.0625rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.card-subtitle {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* Card without body padding */
.card-flat .card-body {
    padding: 0;
}

/* Clickable card */
.card-clickable {
    cursor: pointer;
}

.card-clickable:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}


/* ============================================================
   11. TABLES
   ============================================================ */
.table-container {
    width: 100%;
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--bg-card);
}

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

.table-container thead {
    background: var(--secondary-light);
    border-bottom: 2px solid var(--border);
}

.table-container th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
    position: sticky;
    top: 0;
    background: var(--secondary-light);
    z-index: 1;
}

.table-container td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
}

.table-container tbody tr {
    transition: var(--transition-fast);
}

.table-container tbody tr:hover {
    background: var(--bg-hover);
}

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

.table-container tbody tr.selected {
    background: var(--primary-50);
}

/* Table actions column */
.table-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    justify-content: flex-end;
    white-space: nowrap;
}

/* Striped table */
.table-striped tbody tr:nth-child(even) {
    background: rgba(248, 250, 252, 0.5);
}

/* Compact table */
.table-compact th,
.table-compact td {
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
}

/* Table empty state */
.table-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.table-empty p {
    font-size: 0.9375rem;
    margin-bottom: 0.5rem;
}

/* Row link */
tr.row-link {
    cursor: pointer;
}

tr.row-link:hover td {
    background: var(--bg-hover);
}


/* ============================================================
   12. BADGES
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.1875rem 0.5625rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    line-height: 1.4;
    white-space: nowrap;
    letter-spacing: 0.01em;
}

.badge-primary {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.badge-success {
    background: var(--success-light);
    color: var(--success-dark);
}

.badge-warning {
    background: var(--warning-light);
    color: var(--warning-dark);
}

.badge-danger {
    background: var(--danger-light);
    color: var(--danger-dark);
}

.badge-info {
    background: var(--info-light);
    color: var(--info-dark);
}

.badge-secondary {
    background: var(--secondary-light);
    color: var(--secondary);
}

.badge-dark {
    background: var(--bg-sidebar);
    color: var(--text-on-dark);
}

/* Badge dot indicator */
.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.badge-dot-success { background: var(--success); }
.badge-dot-warning { background: var(--warning); }
.badge-dot-danger  { background: var(--danger); }
.badge-dot-info    { background: var(--info); }


/* ============================================================
   13. MODAL
   ============================================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-2xl);
    width: 100%;
    max-width: 560px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    transform: scale(0.92) translateY(20px);
    transition: var(--transition-bounce);
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.modal-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    font-size: 1.125rem;
    transition: var(--transition-fast);
}

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

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* Modal sizes */
.modal-sm {
    max-width: 400px;
}

.modal-lg {
    max-width: 720px;
}

.modal-xl {
    max-width: 900px;
}

.modal-full {
    max-width: 95vw;
    max-height: 95vh;
}


/* ============================================================
   14. STATS CARDS
   ============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    transition: var(--transition);
    box-shadow: var(--shadow-xs);
}

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

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.375rem;
    flex-shrink: 0;
}

.stat-icon-blue {
    background: var(--primary-light);
    color: var(--primary);
}

.stat-icon-green {
    background: var(--success-light);
    color: var(--success);
}

.stat-icon-red {
    background: var(--danger-light);
    color: var(--danger);
}

.stat-icon-yellow {
    background: var(--warning-light);
    color: var(--warning);
}

.stat-icon-cyan {
    background: var(--info-light);
    color: var(--info);
}

.stat-info {
    flex: 1;
    min-width: 0;
}

.stat-label {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
    margin-bottom: 0.25rem;
}

.stat-trend {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius-full);
}

.stat-trend-up {
    color: var(--success-dark);
    background: var(--success-light);
}

.stat-trend-down {
    color: var(--danger-dark);
    background: var(--danger-light);
}


/* ============================================================
   15. CHARTS
   ============================================================ */
.chart-container {
    position: relative;
    width: 100%;
    padding: 1rem;
}

.chart-container canvas {
    max-height: 350px;
}

.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

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

.chart-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-xs);
}


/* ============================================================
   16. DATA LISTS (Mobile-friendly card view)
   ============================================================ */
.data-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.data-list-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    transition: var(--transition);
    cursor: pointer;
}

.data-list-item:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-200);
}

.data-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.data-list-title {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--text);
}

.data-list-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.data-list-meta-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.data-list-meta-item .meta-icon {
    color: var(--text-muted);
}

.data-list-actions {
    display: flex;
    gap: 0.375rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}


/* ============================================================
   17. PAGINATION
   ============================================================ */
.pagination {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    justify-content: center;
    padding: 1rem 0;
}

.pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 0.5rem;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    border-radius: var(--radius);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
    text-decoration: none;
    font-family: var(--font-sans);
}

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

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

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

.pagination-info {
    font-size: 0.8125rem;
    color: var(--text-muted);
    padding: 0 0.75rem;
}


/* ============================================================
   18. TOAST NOTIFICATIONS
   ============================================================ */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 380px;
    width: 100%;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    animation: toast-in 0.35s ease-out;
    pointer-events: auto;
    position: relative;
    overflow: hidden;
}

.toast::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--secondary);
}

.toast-success::before { background: var(--success); }
.toast-error::before   { background: var(--danger); }
.toast-warning::before { background: var(--warning); }
.toast-info::before    { background: var(--info); }

.toast-icon {
    font-size: 1.125rem;
    flex-shrink: 0;
    line-height: 1;
    margin-top: 1px;
}

.toast-content {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text);
    margin-bottom: 0.125rem;
}

.toast-message {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.125rem;
    line-height: 1;
    flex-shrink: 0;
    transition: var(--transition-fast);
    border-radius: var(--radius-xs);
}

.toast-close:hover {
    color: var(--text);
    background: var(--bg-hover);
}

.toast-exit {
    animation: toast-out 0.3s ease-in forwards;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateX(100%) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes toast-out {
    from {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateX(100%) scale(0.95);
    }
}


/* ============================================================
   19. LOADING SPINNER
   ============================================================ */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 1rem;
    gap: 1rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spinner-rotate 0.7s linear infinite;
}

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

.spinner-lg {
    width: 56px;
    height: 56px;
    border-width: 4px;
}

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

/* Skeleton loading */
.skeleton {
    background: linear-gradient(90deg, var(--secondary-light) 25%, #e8ecf0 50%, var(--secondary-light) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
    width: 100%;
}

.skeleton-text:last-child {
    width: 60%;
}

.skeleton-title {
    height: 1.5rem;
    width: 40%;
    margin-bottom: 0.75rem;
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.skeleton-card {
    height: 120px;
    width: 100%;
    border-radius: var(--radius-lg);
}

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


/* ============================================================
   20. EMPTY STATE
   ============================================================ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
}

.empty-state-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    opacity: 0.7;
    line-height: 1;
}

.empty-state-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.375rem;
}

.empty-state-desc {
    font-size: 0.875rem;
    color: var(--text-muted);
    max-width: 320px;
    margin-bottom: 1.25rem;
}

.empty-state-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}


/* ============================================================
   21. TOOLBAR (Search / Filter Bar)
   ============================================================ */
.toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.toolbar-search {
    flex: 1;
    min-width: 200px;
    position: relative;
}

.toolbar-search input {
    padding-left: 2.25rem;
}

.toolbar-search .search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.875rem;
    pointer-events: none;
}

.toolbar-filters {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.toolbar-spacer {
    flex: 1;
}

/* Filter dropdown */
.filter-dropdown {
    position: relative;
}

.filter-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 200px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 0.375rem;
    z-index: 50;
    display: none;
}

.filter-dropdown-menu.open {
    display: block;
    animation: animate-fade-in 0.15s ease;
}

.filter-dropdown-item {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: var(--text);
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
    font-family: var(--font-sans);
}

.filter-dropdown-item:hover {
    background: var(--bg-hover);
}

.filter-dropdown-item.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 500;
}


/* ============================================================
   22. TABS
   ============================================================ */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    gap: 0;
    margin-bottom: 1.5rem;
    overflow-x: auto;
    scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
    display: none;
}

.tab {
    padding: 0.75rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    border: none;
    background: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: var(--transition-fast);
    white-space: nowrap;
    font-family: var(--font-sans);
    position: relative;
}

.tab:hover {
    color: var(--primary);
}

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

.tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 0.375rem;
    background: var(--secondary-light);
    color: var(--text-muted);
    font-size: 0.6875rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    margin-left: 0.375rem;
}

.tab.active .tab-count {
    background: var(--primary-light);
    color: var(--primary);
}

/* Tab content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: animate-fade-in 0.25s ease;
}

/* Pill tabs */
.tabs-pills {
    border-bottom: none;
    gap: 0.375rem;
    background: var(--secondary-light);
    padding: 0.375rem;
    border-radius: var(--radius-lg);
    display: inline-flex;
}

.tabs-pills .tab {
    border-bottom: none;
    margin-bottom: 0;
    border-radius: var(--radius);
    padding: 0.5rem 1rem;
}

.tabs-pills .tab.active {
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
}


/* ============================================================
   23. RESPONSIVE DESIGN
   ============================================================ */

/* Tablet & Below */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-2xl);
    }

    .main-content {
        margin-left: 0;
    }

    .menu-toggle {
        display: flex;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }

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

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

/* Mobile */
@media (max-width: 768px) {
    html {
        font-size: 15px;
    }

    .page-content {
        padding: 1rem;
    }

    .topbar {
        padding: 0 1rem;
    }

    .page-title {
        font-size: 1.0625rem;
    }

    /* Hide table on mobile, show data-list instead */
    .table-container {
        display: none;
    }

    .table-container.mobile-visible {
        display: block;
    }

    .data-list {
        display: flex;
    }

    .data-list.hidden-mobile {
        display: none;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }

    .stat-card {
        padding: 1rem;
        flex-direction: column;
        text-align: center;
        align-items: center;
    }

    .stat-icon {
        width: 42px;
        height: 42px;
    }

    .stat-value {
        font-size: 1.25rem;
    }

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

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

    .toolbar-filters {
        justify-content: flex-start;
    }

    .auth-card {
        padding: 1.75rem;
        border-radius: var(--radius-lg);
    }

    .auth-header h1 {
        font-size: 1.625rem;
    }

    .modal {
        max-width: calc(100vw - 2rem);
        max-height: 90vh;
        margin: auto;
        border-radius: var(--radius-lg);
    }

    .modal-body {
        padding: 1rem;
    }

    .tabs-pills {
        width: 100%;
        overflow-x: auto;
    }

    .pagination {
        flex-wrap: wrap;
    }

    .installer-card {
        margin: 0 0.5rem;
        padding: 1.5rem;
    }

    .toast-container {
        left: 1rem;
        right: 1rem;
        max-width: none;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Small mobile */
@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .page-content {
        padding: 0.75rem;
    }

    .stat-value {
        font-size: 1.375rem;
    }
}


/* ============================================================
   24. RTL SUPPORT
   ============================================================ */
[dir="rtl"],
.rtl {
    direction: rtl;
    text-align: right;
}

[dir="rtl"] .main-content,
.rtl .main-content {
    margin-left: 0;
    margin-right: var(--sidebar-width);
}

[dir="rtl"] .sidebar,
.rtl .sidebar {
    left: auto;
    right: 0;
}

[dir="rtl"] .sidebar.open,
.rtl .sidebar.open {
    transform: translateX(0);
}

[dir="rtl"] .sidebar:not(.open),
.rtl .sidebar:not(.open) {
    transform: translateX(100%);
}

[dir="rtl"] .toast-container,
.rtl .toast-container {
    right: auto;
    left: 1rem;
}

[dir="rtl"] .modal-close,
.rtl .modal-close {
    margin-left: 0;
    margin-right: auto;
}

[dir="rtl"] .form-hint,
.rtl .form-hint {
    text-align: right;
}

[dir="rtl"] .table-container th,
[dir="rtl"] .table-container td,
.rtl .table-container th,
.rtl .table-container td {
    text-align: right;
}

[dir="rtl"] .table-actions,
.rtl .table-actions {
    justify-content: flex-start;
}

[dir="rtl"] .sidebar-nav,
.rtl .sidebar-nav {
    direction: rtl;
}

[dir="rtl"] .lang-select,
.rtl .lang-select {
    background-position: left 0.625rem center;
    padding-left: 2rem;
    padding-right: 0.625rem;
}

[dir="rtl"] select,
.rtl select {
    background-position: left 0.625rem center;
    padding-left: 2rem;
    padding-right: 0.75rem;
}

[dir="rtl"] .input-group,
.rtl .input-group {
    direction: rtl;
}

[dir="rtl"] .toast,
.rtl .toast {
    flex-direction: row-reverse;
}

[dir="rtl"] .toast::before,
.rtl .toast::before {
    left: auto;
    right: 0;
}

/* RTL mobile override */
@media (max-width: 1024px) {
    [dir="rtl"] .main-content,
    .rtl .main-content {
        margin-right: 0;
    }
}


/* ============================================================
   25. UTILITY CLASSES
   ============================================================ */

/* Spacing */
.m-0    { margin: 0; }
.m-1    { margin: 0.25rem; }
.m-2    { margin: 0.5rem; }
.m-3    { margin: 0.75rem; }
.m-4    { margin: 1rem; }
.m-5    { margin: 1.5rem; }
.m-6    { margin: 2rem; }

.mt-0   { margin-top: 0; }
.mt-1   { margin-top: 0.25rem; }
.mt-2   { margin-top: 0.5rem; }
.mt-3   { margin-top: 0.75rem; }
.mt-4   { margin-top: 1rem; }
.mt-5   { margin-top: 1.5rem; }
.mt-6   { margin-top: 2rem; }
.mt-8   { margin-top: 3rem; }

.mb-0   { margin-bottom: 0; }
.mb-1   { margin-bottom: 0.25rem; }
.mb-2   { margin-bottom: 0.5rem; }
.mb-3   { margin-bottom: 0.75rem; }
.mb-4   { margin-bottom: 1rem; }
.mb-5   { margin-bottom: 1.5rem; }
.mb-6   { margin-bottom: 2rem; }

.ml-0   { margin-left: 0; }
.ml-1   { margin-left: 0.25rem; }
.ml-2   { margin-left: 0.5rem; }
.ml-3   { margin-left: 0.75rem; }
.ml-4   { margin-left: 1rem; }
.ml-auto { margin-left: auto; }

.mr-0   { margin-right: 0; }
.mr-1   { margin-right: 0.25rem; }
.mr-2   { margin-right: 0.5rem; }
.mr-3   { margin-right: 0.75rem; }
.mr-4   { margin-right: 1rem; }
.mr-auto { margin-right: auto; }

.mx-auto { margin-left: auto; margin-right: auto; }

/* Padding */
.p-0    { padding: 0; }
.p-1    { padding: 0.25rem; }
.p-2    { padding: 0.5rem; }
.p-3    { padding: 0.75rem; }
.p-4    { padding: 1rem; }
.p-5    { padding: 1.5rem; }
.p-6    { padding: 2rem; }

.pt-0   { padding-top: 0; }
.pt-4   { padding-top: 1rem; }
.pt-5   { padding-top: 1.5rem; }

.pb-0   { padding-bottom: 0; }
.pb-4   { padding-bottom: 1rem; }
.pb-5   { padding-bottom: 1.5rem; }

.px-4   { padding-left: 1rem; padding-right: 1rem; }
.py-4   { padding-top: 1rem; padding-bottom: 1rem; }

/* Gap */
.gap-0   { gap: 0; }
.gap-1   { gap: 0.25rem; }
.gap-2   { gap: 0.5rem; }
.gap-3   { gap: 0.75rem; }
.gap-4   { gap: 1rem; }
.gap-5   { gap: 1.5rem; }
.gap-6   { gap: 2rem; }

/* Display */
.d-none    { display: none !important; }
.d-block   { display: block; }
.d-flex    { display: flex; }
.d-inline  { display: inline; }
.d-inline-flex { display: inline-flex; }
.d-grid    { display: grid; }

/* Flexbox */
.flex      { display: flex; }
.flex-col  { flex-direction: column; }
.flex-row  { flex-direction: row; }
.flex-wrap { flex-wrap: wrap; }
.flex-1    { flex: 1; }
.flex-auto { flex: auto; }

.items-center     { align-items: center; }
.items-start      { align-items: flex-start; }
.items-end        { align-items: flex-end; }
.items-stretch    { align-items: stretch; }

.justify-center   { justify-content: center; }
.justify-between  { justify-content: space-between; }
.justify-end      { justify-content: flex-end; }
.justify-start    { justify-content: flex-start; }

.flex-shrink-0 { flex-shrink: 0; }

/* Width */
.w-full   { width: 100%; }
.w-auto   { width: auto; }
.max-w-sm { max-width: 400px; }
.max-w-md { max-width: 560px; }
.max-w-lg { max-width: 720px; }
.max-w-xl { max-width: 900px; }

/* Height */
.h-full { height: 100%; }
.min-h-screen { min-height: 100vh; }

/* Grid */
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* Border */
.border        { border: 1px solid var(--border); }
.border-t      { border-top: 1px solid var(--border); }
.border-b      { border-bottom: 1px solid var(--border); }
.border-0      { border: 0; }
.rounded       { border-radius: var(--radius); }
.rounded-lg    { border-radius: var(--radius-lg); }
.rounded-full  { border-radius: var(--radius-full); }

/* Background */
.bg-white   { background: var(--bg-card); }
.bg-light   { background: var(--bg); }
.bg-primary { background: var(--primary); }

/* Overflow */
.overflow-hidden { overflow: hidden; }
.overflow-auto   { overflow: auto; }
.overflow-x-auto { overflow-x: auto; }

/* Cursor */
.cursor-pointer { cursor: pointer; }

/* Visibility */
.visible   { visibility: visible; }
.invisible { visibility: hidden; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Position */
.relative { position: relative; }
.absolute { position: absolute; }
.sticky   { position: sticky; }

/* Opacity */
.opacity-0   { opacity: 0; }
.opacity-50  { opacity: 0.5; }
.opacity-75  { opacity: 0.75; }
.opacity-100 { opacity: 1; }

/* Shadow */
.shadow-none { box-shadow: none; }
.shadow-sm   { box-shadow: var(--shadow-sm); }
.shadow      { box-shadow: var(--shadow); }
.shadow-lg   { box-shadow: var(--shadow-lg); }
.shadow-xl   { box-shadow: var(--shadow-xl); }


/* ============================================================
   26. INSTALLER STYLES
   ============================================================ */
.installer-page {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 2rem 1rem;
}

.installer-page::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: radial-gradient(rgba(255,255,255,0.03) 1px, transparent 1px);
    background-size: 24px 24px;
    pointer-events: none;
}

.installer-wrapper {
    width: 100%;
    max-width: 640px;
    position: relative;
    z-index: 1;
}

.installer-header {
    text-align: center;
    margin-bottom: 2rem;
}

.installer-logo h1 {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--text-on-dark);
    letter-spacing: -0.03em;
    margin-bottom: 0.25rem;
}

.installer-subtitle {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.5);
}

/* Step Progress */
.installer-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 2rem;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative;
}

.progress-step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 16px;
    left: calc(50% + 20px);
    width: calc(100% - 40px);
    height: 2px;
    background: rgba(255, 255, 255, 0.15);
    z-index: 0;
}

.progress-step.completed:not(:last-child)::after {
    background: var(--success);
}

.progress-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8125rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.15);
    position: relative;
    z-index: 1;
    transition: var(--transition);
}

.progress-step.active .progress-number {
    background: var(--primary);
    color: var(--text-on-primary);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.2);
}

.progress-step.completed .progress-number {
    background: var(--success);
    color: var(--text-on-primary);
    border-color: var(--success);
}

.progress-label {
    font-size: 0.6875rem;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 0.5rem;
    text-align: center;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.progress-step.active .progress-label {
    color: var(--text-on-dark);
}

.progress-step.completed .progress-label {
    color: var(--success);
}

/* Installer Card */
.installer-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-2xl);
    padding: 2rem;
}

.installer-card-title {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.375rem;
}

.installer-card-desc {
    font-size: 0.9375rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

/* Requirements list */
.requirements-list {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    margin-bottom: 1.5rem;
}

.requirement-item {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    transition: var(--transition-fast);
}

.requirement-item.pass {
    border-color: rgba(22, 163, 74, 0.2);
    background: rgba(22, 163, 74, 0.03);
}

.requirement-item.fail {
    border-color: rgba(220, 38, 38, 0.2);
    background: rgba(220, 38, 38, 0.03);
}

.requirement-item.warning {
    border-color: rgba(217, 119, 6, 0.2);
    background: rgba(217, 119, 6, 0.03);
}

.req-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
    line-height: 1;
}

.req-info {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.req-info strong {
    font-size: 0.9375rem;
    color: var(--text);
}

.req-info span {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* Installer Actions */
.installer-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1.5rem;
    justify-content: flex-end;
}

.installer-actions .btn-secondary:last-of-type,
.installer-actions .btn-primary {
    margin-left: auto;
}

/* Database test result */
.db-test-result {
    margin-bottom: 1rem;
}

.db-test-success {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--success-light);
    color: var(--success-dark);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid rgba(22, 163, 74, 0.2);
    animation: animate-fade-in 0.3s ease;
}

.db-test-error {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--danger-light);
    color: var(--danger-dark);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid rgba(220, 38, 38, 0.2);
    animation: animate-fade-in 0.3s ease;
}

.db-test-loading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--primary-light);
    color: var(--primary-dark);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    animation: animate-fade-in 0.3s ease;
}

/* Installer Error */
.installer-error {
    background: var(--danger-light);
    border: 1px solid rgba(220, 38, 38, 0.2);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.installer-error-header {
    font-weight: 600;
    color: var(--danger-dark);
    font-size: 1rem;
    margin-bottom: 0.75rem;
}

.installer-error ul {
    list-style: disc;
    padding-left: 1.25rem;
    margin-bottom: 1rem;
}

.installer-error li {
    font-size: 0.875rem;
    color: var(--danger-dark);
    margin-bottom: 0.375rem;
}

.installer-warning {
    padding: 1rem;
    background: var(--warning-light);
    border: 1px solid rgba(217, 119, 6, 0.2);
    border-radius: var(--radius);
    color: var(--warning-dark);
    font-size: 0.875rem;
}

/* Installer Success */
.installer-success {
    text-align: center;
}

.success-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    line-height: 1;
    animation: success-bounce 0.6s ease;
}

@keyframes success-bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

.success-details {
    margin: 1.5rem 0;
    padding: 1rem;
    background: var(--secondary-light);
    border-radius: var(--radius);
    text-align: left;
}

.success-detail-item {
    display: flex;
    justify-content: space-between;
    padding: 0.375rem 0;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border);
}

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

.success-detail-item strong {
    color: var(--text);
}

.success-detail-item span {
    color: var(--text-secondary);
}

.success-actions {
    margin-top: 1.5rem;
}

.installer-note {
    margin-top: 1.5rem;
    padding: 0.75rem 1rem;
    background: var(--warning-light);
    border: 1px solid rgba(217, 119, 6, 0.15);
    border-radius: var(--radius);
    font-size: 0.8125rem;
    color: var(--warning-dark);
}

.installer-note code {
    background: rgba(217, 119, 6, 0.15);
    color: var(--warning-dark);
}

/* Installer Footer */
.installer-footer {
    text-align: center;
    margin-top: 2rem;
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.8125rem;
}

/* Installer responsive */
@media (max-width: 640px) {
    .installer-card {
        padding: 1.5rem;
    }

    .installer-progress {
        gap: 0.25rem;
    }

    .progress-label {
        font-size: 0.625rem;
    }

    .progress-number {
        width: 28px;
        height: 28px;
        font-size: 0.75rem;
    }

    .progress-step:not(:last-child)::after {
        top: 14px;
        left: calc(50% + 18px);
        width: calc(100% - 36px);
    }

    .installer-actions {
        flex-direction: column;
    }

    .installer-actions .btn {
        width: 100%;
    }
}


/* ============================================================
   27. PRINT STYLES
   ============================================================ */
@media print {
    /* Hide non-printable elements */
    .sidebar,
    .topbar,
    .menu-toggle,
    .btn,
    .toolbar,
    .pagination,
    .toast-container,
    .modal-overlay,
    .sidebar-overlay,
    .sidebar-footer .btn-logout {
        display: none !important;
    }

    /* Reset layout */
    .app-shell {
        display: block;
    }

    .main-content {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .page-content {
        padding: 0 !important;
        max-width: 100% !important;
    }

    /* Card styles for print */
    .card {
        border: 1px solid #ddd;
        box-shadow: none;
        break-inside: avoid;
        page-break-inside: avoid;
        margin-bottom: 1rem;
    }

    /* Table styles for print */
    .table-container {
        border: 1px solid #ddd;
        overflow: visible;
    }

    .table-container table {
        font-size: 10pt;
    }

    .table-container thead th {
        background: #f5f5f5 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .table-container tbody tr:hover {
        background: transparent;
    }

    /* Typography for print */
    body {
        font-size: 11pt;
        color: #000;
        background: #fff;
    }

    h1, h2, h3, h4, h5, h6 {
        color: #000;
    }

    /* Links */
    a[href]:after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #666;
    }

    a[href^="#"]:after,
    a[href^="javascript"]:after {
        content: "";
    }

    /* Ensure backgrounds print */
    .badge {
        border: 1px solid currentColor;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Stat cards */
    .stat-card {
        border: 1px solid #ddd;
        box-shadow: none;
    }

    /* Prevent page breaks inside elements */
    .stat-card,
    .data-list-item,
    tr {
        break-inside: avoid;
    }
}


/* ============================================================
   28. CUSTOM SCROLLBAR
   ============================================================ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, 0.25);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 116, 139, 0.4);
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(100, 116, 139, 0.25) transparent;
}

/* Scrollbar for sidebar (dark) */
.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.sidebar-nav {
    scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}


/* ============================================================
   29. ANIMATIONS
   ============================================================ */

/* Fade In */
@keyframes animate-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.animate-fade-in {
    animation: animate-fade-in 0.3s ease-out;
}

/* Slide In from Top */
@keyframes animate-slide-down {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-slide-down {
    animation: animate-slide-down 0.3s ease-out;
}

/* Slide In from Bottom */
@keyframes animate-slide-up {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-slide-up {
    animation: animate-slide-up 0.3s ease-out;
}

/* Scale In */
@keyframes animate-scale-in {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.animate-scale-in {
    animation: animate-scale-in 0.2s ease-out;
}

/* Pulse (for loading / live indicators) */
@keyframes animate-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.5; }
}

.animate-pulse {
    animation: animate-pulse 2s ease-in-out infinite;
}

/* Bounce */
@keyframes animate-bounce {
    0%, 100% {
        transform: translateY(0);
        animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
    }
    50% {
        transform: translateY(-6px);
        animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
    }
}

.animate-bounce {
    animation: animate-bounce 1s infinite;
}

/* Spin */
@keyframes animate-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.animate-spin {
    animation: animate-spin 1s linear infinite;
}

/* Shake (for errors) */
@keyframes animate-shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}

.animate-shake {
    animation: animate-shake 0.5s ease-in-out;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}


/* ============================================================
   30. ADDITIONAL COMPONENTS
   ============================================================ */

/* Dropdown Menu */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 180px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 0.375rem;
    z-index: 50;
    display: none;
}

.dropdown-menu.open {
    display: block;
    animation: animate-slide-down 0.15s ease;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: var(--text);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
}

.dropdown-item:hover {
    background: var(--bg-hover);
    text-decoration: none;
}

.dropdown-item.danger {
    color: var(--danger);
}

.dropdown-item.danger:hover {
    background: var(--danger-light);
}

.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 0.25rem 0;
}

.dropdown-header {
    padding: 0.5rem 0.75rem 0.25rem;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

/* Avatar */
.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-on-primary);
    background: var(--primary);
    flex-shrink: 0;
    overflow: hidden;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-sm {
    width: 28px;
    height: 28px;
    font-size: 0.75rem;
}

.avatar-lg {
    width: 48px;
    height: 48px;
    font-size: 1.125rem;
}

.avatar-xl {
    width: 64px;
    height: 64px;
    font-size: 1.5rem;
}

/* Tooltip */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%) scale(0.9);
    padding: 0.375rem 0.625rem;
    background: var(--bg-sidebar);
    color: var(--text-on-dark);
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: var(--transition-fast);
    z-index: var(--z-tooltip);
}

[data-tooltip]:hover::after {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

/* Confirm Dialog */
.confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: calc(var(--z-modal) + 10);
    padding: 1rem;
}

.confirm-dialog {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: 2rem;
    max-width: 400px;
    width: 100%;
    box-shadow: var(--shadow-2xl);
    text-align: center;
    animation: animate-scale-in 0.2s ease;
}

.confirm-dialog-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.confirm-dialog-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.confirm-dialog-message {
    font-size: 0.9375rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.confirm-dialog-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

/* Divider */
.divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
    color: var(--text-muted);
    font-size: 0.8125rem;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* Alert / Callout */
.alert {
    padding: 0.875rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    border: 1px solid transparent;
}

.alert-info {
    background: var(--info-light);
    color: var(--info-dark);
    border-color: rgba(8, 145, 178, 0.2);
}

.alert-success {
    background: var(--success-light);
    color: var(--success-dark);
    border-color: rgba(22, 163, 74, 0.2);
}

.alert-warning {
    background: var(--warning-light);
    color: var(--warning-dark);
    border-color: rgba(217, 119, 6, 0.2);
}

.alert-danger {
    background: var(--danger-light);
    color: var(--danger-dark);
    border-color: rgba(220, 38, 38, 0.2);
}

.alert-icon {
    font-size: 1.125rem;
    flex-shrink: 0;
    line-height: 1.3;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 600;
    margin-bottom: 0.125rem;
}

.alert-close {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 1.125rem;
    opacity: 0.6;
    padding: 0.125rem;
    flex-shrink: 0;
    transition: var(--transition-fast);
}

.alert-close:hover {
    opacity: 1;
}

/* Switch / Toggle */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--border);
    border-radius: var(--radius-full);
    transition: var(--transition);
}

.switch-slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: var(--bg-card);
    border-radius: 50%;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.switch input:checked + .switch-slider {
    background: var(--primary);
}

.switch input:checked + .switch-slider::before {
    transform: translateX(20px);
}

.switch input:focus-visible + .switch-slider {
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* Progress Bar */
.progress {
    height: 8px;
    background: var(--secondary-light);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: var(--radius-full);
    background: var(--primary);
    transition: width var(--transition-slow);
}

.progress-bar-success { background: var(--success); }
.progress-bar-warning { background: var(--warning); }
.progress-bar-danger  { background: var(--danger); }

.progress-sm {
    height: 4px;
}

.progress-lg {
    height: 12px;
}

/* Timeline */
.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 4px;
    bottom: 4px;
    width: 2px;
    background: var(--border);
}

.timeline-item {
    position: relative;
    padding-bottom: 1.5rem;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-dot {
    position: absolute;
    left: -2rem;
    top: 4px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 2px solid var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.timeline-dot-inner {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
}

.timeline-content {
    padding-left: 0.25rem;
}

.timeline-title {
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.timeline-desc {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.timeline-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* KBD (keyboard shortcut) */
kbd {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.375rem;
    background: var(--secondary-light);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-secondary);
    box-shadow: 0 1px 0 var(--border);
    line-height: 1.4;
}

/* Number input group */
.number-input {
    display: inline-flex;
    align-items: center;
}

.number-input input {
    width: 80px;
    text-align: center;
    border-radius: 0;
}

.number-input .num-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
    transition: var(--transition-fast);
    user-select: none;
}

.number-input .num-btn:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.number-input .num-btn:first-child {
    border-radius: var(--radius) 0 0 var(--radius);
}

.number-input .num-btn:last-child {
    border-radius: 0 var(--radius) var(--radius) 0;
}

/* Focus ring utility */
.focus-ring:focus {
    outline: none;
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* Selection */
::selection {
    background: var(--primary-light);
    color: var(--primary-dark);
}

/* ====== DARK MODE ====== */
[data-theme="dark"] {
    --bg: #0f172a;
    --bg-card: #1e293b;
    --bg-sidebar: #020617;
    --bg-sidebar-hover: #0f172a;
    --text: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-sidebar: #94a3b8;
    --text-sidebar-active: #f1f5f9;
    --border: #334155;
    --border-focus: #3b82f6;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow: 0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.4), 0 4px 6px -2px rgba(0,0,0,0.3);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.5), 0 10px 10px -5px rgba(0,0,0,0.3);
}

[data-theme="dark"] .table-container table {
    background: var(--bg-card);
}
[data-theme="dark"] .table-container table th {
    background: #0f172a;
    color: var(--text-secondary);
    border-color: var(--border);
}
[data-theme="dark"] .table-container table td {
    border-color: var(--border);
    color: var(--text);
}
[data-theme="dark"] .form-input, [data-theme="dark"] .form-select, [data-theme="dark"] .form-textarea {
    background: #0f172a;
    border-color: var(--border);
    color: var(--text);
}
[data-theme="dark"] .form-input:focus, [data-theme="dark"] .form-select:focus {
    border-color: var(--border-focus);
}
[data-theme="dark"] .modal {
    background: var(--bg-card);
}
[data-theme="dark"] .badge-secondary {
    background: #334155;
    color: var(--text-secondary);
}
[data-theme="dark"] .topbar {
    background: var(--bg-card);
    border-bottom-color: var(--border);
}
[data-theme="dark"] .toolbar {
    background: transparent;
}
[data-theme="dark"] .toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
}
[data-theme="dark"] .booking-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
}
[data-theme="dark"] .card:hover {
    box-shadow: var(--shadow-lg);
}
[data-theme="dark"] .btn-ghost {
    color: var(--text-secondary);
}
[data-theme="dark"] .btn-ghost:hover {
    background: rgba(255,255,255,0.1);
    color: var(--text);
}
[data-theme="dark"] .empty-state p {
    color: var(--text-muted);
}
[data-theme="dark"] .installer-card {
    background: var(--bg-card);
}

/* ====== LANDING PAGE ====== */
.landing-page {
    min-height: 100vh;
}

.hero {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
    color: white;
    padding: 3rem 2rem 4rem;
    text-align: center;
}

.hero-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto 3rem;
}

.hero-logo h2 {
    color: white;
    font-size: 1.5rem;
    margin: 0;
}

.hero-nav-actions {
    display: flex;
    gap: 0.5rem;
}

.hero-nav-actions .btn-ghost {
    color: rgba(255,255,255,0.8);
    border: none;
}

.hero-nav-actions .btn-ghost:hover {
    color: white;
    background: rgba(255,255,255,0.1);
}

.hero-content {
    max-width: 700px;
    margin: 0 auto;
}

.hero-content h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.hero-content p {
    font-size: 1.2rem;
    opacity: 0.8;
    margin-bottom: 2rem;
}

.hero-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.section-title {
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 2rem;
    color: var(--text);
}

.features-section {
    padding: 4rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    transition: var(--transition);
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.feature-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.feature-card h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.feature-card p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

.auth-section {
    padding: 4rem 2rem;
    display: flex;
    justify-content: center;
}

.contact-section {
    padding: 4rem 2rem;
    max-width: 600px;
    margin: 0 auto;
}

.contact-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
}

.landing-footer {
    background: var(--bg-sidebar);
    color: var(--text-muted);
    text-align: center;
    padding: 2rem;
    margin-top: 2rem;
}

@media (max-width: 768px) {
    .hero-content h1 {
        font-size: 2rem;
    }
    .hero-nav {
        flex-direction: column;
        gap: 1rem;
    }
    .features-grid {
        grid-template-columns: 1fr;
    }
    .hero-actions {
        flex-direction: column;
        align-items: center;
    }
}

/* ====== DATA BACKUP ====== */
.export-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.data-stats {
    margin-top: 1rem;
}

/* ====== PRINT STYLES ====== */
@media print {
    .sidebar, .topbar, .toolbar, .modal-overlay, .toast-container,
    .btn, .pagination, .search-box, .export-buttons { display: none !important; }
    .main-content { margin: 0 !important; }
    .page-content { padding: 0 !important; }
    .card { box-shadow: none !important; border: 1px solid #e2e8f0 !important; break-inside: avoid; }
    .table-container table th { background: #f1f5f9 !important; -webkit-print-color-adjust: exact; }
    .stat-card { border: 1px solid #e2e8f0 !important; box-shadow: none !important; }
    body { background: white !important; color: black !important; }
}

/* ====== TEXT COLORS ====== */
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-info { color: var(--info); }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }

/* ====== LANDING PAGE ====== */
[data-theme="dark"] .landing-page .hero {
    background: linear-gradient(135deg, #020617 0%, #1e293b 50%, #020617 100%);
}
[data-theme="dark"] .feature-card {
    background: #1e293b;
    border-color: #334155;
}
[data-theme="dark"] .contact-card {
    background: #1e293b;
    border-color: #334155;
}
[data-theme="dark"] .landing-footer {
    background: #020617;
}

/* ====== ANIMATIONS ====== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

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

.animate-fade-in {
    animation: fadeIn 0.3s ease-out;
}

.animate-slide-in {
    animation: slideIn 0.3s ease-out;
}

.animate-scale-in {
    animation: scaleIn 0.2s ease-out;
}

/* Stagger delays for card grids */
.stat-card:nth-child(1) { animation-delay: 0ms; }
.stat-card:nth-child(2) { animation-delay: 75ms; }
.stat-card:nth-child(3) { animation-delay: 150ms; }
.stat-card:nth-child(4) { animation-delay: 225ms; }
.stat-card:nth-child(5) { animation-delay: 300ms; }
.stat-card:nth-child(6) { animation-delay: 375ms; }

.stat-card { animation: fadeIn 0.3s ease-out both; }
.card:hover { transition: transform 0.2s ease, box-shadow 0.2s ease; transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.btn { transition: all 0.2s ease; }

/* ====== RESPONSIVE GRID ====== */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}
.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}
@media (max-width: 768px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* ====== SCROLLBAR ====== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
