/*
  Developed by Rameez Scripts
  WhatsApp: https://wa.me/923435347417 (For Custom Projects)
  YouTube: https://www.youtube.com/@rameezimdad (Subscribe for more!)
*/

/* ===== Color Scheme - Light Theme (Default) ===== */
:root {
    --navy-primary: #001f3f;
    --navy-dark: #001529;
    --navy-light: #003366;
    --navy-accent: #0074D9;
    --navy-hover: #002a52;
    --success: #34a853;
    --warning: #fbbc04;
    --danger: #ea4335;

    /* Light Theme Colors */
    --bg-primary: #f5f5f5;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --text-primary: #333333;
    --text-secondary: #555555;
    --text-muted: #666666;
    --border-color: #e0e0e0;
    --border-light: #f0f0f0;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --shadow-hover: rgba(0, 0, 0, 0.15);
    --input-bg: #ffffff;
    --input-border: #d0d0d0;
    --table-hover: #f9f9f9;
    --skeleton-base: #f0f0f0;
    --skeleton-shine: #e0e0e0;
}

/* ===== Dark Theme ===== */
body.dark-mode {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-card: #1e1e3f;
    --text-primary: #e8eaf6;
    --text-secondary: #b0b3c5;
    --text-muted: #8a8d9f;
    --border-color: #2d2d5a;
    --border-light: #252550;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --shadow-hover: rgba(0, 0, 0, 0.4);
    --input-bg: #252550;
    --input-border: #3d3d7a;
    --table-hover: #252550;
    --skeleton-base: #252550;
    --skeleton-shine: #2d2d5a;

    --navy-primary: #0a1628;
    --navy-dark: #060d16;
    --navy-light: #1a3a5c;
}

/* ===== Global Styles ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: background-color 0.3s ease, color 0.3s ease;
}

input, select, textarea {
    font-size: 16px !important;
    touch-action: manipulation;
}

/* ===== App Container ===== */
.app-container {
    display: flex;
    height: 100vh;
}

/* ===== Sidebar ===== */

/* Sidebar User Info */

/* Collapsed Sidebar */

/* Hide submenu arrow in collapsed state */

/* Submenu in collapsed state */

/* Theme toggle in collapsed state */

/* Logout button in collapsed state */

/* Tooltip for collapsed sidebar items */

/* Mobile Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

/* Mobile Menu Button - DEPRECATED (Now using bottom navigation bar) */
/* Old top hamburger button - kept for backwards compatibility but hidden */
.mobile-menu-btn-old {
    display: none !important;
}

/* Bottom nav menu button is now in mobile-menu.php inline styles */

/* ===== Mobile Bottom Navigation Bar ===== */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 65px;
    background: var(--navy-primary);
    z-index: 1001;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.2);
    justify-content: space-around;
    align-items: center;
    padding: 0 5px;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 10px;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.3s ease;
    background: none;
    border: none;
    cursor: pointer;
    min-width: 60px;
}

.mobile-nav-item i {
    font-size: 20px;
    margin-bottom: 4px;
}

.mobile-nav-item span {
    white-space: nowrap;
}

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

.mobile-nav-item.active {
    color: white;
    background: var(--navy-accent);
    box-shadow: 0 2px 8px rgba(0,116,217,0.4);
}

.mobile-nav-item.active i {
    transform: scale(1.1);
}

.mobile-nav-more {
    color: rgba(255,255,255,0.9);
}

/* Sidebar Overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

/* Mobile Sidebar */
@media (max-width: 768px) {
    /* Show bottom navigation */
    .mobile-bottom-nav {
        display: flex;
    }

    /* Add padding to main content for bottom nav */
    .main-content {
        margin-left: 0;
        width: 100%;
        padding-bottom: 80px;
    }

    /* Disable collapsed state on mobile */

    /* Hide sidebar toggle button on mobile */

    .app-container {
        flex-direction: column;
    }

    /* Adjust header for mobile */
    .header {
        padding: 15px;
    }

    .header h1 {
        font-size: 18px;
    }

    /* Data section padding adjustment */
    .data-section {
        padding: 15px;
    }

    .section-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .section-header > div {
        width: 100%;
        display: flex;
        gap: 10px;
    }

    .section-header .btn {
        flex: 1;
    }
}

/* Extra small devices */
@media (max-width: 400px) {
    .mobile-nav-item {
        padding: 8px 8px;
        min-width: 50px;
    }

    .mobile-nav-item i {
        font-size: 18px;
    }

    .mobile-nav-item span {
        font-size: 9px;
    }
}

/* Dark mode for mobile navigation */
body.dark-mode .mobile-bottom-nav {
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
}

body.dark-mode .mobile-nav-item {
    color: var(--text-muted);
}

body.dark-mode .mobile-nav-item:hover,
body.dark-mode .mobile-nav-item:focus {
    color: var(--text-primary);
    background: rgba(255,255,255,0.05);
}

body.dark-mode .mobile-nav-item.active {
    color: white;
    background: var(--navy-accent);
}

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: var(--bg-primary);
    transition: background-color 0.3s ease, margin-left 0.3s ease;
}

.header {
    background: var(--bg-card);
    padding: 20px;
    border-radius: 3px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px var(--shadow-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-primary);
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.header h1 {
    font-size: 24px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.data-section {
    background: var(--bg-card);
    padding: 20px;
    border-radius: 3px;
    box-shadow: 0 2px 4px var(--shadow-color);
    margin-bottom: 30px;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

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

.section-header h2 {
    font-size: 20px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-header-btns {
    display: flex;
    gap: 10px;
}

/* ===== Skeleton Loaders ===== */
.skeleton {
    background: linear-gradient(90deg, var(--skeleton-base) 25%, var(--skeleton-shine) 50%, var(--skeleton-base) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 3px;
}

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

.skeleton-table {
    width: 100%;
    background: var(--bg-card);
    padding: 20px;
    border-radius: 3px;
    transition: background-color 0.3s ease;
}

.skeleton-table-row {
    display: flex;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid var(--border-light);
}

.skeleton-table-cell {
    height: 20px;
    border-radius: 3px;
}

.skeleton-card {
    background: var(--bg-card);
    padding: 24px;
    border-radius: 4px;
    box-shadow: 0 2px 8px var(--shadow-color);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--navy-primary);
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.skeleton-icon {
    width: 60px;
    height: 60px;
    border-radius: 4px;
    margin-bottom: 16px;
}

.skeleton-text {
    height: 16px;
    margin-bottom: 12px;
    border-radius: 3px;
}

.skeleton-text-large {
    height: 32px;
    margin-bottom: 8px;
    border-radius: 3px;
}

.skeleton-chart {
    width: 100%;
    height: 300px;
    border-radius: 3px;
}

/* ===== Dashboard Stats ===== */
.dashboard-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.dashboard-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-card);
    padding: 24px;
    border-radius: 4px;
    box-shadow: 0 2px 8px var(--shadow-color);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--navy-primary);
    transition: all 0.3s;
}

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

.stat-card-icon {
    width: 60px;
    height: 60px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-bottom: 16px;
    background: linear-gradient(135deg, var(--navy-primary) 0%, var(--navy-light) 100%);
    color: white;
}

.stat-card-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--navy-accent);
    margin-bottom: 8px;
}

body.dark-mode .stat-card-value {
    color: #5dade2;
}

.stat-card-label {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
}

/* ===== Charts ===== */
.chart-card {
    background: var(--bg-card);
    padding: 24px;
    border-radius: 4px;
    box-shadow: 0 2px 8px var(--shadow-color);
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.chart-card h3 {
    color: var(--text-primary);
    font-size: 18px;
    margin-bottom: 20px;
    font-weight: 600;
}

.chart-container {
    position: relative;
    height: 300px;
}

/* ===== Buttons ===== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 2px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

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

.btn-primary:hover {
    background: var(--navy-hover);
    transform: translateY(-2px);
}

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

.btn-success:hover {
    background: #2d8e47;
    transform: translateY(-2px);
}

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

.btn-danger:hover {
    background: #c8392b;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
}

.btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* ===== DataTables ===== */
table.dataTable {
    width: 100% !important;
    border-collapse: collapse;
    background: var(--bg-card);
}

table.dataTable thead th {
    background: var(--navy-primary) !important;
    color: white !important;
    padding: 14px !important;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
}

table.dataTable tbody td {
    padding: 12px 14px !important;
    font-size: 14px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-light);
}

table.dataTable tbody tr:hover {
    background: var(--table-hover) !important;
}

body.dark-mode table.dataTable thead th {
    background: var(--navy-light) !important;
}

body.dark-mode .dataTables_wrapper .dataTables_length,
body.dark-mode .dataTables_wrapper .dataTables_filter,
body.dark-mode .dataTables_wrapper .dataTables_info,
body.dark-mode .dataTables_wrapper .dataTables_paginate {
    color: var(--text-secondary) !important;
}

body.dark-mode .dataTables_wrapper .dataTables_filter input,
body.dark-mode .dataTables_wrapper .dataTables_length select {
    background: var(--input-bg) !important;
    border-color: var(--input-border) !important;
    color: var(--text-primary) !important;
}

body.dark-mode .dataTables_wrapper .dataTables_paginate .paginate_button {
    color: var(--text-secondary) !important;
}

body.dark-mode .dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--navy-accent) !important;
    color: white !important;
    border-color: var(--navy-accent) !important;
}

body.dark-mode .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--navy-light) !important;
    color: white !important;
}

.dt-buttons {
    margin-bottom: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.dt-button {
    background: var(--navy-primary) !important;
    color: white !important;
    border: none !important;
    padding: 10px 16px !important;
    border-radius: 4px !important;
    font-size: 14px !important;
    margin-right: 0 !important;
    cursor: pointer !important;
    min-height: 44px;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.dt-button:hover {
    background: var(--navy-hover) !important;
}

/* DataTable wrapper for mobile scroll */
.dataTables_wrapper {
    position: relative;
}

.dataTables_scroll,
.dataTables_scrollBody {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
}

/* DataTable responsive hint for mobile */
.table-scroll-hint {
    display: none;
    text-align: center;
    padding: 10px;
    background: rgba(0, 116, 217, 0.1);
    border-radius: 4px;
    margin-bottom: 10px;
    font-size: 13px;
    color: var(--navy-accent);
}

.table-scroll-hint i {
    margin-right: 6px;
}

@media (max-width: 768px) {
    .table-scroll-hint {
        display: block;
    }
}

/* ===== Action Icons ===== */
.action-icon {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 6px 10px;
    margin: 0 4px;
    border-radius: 2px;
    transition: all 0.3s;
}

.action-icon.edit-icon {
    color: var(--warning);
}

.action-icon.edit-icon:hover {
    background: rgba(251,188,4,0.1);
    transform: scale(1.15);
}

.action-icon.delete-icon {
    color: var(--danger);
}

.action-icon.delete-icon:hover {
    background: rgba(234,67,53,0.1);
    transform: scale(1.15);
}

.action-icon.view-icon {
    color: var(--navy-accent);
}

.action-icon.view-icon:hover {
    background: rgba(0,116,217,0.1);
    transform: scale(1.15);
}

.action-icon.suspend-icon {
    color: var(--warning);
}

.action-icon.suspend-icon:hover {
    background: rgba(251,188,4,0.1);
    transform: scale(1.15);
}

.action-icon.activate-icon {
    color: var(--success);
}

.action-icon.activate-icon:hover {
    background: rgba(52,168,83,0.1);
    transform: scale(1.15);
}

.action-icon.restore-icon {
    color: var(--success);
}

.action-icon.restore-icon:hover {
    background: rgba(52,168,83,0.1);
    transform: scale(1.15);
}

.action-icon.stage-icon {
    color: var(--navy-accent);
}

.action-icon.stage-icon:hover {
    background: rgba(0,116,217,0.1);
    transform: scale(1.15);
}

.action-icon.orders-icon { color: var(--navy-primary); }
.action-icon.orders-icon:hover { background: rgba(0,31,63,0.1); transform: scale(1.15); }

/* ===== Breadcrumb ===== */
.breadcrumb {
    padding: 12px 20px;
    background: white;
    border-radius: 3px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #666;
}

.breadcrumb a {
    color: var(--navy-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s;
}

.breadcrumb a:hover {
    color: var(--navy-accent);
}

.breadcrumb .separator,
.breadcrumb .breadcrumb-separator {
    color: #ccc;
    font-size: 12px;
}

.breadcrumb .current,
.breadcrumb .breadcrumb-current {
    color: var(--text-primary);
    font-weight: 500;
}

/* ===== Skeleton Row (for inline table skeleton) ===== */
.skeleton-row {
    display: flex;
    gap: 10px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
}

.skeleton-row.skeleton-header {
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 14px;
    margin-bottom: 4px;
}

.skeleton-cell {
    height: 18px;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--skeleton-base) 25%, var(--skeleton-shine) 50%, var(--skeleton-base) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
}

/* ===== Status Badges ===== */
.status-badge {
    padding: 6px 14px;
    border-radius: 3px;
    font-size: 13px;
    font-weight: 600;
    display: inline-block;
}

.status-active {
    background: #d4edda;
    color: #155724;
}

.status-inactive {
    background: #f8d7da;
    color: #721c24;
}

.status-admin {
    background: #f8d7da;
    color: #721c24;
}

.status-manager {
    background: #cce5ff;
    color: #004085;
}

.status-user {
    background: #e2e3e5;
    color: #383d41;
}

.status-tailor {
    background: #d4edda;
    color: #155724;
}

.status-accounts {
    background: #fff3cd;
    color: #856404;
}

.status-suspended {
    background: #f8d7da;
    color: #721c24;
}

/* ===== Forms ===== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 14px;
}

.form-group label i {
    margin-right: 8px;
    color: var(--navy-accent);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--input-border);
    border-radius: 2px;
    font-size: 16px;
    transition: all 0.3s;
    font-family: inherit;
    background: var(--input-bg);
    color: var(--text-primary);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--navy-accent);
    box-shadow: 0 0 0 2px rgba(0,116,217,0.2);
}

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

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 30px;
}

.error {
    margin-top: 15px;
    margin-bottom: 15px;
    color: var(--danger);
    font-size: 14px;
    background: #fef2f2;
    padding: 12px;
    border-radius: 4px;
    border: 1px solid #fecaca;
}

/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

body.dark-mode .modal-overlay {
    background: rgba(0,0,0,0.8);
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-card);
    border-radius: 4px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 24px var(--shadow-hover);
    transition: background-color 0.3s ease;
}

.modal-header {
    padding: 24px 30px;
    background: var(--navy-primary);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 4px 4px 0 0;
}

body.dark-mode .modal-header {
    background: var(--navy-light);
}

.modal-header h3 {
    font-size: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.close-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.close-btn:hover {
    background: rgba(255,255,255,0.2);
    transform: rotate(90deg);
}

.modal-body {
    padding: 30px;
    color: var(--text-primary);
}

/* ===== Filters Section ===== */
.filters-section {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 25px;
    transition: background 0.3s ease, border-color 0.3s ease;
}

.filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--navy-accent);
}

.filters-header h3 {
    font-size: 18px;
    color: var(--text-primary);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--input-border);
    border-radius: 3px;
    font-size: 14px;
    transition: all 0.3s;
    font-family: inherit;
    background: var(--input-bg);
    color: var(--text-primary);
}

.filter-input:focus {
    outline: none;
    border-color: var(--navy-accent);
    box-shadow: 0 0 0 3px rgba(0,116,217,0.15);
}

/* ===== Account Info Card ===== */
.account-info-card {
    background: var(--bg-card);
    padding: 30px;
    border-radius: 4px;
    box-shadow: 0 2px 8px var(--shadow-color);
    border-left: 4px solid var(--navy-accent);
    margin-bottom: 30px;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.account-info-card h3 {
    color: var(--text-primary);
    font-size: 20px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.info-row {
    display: flex;
    padding: 15px 0;
    border-bottom: 1px solid var(--border-light);
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    font-weight: 600;
    color: var(--text-secondary);
    width: 180px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-value {
    color: var(--text-primary);
    flex: 1;
}

/* ===== Mobile Responsive ===== */
@media (max-width: 768px) {

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

    .dashboard-grid-3,
    .dashboard-grid-2 {
        grid-template-columns: 1fr;
    }

    .modal {
        width: 95%;
    }

    .filters-section {
        padding: 15px;
    }

    .filters-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .filters-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .filters-header .btn-sm {
        width: 100%;
    }

    .info-row {
        flex-direction: column;
        gap: 5px;
    }

    .info-label {
        width: 100%;
    }

    input, select, textarea {
        font-size: 16px !important;
    }
}

/* ===== Login Page Specific ===== */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    background: linear-gradient(135deg, var(--navy-primary) 0%, var(--navy-light) 100%);
}

.login-box {
    background: white;
    padding: 50px 40px;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    width: 100%;
    max-width: 420px;
    text-align: center;
}

.login-logo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 25px;
    border: 3px solid var(--navy-primary);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.login-box h2 {
    margin-bottom: 35px;
    color: var(--navy-primary);
    font-size: 26px;
    font-weight: 600;
}

.login-footer {
    margin-top: 24px;
    font-size: 13px;
    color: #666;
}

@media (max-width: 480px) {
    .login-box {
        padding: 32px 24px;
    }
}

/* ===== Settings Page - 2x2 Grid Layout ===== */

/* Main Grid */
.settings-grid-2x2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin-bottom: 30px;
}

/* Mega Cards */
.settings-mega-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    border: 2px solid #e9ecef;
    transition: all 0.3s;
}

.settings-mega-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    transform: translateY(-4px);
    border-color: var(--navy-accent);
}

/* Card Header */
.settings-card-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 24px;
    border-bottom: 2px solid #dee2e6;
    display: flex;
    align-items: center;
    gap: 16px;
}

.settings-card-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.settings-card-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--navy-primary);
    margin: 0 0 4px 0;
}

.settings-card-subtitle {
    font-size: 13px;
    color: #666;
    margin: 0;
    font-weight: 500;
}

/* Card Body */
.settings-card-body {
    padding: 24px;
}

/* Stat Items (inline) */
.stat-item-inline {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 12px;
    border: 1px solid #e9ecef;
    transition: all 0.3s;
}

.stat-item-inline:last-child {
    margin-bottom: 0;
}

.stat-item-inline:hover {
    background: #fff;
    border-color: var(--navy-accent);
    box-shadow: 0 2px 8px rgba(0, 116, 217, 0.1);
}

.stat-item-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-item-content {
    flex: 1;
}

.stat-item-label {
    font-size: 13px;
    color: #666;
    font-weight: 600;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-item-value {
    font-size: 16px;
    color: var(--navy-primary);
    font-weight: 700;
}

/* Control Group */
.control-group {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
}

.control-group-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.control-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--navy-primary) 0%, var(--navy-light) 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 31, 63, 0.2);
}

.control-info {
    flex: 1;
}

.control-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--navy-primary);
    margin-bottom: 4px;
}

.control-desc {
    font-size: 13px;
    color: #666;
    font-weight: 500;
}

.control-toggle-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: white;
    border-radius: 8px;
    border: 2px solid #e9ecef;
}

/* Large Toggle Switch */
.toggle-switch-large {
    position: relative;
    display: inline-block;
    flex-shrink: 0;
}

.toggle-input-large {
    display: none;
}

.toggle-label-large {
    display: block;
    width: 80px;
    height: 40px;
    background: #ccc;
    border-radius: 20px;
    cursor: pointer;
    position: relative;
    transition: background-color 0.3s;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.toggle-slider-large {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 32px;
    height: 32px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.toggle-input-large:checked + .toggle-label-large {
    background: var(--success);
}

.toggle-input-large:checked + .toggle-label-large .toggle-slider-large {
    transform: translateX(40px);
}

.toggle-label-large:hover {
    opacity: 0.9;
}

/* Toggle Status */
.toggle-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-enabled {
    background: var(--success);
    box-shadow: 0 0 0 3px rgba(52, 168, 83, 0.2);
}

.status-disabled {
    background: #ccc;
    box-shadow: none;
    animation: none;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 3px rgba(52, 168, 83, 0.2);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(52, 168, 83, 0.1);
    }
}

.status-text {
    font-size: 14px;
    font-weight: 600;
}

/* Info Banner */
.info-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0, 116, 217, 0.05);
    border: 1px solid rgba(0, 116, 217, 0.2);
    border-left: 4px solid var(--navy-accent);
    padding: 14px 16px;
    border-radius: 6px;
    font-size: 13px;
    color: #555;
    line-height: 1.5;
}

.info-banner i {
    color: var(--navy-accent);
    font-size: 18px;
    flex-shrink: 0;
}

/* Security Features */
.security-feature {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 12px;
    border: 1px solid #e9ecef;
    transition: all 0.3s;
}

.security-feature:last-child {
    margin-bottom: 0;
}

.security-feature:hover {
    background: white;
    border-color: var(--success);
    box-shadow: 0 2px 8px rgba(52, 168, 83, 0.1);
}

.security-feature-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--success) 0%, #2d9148 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(52, 168, 83, 0.2);
}

.security-feature-content {
    flex: 1;
}

.security-feature-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--navy-primary);
    margin-bottom: 4px;
}

.security-feature-desc {
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

.security-feature-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.security-feature-badge.active {
    background: rgba(52, 168, 83, 0.1);
    color: var(--success);
    border: 2px solid rgba(52, 168, 83, 0.3);
}

/* Server Info Items */
.server-info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid #f1f3f5;
}

.server-info-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.server-info-label {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: #666;
    font-weight: 600;
}

.server-info-label i {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--navy-accent);
    font-size: 16px;
}

.server-info-value {
    font-size: 14px;
    color: var(--navy-primary);
    font-weight: 700;
}

.version-badge,
.upload-badge {
    background: linear-gradient(135deg, var(--navy-primary) 0%, var(--navy-light) 100%);
    color: white;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(0, 31, 63, 0.2);
}

.upload-badge {
    background: linear-gradient(135deg, var(--success) 0%, #2d9148 100%);
}

.time-value {
    font-family: 'Courier New', monospace;
    background: rgba(0, 116, 217, 0.05);
    padding: 6px 12px;
    border-radius: 6px;
    color: var(--navy-accent);
    font-size: 13px;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    flex-shrink: 0;
}

.toggle-input {
    display: none;
}

.toggle-label {
    display: block;
    width: 60px;
    height: 32px;
    background: #ccc;
    border-radius: 16px;
    cursor: pointer;
    position: relative;
    transition: background-color 0.3s;
}

.toggle-slider {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-input:checked + .toggle-label {
    background: var(--success);
}

.toggle-input:checked + .toggle-label .toggle-slider {
    transform: translateX(28px);
}

.toggle-label:hover {
    opacity: 0.9;
}

/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.info-item {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 24px;
    border-radius: 4px;
    text-align: center;
    border: 1px solid #dee2e6;
    transition: all 0.3s;
}

.info-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: var(--navy-accent);
}

.info-label {
    font-size: 12px;
    color: #666;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.info-value {
    font-size: 18px;
    color: var(--navy-primary);
    font-weight: 700;
}

/* Dashboard Grid 4 */
.dashboard-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

/* Security Cards */
.security-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.security-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    gap: 16px;
    transition: all 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.security-card:hover {
    border-color: var(--success);
    box-shadow: 0 4px 12px rgba(52, 168, 83, 0.15);
    transform: translateY(-2px);
}

.security-card-icon {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.security-card-content {
    flex: 1;
}

.security-card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--navy-primary);
    margin-bottom: 6px;
}

.security-card-desc {
    font-size: 13px;
    color: #666;
    margin-bottom: 10px;
    line-height: 1.4;
}

.security-card-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(52, 168, 83, 0.1);
    color: var(--success);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid rgba(52, 168, 83, 0.2);
}

/* Info Table */
.info-table {
    background: white;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #e9ecef;
}

.info-table-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #f1f3f5;
    transition: all 0.3s;
}

.info-table-row:last-child {
    border-bottom: none;
}

.info-table-row:hover {
    background: #f8f9fa;
}

.info-table-label {
    font-size: 14px;
    color: #666;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.info-table-label i {
    color: var(--navy-accent);
    width: 20px;
    text-align: center;
}

.info-table-value {
    font-size: 14px;
    color: var(--navy-primary);
    font-weight: 600;
    font-family: 'Courier New', monospace;
    background: rgba(0, 31, 63, 0.05);
    padding: 6px 12px;
    border-radius: 4px;
}

/* Mobile Responsive */
@media (max-width: 968px) {
    .settings-grid-2x2 {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .settings-card-header {
        padding: 20px;
    }

    .settings-card-icon {
        width: 48px;
        height: 48px;
        font-size: 24px;
    }

    .settings-card-title {
        font-size: 18px;
    }

    .settings-card-body {
        padding: 20px;
    }

    .control-group-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .control-toggle-wrapper {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }

    .toggle-status {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .setting-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .toggle-switch {
        align-self: flex-start;
    }

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

    .dashboard-grid-4 {
        grid-template-columns: 1fr;
    }

    .security-info-grid {
        grid-template-columns: 1fr;
    }

    .info-table-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .info-table-value {
        width: 100%;
        text-align: left;
    }

    .server-info-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .server-info-value {
        width: 100%;
    }
}

/* ===== Sidebar Submenu Styles ===== */

/* ===== Setup Page Styles ===== */
.setup-wrapper {
    min-height: 100vh;
    padding: 40px 20px;
    background: linear-gradient(135deg, var(--navy-primary) 0%, var(--navy-light) 100%);
}

.setup-container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.setup-container h2 {
    color: var(--navy-primary);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.setup-container .subtitle {
    color: #666;
    margin-bottom: 30px;
    font-size: 14px;
}

.setup-container hr {
    border: none;
    border-top: 2px solid var(--navy-primary);
    margin-bottom: 30px;
}

.log-item {
    padding: 12px 16px;
    margin-bottom: 10px;
    border-radius: 4px;
    border-left: 4px solid;
    display: flex;
    align-items: center;
    gap: 10px;
}

.log-success {
    background: #d4edda;
    border-left-color: var(--success);
    color: #155724;
}

.log-error {
    background: #f8d7da;
    border-left-color: var(--danger);
    color: #721c24;
}

.log-info {
    background: #d1ecf1;
    border-left-color: var(--navy-accent);
    color: #0c5460;
}

.credentials-box {
    background: #fff3cd;
    padding: 20px;
    border-radius: 4px;
    margin: 20px 0;
    border-left: 4px solid #ffc107;
}

.credentials-box strong {
    color: var(--navy-primary);
}

/* ===== Theme Toggle ===== */

/* Dark mode specific overrides */
body.dark-mode .login-container {
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

body.dark-mode .login-box {
    background: var(--bg-card);
    box-shadow: 0 4px 20px var(--shadow-hover);
}

body.dark-mode .login-box h2 {
    color: var(--text-primary);
}

/* Login Page Theme Toggle */
.login-theme-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px var(--shadow-color);
    transition: all 0.3s ease;
    z-index: 1000;
}

.login-theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px var(--shadow-hover);
}

body.dark-mode .login-theme-toggle {
    background: var(--bg-card);
    border-color: var(--navy-accent);
    color: #ffd700;
}

body.dark-mode .setup-wrapper {
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

body.dark-mode .setup-container {
    background: var(--bg-card);
    box-shadow: 0 4px 20px var(--shadow-hover);
}

body.dark-mode .setup-container h2 {
    color: var(--text-primary);
}

body.dark-mode .setup-container .subtitle {
    color: var(--text-muted);
}

body.dark-mode .setup-container hr {
    border-top-color: var(--border-color);
}

body.dark-mode .log-item {
    border-left-width: 4px;
}

body.dark-mode .log-success {
    background: rgba(52, 168, 83, 0.15);
    color: #6fcf97;
}

body.dark-mode .log-error {
    background: rgba(234, 67, 53, 0.15);
    color: #f5857a;
}

body.dark-mode .log-info {
    background: rgba(0, 116, 217, 0.15);
    color: #5dade2;
}

body.dark-mode .credentials-box {
    background: rgba(251, 188, 4, 0.1);
    border-color: rgba(251, 188, 4, 0.4);
    color: var(--text-secondary);
}

body.dark-mode .credentials-box strong {
    color: var(--text-primary);
}

/* Settings Page Dark Mode */
body.dark-mode .settings-mega-card {
    background: var(--bg-card);
    border-color: var(--border-color);
}

body.dark-mode .settings-card-header {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    border-bottom-color: var(--border-color);
}

body.dark-mode .settings-card-title {
    color: var(--text-primary);
}

body.dark-mode .settings-card-subtitle {
    color: var(--text-muted);
}

body.dark-mode .stat-item-inline {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

body.dark-mode .stat-item-label {
    color: var(--text-muted);
}

body.dark-mode .stat-item-value {
    color: var(--text-primary);
}

body.dark-mode .control-group {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-card) 100%);
    border-color: var(--border-color);
}

body.dark-mode .control-title {
    color: var(--text-primary);
}

body.dark-mode .control-desc {
    color: var(--text-muted);
}

body.dark-mode .control-toggle-wrapper {
    background: var(--bg-card);
    border-color: var(--border-color);
}

body.dark-mode .info-banner {
    background: rgba(0, 116, 217, 0.1);
    border-color: rgba(0, 116, 217, 0.3);
    color: var(--text-secondary);
}

body.dark-mode .security-feature {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

body.dark-mode .security-feature-name {
    color: var(--text-primary);
}

body.dark-mode .security-feature-desc {
    color: var(--text-muted);
}

body.dark-mode .server-info-item {
    border-bottom-color: var(--border-light);
}

body.dark-mode .server-info-label {
    color: var(--text-muted);
}

body.dark-mode .server-info-value {
    color: var(--text-primary);
}

body.dark-mode .time-value {
    background: rgba(0, 116, 217, 0.1);
    color: var(--navy-accent);
}

/* Dashboard Page Dark Mode */
body.dark-mode .data-section p {
    color: var(--text-secondary);
}

body.dark-mode .data-section strong {
    color: var(--text-primary);
}

/* Logs Page Dark Mode - Empty Details */
body.dark-mode em.text-muted,
body.dark-mode .text-muted em {
    color: var(--text-muted) !important;
}

/* Version/Upload Badges in Dark Mode */
body.dark-mode .version-badge,
body.dark-mode .upload-badge {
    color: white !important;
}

/* Ensure form inputs text is visible in dark mode */
body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea {
    background: var(--input-bg);
    border-color: var(--input-border);
    color: var(--text-primary);
}

body.dark-mode input::placeholder,
body.dark-mode textarea::placeholder {
    color: var(--text-muted);
}

/* Filter labels in dark mode */
body.dark-mode .filter-group label {
    color: var(--text-secondary);
}

/* Settings page stat items dark mode */
body.dark-mode .stat-item-inline:hover {
    background: var(--bg-card);
    border-color: var(--navy-accent);
}

body.dark-mode .security-feature:hover {
    background: var(--bg-card);
    border-color: var(--success);
}

/* Ensure all header welcome text is visible */
body.dark-mode .header > div {
    color: var(--text-secondary) !important;
}

/* ===== UI Customization / Theme Section ===== */
.theme-preview {
    margin-bottom: 25px;
    padding: 20px;
    border-radius: 8px;
    border: 2px solid var(--border-color);
    background: var(--bg-secondary);
    transition: all 0.3s ease;
}

body.dark-mode .theme-preview {
    background: var(--bg-card);
    border-color: var(--border-color) !important;
}

.theme-preview h4 {
    margin-bottom: 15px;
    color: var(--text-primary);
}

.theme-preview-swatches {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
}

.color-swatch {
    width: 80px;
    height: 50px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: 600;
}

.theme-preview .btn {
    margin-left: 20px;
}

/* Color picker styling */
input[type="color"] {
    -webkit-appearance: none;
    border: none;
    background: none;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

/* Color picker layout */
.form-grid-3col {
    grid-template-columns: repeat(3, 1fr);
}

.color-picker-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.color-input {
    width: 60px;
    height: 45px;
    padding: 2px;
    cursor: pointer;
    border: 2px solid var(--border-color);
    border-radius: 4px;
}

.hex-input {
    flex: 1;
    text-transform: uppercase;
}

.color-help-text {
    margin-top: 5px;
    display: block;
}

/* Preset buttons */
.preset-container {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.preset-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid var(--border-color);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.preset-navy { background: linear-gradient(135deg, #001f3f 50%, #0074D9 50%); }
.preset-dark-rose { background: linear-gradient(135deg, #1a1a2e 50%, #e94560 50%); }
.preset-emerald { background: linear-gradient(135deg, #2d3436 50%, #00b894 50%); }
.preset-purple { background: linear-gradient(135deg, #4a0e4e 50%, #c92bc8 50%); }
.preset-forest { background: linear-gradient(135deg, #1b4332 50%, #40916c 50%); }
.preset-brown { background: linear-gradient(135deg, #7f5539 50%, #dda15e 50%); }
.preset-ocean { background: linear-gradient(135deg, #03045e 50%, #00b4d8 50%); }
.preset-violet { background: linear-gradient(135deg, #3d0066 50%, #c77dff 50%); }

.preset-btn:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

/* Theme mode options */
.theme-mode-options {
    display: flex;
    gap: 20px;
    margin-top: 10px;
}

.theme-mode-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 12px 20px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    transition: all 0.3s ease;
}

.theme-mode-option input[type="radio"] {
    width: 18px;
    height: 18px;
}

.theme-mode-option .fa-sun {
    color: #fbbc04;
}

.theme-mode-option .fa-moon {
    color: #5dade2;
}

.theme-mode-option:hover {
    border-color: var(--navy-accent) !important;
    background: var(--bg-secondary);
}

.theme-mode-option:has(input:checked) {
    border-color: var(--navy-accent) !important;
    background: rgba(0, 116, 217, 0.1);
}

body.dark-mode .theme-mode-option {
    border-color: var(--border-color) !important;
}

body.dark-mode .theme-mode-option:hover {
    border-color: var(--navy-accent) !important;
    background: var(--bg-secondary);
}

body.dark-mode .theme-mode-option:has(input:checked) {
    border-color: var(--navy-accent) !important;
    background: rgba(0, 116, 217, 0.2);
}

/* Responsive theme form */
@media (max-width: 768px) {
    #themeForm .form-grid {
        grid-template-columns: 1fr !important;
    }

    .preset-btn {
        width: 35px !important;
        height: 35px !important;
    }

    .theme-mode-option {
        flex: 1;
        justify-content: center;
    }
}

/* SweetAlert2 Dark Mode */
body.dark-mode .swal2-popup {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
}

body.dark-mode .swal2-title {
    color: var(--text-primary) !important;
}

body.dark-mode .swal2-html-container {
    color: var(--text-secondary) !important;
}

body.dark-mode .swal2-input,
body.dark-mode .swal2-textarea {
    background: var(--input-bg) !important;
    border-color: var(--input-border) !important;
    color: var(--text-primary) !important;
}

/* ===== Text Utility Classes ===== */
.text-muted {
    color: var(--text-muted) !important;
}

.text-primary {
    color: var(--text-primary) !important;
}

.text-secondary {
    color: var(--text-secondary) !important;
}

/* ===== COMPREHENSIVE MOBILE RESPONSIVE STYLES ===== */

/* Smooth scrolling for better UX */
html {
    scroll-behavior: smooth;
}

/* Prevent horizontal overflow */
body {
    overflow-x: hidden;
}

/* Mobile-optimized scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--navy-accent);
    border-radius: 3px;
}

/* Safe area padding for iOS devices with notch */
@supports (padding: max(0px)) {
    .mobile-bottom-nav {
        padding-bottom: max(env(safe-area-inset-bottom), 8px);
        height: calc(65px + env(safe-area-inset-bottom, 0px));
    }

    .main-content {
        padding-bottom: max(80px, calc(80px + env(safe-area-inset-bottom)));
    }
}

/* ===== Mobile Responsive (max-width: 768px) ===== */
@media (max-width: 768px) {
    /* Main content adjustments */
    .main-content {
        padding: 15px;
        padding-bottom: 90px;
    }

    /* Header mobile optimization */
    .header {
        padding: 15px;
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .header h1 {
        font-size: 18px;
        width: 100%;
    }

    .header > div {
        font-size: 13px;
        width: 100%;
        text-align: right;
    }

    /* Data section mobile */
    .data-section {
        padding: 15px;
        border-radius: 6px;
    }

    .section-header {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }

    .section-header h2 {
        font-size: 18px;
    }

    .section-header .btn {
        width: 100%;
        justify-content: center;
        padding: 14px 20px;
    }

    /* Stat cards mobile */
    .stat-card {
        padding: 20px;
    }

    .stat-card-icon {
        width: 50px;
        height: 50px;
        font-size: 24px;
        margin-bottom: 12px;
    }

    .stat-card-value {
        font-size: 28px;
    }

    .stat-card-label {
        font-size: 12px;
    }

    /* Charts mobile */
    .chart-card {
        padding: 15px;
    }

    .chart-container {
        height: 250px;
    }

    /* Buttons mobile - larger touch targets */
    .btn {
        padding: 14px 20px;
        font-size: 15px;
        min-height: 48px;
    }

    .btn-sm {
        padding: 12px 16px;
        min-height: 44px;
    }

    /* Form inputs mobile - larger touch targets */
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 16px;
        font-size: 16px !important;
        min-height: 52px;
        border-radius: 6px;
    }

    .form-group label {
        font-size: 14px;
        margin-bottom: 10px;
    }

    .form-group {
        margin-bottom: 18px;
    }

    .form-actions {
        flex-direction: column;
        gap: 12px;
    }

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

    /* Filter inputs mobile */
    .filter-input {
        padding: 14px 12px;
        font-size: 16px !important;
        min-height: 50px;
    }

    /* Modal mobile full screen */
    .modal-overlay {
        padding: 0;
        align-items: flex-end;
    }

    .modal {
        width: 100%;
        max-width: 100%;
        max-height: 95vh;
        border-radius: 16px 16px 0 0;
        margin: 0;
    }

    .modal-header {
        padding: 20px;
        border-radius: 16px 16px 0 0;
    }

    .modal-header h3 {
        font-size: 18px;
    }

    .close-btn {
        width: 40px;
        height: 40px;
        font-size: 24px;
    }

    .modal-body {
        padding: 20px;
        max-height: calc(95vh - 80px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Account info cards mobile */
    .account-info-card {
        padding: 20px;
        margin-bottom: 20px;
    }

    .account-info-card h3 {
        font-size: 18px;
    }

    .info-row {
        flex-direction: column;
        gap: 8px;
        padding: 12px 0;
    }

    .info-label {
        width: 100%;
        font-size: 12px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .info-value {
        font-size: 15px;
        font-weight: 500;
    }

    /* DataTables mobile */
    .dataTables_wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table.dataTable {
        min-width: 600px;
    }

    table.dataTable thead th {
        padding: 12px 10px !important;
        font-size: 12px !important;
        white-space: nowrap;
    }

    table.dataTable tbody td {
        padding: 14px 10px !important;
        font-size: 13px !important;
    }

    /* Action icons mobile - larger touch targets */
    .action-icon {
        padding: 10px 12px;
        font-size: 18px;
        min-width: 44px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* DataTables buttons mobile */
    .dt-buttons {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin-bottom: 15px;
    }

    .dt-button {
        flex: 1;
        min-width: calc(33.33% - 6px);
        padding: 12px 10px !important;
        font-size: 12px !important;
        text-align: center;
        margin-right: 0 !important;
    }

    /* DataTables search and length mobile */
    .dataTables_length,
    .dataTables_filter {
        width: 100%;
        margin-bottom: 15px;
        text-align: left !important;
    }

    .dataTables_length select,
    .dataTables_filter input {
        width: 100% !important;
        margin-left: 0 !important;
        margin-top: 8px;
        padding: 12px !important;
        font-size: 16px !important;
    }

    .dataTables_info {
        font-size: 12px;
        padding: 10px 0;
    }

    .dataTables_paginate {
        padding-top: 15px;
    }

    .dataTables_paginate .paginate_button {
        padding: 10px 14px !important;
        min-width: 44px;
        min-height: 44px;
    }

    /* Login page mobile */
    .login-container {
        padding: 15px;
        min-height: 100vh;
        min-height: -webkit-fill-available;
    }

    .login-box {
        padding: 30px 20px;
        border-radius: 12px;
        width: 100%;
        max-width: 100%;
    }

    .login-logo {
        width: 90px;
        height: 90px;
        margin-bottom: 20px;
    }

    .login-box h2 {
        font-size: 22px;
        margin-bottom: 25px;
    }

    .login-box .form-group input {
        padding: 16px;
    }

    .login-box .btn {
        padding: 16px;
        font-size: 16px;
    }

    /* Settings page mobile */
    .settings-grid-2x2 {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .settings-mega-card {
        border-radius: 8px;
    }

    .settings-card-header {
        padding: 16px;
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }

    .settings-card-icon {
        width: 48px;
        height: 48px;
        font-size: 22px;
    }

    .settings-card-title {
        font-size: 16px;
    }

    .settings-card-body {
        padding: 16px;
    }

    .control-group {
        padding: 15px;
        margin-bottom: 12px;
    }

    .control-group-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .control-icon {
        width: 42px;
        height: 42px;
        font-size: 20px;
    }

    .control-title {
        font-size: 15px;
    }

    .control-toggle-wrapper {
        flex-direction: column;
        gap: 12px;
        padding: 14px;
    }

    /* Security features mobile */
    .security-feature {
        flex-direction: column;
        text-align: center;
        gap: 12px;
        padding: 14px;
    }

    .security-feature-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    /* Server info mobile */
    .server-info-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding: 12px 0;
    }

    /* Stat items inline mobile */
    .stat-item-inline {
        flex-direction: column;
        text-align: center;
        gap: 10px;
        padding: 14px;
    }

    .stat-item-icon {
        width: 42px;
        height: 42px;
        font-size: 20px;
    }

    /* Status badges mobile */
    .status-badge {
        padding: 8px 12px;
        font-size: 12px;
    }

    /* Filters mobile */
    .filters-section {
        padding: 12px;
        margin-bottom: 15px;
    }

    .filters-header {
        padding-bottom: 12px;
        margin-bottom: 15px;
    }

    .filters-header h3 {
        font-size: 16px;
    }

    .filters-grid {
        gap: 12px;
    }

    .filter-group label {
        font-size: 12px;
    }

    /* Profile image section mobile */
    .profile-image-container {
        max-width: 100%;
    }

    /* Theme customization mobile */
    #themeForm .form-grid {
        grid-template-columns: 1fr !important;
    }

    .preset-btn {
        width: 40px !important;
        height: 40px !important;
    }

    .theme-mode-option {
        padding: 12px !important;
    }

    .theme-preview {
        padding: 15px !important;
    }
}

/* ===== Extra Small Devices (max-width: 480px) ===== */
@media (max-width: 480px) {
    .main-content {
        padding: 10px;
        padding-bottom: 85px;
    }

    .header {
        padding: 12px;
    }

    .header h1 {
        font-size: 16px;
    }

    .data-section {
        padding: 12px;
    }

    .section-header h2 {
        font-size: 16px;
    }

    .stat-card {
        padding: 15px;
    }

    .stat-card-value {
        font-size: 24px;
    }

    .stat-card-label {
        font-size: 11px;
    }

    .chart-container {
        height: 200px;
    }

    .modal-body {
        padding: 15px;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 14px;
    }

    table.dataTable thead th {
        padding: 10px 8px !important;
        font-size: 11px !important;
    }

    table.dataTable tbody td {
        padding: 12px 8px !important;
        font-size: 12px !important;
    }

    .dt-button {
        min-width: calc(50% - 4px);
        padding: 10px 8px !important;
        font-size: 11px !important;
    }

    .login-box {
        padding: 25px 15px;
    }

    .login-logo {
        width: 80px;
        height: 80px;
    }

    .login-box h2 {
        font-size: 20px;
    }

    .account-info-card {
        padding: 15px;
    }

    .info-label {
        font-size: 11px;
    }

    .info-value {
        font-size: 14px;
    }

    /* Mobile bottom nav extra small */
    .mobile-nav-item {
        padding: 6px 8px;
        min-width: 50px;
    }

    .mobile-nav-item i {
        font-size: 18px;
    }

    .mobile-nav-item span {
        font-size: 9px;
    }
}

/* ===== Landscape Mobile Orientation ===== */
@media (max-height: 500px) and (orientation: landscape) {
    .mobile-bottom-nav {
        height: 55px;
    }

    .mobile-nav-item {
        padding: 5px 10px;
    }

    .mobile-nav-item i {
        font-size: 18px;
        margin-bottom: 2px;
    }

    .mobile-nav-item span {
        font-size: 9px;
    }

    .main-content {
        padding-bottom: 70px;
    }

    .modal {
        max-height: 100vh;
        border-radius: 0;
    }

    .modal-body {
        max-height: calc(100vh - 70px);
    }
}

/* ===== Touch Device Optimizations ===== */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets for touch devices */
    .btn {
        min-height: 48px;
    }

    .action-icon {
        min-width: 48px;
        min-height: 48px;
    }

    .mobile-nav-item {
        min-height: 56px;
    }

    /* Remove hover effects on touch devices */
    .btn:hover {
        transform: none;
    }

    .stat-card:hover {
        transform: none;
    }

    .action-icon:hover {
        transform: none;
    }

    /* Add active states for touch feedback */
    .btn:active {
        transform: scale(0.98);
        opacity: 0.9;
    }

    .action-icon:active {
        transform: scale(0.95);
        opacity: 0.8;
    }

    .mobile-nav-item:active {
        transform: scale(0.95);
        opacity: 0.9;
    }
}

/* ===== iOS Specific Fixes ===== */
@supports (-webkit-touch-callout: none) {
    /* Fix for iOS 100vh issue */
    .login-container {
        min-height: -webkit-fill-available;
    }

    .app-container {
        min-height: -webkit-fill-available;
    }

    /* Fix for iOS input zoom */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="tel"],
    select,
    textarea {
        font-size: 16px !important;
    }

    /* Fix for iOS momentum scrolling */
    .modal-body,
    .main-content {
        -webkit-overflow-scrolling: touch;
    }
}

/* ===== Pull to Refresh Prevention ===== */
body {
    overscroll-behavior-y: contain;
}

/* ===== Tablet Responsive (768px - 1024px) ===== */
@media (min-width: 769px) and (max-width: 1024px) {

    .dashboard-grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }

    .settings-grid-2x2 {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .form-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .modal {
        width: 85%;
        max-width: 700px;
    }
}

/* ===== Print Styles ===== */
@media print {
    .mobile-bottom-nav,
    .sidebar-overlay,
    .btn,
    .action-icon,
    .dt-buttons {
        display: none !important;
    }

    .main-content {
        margin: 0;
        padding: 20px;
    }

    .app-container {
        display: block;
    }
}

/* ===== Dark Mode Global Text Colors ===== */
body.dark-mode {
    color: var(--text-primary);
}

body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3,
body.dark-mode h4,
body.dark-mode h5,
body.dark-mode h6 {
    color: var(--text-primary) !important;
}

body.dark-mode p,
body.dark-mode span:not(.status-badge):not(.role-badge):not(.version-badge):not(.upload-badge),
body.dark-mode div:not(.sidebar):not(.modal-header):not(.stat-card-icon):not(.settings-card-icon),
body.dark-mode label {
    color: var(--text-secondary);
}

body.dark-mode .text-muted,
body.dark-mode .info-text,
body.dark-mode .help-text,
body.dark-mode em.text-muted {
    color: var(--text-muted) !important;
}

/* Account Page Dark Mode */
body.dark-mode .account-info-card {
    background: var(--bg-card);
    border-left-color: var(--navy-accent);
}

body.dark-mode .account-info-card h3 {
    color: var(--text-primary);
}

body.dark-mode .info-row {
    border-bottom-color: var(--border-light);
}

body.dark-mode .info-label {
    color: var(--text-secondary);
}

body.dark-mode .info-value {
    color: var(--text-primary);
}

/* Profile Image Section Dark Mode */
body.dark-mode .profile-image-container {
    background: var(--bg-secondary);
    border-color: var(--navy-accent);
}

body.dark-mode .profile-image-label {
    color: var(--text-muted) !important;
}

body.dark-mode #defaultProfileIcon {
    color: var(--navy-accent) !important;
}

/* Form Labels and Text Dark Mode */
body.dark-mode .form-group label {
    color: var(--text-secondary);
}

body.dark-mode .form-group label i {
    color: var(--navy-accent);
}

/* Section Headers Dark Mode */
body.dark-mode .section-header h2 {
    color: var(--text-primary);
}

body.dark-mode .data-section {
    background: var(--bg-card);
}

/* Info/Help Text Dark Mode */
body.dark-mode [style*="color: #666"],
body.dark-mode [style*="color:#666"] {
    color: var(--text-muted) !important;
}

/* Warning/Disabled Messages Dark Mode */
body.dark-mode #uploadDisabledMessage {
    background: rgba(251, 188, 4, 0.1) !important;
    border-color: rgba(251, 188, 4, 0.4) !important;
    color: #ffd54f !important;
}

/* File Input Dark Mode */
body.dark-mode input[type="file"] {
    background: var(--bg-secondary) !important;
    border-color: var(--navy-accent) !important;
    color: var(--text-primary) !important;
}

/* Header Welcome Text Dark Mode */
body.dark-mode .header {
    background: var(--bg-card);
    color: var(--text-primary);
}

body.dark-mode .header div {
    color: var(--text-secondary);
}

/* Breadcrumb Dark Mode */
body.dark-mode .breadcrumb {
    background: var(--bg-card);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    color: var(--text-muted);
}

body.dark-mode .breadcrumb a {
    color: var(--navy-accent);
}

body.dark-mode .breadcrumb .breadcrumb-current,
body.dark-mode .breadcrumb .current {
    color: var(--text-primary);
}

/* ===== Profile Image Section ===== */
.profile-section-grid {
    display: flex;
    align-items: flex-start;
    gap: 30px;
    flex-wrap: wrap;
}

.profile-image-display {
    text-align: center;
    flex-shrink: 0;
}

.profile-image-container {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--navy-primary);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    margin: 0 auto 15px;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-image-container .profile-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-image-container #defaultProfileIcon {
    font-size: 50px;
    color: var(--navy-accent);
}

.profile-image-label {
    font-size: 13px;
    color: var(--text-muted);
}

.profile-upload-form {
    flex: 1;
    min-width: 280px;
}

.file-input-styled {
    width: 100%;
    padding: 14px;
    border: 2px dashed var(--navy-accent);
    border-radius: 6px;
    background: var(--bg-secondary);
    font-size: 16px !important;
    cursor: pointer;
    transition: all 0.3s ease;
}

.file-input-styled:hover {
    border-color: var(--navy-primary);
    background: var(--bg-primary);
}

.help-text {
    margin-top: 10px;
    font-size: 13px;
    color: var(--text-muted);
}

.warning-message {
    padding: 15px;
    background: rgba(251, 188, 4, 0.15);
    border: 1px solid rgba(251, 188, 4, 0.5);
    border-radius: 6px;
    color: var(--warning);
    margin-top: 15px;
    font-size: 14px;
}

@media (max-width: 768px) {
    .profile-section-grid {
        flex-direction: column;
        align-items: center;
        gap: 20px;
    }

    .profile-image-display {
        width: 100%;
    }

    .profile-image-container {
        width: 100px;
        height: 100px;
    }

    .profile-image-container #defaultProfileIcon {
        font-size: 40px;
    }

    .profile-upload-form {
        width: 100%;
        min-width: unset;
    }

    .file-input-styled {
        padding: 16px;
    }
}

/* ===== Theme Customization Section Mobile ===== */
@media (max-width: 768px) {
    .theme-preview {
        padding: 15px !important;
    }

    .theme-preview > div {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 10px !important;
    }

    #previewPrimary,
    #previewSecondary,
    #previewAccent {
        width: 100% !important;
        height: 40px !important;
    }

    #previewButton {
        width: 100% !important;
        margin-left: 0 !important;
        margin-top: 10px !important;
    }

    .theme-mode-option {
        flex: 1;
        justify-content: center;
        padding: 14px 16px !important;
    }

    .preset-btn {
        width: 45px !important;
        height: 45px !important;
    }
}

/* ========================================
   Manage Types Modal (Expense Types, etc.)
   ======================================== */
.types-add-form {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--navy-primary);
}
.types-add-input-wrap {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}
.types-add-input-wrap i {
    position: absolute;
    left: 14px;
    color: var(--navy-accent);
    font-size: 14px;
}
.types-add-input-wrap input {
    width: 100%;
    padding: 12px 14px 12px 40px;
    border: 2px solid #ced4da;
    border-radius: 3px;
    font-size: 15px;
    transition: all 0.3s;
    font-family: inherit;
}
.types-add-input-wrap input:focus {
    outline: none;
    border-color: var(--navy-accent);
    box-shadow: 0 0 0 3px rgba(0,116,217,0.15);
}
.types-add-form .btn {
    white-space: nowrap;
    padding: 12px 20px;
}

.types-summary {
    display: flex;
    gap: 20px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 4px;
    margin-bottom: 16px;
    font-size: 13px;
    color: #555;
    flex-wrap: wrap;
}
.types-summary span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.types-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
}

.types-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: white;
    border: 1px solid #e0e0e0;
    border-left: 4px solid var(--navy-primary);
    border-radius: 4px;
    transition: all 0.3s;
    gap: 12px;
}
.types-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transform: translateX(2px);
}
.types-item-disabled {
    border-left-color: #ccc;
    opacity: 0.65;
}
.types-item-editing {
    border-left-color: var(--navy-accent);
    box-shadow: 0 0 0 2px rgba(0,116,217,0.15);
}

.types-item-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}
.types-item-icon {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    background: linear-gradient(135deg, var(--navy-primary) 0%, var(--navy-light) 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}
.types-item-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.types-item-name {
    font-weight: 600;
    font-size: 15px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.types-item-date {
    font-size: 12px;
    color: #999;
}
.types-item-edit {
    display: none;
    width: 100%;
    padding: 6px 10px;
    font-size: 15px;
    border: 2px solid var(--navy-accent);
    border-radius: 3px;
    font-family: inherit;
    font-weight: 600;
    color: #333;
}
.types-item-edit:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0,116,217,0.15);
}

.types-item-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
.types-item-actions {
    display: flex;
    gap: 4px;
}

.types-loading,
.types-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 15px;
}
.types-loading i,
.types-empty i {
    margin-right: 8px;
    font-size: 16px;
}
.types-empty i {
    color: var(--navy-accent);
}

/* Dark mode support for types management */
[data-theme="dark"] .types-add-input-wrap input {
    background: var(--bg-color);
    border-color: var(--border-color);
    color: var(--text-color);
}
[data-theme="dark"] .types-summary {
    background: linear-gradient(135deg, var(--card-bg) 0%, var(--bg-color) 100%);
    color: var(--text-muted);
}
[data-theme="dark"] .types-item {
    background: var(--card-bg);
    border-color: var(--border-color);
}
[data-theme="dark"] .types-item-name {
    color: var(--text-color);
}
[data-theme="dark"] .types-item-edit {
    background: var(--bg-color);
    color: var(--text-color);
    border-color: var(--navy-accent);
}

/* Mobile responsive */
@media (max-width: 768px) {
    .types-add-form {
        flex-direction: column;
    }
    .types-add-form .btn {
        width: 100%;
    }
    .types-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .types-item-right {
        width: 100%;
        justify-content: space-between;
    }
    .types-summary {
        flex-direction: column;
        gap: 8px;
    }
}

/* ========================================
   About App Section Styles
   ======================================== */
.about-section {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.about-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    padding: 25px;
    background: linear-gradient(135deg, var(--navy-primary) 0%, var(--navy-light) 100%);
    border-radius: 4px;
    color: white;
}

.about-logo img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,0.3);
    object-fit: cover;
}

.about-title h1 {
    font-size: 24px;
    margin-bottom: 8px;
    font-weight: 700;
}

.about-dev {
    font-size: 14px;
    opacity: 0.9;
}

.about-card {
    background: white;
    border-radius: 4px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border-left: 4px solid var(--navy-primary);
}

.about-card h2 {
    color: var(--navy-primary);
    font-size: 20px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.about-card p {
    color: #555;
    line-height: 1.7;
    font-size: 15px;
}

.about-features {
    list-style: none;
    padding: 0;
    margin: 0;
}

.about-features li {
    padding: 12px 0;
    border-bottom: 1px solid #eee;
    color: #555;
    font-size: 15px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.about-features li:last-child {
    border-bottom: none;
}

.about-features li i {
    color: var(--success);
    margin-top: 3px;
    flex-shrink: 0;
}

.about-table-wrapper {
    overflow-x: auto;
    margin: 15px 0;
}

.about-roles-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.about-roles-table th,
.about-roles-table td {
    padding: 12px 15px;
    text-align: center;
    border: 1px solid #e0e0e0;
}

.about-roles-table th {
    background: var(--navy-primary);
    color: white;
    font-weight: 600;
}

.about-roles-table th:first-child {
    text-align: left;
}

.about-roles-table td:first-child {
    text-align: left;
    font-weight: 500;
    background: #f8f9fa;
}

.about-roles-table tbody tr:hover {
    background: #f5f5f5;
}

.role-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 600;
}

.role-admin {
    background: #f8d7da;
    color: #721c24;
}

.role-manager {
    background: #cce5ff;
    color: #004085;
}

.role-user {
    background: #d4edda;
    color: #155724;
}

.role-tailor {
    background: #fff3cd;
    color: #856404;
}

.role-accounts {
    background: #e2e3f1;
    color: #383d6e;
}

.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }

.role-legend {
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 4px;
}

.role-legend p {
    margin: 8px 0;
    font-size: 13px;
    color: #555;
}

.about-developer {
    border-left-color: var(--navy-accent);
}

.developer-info {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.developer-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--navy-primary);
    flex-shrink: 0;
}

.developer-details h3 {
    color: var(--navy-primary);
    font-size: 20px;
    margin-bottom: 5px;
}

.developer-brand {
    color: var(--navy-accent);
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 10px;
}

.developer-details p {
    margin-bottom: 15px;
}

.developer-links {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.dev-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s;
}

.dev-link.whatsapp {
    background: #25D366;
    color: white;
}

.dev-link.whatsapp:hover {
    background: #128C7E;
    transform: translateY(-2px);
}

.dev-link.youtube {
    background: #FF0000;
    color: white;
}

.dev-link.youtube:hover {
    background: #CC0000;
    transform: translateY(-2px);
}

.about-footer {
    text-align: center;
    padding: 25px;
    color: #666;
    font-size: 14px;
}

.about-version {
    font-size: 12px;
    color: #999;
    margin-top: 5px;
}

@media (max-width: 768px) {
    .about-header {
        flex-direction: column;
        text-align: center;
    }

    .about-title h1 {
        font-size: 20px;
    }

    .developer-info {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .developer-links {
        justify-content: center;
    }

    .about-roles-table {
        font-size: 12px;
    }

    .about-roles-table th,
    .about-roles-table td {
        padding: 8px 6px;
    }
}

/* About App - Dark Mode */
body.dark-mode .about-card {
    background: rgba(30, 30, 46, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    border-left: 4px solid var(--navy-accent);
}

body.dark-mode .about-card h2 {
    color: #e8eaf6;
}

body.dark-mode .about-card p,
body.dark-mode .about-features li {
    color: #b0b3c5;
}

body.dark-mode .about-features li {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .about-roles-table th {
    background: rgba(0, 116, 217, 0.3);
}

body.dark-mode .about-roles-table td {
    border-color: rgba(255, 255, 255, 0.1);
    color: #b0b3c5;
}

body.dark-mode .about-roles-table td:first-child {
    background: rgba(255, 255, 255, 0.05);
}

body.dark-mode .about-roles-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

body.dark-mode .role-legend {
    background: rgba(255, 255, 255, 0.05);
}

body.dark-mode .role-legend p {
    color: #b0b3c5;
}

body.dark-mode .developer-details h3 {
    color: #e8eaf6;
}

body.dark-mode .about-footer {
    color: #b0b3c5;
}

body.dark-mode .about-developer {
    border-left-color: var(--navy-accent);
}

/* =============================================
   ORDER MANAGEMENT STYLES
   ============================================= */

/* Order Stage Badges */
.order-stage { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.order-stage-new { background: #e3f2fd; color: #1565c0; }
.order-stage-measurement-requested { background: #fff3e0; color: #e65100; }
.order-stage-measurement-received { background: #e0f2f1; color: #00695c; }
.order-stage-stitching { background: #f3e5f5; color: #7b1fa2; }
.order-stage-qc { background: #fffde7; color: #f57f17; }
.order-stage-ready { background: #e8f5e9; color: #2e7d32; }
.order-stage-dispatched { background: #e8eaf6; color: #283593; }
.order-stage-delivered { background: #c8e6c9; color: #1b5e20; }
.order-stage-cancelled { background: #ffebee; color: #c62828; }

/* Order Priority Badges */
.order-priority { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.order-priority-normal { background: #f5f5f5; color: #616161; }
.order-priority-urgent { background: #fff3e0; color: #e65100; border: 1px solid #ffcc80; }
.order-priority-vip { background: #fff8e1; color: #ff8f00; border: 1px solid #ffe082; }

/* Order Form Sections */
.order-form-section { margin-bottom: 18px; }
.order-form-section h3 { font-size: 14px; font-weight: 600; color: var(--navy-primary); margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid #eee; }
.order-form-section h3 i { margin-right: 6px; color: var(--navy-accent); }
.order-number-display { font-family: monospace; font-weight: 700; font-size: 14px; color: var(--navy-primary); background: #f0f4f8; }
.form-control-calculated { background: #f8f9fa !important; font-weight: 600; }
.form-group-full { flex: 1; }

/* Product thumbnails (Inventory page) */
.product-thumb { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; border: 1px solid #ddd; cursor: pointer; }
.product-no-img { width: 40px; height: 40px; border-radius: 6px; background: #f0f0f0; display: flex; align-items: center; justify-content: center; color: #aaa; font-size: 16px; }
.stock-out { color: #ea4335; font-weight: 700; }
.stock-low { color: #e67e22; font-weight: 600; }
.stock-ok { color: #34a853; font-weight: 600; }
.img-preview-wrap { margin-top: 8px; position: relative; display: inline-block; }
.img-preview-wrap img { max-width: 150px; max-height: 120px; border-radius: 8px; border: 1px solid #ddd; }
.img-preview-wrap .remove-img-btn { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; background: #ea4335; color: #fff; border: none; cursor: pointer; font-size: 11px; display: flex; align-items: center; justify-content: center; }
.view-product-img { max-width: 100%; max-height: 200px; border-radius: 8px; margin-bottom: 15px; }

/* Product Gallery */
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 8px; margin-top: 8px; }
.gallery-item { position: relative; border-radius: 6px; overflow: hidden; aspect-ratio: 1; border: 1px solid #ddd; }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; cursor: pointer; }
.gallery-item .gallery-del { position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%; background: rgba(234,67,53,0.9); color: #fff; border: none; cursor: pointer; font-size: 10px; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .2s; }
.gallery-item:hover .gallery-del { opacity: 1; }
.gallery-empty { color: #999; font-size: 13px; padding: 12px 0; }
.gallery-label { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.gallery-label .gallery-count { font-size: 12px; color: #888; font-weight: 400; }
.gallery-upload-btn { margin-top: 8px; }
.view-gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; margin-top: 10px; }
.view-gallery-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; border: 1px solid #ddd; cursor: pointer; }

/* Profit display */
.profit-positive { color: #34a853; font-weight: 700; }
.profit-negative { color: #ea4335; font-weight: 700; }

/* Dark mode — Orders */
body.dark-mode .order-stage-new { background: #1a237e; color: #90caf9; }
body.dark-mode .order-stage-measurement-requested { background: #4e342e; color: #ffcc80; }
body.dark-mode .order-stage-measurement-received { background: #004d40; color: #80cbc4; }
body.dark-mode .order-stage-stitching { background: #4a148c; color: #ce93d8; }
body.dark-mode .order-stage-qc { background: #5d4037; color: #fff176; }
body.dark-mode .order-stage-ready { background: #1b5e20; color: #a5d6a7; }
body.dark-mode .order-stage-dispatched { background: #1a237e; color: #9fa8da; }
body.dark-mode .order-stage-delivered { background: #2e7d32; color: #c8e6c9; }
body.dark-mode .order-stage-cancelled { background: #b71c1c; color: #ef9a9a; }
body.dark-mode .order-priority-normal { background: #333; color: #aaa; }
body.dark-mode .order-priority-urgent { background: #4e342e; color: #ffcc80; border-color: #5d4037; }
body.dark-mode .order-priority-vip { background: #5d4037; color: #ffe082; border-color: #6d4c41; }
body.dark-mode .order-form-section h3 { color: #90caf9; border-bottom-color: #333; }
body.dark-mode .order-form-section h3 i { color: #64b5f6; }
body.dark-mode .order-number-display { background: #1e1e2e; color: #90caf9; }
body.dark-mode .form-control-calculated { background: #1e1e2e !important; }

/* Utility Classes */
.hidden { display: none; }
.text-center { text-align: center; }
.modal-md { max-width: 700px; }
.modal-sm { max-width: 600px; }
.modal-lg { max-width: 800px; }
.modal-view { max-width: 800px; }
.modal-invoice { max-width: 900px; }
.gallery-label label { margin-bottom: 0; }
.view-gallery-section { margin-top: 15px; }
.fw-bold { font-weight: 700; }
.mt-20 { margin-top: 20px; }
.mt-25 { margin-top: 25px; }
.mt-30 { margin-top: 30px; }
.mb-20 { margin-bottom: 20px; }

/* ===== Order Items (inside View Modal) ===== */
.order-items-section {
    margin-top: 20px;
    border-top: 2px solid var(--border-color);
    padding-top: 15px;
}

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

.order-items-header h4 {
    margin: 0;
    font-size: 16px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.order-items-header .btn {
    font-size: 13px;
    padding: 6px 14px;
}

.order-items-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.order-items-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.order-items-table th {
    background: var(--navy-primary);
    color: white;
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
}

.order-items-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
    vertical-align: middle;
}

.order-items-table tbody tr:hover {
    background: var(--table-hover);
}

.order-items-table .item-actions {
    white-space: nowrap;
    display: flex;
    gap: 6px;
}

.order-items-total {
    text-align: right;
    padding: 12px;
    font-weight: 700;
    font-size: 15px;
    color: var(--text-primary);
    border-top: 2px solid var(--navy-primary);
    background: var(--bg-secondary);
}

.order-items-empty {
    text-align: center;
    padding: 30px 15px;
    color: var(--text-muted);
    font-size: 14px;
}

.order-items-empty i {
    font-size: 28px;
    display: block;
    margin-bottom: 10px;
    opacity: 0.5;
}

/* Item inline form */
.item-form-row td {
    padding: 8px 6px !important;
    background: rgba(0, 116, 217, 0.04);
}

.item-form-row input,
.item-form-row select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    background: var(--input-bg);
    color: var(--text-primary);
}

.item-form-row input:focus,
.item-form-row select:focus {
    outline: none;
    border-color: var(--navy-accent);
    box-shadow: 0 0 0 2px rgba(0,116,217,0.15);
}

.item-form-row .item-form-actions {
    display: flex;
    gap: 4px;
}

.item-form-row .item-form-actions .btn {
    padding: 6px 10px;
    font-size: 12px;
}

/* Searchable Dropdown */
.searchable-dropdown { position: relative; width: 100%; }
.searchable-dropdown-input { width: 100%; padding: 8px 32px 8px 10px; border: 2px solid var(--border-color, #ced4da); border-radius: 3px; font-size: 14px !important; transition: all 0.3s; font-family: inherit; background: var(--bg-card, white); cursor: pointer; touch-action: manipulation; color: var(--text-color, #333); }
.searchable-dropdown-input:focus { outline: none; border-color: var(--navy-accent); box-shadow: 0 0 0 3px rgba(0,116,217,0.15); }
.searchable-dropdown-input::placeholder { color: var(--text-muted, #999); }
.searchable-dropdown-arrow { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--text-muted, #666); font-size: 11px; transition: transform 0.3s; }
.searchable-dropdown-arrow.open { transform: translateY(-50%) rotate(180deg); }
.searchable-dropdown-list { position: absolute; top: 100%; left: 0; right: 0; background: var(--bg-card, white); border: 2px solid var(--navy-accent); border-top: none; border-radius: 0 0 3px 3px; max-height: 220px; overflow-y: auto; z-index: 1000; box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.searchable-dropdown-item { padding: 10px 12px; cursor: pointer; font-size: 13px; transition: background 0.15s; border-bottom: 1px solid var(--border-light, #f0f0f0); display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.searchable-dropdown-item:last-child { border-bottom: none; }
.searchable-dropdown-item:hover { background: rgba(0,116,217,0.1); }
.searchable-dropdown-item.selected { background: var(--navy-primary); color: white; }
.searchable-dropdown-item .sd-product-name { font-weight: 500; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.searchable-dropdown-item .sd-product-price { font-weight: 600; color: var(--navy-accent); font-size: 13px; }
.searchable-dropdown-item.selected .sd-product-price { color: rgba(255,255,255,0.9); }
.searchable-dropdown-item .sd-product-sku { width: 100%; font-size: 11px; color: var(--text-muted, #999); }
.searchable-dropdown-item.selected .sd-product-sku { color: rgba(255,255,255,0.7); }
.searchable-dropdown-item.no-results { color: var(--text-muted, #999); font-style: italic; cursor: default; justify-content: center; }
.searchable-dropdown-item.no-results:hover { background: transparent; }

/* Item skeleton */
.item-skeleton-row td {
    padding: 12px !important;
}

.item-skeleton-bar {
    height: 14px;
    background: linear-gradient(90deg, var(--skeleton-base) 25%, var(--skeleton-shine) 50%, var(--skeleton-base) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 3px;
}

/* Dark mode — Order Items */
body.dark-mode .order-items-section {
    border-top-color: var(--border-color);
}

body.dark-mode .order-items-table th {
    background: var(--navy-light);
}

body.dark-mode .order-items-total {
    background: var(--bg-secondary);
    border-top-color: var(--navy-light);
}

body.dark-mode .item-form-row td {
    background: rgba(0, 116, 217, 0.08);
}

body.dark-mode .searchable-dropdown-list {
    border-color: var(--navy-accent);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
body.dark-mode .searchable-dropdown-item:hover {
    background: rgba(0,116,217,0.2);
}

/* Responsive — Order Items */
@media (max-width: 768px) {
    .order-items-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .order-items-table {
        font-size: 13px;
    }

    .order-items-table th,
    .order-items-table td {
        padding: 8px;
    }
}

/* ===== Order Measurements (inside View Modal) ===== */
.order-measurements-section {
    margin-top: 20px;
    border-top: 2px solid var(--border-color);
    padding-top: 15px;
}

.order-measurements-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.order-measurements-header h4 {
    margin: 0;
    font-size: 16px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.order-measurements-header .btn {
    font-size: 13px;
    padding: 6px 14px;
}

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

.measurement-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 14px;
    position: relative;
    transition: box-shadow 0.2s;
}

.measurement-card:hover {
    box-shadow: 0 2px 8px var(--shadow-color);
}

.measurement-card .m-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.measurement-card .m-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--navy-primary);
}

.measurement-card .m-unit {
    font-size: 13px;
    font-weight: 400;
    color: var(--text-muted);
    margin-left: 3px;
}

.measurement-card .m-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.measurement-card:hover .m-actions {
    opacity: 1;
}

.measurement-card .m-actions .action-icon {
    font-size: 13px;
    width: 26px;
    height: 26px;
}

.measurements-empty {
    text-align: center;
    padding: 25px 15px;
    color: var(--text-muted);
    font-size: 14px;
}

.measurements-empty i {
    font-size: 28px;
    display: block;
    margin-bottom: 10px;
    opacity: 0.5;
}

/* Measurement inline form */
.measurement-form {
    background: rgba(0, 116, 217, 0.04);
    border: 2px dashed var(--navy-accent);
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 15px;
}

.measurement-form-grid {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1fr 80px auto;
    gap: 10px;
    align-items: end;
}

.measurement-form-grid .form-group {
    margin-bottom: 0;
}

.measurement-form-grid .form-group label {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 4px;
    display: block;
    color: var(--text-secondary);
}

.measurement-form-grid .form-group input,
.measurement-form-grid .form-group select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    background: var(--input-bg);
    color: var(--text-primary);
}

.measurement-form-grid .form-group input:focus,
.measurement-form-grid .form-group select:focus {
    outline: none;
    border-color: var(--navy-accent);
    box-shadow: 0 0 0 2px rgba(0,116,217,0.15);
}

.measurement-form-actions {
    display: flex;
    gap: 6px;
    padding-bottom: 1px;
}

.measurement-form-actions .btn {
    padding: 8px 12px;
    font-size: 13px;
}

/* Dark mode — Measurements */
body.dark-mode .measurement-card {
    background: var(--bg-card);
    border-color: var(--border-color);
}

body.dark-mode .measurement-card .m-value {
    color: var(--navy-accent);
}

body.dark-mode .measurement-form {
    background: rgba(0, 116, 217, 0.08);
    border-color: var(--navy-accent);
}

body.dark-mode .order-measurements-section {
    border-top-color: var(--border-color);
}

/* Responsive — Measurements */
@media (max-width: 768px) {
    .measurements-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 8px;
    }

    .measurement-card .m-actions {
        opacity: 1;
    }

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

    .measurement-form-actions {
        grid-column: 1 / -1;
    }

    .order-measurements-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
}

/* Dark mode — Products / Gallery */
body.dark-mode .product-no-img { background: #2a2a3e; color: #666; }
body.dark-mode .product-thumb { border-color: #444; }
body.dark-mode .gallery-item { border-color: #444; }
body.dark-mode .gallery-empty { color: #666; }
body.dark-mode .view-gallery-grid img { border-color: #444; }

/* ===== Order Files (inside View Modal) ===== */
.order-files-section {
    margin-top: 20px;
    border-top: 2px solid var(--border-color);
    padding-top: 15px;
}
.order-files-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}
.order-files-header h4 {
    margin: 0;
    font-size: 16px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}
.order-files-header .btn { font-size: 13px; padding: 6px 14px; }
.order-files-empty {
    text-align: center;
    padding: 25px;
    color: var(--text-muted);
    font-size: 14px;
}
.order-files-empty i { margin-right: 8px; font-size: 16px; }
.order-files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}
.order-file-card {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
    background: var(--card-bg, #fff);
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: box-shadow 0.2s;
}
.order-file-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.file-thumbnail {
    width: 100%;
    height: 120px;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    cursor: pointer;
}
.file-thumbnail img { width: 100%; height: 100%; object-fit: cover; }
.file-icon-preview { background: var(--navy-primary); color: white; }
.file-icon-preview i { font-size: 36px; opacity: 0.8; }
.file-info { flex: 1; }
.file-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.file-category-badge {
    display: inline-block;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    margin-top: 4px;
    background: var(--navy-accent);
    color: white;
}
.file-category-badge.file-category-invoice { background: var(--success); }
.file-category-badge.file-category-bill { background: var(--warning); color: #333; }
.file-category-badge.file-category-reference-image { background: var(--navy-accent); }
.file-category-badge.file-category-shipping-label { background: #6c5ce7; }
.file-category-badge.file-category-other { background: #636e72; }
.file-meta { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.file-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* File Upload Form */
.file-upload-form {
    background: var(--bg-secondary, #f8f9fa);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}
.file-upload-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.file-upload-form-actions { margin-top: 12px; display: flex; gap: 8px; }

/* ===== Stage History Timeline ===== */
.order-stage-log-section {
    margin-top: 20px;
    border-top: 2px solid var(--border-color);
    padding-top: 15px;
}
.order-stage-log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}
.order-stage-log-header h4 {
    margin: 0;
    font-size: 16px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}
.stage-log-empty { text-align: center; padding: 25px; color: var(--text-muted); font-size: 14px; }
.stage-log-empty i { margin-right: 8px; }
.stage-timeline { position: relative; padding-left: 30px; }
.stage-timeline::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 5px;
    bottom: 5px;
    width: 2px;
    background: var(--border-color);
}
.stage-timeline-item { position: relative; margin-bottom: 18px; }
.stage-timeline-dot {
    position: absolute;
    left: -24px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--navy-accent);
    border: 2px solid white;
    box-shadow: 0 0 0 2px var(--navy-accent);
}
.stage-timeline-current .stage-timeline-dot {
    background: var(--success);
    box-shadow: 0 0 0 2px var(--success);
}
.stage-timeline-content {
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 14px;
}
.stage-timeline-stages {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}
.stage-arrow { color: var(--text-muted); font-size: 12px; }
.stage-timeline-meta { font-size: 12px; color: var(--text-muted); }
.stage-timeline-meta i { margin-right: 3px; }
.stage-timeline-remarks {
    margin-top: 6px;
    font-size: 13px;
    color: var(--text-secondary, #555);
    font-style: italic;
}
.stage-timeline-remarks i { margin-right: 4px; color: var(--text-muted); }

/* Dark mode — Order Files */
body.dark-mode .order-files-section { border-top-color: #444; }
body.dark-mode .order-file-card { background: #1e1e2e; border-color: #444; }
body.dark-mode .file-thumbnail { background: #2d2d3d; }
body.dark-mode .file-upload-form { background: #1e1e2e; border-color: #444; }

/* Dark mode — Stage Timeline */
body.dark-mode .order-stage-log-section { border-top-color: #444; }
body.dark-mode .stage-timeline::before { background: #444; }
body.dark-mode .stage-timeline-content { background: #1e1e2e; border-color: #444; }
body.dark-mode .stage-timeline-dot { border-color: #1e1e2e; }

/* Responsive — Order Files & Stage Log */
@media (max-width: 768px) {
    .order-files-grid { grid-template-columns: 1fr; }
    .file-upload-form-grid { grid-template-columns: 1fr; }
    .order-files-header, .order-stage-log-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
}

/* ===== Invoice-Style Order View ===== */
.modal-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.modal-header-actions .btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 6px 14px;
    font-size: 13px;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 6px;
}
.modal-header-actions .btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.invoice-wrapper {
    background: #fff;
    padding: 0;
}

/* Invoice Header */
.invoice-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 24px 28px;
    background: linear-gradient(135deg, var(--navy-primary) 0%, var(--navy-light) 100%);
    border-radius: 4px;
    margin-bottom: 20px;
    color: white;
}
.invoice-header-left {
    flex: 1;
}
.invoice-order-number {
    font-family: 'Courier New', Courier, monospace;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: 1px;
    margin-bottom: 10px;
    color: #fff;
}
.invoice-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}
.invoice-header-right {
    text-align: right;
    min-width: 180px;
}
.invoice-date-row {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 6px;
    font-size: 13px;
}
.invoice-date-label {
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
}
.invoice-date-value {
    font-weight: 600;
    color: #fff;
}

/* Invoice Info Grid (2x2) */
.invoice-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}
.invoice-info-card {
    border: 1px solid var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    background: var(--bg-card);
}
.invoice-info-card-title {
    padding: 10px 16px;
    background: #f8f9fa;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--navy-primary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 8px;
}
.invoice-info-card-title i {
    color: var(--navy-accent);
    font-size: 13px;
}
.invoice-info-card-body {
    padding: 12px 16px;
}
.invoice-info-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    font-size: 14px;
}
.invoice-info-line:not(:last-child) {
    border-bottom: 1px dashed var(--border-light);
}
.invoice-info-label {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
}
.invoice-info-value {
    font-weight: 600;
    color: var(--text-primary);
    text-align: right;
}

/* Invoice Notes */
.invoice-notes-section {
    margin-bottom: 20px;
}
.invoice-note {
    padding: 10px 16px;
    background: #f8f9fa;
    border-left: 3px solid var(--navy-accent);
    border-radius: 0 4px 4px 0;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 8px;
}
.invoice-note i {
    margin-right: 6px;
    color: var(--navy-accent);
}
.invoice-note-internal {
    border-left-color: var(--warning);
    background: #fffbf0;
}
.invoice-note-internal i {
    color: var(--warning);
}

/* Invoice Sections */
.invoice-section {
    margin-bottom: 20px;
}
.invoice-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 10px;
    margin-bottom: 12px;
    border-bottom: 2px solid var(--navy-primary);
}
.invoice-section-header h4 {
    font-size: 15px;
    font-weight: 700;
    color: var(--navy-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}
.invoice-section-header h4 i {
    color: var(--navy-accent);
}
.invoice-loading {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 14px;
}
.invoice-loading i {
    margin-right: 8px;
}

/* Financial Summary (right-aligned invoice style) */
.invoice-financial-summary {
    margin-left: auto;
    width: 300px;
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}
.invoice-financial-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 16px;
    font-size: 14px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-light);
}
.invoice-financial-row:last-child {
    border-bottom: none;
}
.invoice-financial-row span:last-child {
    font-weight: 600;
    font-family: 'Courier New', Courier, monospace;
}
.invoice-financial-total {
    background: var(--navy-primary);
    color: #fff !important;
    font-weight: 700;
    font-size: 15px;
}
.invoice-financial-total span {
    color: #fff !important;
}
.invoice-financial-divider {
    padding: 0;
    border-bottom: 2px dashed var(--border-color);
}
.invoice-profit-positive span:last-child {
    color: var(--success) !important;
}
.invoice-profit-negative span:last-child {
    color: var(--danger) !important;
}

/* Invoice Footer */
.invoice-footer {
    margin-top: 30px;
    text-align: center;
}
.invoice-footer-line {
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--navy-primary), transparent);
    margin-bottom: 12px;
}
.invoice-footer-text {
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: 0.3px;
}

/* Dark Mode — Invoice */
body.dark-mode .invoice-header {
    background: linear-gradient(135deg, var(--navy-light) 0%, var(--navy-dark) 100%);
}
body.dark-mode .invoice-info-card {
    border-color: var(--border-color);
    background: var(--bg-card);
}
body.dark-mode .invoice-info-card-title {
    background: rgba(255, 255, 255, 0.05);
    color: #90caf9;
    border-bottom-color: var(--border-color);
}
body.dark-mode .invoice-info-card-title i {
    color: #64b5f6;
}
body.dark-mode .invoice-info-line:not(:last-child) {
    border-bottom-color: var(--border-color);
}
body.dark-mode .invoice-note {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
}
body.dark-mode .invoice-note-internal {
    background: rgba(251, 188, 4, 0.08);
}
body.dark-mode .invoice-section-header {
    border-bottom-color: var(--navy-light);
}
body.dark-mode .invoice-section-header h4 {
    color: #90caf9;
}
body.dark-mode .invoice-financial-summary {
    border-color: var(--border-color);
}
body.dark-mode .invoice-financial-row {
    border-bottom-color: var(--border-color);
    color: var(--text-secondary);
}
body.dark-mode .invoice-financial-total {
    background: var(--navy-light);
}
body.dark-mode .invoice-financial-divider {
    border-bottom-color: var(--border-color);
}
body.dark-mode .invoice-footer-line {
    background: linear-gradient(90deg, transparent, var(--navy-light), transparent);
}

/* Responsive — Invoice */
@media (max-width: 768px) {
    .modal-invoice { max-width: 95%; }
    .invoice-header {
        flex-direction: column;
        gap: 15px;
    }
    .invoice-header-right {
        text-align: left;
        min-width: unset;
        width: 100%;
    }
    .invoice-info-grid {
        grid-template-columns: 1fr;
    }
    .invoice-financial-summary {
        width: 100%;
    }
    .invoice-order-number {
        font-size: 20px;
    }
    .modal-header-actions .btn span {
        display: none;
    }
}

/* Print Styles — Invoice */
@media print {
    .no-print,
    .modal-header,
    .modal-header-actions,
    .mobile-bottom-nav,
    .item-form-row,
    .m-actions {
        display: none !important;
    }
    .modal-overlay {
        position: static;
        background: none;
        padding: 0;
    }
    .modal-invoice {
        box-shadow: none;
        border: none;
        width: 100%;
        max-width: 100%;
        max-height: unset;
        overflow: visible;
    }
    .invoice-wrapper {
        box-shadow: none;
    }
    .invoice-header {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .order-stage, .order-priority, .status-badge, .invoice-financial-total {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* ===== Invoice Items Table ===== */
.invoice-items-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.invoice-items-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.invoice-items-table thead th {
    background: #f8f9fa;
    color: var(--navy-primary);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 10px 12px;
    border-bottom: 2px solid var(--navy-primary);
    text-align: left;
    white-space: nowrap;
}
.invoice-items-th-num { width: 40px; text-align: center; }
.invoice-items-th-qty { width: 60px; text-align: center; }
.invoice-items-th-price { width: 100px; text-align: right; }
.invoice-items-th-actions { width: 80px; text-align: center; }
.invoice-items-table tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary);
    vertical-align: middle;
}
.invoice-items-table tbody tr:hover {
    background: #f9f9f9;
}
.invoice-items-num { text-align: center; color: var(--text-muted); font-weight: 600; }
.invoice-items-product { font-weight: 600; color: var(--text-primary); }
.invoice-items-sku { font-family: 'Courier New', Courier, monospace; font-size: 13px; color: var(--text-muted); }
.invoice-items-qty { text-align: center; font-weight: 600; }
.invoice-items-price { text-align: right; font-family: 'Courier New', Courier, monospace; }
.invoice-items-notes { font-size: 13px; color: var(--text-muted); max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.invoice-items-total-label {
    text-align: right;
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    padding: 12px;
    border-top: 2px solid var(--navy-primary);
    color: var(--navy-primary);
}
.invoice-items-total-value {
    text-align: right;
    font-weight: 800;
    font-size: 15px;
    font-family: 'Courier New', Courier, monospace;
    padding: 12px;
    border-top: 2px solid var(--navy-primary);
    color: var(--navy-primary);
}

/* Dark Mode — Invoice Items */
body.dark-mode .invoice-items-table thead th {
    background: rgba(255, 255, 255, 0.05);
    color: #90caf9;
    border-bottom-color: var(--navy-light);
}
body.dark-mode .invoice-items-table tbody td {
    border-bottom-color: var(--border-color);
}
body.dark-mode .invoice-items-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}
body.dark-mode .invoice-items-product {
    color: var(--text-primary);
}
body.dark-mode .invoice-items-total-label,
body.dark-mode .invoice-items-total-value {
    border-top-color: var(--navy-light);
    color: #90caf9;
}

/* ===== Invoice Measurements Grid (2x2) ===== */
.invoice-measurements-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.invoice-measurement-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: #fafbfc;
    position: relative;
    transition: all 0.2s;
}
.invoice-measurement-card:hover {
    border-color: var(--navy-accent);
    background: #f0f7ff;
}
.invoice-m-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.invoice-m-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--navy-primary);
    font-family: 'Courier New', Courier, monospace;
}
.invoice-m-unit {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    margin-left: 2px;
}
.invoice-measurement-card .m-actions {
    position: absolute;
    top: 4px;
    right: 4px;
    display: none;
}
.invoice-measurement-card:hover .m-actions {
    display: flex;
    gap: 2px;
}
.invoice-measurement-card .m-actions .action-icon {
    font-size: 13px;
    padding: 3px 5px;
}

/* Dark Mode — Invoice Measurements */
body.dark-mode .invoice-measurement-card {
    background: rgba(255, 255, 255, 0.03);
    border-color: var(--border-color);
}
body.dark-mode .invoice-measurement-card:hover {
    background: rgba(0, 116, 217, 0.08);
    border-color: var(--navy-accent);
}
body.dark-mode .invoice-m-value {
    color: #90caf9;
}

/* Responsive — Invoice Measurements */
@media (max-width: 768px) {
    .invoice-measurements-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== Invoice Empty State ===== */
.invoice-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    color: var(--text-muted);
    font-size: 14px;
    gap: 8px;
}
.invoice-empty-state i {
    font-size: 24px;
    opacity: 0.5;
}

body.dark-mode .invoice-empty-state {
    color: var(--text-muted);
}

/* ===== Login page — split layout ===== */
:root {
    --navy-primary-rgb: 0, 31, 63;
    --navy-light-rgb: 0, 51, 102;
    --navy-accent-rgb: 0, 116, 217;
    --accent-ink: #0074d9;
    --r-panel: 4px; --r-ctrl: 3px; --r-chip: 3px;
}
body.dark-mode {
    --navy-primary-rgb: 10, 22, 40;
    --navy-light-rgb: 26, 58, 92;
    --accent-ink: #2789df;
}
/* login footer contact block */
.auth-contact {
    text-align: center;
    padding: 14px 10px 0;
    font-size: 12px;
}

.auth-contact-title {
    display: block;
    font-weight: 700;
    color: var(--navy-primary);
    margin-bottom: 6px;
}

.auth-contact-links {
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px;
}

.auth-contact-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: color 0.15s;
}

.auth-contact-links a:hover { color: var(--accent-ink); }
/* ===== Auth — full-bleed split: showcase left, form right ===== */
.auth-body {
    position: relative;
    min-height: 100dvh;
    display: flex;
    background: var(--bg-card);
}
.auth-wrap { position: relative; flex: 1; display: flex; flex-direction: column; min-height: 100dvh; width: 100%; }
.auth-card {
    flex: 1;
    width: 100%; min-height: 100dvh;
    display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    background: var(--bg-card);
}

/* ---------- right: form column ---------- */
.auth-form-col {
    position: relative;
    display: flex; flex-direction: column;
    min-width: 0; max-height: 100dvh;
    padding: 20px 28px 18px;
    overflow-y: auto;                       /* long errors scroll the column, never the page */
}
.auth-topbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.auth-brandmark {
    display: inline-flex; align-items: center; gap: 10px;
    color: var(--navy-primary); font-size: 15px; font-weight: 700;
    text-decoration: none; letter-spacing: -0.2px;
}
.auth-brandmark img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.auth-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; margin-left: auto;
    border: 1px solid var(--border-color); border-radius: 50%;
    background: var(--bg-card); color: var(--text-secondary);
    font-size: 15px; cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
}
.auth-toggle:hover { color: var(--accent-ink); border-color: var(--navy-accent); }

.auth-form-inner { width: 100%; max-width: 400px; margin: auto; padding: 24px 0; }
.auth-form-inner:has(.auth-grid) { max-width: 560px; }
.auth-form-inner .error,
.auth-form-inner .success { margin: 0 0 16px; text-align: left; }
.auth-logo-mark { display: block; width: 40px; height: 40px; margin: 0 auto 14px; border-radius: 50%; object-fit: cover; }

/* icon badge — forgot / reset / verify pages */
.auth-badge-wrap { display: flex; justify-content: center; margin-bottom: 14px; }
.auth-badge {
    display: flex; align-items: center; justify-content: center;
    width: 44px; height: 44px;
    border-radius: var(--r-ctrl);
    background: rgba(var(--navy-accent-rgb), 0.12);
    color: var(--accent-ink); font-size: 18px;
}
.auth-form-inner h1 { font-size: 24px; font-weight: 700; color: var(--text-primary); text-align: center; margin: 0 0 6px; letter-spacing: -0.3px; }
.auth-sub { font-size: 14px; color: var(--text-muted); text-align: center; margin: 0 0 24px; }

.auth-group { margin-bottom: 14px; min-width: 0; }
.auth-group label { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--text-primary); }
.auth-group label i { display: none; }
.auth-field { position: relative; }
.auth-field-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 14px; pointer-events: none; }
.auth-field input {
    width: 100%; height: 44px;
    padding: 0 14px;
    border: 1px solid var(--input-border);
    border-radius: var(--r-ctrl);
    background: var(--input-bg);
    color: var(--text-primary);
    font-size: 16px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.auth-field-icon ~ input { padding-left: 40px; }
.auth-field input:has(~ .auth-eye) { padding-right: 44px; }
.auth-field input:focus {
    outline: none;
    border-color: var(--navy-accent);
    box-shadow: 0 0 0 3px rgba(var(--navy-accent-rgb), 0.14);
}
.auth-eye {
    position: absolute; right: 4px; top: 50%;
    transform: translateY(-50%);
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px;
    background: none; border: 0; border-radius: var(--r-chip);
    color: var(--text-muted); font-size: 15px; line-height: 1;
    cursor: pointer; transition: color 0.2s, background 0.2s;
}
.auth-eye:hover, .auth-eye:focus-visible { color: var(--accent-ink); background: rgba(var(--navy-accent-rgb), 0.1); }

/* 2 x 2 form (signup) — one column on phones */
.auth-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }

/* login steps — email, then password + Sign In */
.auth-edit { display: none; }
.auth-steps:not(.js-steps) .auth-next,
.auth-steps.js-steps:not(.is-step2) .auth-step2,
.auth-steps.js-steps:not(.is-step2) .auth-go,
.auth-steps.js-steps.is-step2 .auth-next { display: none; }
.auth-steps.js-steps.is-step2 .auth-edit { display: inline-flex; }
.auth-steps.js-steps.is-step2 .auth-step2 { animation: authFadeIn 0.3s cubic-bezier(.16, 1, .3, 1) both; }

.auth-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 2px 0 18px; flex-wrap: wrap; }
.auth-check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-secondary); cursor: pointer; }
.auth-check input { width: 17px; height: 17px; accent-color: var(--navy-accent); cursor: pointer; }
.auth-link { color: var(--accent-ink); font-size: 13.5px; font-weight: 600; text-decoration: none; }
.auth-link:hover { text-decoration: none; opacity: 0.85; }

/* dark primary button, like the reference — palette primary, not a fixed black */
.auth-submit {
    width: 100%; height: 44px;
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    border: 0; border-radius: var(--r-ctrl);
    background: linear-gradient(180deg, rgba(var(--navy-primary-rgb), 0.86) 0%, var(--navy-primary) 100%);
    color: #fff; font-size: 15px; font-weight: 600; font-family: inherit;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(var(--navy-primary-rgb), 0.22);
    transition: filter 0.2s, box-shadow 0.2s;
    touch-action: manipulation;
}
.auth-submit:hover  { filter: brightness(1.18); box-shadow: 0 8px 20px rgba(var(--navy-primary-rgb), 0.30); }
.auth-submit:disabled { opacity: 0.65; cursor: not-allowed; pointer-events: none; }

.auth-or { display: flex; align-items: center; gap: 12px; margin: 16px 0; }
.auth-or::before, .auth-or::after { content: ''; flex: 1; height: 1px; background: var(--border-color); }
.auth-or span { color: var(--text-muted); font-size: 12.5px; font-weight: 500; }

/* soft filled social button */
.auth-google {
    width: 100%; height: 44px;
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    border: 1px solid transparent;
    border-radius: var(--r-ctrl);
    background: color-mix(in srgb, var(--text-primary) 6%, var(--bg-card));
    color: var(--text-primary);
    font-size: 14.5px; font-weight: 600;
    font-family: inherit;                   /* verify_otp uses this on a <button> — buttons don't inherit */
    text-decoration: none; cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}
.auth-google svg { width: 18px; height: 18px; }
.auth-google:hover { background: color-mix(in srgb, var(--text-primary) 10%, var(--bg-card)); }
.auth-signup { margin: 20px 0 0; text-align: center; font-size: 14px; color: var(--text-secondary); }
.auth-maint { margin: 0 0 16px; text-align: left; }

.auth-foot { width: 100%; padding-top: 12px; }
.auth-copy {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 0 0; text-align: center;
    font-size: 12.5px; color: var(--text-muted);
}
.auth-copy i { color: var(--accent-ink); }

/* ---------- left: showcase panel ---------- */
.auth-showcase { order: -1; display: flex; padding: 14px; min-width: 0; }
.auth-showcase-card {
    position: relative;
    flex: 1; min-width: 0;
    display: flex; flex-direction: column; justify-content: space-between;
    padding: 24px 28px 24px;
    border: 1px solid rgba(var(--navy-accent-rgb), 0.12);
    border-radius: var(--r-panel);
    overflow: hidden;
    isolation: isolate;
    background: linear-gradient(160deg,
        rgba(var(--navy-accent-rgb), 0.12) 0%,
        rgba(var(--navy-accent-rgb), 0.05) 55%,
        color-mix(in srgb, var(--navy-accent) 8%, var(--bg-card)) 100%);
}
/* big faint ring bottom-right */
.auth-showcase-card::before {
    content: '';
    position: absolute; right: -22%; bottom: -30%;
    width: 78%; aspect-ratio: 1;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 25%, color-mix(in srgb, var(--bg-card) 70%, transparent), rgba(var(--navy-accent-rgb), 0.10) 70%);
    border: 1px solid color-mix(in srgb, var(--bg-card) 60%, transparent);
    z-index: -1;
}
/* glossy theme orbs */
.auth-orb {
    position: absolute; z-index: -1;
    aspect-ratio: 1; border-radius: 50%;
    background: radial-gradient(circle at 32% 28%,
        color-mix(in srgb, var(--bg-card) 75%, var(--navy-accent)) 0%,
        rgba(var(--navy-accent-rgb), 0.85) 48%,
        rgba(var(--navy-accent-rgb), 0.55) 100%);
    box-shadow: inset -10px -14px 30px rgba(var(--navy-primary-rgb), 0.18);
    animation: authDrift 12s ease-in-out infinite;
}
.auth-orb.o1 {                              /* large pale glass orb, top */
    width: 82%; top: -26%; left: 6%;
    background: radial-gradient(circle at 40% 70%, color-mix(in srgb, var(--bg-card) 85%, transparent) 0%, rgba(var(--navy-accent-rgb), 0.10) 100%);
    box-shadow: none;
    animation-duration: 16s;
}
.auth-orb.o2 { width: 34%; right: -9%; top: 30%; animation-delay: -4s; }
.auth-orb.o3 { width: 13%; left: -5%; top: 56%; animation-delay: -8s; }
@keyframes authDrift { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }

.auth-show-brand {
    display: inline-flex; align-items: center; gap: 8px; align-self: flex-start;
    color: var(--text-primary); font-size: 15px; font-weight: 700; text-decoration: none;
}
.auth-show-brand img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }

.auth-show-foot { width: 100%; }
.auth-show-title {
    margin: 0 0 8px;
    font-size: clamp(20px, 1.7vw, 26px); font-weight: 700; letter-spacing: -0.3px; line-height: 1.25;
    color: var(--text-primary);
}
.auth-slides { position: relative; width: 100%; max-width: 520px; min-height: 46px; }
.auth-slide {
    position: absolute; inset: 0;
    margin: 0;
    font-size: 14px; line-height: 1.6; color: var(--text-secondary);
    opacity: 0; transform: translateY(6px);
    transition: opacity 0.45s ease, transform 0.45s ease;
    pointer-events: none;
}
.auth-slide.is-active { opacity: 1; transform: none; }
.auth-dots { display: flex; align-items: center; gap: 6px; margin-top: 10px; }
.auth-dot {
    width: 7px; height: 7px; padding: 0;
    border: 0; border-radius: 4px;
    background: rgba(var(--navy-primary-rgb), 0.22);
    cursor: pointer;
    transition: width 0.3s, background 0.3s;
}
.auth-dot.is-active { width: 22px; background: var(--navy-accent); }

/* frosted trust card */
.auth-trust {
    display: flex; align-items: center; gap: 12px;
    margin-top: 18px; padding: 12px 14px;
    border: 1px solid color-mix(in srgb, var(--bg-card) 70%, transparent);
    border-radius: var(--r-ctrl);
    background: color-mix(in srgb, var(--bg-card) 55%, transparent);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.auth-trust-stack { display: inline-flex; flex-shrink: 0; }
.auth-trust-stack i {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; margin-left: -8px;
    border: 2px solid var(--bg-card); border-radius: 50%;
    background: var(--navy-accent); color: #fff; font-size: 12px;
}
.auth-trust-stack i:first-child { margin-left: 0; background: var(--navy-primary); }
.auth-trust-stack i:last-child { background: var(--navy-light); }
.auth-trust-text { display: flex; flex-direction: column; min-width: 0; }
.auth-trust-text b { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.auth-trust-text small { font-size: 12px; color: var(--text-muted); }

/* ---------- dark mode — beat the blanket p/span/div/label colour rules ---------- */
body.dark-mode .auth-brandmark,
body.dark-mode .auth-brandmark span,
body.dark-mode .auth-show-brand span,
body.dark-mode .auth-show-title,
body.dark-mode .auth-trust-text b,
body.dark-mode .auth-form-inner h1 { color: var(--text-primary) !important; }  /* h1-h6 blanket is !important */
body.dark-mode .auth-sub,
body.dark-mode .auth-copy,
body.dark-mode .auth-or span,
body.dark-mode .auth-signup,
body.dark-mode .auth-trust-text small,
body.dark-mode .auth-check span { color: var(--text-muted) !important; }
body.dark-mode .auth-slide { color: var(--text-secondary) !important; }
body.dark-mode .error { background: rgba(234, 67, 53, 0.10); border-color: rgba(234, 67, 53, 0.30); }
body.dark-mode .auth-showcase-card {
    border-color: rgba(var(--navy-accent-rgb), 0.22);
    background: linear-gradient(160deg,
        rgba(var(--navy-accent-rgb), 0.18) 0%,
        rgba(var(--navy-accent-rgb), 0.06) 55%,
        var(--bg-card) 100%);
}
body.dark-mode .auth-orb.o1 { background: radial-gradient(circle at 40% 70%, rgba(var(--navy-accent-rgb), 0.16) 0%, rgba(var(--navy-accent-rgb), 0.04) 100%); }
body.dark-mode .auth-showcase-card::before { background: radial-gradient(circle at 30% 25%, rgba(var(--navy-accent-rgb), 0.10), transparent 70%); border-color: rgba(var(--navy-accent-rgb), 0.18); }
/* navy primary vanishes on a black page -> accent button in dark */
body.dark-mode .auth-submit { background: linear-gradient(180deg, rgba(var(--navy-accent-rgb), 0.86) 0%, var(--navy-accent) 100%); box-shadow: none; }
body.dark-mode .auth-dot { background: rgba(255, 255, 255, 0.22); }

/* ---------- responsive ---------- */
@media (min-width: 1025px) {
    .auth-topbar .auth-brandmark { visibility: hidden; }   /* showcase carries the brand on desktop */
}
@media (max-width: 1024px) {
    .auth-card { grid-template-columns: 1fr; min-height: 100dvh; }
    .auth-showcase { display: none; }
    .auth-form-col { max-height: none; overflow: visible; padding: 18px 24px 16px; }
}
@media (max-width: 560px) {
    .auth-form-col { padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); }
    .auth-form-inner { padding: 16px 0; }
    .auth-form-inner h1 { font-size: 22px; }
    .auth-sub { margin-bottom: 20px; }
    .auth-grid { grid-template-columns: 1fr; }
}

/* ===== Auth transitions — login <-> signup slide, showcase stays put =====
   Cross-document view transitions (opted in globally above). The showcase panel is
   identical on every auth page, so it gets its own snapshot and never moves. */
.auth-showcase   { view-transition-name: auth-brand; }
.auth-form-inner { view-transition-name: auth-form; }

/* showcase box = same on every page -> hold it perfectly still, no crossfade */
::view-transition-group(auth-brand) { animation-duration: 0s; }
::view-transition-old(auth-brand),
::view-transition-new(auth-brand)   { animation: none; }

/* default pair — forgot/reset/verify carry no html.auth-* class, so without this
   they fall back to the unstyled group animation instead of a clean fade */
::view-transition-old(auth-form) { animation: authFadeOut 0.18s ease both; }
::view-transition-new(auth-form) { animation: authFadeIn 0.34s cubic-bezier(.16, 1, .3, 1) both; }

/* form slides in the direction you travelled — class sits on <html> per page */
.auth-signup::view-transition-old(auth-form) { animation: authOutLeft 0.20s ease both; }
.auth-signup::view-transition-new(auth-form) { animation: authInRight 0.40s cubic-bezier(.16, 1, .3, 1) both; }
.auth-login::view-transition-old(auth-form)  { animation: authOutRight 0.20s ease both; }
.auth-login::view-transition-new(auth-form)  { animation: authInLeft 0.40s cubic-bezier(.16, 1, .3, 1) both; }

@keyframes authFadeOut { to   { opacity: 0; transform: translateY(-8px); } }
@keyframes authFadeIn  { from { opacity: 0; transform: translateY(10px); } }
@keyframes authOutLeft  { to   { opacity: 0; transform: translateX(-38px); } }
@keyframes authInRight  { from { opacity: 0; transform: translateX(38px); } }
@keyframes authOutRight { to   { opacity: 0; transform: translateX(38px); } }
@keyframes authInLeft   { from { opacity: 0; transform: translateX(-38px); } }

/* no view transitions (older Safari/Firefox) -> plain entrance so it still feels alive */
@supports not (view-transition-name: none) {
    .auth-form-inner { animation: authFadeIn 0.45s cubic-bezier(.16, 1, .3, 1) 0.05s both; }
}

@media (prefers-reduced-motion: reduce) {
    ::view-transition-old(auth-form), ::view-transition-new(auth-form) { animation: none; }
    .auth-form-inner { animation: none; }
    .auth-orb, .auth-steps.js-steps.is-step2 .auth-step2 { animation: none; }
    .auth-slide { transition: none; }
}

/* ===== Sidebar — icon rail + panel with folding sections ===== */
/* ===== Sidebar ===== */
/* icon rail (logo · shortcuts · preferences · account) + panel (name · search · folding sections).
   desktop folds the panel to icons, phones get both as a drawer */
:root {
    --sb-rail-w: 52px;
    --sb-w: 292px;      /* rail + panel */
    --sb-mini: 108px;   /* rail + icon column */
    --sb-r: 4px;
}

.sidebar {
    --sb-bg: var(--bg-secondary);
    --sb-rail: color-mix(in srgb, var(--text-primary) 3.5%, transparent);
    --sb-hover: color-mix(in srgb, var(--text-primary) 5%, transparent);
    --sb-active: color-mix(in srgb, var(--text-primary) 8%, transparent);
    --sb-ring: var(--bg-secondary);
    width: var(--sb-w);
    height: 100vh;
    height: 100dvh;
    flex-shrink: 0;
    display: flex;
    position: relative;
    z-index: 950; /* tooltips + account menu paint over the page */
    background: var(--sb-bg);
    border-right: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 14px;
    transition: width 0.25s ease, background-color 0.3s ease;
}
.sb-off { display: none !important; }

/* rail */
.sb-rail {
    width: var(--sb-rail-w);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-bottom: 12px;
    background: var(--sb-rail);
    border-right: 1px solid var(--border-color);   /* no overflow clip — the account + theme menus open beside it */
}
.sb-rail-logo {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 56px;
}
.sb-logo {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
}
.sb-rail-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.sb-rail-foot {
    margin-top: auto;
    padding-top: 12px;
}
.sb-rail-list li { position: relative; }
.sb-rail-list > li > a,
.sb-rail-list > li > button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: var(--sb-r);
    color: var(--text-muted);
    font-size: 15px;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}
.sb-rail-list > li > a:hover,
.sb-rail-list > li > button:hover,
.sb-user-btn[aria-expanded="true"] {
    background: var(--sb-hover);
    color: var(--text-primary);
}
.sb-rail-list > li > a.active {
    background: var(--sb-active);
    color: var(--text-primary);
}
/* header theme menu while borrowed by the rail — opens to the right, bottom-aligned */
.sb-theme > .theme-quick-menu {
    top: auto;
    right: auto;
    bottom: 0;
    left: calc(100% + 8px);
}
#sbMode .fa-sun,
#sbMode[aria-checked="true"] .fa-moon { display: none; }
#sbMode[aria-checked="true"] .fa-sun { display: inline-block; }

/* panel */
.sb-panel {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.sb-brand {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    height: 56px;
    padding: 0 10px 0 16px;
    border-bottom: 1px solid var(--border-color);
}
.sb-name {
    flex: 1;
    min-width: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sb-icon-btn {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 0;
    border-radius: var(--sb-r);
    color: var(--text-muted);
    font-size: 15px;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}
.sb-icon-btn:hover {
    background: var(--sb-hover);
    color: var(--text-primary);
}

/* search box — "/" jumps here */
.sb-search {
    flex-shrink: 0;
    padding: 12px 12px 4px;
}
.sb-find {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 34px;
    padding: 0 8px 0 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--sb-r);
    cursor: text;
    transition: border-color 0.2s, background-color 0.2s;
}
.sb-find:hover { border-color: var(--input-border); }
.sb-find i {
    width: 16px;
    flex-shrink: 0;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
}
.sidebar .sb-find input {
    flex: 1;
    min-width: 0;
    height: 100%;
    padding: 0;
    background: transparent;
    border: 0;
    outline: 0;
    color: var(--text-primary);
    font-family: inherit;
}
.sb-find input::placeholder {
    color: var(--text-muted);
    opacity: 1;
}
.sb-find input::-webkit-search-cancel-button { -webkit-appearance: none; }
.sb-find kbd {
    flex-shrink: 0;
    font: 500 12px/1 inherit;
    color: var(--text-muted);
}
.sb-find:focus-within kbd { display: none; }
/* 16px stays on touch screens (stops iOS zoom); mouse users get the row size */
@media (hover: hover) and (pointer: fine) {
    .sb-find input { font-size: 14px !important; }
}
@media (hover: none) {
    .sb-find kbd { display: none; }
}

/* scrolling middle */
.sb-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
}
/* hairline scroller: unseen at rest, faint while the pointer is on the sidebar */
.sb-scroll::-webkit-scrollbar { width: 2px; }
.sb-scroll::-webkit-scrollbar-track { background: transparent; }
.sb-scroll::-webkit-scrollbar-thumb { background: transparent; border-radius: 2px; }
.sb-scroll:hover::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--text-secondary) 35%, transparent); }
.sb-sec { padding: 8px 12px; }
.sb-sec + .sb-sec { border-top: 1px solid var(--border-color); }

/* section title — chevron · NAME · summed count while folded */
.sb-head {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    height: 32px;
    padding: 0 10px;
    background: none;
    border: 0;
    border-radius: var(--sb-r);
    font: inherit;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    text-align: left;
    cursor: pointer;
    transition: color 0.2s;
}
.sb-head:hover { color: var(--text-primary); }
.submenu-arrow {
    width: 12px;
    font-size: 10px;
    transform: rotate(-90deg);
    transition: transform 0.2s ease;
}
.submenu-toggle.open .submenu-arrow { transform: none; }
.sb-head .nav-pill-group {
    position: static;
    margin-left: auto;
    transform: none;
}
.sb-head.open .nav-pill-group { display: none; }   /* open: each row shows its own */
.sidebar-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}
.sidebar-submenu.open,
.sidebar.sb-filtering .sidebar-submenu { max-height: 1600px; }   /* room for a long project menu */

/* rows */
.sidebar-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}
.sidebar-menu li { position: relative; }
.sidebar-menu li + li { margin-top: 1px; }
.sidebar-menu a,
.sidebar-menu button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    height: 36px;
    padding: 0 10px;
    background: transparent;
    border: 0;
    border-radius: var(--sb-r);
    color: inherit;
    font: inherit;
    font-weight: 500;
    text-align: left;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}
.sidebar-menu a > i:first-child,
.sidebar-menu button > i:first-child {
    width: 18px;
    flex-shrink: 0;
    text-align: center;
    font-size: 15px;
    color: var(--text-muted);
    transition: color 0.2s;
}
.sidebar-menu a span,
.sidebar-menu button span {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-menu li[data-pill] > a,
.sidebar-menu li[data-pill] > button { padding-right: 44px; }
.sidebar-menu a:hover,
.sidebar-menu button:hover {
    background: var(--sb-hover);
    color: var(--text-primary);
}
.sidebar-menu a:hover > i:first-child,
.sidebar-menu button:hover > i:first-child { color: var(--text-primary); }
.sidebar-menu a.active {
    background: var(--sb-active);
    color: var(--text-primary);
    font-weight: 600;
}
.sidebar-menu a.active > i:first-child { color: var(--text-primary); }

.sidebar a:focus-visible,
.sidebar button:focus-visible,
.sb-find:focus-within {
    outline: 2px solid rgba(var(--navy-accent-rgb), 0.55);
    outline-offset: -2px;
}

/* waiting counts — plain number in the panel, a dot on the rail / folded panel */
.nav-pill {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    font-size: 12px;
    font-style: normal;
    font-weight: 600;
    line-height: 1;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}
.sb-rail .nav-pill {
    top: 5px;
    right: 5px;
    transform: none;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--danger);
    box-shadow: 0 0 0 2px var(--sb-ring);
    font-size: 0;
}

.sb-nohit {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 22px;
    font-size: 13px;
    color: var(--text-muted);
}

/* account — avatar on the rail, menu opens beside it */
.sb-user-btn img.sb-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border-color);
}
.sb-user-menu {
    position: absolute;
    left: calc(100% + 8px);
    bottom: 0;
    z-index: 5;
    width: 220px;
    padding: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--sb-r);
    box-shadow: 0 10px 28px var(--shadow-hover);
    opacity: 0;
    visibility: hidden;
    transform: translateX(-4px);
    transition: opacity 0.15s, transform 0.15s, visibility 0s 0.15s;
}
.sb-user-menu.open {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition-delay: 0s;
}
.sb-user-txt {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px 10px 10px;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--border-color);
    line-height: 1.3;
}
.sb-user-txt strong,
.sb-user-txt small {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sb-user-txt strong {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}
.sb-user-txt small {
    font-size: 12px;
    color: var(--text-muted);
}
.sb-user-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--sb-r);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
}
.sb-user-menu a i {
    width: 16px;
    text-align: center;
    color: var(--text-muted);
}
.sb-user-menu a:hover {
    background: var(--sb-hover);
    color: var(--text-primary);
}
.sb-user-menu a.danger,
.sb-user-menu a.danger i { color: var(--danger); }
.sb-user-menu a.danger:hover { background: color-mix(in srgb, var(--danger) 9%, transparent); }

/* icon tooltip (lives on <body>) */
.sb-tip {
    position: fixed;
    z-index: 1100;
    transform: translateY(-50%);
    padding: 6px 10px;
    border-radius: var(--sb-r);
    background: var(--text-primary);
    color: var(--bg-card);
    font-size: 12.5px;
    font-weight: 500;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.12s;
}
.sb-tip.on { opacity: 1; }

/* impersonation notice sits under the brand row */
.sidebar .impersonate-notice { flex-shrink: 0; margin: 8px 12px 0; }

/* folded panel — desktop only, phones always get the full drawer */
@media (min-width: 769px) {
    .sb-x { display: none; }
    .sidebar.collapsed { width: var(--sb-mini); }
    .sidebar.collapsed .sb-name,
    .sidebar.collapsed .sb-find input,
    .sidebar.collapsed .sb-find kbd,
    .sidebar.collapsed .sb-head,
    .sidebar.collapsed .sidebar-menu span,
    .sidebar.collapsed .impersonate-text { display: none; }
    .sidebar.collapsed .sb-brand {
        justify-content: center;
        padding: 0;
    }
    .sidebar.collapsed .sb-search { padding: 12px 0 4px; }
    .sidebar.collapsed .sb-sec { padding: 8px 0; }
    .sidebar.collapsed .sb-find,
    .sidebar.collapsed .sidebar-menu a,
    .sidebar.collapsed .sidebar-menu button {
        width: 36px;
        margin: 0 auto;
        padding: 0;
        gap: 0;
        justify-content: center;
        cursor: pointer;
    }
    .sidebar.collapsed .sidebar-submenu { max-height: none; }
    .sidebar.collapsed .sb-panel .nav-pill {
        top: 5px;
        right: calc(50% - 16px);
        transform: none;
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: var(--danger);
        box-shadow: 0 0 0 2px var(--sb-ring);
        font-size: 0;
    }
    .sidebar.collapsed .impersonate-notice {
        justify-content: center;
        margin: 8px 6px 0;
        padding: 8px 0;
    }
}

/* drawer overlay (phones) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
}
.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* phones: off-canvas drawer (rail + panel), above the bottom bar */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        z-index: 1002;
        width: min(330px, 90vw);
        transform: translateX(-100%);
        visibility: hidden;
        transition: transform 0.28s ease, visibility 0s 0.28s;
    }
    .sidebar.mobile-open {
        transform: none;
        visibility: visible;
        transition-delay: 0s;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.18);
    }
    .sb-rail { width: 58px; }
    .sb-rail-list > li > a,
    .sb-rail-list > li > button,
    .sidebar-menu a,
    .sidebar-menu button { height: 44px; }
    .sb-rail-list > li > a,
    .sb-rail-list > li > button { width: 44px; }
    .sb-find { height: 44px; }
    .sb-sec { padding: 8px 10px; }
    .sb-brand .sb-icon-btn .fa-table-columns { display: none; }
    .sb-brand .sb-icon-btn { width: 44px; height: 44px; }
    .sb-user-menu { width: min(220px, calc(90vw - 72px)); }
}

/* dark mode — the global span/div colour rule outranks plain classes */
body.dark-mode .sidebar-menu a.active span,
body.dark-mode .sidebar-menu a:hover span,
body.dark-mode .sidebar-menu button:hover span { color: var(--text-primary) !important; }

@media (prefers-reduced-motion: reduce) {
    .sidebar,
    .sidebar *,
    .sb-tip { transition: none !important; }
}


@media print { .sidebar { display: none !important; } }
