/*
  Developed by Rameez Scripts
  WhatsApp: https://whatsapp.rameezscripts.com/ (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;

    /* rgb triplets — fallbacks; config.php overwrites these per user theme */
    --navy-primary-rgb: 0, 31, 63;
    --navy-light-rgb: 0, 51, 102;
    --navy-accent-rgb: 0, 116, 217;
    --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;
    --navy-primary-rgb: 10, 22, 40;
    --navy-light-rgb: 26, 58, 92;
}

/* ===== 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 {
    width: 260px;
    background: linear-gradient(180deg, var(--navy-primary) 0%, var(--navy-dark) 100%);
    color: white;
    overflow-y: auto;
    overflow-x: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    transition: width 0.3s ease;
    position: relative;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    position: relative;
}

.sidebar-title {
    color: white;
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-title-text {
    transition: opacity 0.3s ease, width 0.3s ease;
}

.sidebar-toggle-btn {
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    flex-shrink: 0;
}

.sidebar-toggle-btn:hover {
    background: rgba(255,255,255,0.2);
}

.sidebar-toggle-btn i {
    font-size: 14px;
    transition: transform 0.3s ease;
}

.sidebar-logo-section {
    padding: 15px;
    background: rgba(0,0,0,0.2);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    justify-content: center;
    align-items: center;
}

.sidebar-logo {
    width: 55px;
    height: 55px;
    min-width: 55px;
    min-height: 55px;
    max-width: 55px;
    max-height: 55px;
    border-radius: 50%;
    object-fit: cover;
    object-position: center;
    border: 2px solid rgba(255,255,255,0.25);
    box-shadow: 0 3px 10px rgba(0,0,0,0.4);
    transition: all 0.3s ease;
    display: block;
    overflow: hidden;
}

.sidebar-logo:hover {
    transform: scale(1.1);
    border-color: var(--navy-accent);
    box-shadow: 0 5px 15px rgba(0,116,217,0.6);
}

.sidebar-menu-section {
    flex: 1;
    padding: 20px 16px;
}

.sidebar-menu-title {
    margin-bottom: 12px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.5);
    padding: 0 12px;
}

.sidebar-menu {
    list-style: none;
}

.sidebar-menu li {
    margin-bottom: 4px;
}

.sidebar-menu a,
.sidebar-menu button {
    width: 100%;
    text-align: left;
    padding: 14px 16px;
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.9);
    cursor: pointer;
    border-radius: 3px;
    font-size: 15px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 14px;
    font-weight: 500;
    text-decoration: none;
}

.sidebar-menu a:hover,
.sidebar-menu button:hover {
    background: rgba(255,255,255,0.1);
    color: white;
    transform: translateX(4px);
}

.sidebar-menu a.active,
.sidebar-menu button.active {
    background: var(--navy-accent);
    color: white;
    box-shadow: 0 4px 12px rgba(0,116,217,0.3);
}

.sidebar-menu i {
    width: 20px;
    text-align: center;
    font-size: 18px;
}

.sidebar-logout {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    background: rgba(0,0,0,0.15);
}

.sidebar-logout button {
    width: 100%;
    padding: 14px 16px;
    background: linear-gradient(135deg, rgba(234,67,53,0.2) 0%, rgba(234,67,53,0.3) 100%);
    border: 1px solid rgba(234,67,53,0.4);
    color: white;
    cursor: pointer;
    border-radius: 3px;
    font-size: 15px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: 600;
}

.sidebar-logout button:hover {
    background: linear-gradient(135deg, rgba(234,67,53,0.4) 0%, rgba(234,67,53,0.5) 100%);
    transform: translateY(-2px);
}

.sidebar-logout button i {
    font-size: 16px;
}

.sidebar-logout button span {
    font-size: 15px;
}

/* Sidebar User Info */
.sidebar-user-name {
    font-size: 15px;
    font-weight: 600;
    color: white;
    text-align: center;
    transition: all 0.3s ease;
}

.sidebar-user-role {
    font-size: 12px;
    color: rgba(255,255,255,0.7);
    background: rgba(0,116,217,0.3);
    padding: 4px 12px;
    border-radius: 12px;
    text-transform: capitalize;
    transition: all 0.3s ease;
}

/* Collapsed Sidebar */
.sidebar.collapsed {
    width: 70px;
}

.sidebar.collapsed .sidebar-header {
    padding: 20px 10px;
    justify-content: center;
}

.sidebar.collapsed .sidebar-title {
    justify-content: center;
}

.sidebar.collapsed .sidebar-title-text {
    display: none;
}

.sidebar.collapsed .sidebar-toggle-btn {
    position: absolute;
    right: -16px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--navy-primary);
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.sidebar.collapsed .sidebar-logo-section {
    padding: 10px;
}

.sidebar.collapsed .sidebar-logo {
    width: 45px;
    height: 45px;
    min-width: 45px;
    min-height: 45px;
    max-width: 45px;
    max-height: 45px;
}

.sidebar.collapsed .sidebar-menu-section {
    padding: 15px 8px;
}

.sidebar.collapsed .sidebar-menu-title {
    display: none;
}

.sidebar.collapsed .sidebar-menu a,
.sidebar.collapsed .sidebar-menu button {
    justify-content: center;
    padding: 14px 10px;
    gap: 0;
}

.sidebar.collapsed .sidebar-menu a span,
.sidebar.collapsed .sidebar-menu button span {
    display: none;
}

.sidebar.collapsed .sidebar-menu a i,
.sidebar.collapsed .sidebar-menu button i {
    font-size: 20px;
    width: auto;
}

.sidebar.collapsed .sidebar-menu a:hover,
.sidebar.collapsed .sidebar-menu button:hover {
    transform: scale(1.1);
}

/* Hide submenu arrow in collapsed state */
.sidebar.collapsed .submenu-arrow {
    display: none;
}

/* Submenu in collapsed state */
.sidebar.collapsed .sidebar-submenu {
    position: absolute;
    left: 70px;
    top: 0;
    width: 200px;
    background: var(--navy-dark);
    border-radius: 4px;
    box-shadow: 4px 4px 12px rgba(0,0,0,0.3);
    max-height: none;
    opacity: 0;
    visibility: hidden;
    z-index: 100;
}

.sidebar.collapsed .has-submenu:hover .sidebar-submenu {
    opacity: 1;
    visibility: visible;
}

.sidebar.collapsed .sidebar-submenu a {
    padding: 12px 16px;
    justify-content: flex-start;
    gap: 10px;
}

.sidebar.collapsed .sidebar-submenu a span {
    display: inline;
}

.sidebar.collapsed .sidebar-submenu a i {
    font-size: 14px;
    width: 20px;
}

/* Theme toggle in collapsed state */
.sidebar.collapsed .sidebar-theme {
    padding: 12px 8px;
}

.sidebar.collapsed .sidebar-theme button {
    padding: 14px 10px;
    justify-content: center;
}

.sidebar.collapsed .sidebar-theme button span {
    display: none;
}

.sidebar.collapsed .sidebar-theme button i {
    font-size: 20px;
}

/* Logout button in collapsed state */
.sidebar.collapsed .sidebar-logout {
    padding: 12px 8px;
}

.sidebar.collapsed .sidebar-logout button {
    padding: 14px 10px;
    justify-content: center;
}

.sidebar.collapsed .sidebar-logout button span {
    display: none;
}

.sidebar.collapsed .sidebar-logout button i {
    font-size: 20px;
}

/* Tooltip for collapsed sidebar items */
.sidebar.collapsed .sidebar-menu li {
    position: relative;
}

.sidebar.collapsed .sidebar-menu li::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 70px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--navy-dark);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 13px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    z-index: 100;
    box-shadow: 2px 2px 8px rgba(0,0,0,0.2);
}

.sidebar.collapsed .sidebar-menu li:hover::after {
    opacity: 1;
    visibility: visible;
}

/* 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;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: -280px;
        width: 280px !important;
        z-index: 1000;
        transition: left 0.3s ease;
        height: 100vh;
        overflow-y: auto;
    }

    .sidebar.mobile-open {
        left: 0;
        box-shadow: 4px 0 20px rgba(0,0,0,0.3);
    }

    /* Disable collapsed state on mobile */
    .sidebar.collapsed {
        width: 280px !important;
        left: -280px;
    }

    .sidebar.collapsed.mobile-open {
        left: 0;
    }

    .sidebar.collapsed .sidebar-title-text,
    .sidebar.collapsed .sidebar-menu-title,
    .sidebar.collapsed .sidebar-menu a span,
    .sidebar.collapsed .sidebar-menu button span,
    .sidebar.collapsed .sidebar-theme button span,
    .sidebar.collapsed .sidebar-logout button span {
        display: inline !important;
    }

    .sidebar.collapsed .sidebar-menu a,
    .sidebar.collapsed .sidebar-menu button,
    .sidebar.collapsed .sidebar-theme button,
    .sidebar.collapsed .sidebar-logout button {
        justify-content: flex-start !important;
        padding: 14px 16px !important;
        gap: 14px !important;
    }

    .sidebar.collapsed .sidebar-menu a i,
    .sidebar.collapsed .sidebar-menu button i {
        font-size: 18px !important;
    }

    .sidebar.collapsed .sidebar-logo {
        width: 55px !important;
        height: 55px !important;
        min-width: 55px !important;
        min-height: 55px !important;
        max-width: 55px !important;
        max-height: 55px !important;
    }

    .sidebar.collapsed .submenu-arrow {
        display: inline !important;
    }

    .sidebar.collapsed .sidebar-submenu {
        position: static !important;
        width: 100% !important;
        background: transparent !important;
        box-shadow: none !important;
        opacity: 0;
        visibility: hidden;
    }

    .sidebar.collapsed .sidebar-submenu.open {
        opacity: 1;
        visibility: visible;
    }

    /* Hide sidebar toggle button on mobile */
    .sidebar-toggle-btn {
        display: none !important;
    }

    .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);
    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;
}

/* ===== 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;
}

/* mobile table scroll hint */
.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);
}

/* ===== 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: #d4edda;
    color: #155724;
}

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

.status-current {
    background: #e3f2fd;
    color: #1565c0;
    font-size: 11px;
}

/* ===== 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) {
    .sidebar {
        width: 220px;
    }

    .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 ===== */
.sidebar-menu .has-submenu {
    position: relative;
}

.submenu-toggle {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.submenu-arrow {
    font-size: 12px;
    margin-left: auto;
    transition: transform 0.3s ease;
    color: rgba(255, 255, 255, 0.7);
}

.submenu-toggle.open .submenu-arrow {
    transform: rotate(45deg); /* + becomes x */
    color: white;
}

.sidebar-submenu {
    list-style: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    opacity: 0;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 3px;
    margin-top: 4px;
}

.sidebar-submenu.open {
    max-height: 500px;
    opacity: 1;
    margin-bottom: 8px;
}

.sidebar-submenu li {
    margin-bottom: 0;
}

.sidebar-submenu a {
    width: 100%;
    text-align: left;
    padding: 12px 16px 12px 48px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    border-radius: 3px;
    font-size: 14px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 400;
    text-decoration: none;
    border-left: 3px solid transparent;
}

.sidebar-submenu a:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
    border-left-color: var(--navy-accent);
    padding-left: 52px;
}

.sidebar-submenu a.active {
    background: rgba(0, 116, 217, 0.25);
    color: white;
    border-left-color: var(--navy-accent);
    font-weight: 500;
}

.sidebar-submenu a i {
    width: 16px;
    text-align: center;
    font-size: 14px;
}

.submenu-toggle.active {
    background: var(--navy-accent);
    color: white;
}

@media (max-width: 768px) {
    .sidebar-submenu a {
        padding: 12px 16px 12px 40px;
        font-size: 13px;
    }

    .sidebar-submenu a:hover {
        padding-left: 44px;
    }
}

/* ===== 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 ===== */
.sidebar .sidebar-theme {
    padding: 16px 20px;
    background: rgba(0,0,0,0.15);
}

.sidebar .sidebar-theme button {
    width: 100% !important;
    padding: 14px 16px !important;
    background: linear-gradient(135deg, rgba(251,188,4,0.2) 0%, rgba(251,188,4,0.3) 100%) !important;
    border: 1px solid rgba(251,188,4,0.4) !important;
    color: white !important;
    cursor: pointer !important;
    border-radius: 3px !important;
    font-size: 15px !important;
    transition: all 0.3s !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
    font-weight: 600 !important;
    font-family: inherit;
    text-align: center;
    box-sizing: border-box;
}

.sidebar .sidebar-theme button:hover {
    background: linear-gradient(135deg, rgba(251,188,4,0.4) 0%, rgba(251,188,4,0.5) 100%) !important;
    transform: translateY(-2px);
}

.sidebar .sidebar-theme button i {
    font-size: 16px;
    width: auto;
}

.sidebar .sidebar-theme button span {
    font-size: 15px;
}

/* ===== Google Translate Widget ===== */
/* Hide Google Translate top bar */
.goog-te-banner-frame.skiptranslate {
    display: none !important;
}

body {
    top: 0 !important;
}

.VIpgJd-ZVi9od-ORHb-OEVmcd {
    display: none !important;
}

/* 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 {
    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 {
    color: var(--text-primary);
}

/* 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;
}

/* Preset buttons */
.preset-btn {
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

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

/* Theme mode options */
.theme-mode-option {
    transition: all 0.3s ease;
}

.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;
    }

    /* 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;
    }

    /* 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;
    }

    .about-features {
        grid-template-columns: 1fr;
    }

    .chart-container {
        height: 200px;
    }

    .modal-body {
        padding: 15px;
    }

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

    .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;
    }

    .sidebar-menu a,
    .sidebar-menu button {
        min-height: 50px;
    }

    .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;
    }

    .sidebar-menu a:active,
    .sidebar-menu button:active {
        transform: scale(0.98);
    }
}

/* ===== 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,
    .sidebar {
        -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) {
    .sidebar {
        width: 220px;
    }

    .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 {
    .sidebar,
    .mobile-bottom-nav,
    .sidebar-overlay,
    .btn,
    .action-icon {
        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);
}

/* ===== 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 #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-container {
        padding: 15px;
    }

    .theme-preview-swatches {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    #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;
    }
}

/* ===== Setup Guide Table (OAuth & SMTP) ===== */
.setup-guide-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.setup-guide-table thead tr {
    background: var(--navy-primary);
    color: white;
}

.setup-guide-table th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
}

.setup-guide-table td {
    padding: 14px 16px;
}

.setup-guide-table tbody tr {
    border-bottom: 1px solid var(--input-border, #e9ecef);
}

.setup-guide-table tbody tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.02);
}

.setup-guide-table .step-num {
    font-weight: bold;
    color: var(--navy-accent);
    width: 50px;
}

.setup-guide-table .step-name {
    font-weight: 600;
    min-width: 180px;
}

.setup-guide-table .step-final {
    background: rgba(52, 168, 83, 0.08);
}

.setup-guide-table .step-final .step-num {
    color: var(--success);
}

.setup-guide-table .step-final .step-name {
    color: var(--success);
}

.setup-guide-table .step-section-header td {
    background: var(--navy-primary);
    color: #fff;
    font-weight: 600;
    padding: 10px 16px;
}

.setup-guide-table code {
    background: var(--input-border, #e9ecef);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 13px;
    display: inline-block;
    margin-top: 6px;
    word-break: break-all;
}

body.dark-mode .setup-guide-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.03);
}

body.dark-mode .setup-guide-table .step-final {
    background: rgba(52, 168, 83, 0.1);
}

body.dark-mode .setup-guide-table .step-section-header td {
    background: var(--navy-light);
}

/* ===== Credential Status Indicator ===== */
.credential-status {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
}

.credential-input-wrapper {
    position: relative;
}

/* ===== Success Message ===== */
.success {
    margin-top: 15px;
    margin-bottom: 15px;
    color: var(--success);
    font-size: 14px;
    background: #f0fdf4;
    padding: 12px 16px;
    border-radius: 4px;
    border: 1px solid #bbf7d0;
}

body.dark-mode .success {
    background: rgba(52, 168, 83, 0.1);
    border-color: rgba(52, 168, 83, 0.3);
}

/* ===== Login Page Utilities ===== */
.login-subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 20px;
}

.login-subtitle .highlight {
    color: var(--navy-accent);
    font-weight: 600;
}

.login-link {
    color: var(--navy-accent);
    text-decoration: none;
    font-weight: 500;
}

.login-link:hover {
    text-decoration: underline;
}

.login-footer-link {
    margin-bottom: 8px;
}

/* ===== OTP Input ===== */
.otp-input {
    text-align: center;
    font-size: 24px;
    letter-spacing: 8px;
    font-weight: bold;
}

/* ===== Full Width Button ===== */
.btn-block {
    width: 100%;
}

/* ===== Remember Me & Forgot Password Row ===== */
.login-options-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    font-size: 13px;
}

.remember-me-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: var(--text-muted);
}

.remember-me-label input[type="checkbox"] {
    width: auto;
    margin: 0;
    accent-color: var(--navy-accent);
}

/* ===== OAuth Divider ===== */
.oauth-divider {
    display: flex;
    align-items: center;
    margin: 20px 0;
    gap: 12px;
}

.oauth-divider hr {
    flex: 1;
    border: none;
    border-top: 1px solid var(--border-color);
}

.oauth-divider span {
    color: var(--text-muted);
    font-size: 13px;
    white-space: nowrap;
}

/* ===== Google OAuth Button ===== */
.google-oauth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-card);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.3s ease;
    cursor: pointer;
}

.google-oauth-btn:hover {
    border-color: #4285F4;
    background: rgba(66, 133, 244, 0.05);
}

/* ===== SMTP Setup Utilities ===== */
.smtp-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.smtp-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.smtp-actions .btn {
    flex: 1;
}

.card-divider {
    margin: 16px 0;
    border: none;
    border-top: 1px solid var(--border-color);
}

/* ===== Resend OTP Section ===== */
.resend-section {
    margin-top: 20px;
    text-align: center;
}

.resend-countdown {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 10px;
}

.resend-countdown .timer {
    font-weight: bold;
    color: var(--navy-accent);
}

/* ===== Card Icon Gradient Variants ===== */
.icon-gradient-navy {
    background: linear-gradient(135deg, var(--navy-primary) 0%, var(--navy-light) 100%);
}
.icon-gradient-accent {
    background: linear-gradient(135deg, var(--navy-accent) 0%, #0056a8 100%);
}
.icon-gradient-navy-accent {
    background: linear-gradient(135deg, var(--navy-primary) 0%, var(--navy-accent) 100%);
}
.icon-gradient-light {
    background: linear-gradient(135deg, var(--navy-light) 0%, var(--navy-hover) 100%);
}
.icon-gradient-success {
    background: linear-gradient(135deg, #34a853 0%, #2d9148 100%);
}
.icon-gradient-blue {
    background: linear-gradient(135deg, #0074D9 0%, #0056a8 100%);
}
.icon-gradient-warning {
    background: linear-gradient(135deg, #fbbc04 0%, #e0a800 100%);
}

/* ===== Stat Icon Color Variants ===== */
.stat-icon-success {
    background: rgba(52, 168, 83, 0.1);
    color: var(--success);
}
.stat-icon-accent {
    background: rgba(0, 116, 217, 0.1);
    color: var(--navy-accent);
}
.stat-icon-warning {
    background: rgba(251, 188, 4, 0.1);
    color: var(--warning);
}
.stat-icon-danger {
    background: rgba(234, 67, 53, 0.1);
    color: var(--danger);
}

/* ===== Layout Utilities ===== */
.mb-24 { margin-bottom: 24px; }
.mb-30 { margin-bottom: 30px; }
.mt-24 { margin-top: 24px; }
.mt-20 { margin-top: 20px; }
.mt-25 { margin-top: 25px; }
.mt-30 { margin-top: 30px; }

/* ===== Quick Actions Bar ===== */
.quick-actions-bar {
    margin-bottom: 25px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

/* ===== Card Body Variants ===== */
.card-body-flush {
    padding: 0;
}
.card-body-flush-scroll {
    padding: 0;
    overflow-x: auto;
}

/* ===== Info Banner Variants ===== */
.info-banner-inset {
    margin: 16px;
    border-radius: 8px;
}
.info-banner-top {
    margin-top: 10px;
}

/* ===== Button Group Inline ===== */
.btn-group-inline {
    display: flex;
    gap: 10px;
}

/* ===== Table Responsive Wrapper ===== */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-full-width {
    width: 100%;
}

/* ===== Data Table Flush ===== */
.data-table.data-table-flush {
    margin: 0;
}

/* ===== Skeleton Helpers ===== */
.skeleton-card-mb { margin-bottom: 20px; }
.skeleton-grid-mb { margin-bottom: 30px; }
.skeleton-w-50 { width: 50%; }
.skeleton-w-60 { width: 60%; }
.skeleton-w-70 { width: 70%; }
.skeleton-w-80 { width: 80%; }
.skeleton-mb-sm { margin-bottom: 12px; }
.skeleton-mb-md { margin-bottom: 16px; }
.skeleton-flex-1 { flex: 1; }
.skeleton-flex-2 { flex: 2; }

/* ===== Dashboard Activities ===== */
.activities-loading {
    padding: 30px;
    text-align: center;
    color: var(--text-muted);
}
.activities-loading .fa-spinner {
    font-size: 24px;
}
.activities-loading p {
    margin-top: 10px;
}
.activities-empty {
    padding: 30px;
    text-align: center;
    color: var(--text-muted);
}
.activities-empty .fa-inbox {
    font-size: 32px;
    margin-bottom: 10px;
}

/* ===== Dashboard Activity Table Cells ===== */
.action-badge {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}
.action-badge-default {
    background: rgba(0, 116, 217, 0.1);
    color: var(--navy-accent);
}
.action-badge-success {
    background: rgba(52, 168, 83, 0.1);
    color: var(--success);
}
.action-badge-danger {
    background: rgba(234, 67, 53, 0.1);
    color: var(--danger);
}
.action-badge-warning {
    background: rgba(251, 188, 4, 0.1);
    color: var(--warning);
}
.activity-detail {
    color: var(--text-muted);
    font-size: 13px;
}
.activity-ip code {
    font-size: 12px;
    background: var(--bg-secondary);
    padding: 2px 8px;
    border-radius: 3px;
}

.ip-mask-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.ip-mask-wrap code {
    font-size: 12px;
    background: var(--bg-secondary);
    padding: 2px 8px;
    border-radius: 3px;
}

.ip-toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 13px;
    padding: 2px 4px;
    transition: color 0.2s;
}

.ip-toggle-btn:hover {
    color: var(--navy-primary);
}
.activity-time {
    white-space: nowrap;
    font-size: 13px;
    color: var(--text-muted);
}

/* ===== Status Text Helpers ===== */
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-info { color: #0074D9; }
.text-muted { color: var(--text-muted); }

/* ===== Logo Upload Section (settings.php) ===== */
.logo-upload-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 8px;
}
.logo-preview-img {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e9ecef;
}
body.dark-mode .logo-preview-img {
    border-color: var(--border-color);
}
.logo-upload-controls {
    flex: 1;
}
.logo-upload-controls-inner {
    display: flex;
    gap: 10px;
    align-items: center;
}
.logo-help-text {
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 6px;
}

/* ===== Form Grid Variants ===== */
.form-grid-2col {
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.form-grid-3col {
    grid-template-columns: repeat(3, 1fr);
}

/* ===== Theme Customization (account.php) ===== */
.theme-preview-container {
    margin-bottom: 25px;
    padding: 20px;
    border-radius: 8px;
    border: 2px solid var(--border-color);
}
.theme-preview-title {
    margin-bottom: 15px;
    color: var(--text-primary);
}
.theme-preview-swatches {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
}
.color-preview-box {
    width: 80px;
    height: 50px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: 600;
}
.preview-button-spacer {
    margin-left: 20px;
}
.color-picker-row {
    display: flex;
    gap: 10px;
    align-items: center;
}
.color-picker-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 {
    color: var(--text-muted);
    margin-top: 5px;
    display: block;
}
.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;
}
.theme-mode-option input[type="radio"] {
    width: 18px;
    height: 18px;
}
.icon-sun { color: #fbbc04; }
.icon-moon { color: #5dade2; }
.preset-colors-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 10px;
}

/* ===== Preset Button Base Styles ===== */
.preset-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid var(--border-color);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}
.preset-btn:hover {
    transform: scale(1.15);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* ===== Profile Image Cover ===== */
.profile-img-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ===== UI Help Text ===== */
.ui-help-text {
    margin-bottom: 20px;
    color: var(--text-muted);
}

/* ===== Palette Gallery (UI Customization) ===== */
.palette-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
    gap: 14px;
    margin-top: 10px;
}
.palette-card {
    position: relative;
    text-align: left;
    padding: 0;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.palette-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 18px var(--shadow-hover);
    border-color: var(--navy-accent);
}
.palette-card.active {
    border-color: var(--navy-accent);
    box-shadow: 0 0 0 2px var(--navy-accent) inset;
}
.palette-swatch {
    display: flex;
    height: 54px;
    width: 100%;
}
.palette-swatch span { flex: 1; }
.palette-meta { padding: 10px 12px; }
.palette-name {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}
.palette-id {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}
.palette-check {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--navy-accent);
    color: #fff;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 11px;
}
.palette-card.active .palette-check { display: flex; }
.palette-default-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 20px;
    letter-spacing: 0.3px;
}

/* ===== AdminLTE-style collapsible card (theme-aware) ===== */
.lte-card {
    background: var(--bg-card);
    border-radius: 6px;
    box-shadow: 0 2px 6px var(--shadow-color);
    margin-bottom: 22px;
    border-top: 3px solid var(--navy-accent);
    overflow: hidden;
}
.lte-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
}
.lte-card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.lte-card-title i { color: var(--navy-accent); }
.lte-card-tools { display: flex; align-items: center; gap: 4px; }
.lte-card-tools button {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 9px;
    font-size: 14px;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
}
.lte-card-tools button:hover { color: var(--navy-accent); background: var(--bg-primary); }
.lte-card-body { padding: 18px; }
.lte-card.collapsed .lte-card-body { display: none; }
.lte-card.collapsed { border-top-color: var(--border-color); }

/* current theme summary strip */
.current-theme-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}
.current-swatch {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    min-width: 145px;
}
.current-swatch-chip {
    width: 34px;
    height: 34px;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    flex-shrink: 0;
}
.current-swatch-label {
    display: block;
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.current-swatch-hex {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    font-family: monospace;
}
.current-theme-meta {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.current-theme-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    padding: 7px 15px;
    border-radius: 20px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
}
.current-mode-badge {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 7px 13px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    display: inline-flex;
    gap: 6px;
    align-items: center;
}
.theme-action-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

/* ===== AdminLTE small-box KPI (dashboard) ===== */
.lte-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}
@media (max-width: 1200px) { .lte-kpi-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 576px)  { .lte-kpi-grid { grid-template-columns: 1fr; } }

.small-box {
    position: relative;
    display: block;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    color: #fff;
    overflow: hidden;
    transition: transform 0.25s;
}
.small-box:hover { transform: translateY(-3px); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2); }
.small-box .inner { padding: 18px 20px 12px; position: relative; z-index: 2; }
.small-box .inner h3 { font-size: clamp(24px, 4.5vw, 32px); font-weight: 700; margin: 0 0 6px; white-space: nowrap; }
.small-box .inner p { font-size: 14px; margin: 0; opacity: 0.95; }
.small-box .icon { position: absolute; top: 12px; right: 16px; z-index: 1; font-size: 64px; color: rgba(0, 0, 0, 0.15); transition: font-size 0.3s; }
.small-box:hover .icon { font-size: 70px; }
.small-box-footer {
    position: relative;
    display: block;
    width: 100%;
    padding: 8px 0;
    text-align: center;
    background: rgba(0, 0, 0, 0.12);
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    text-decoration: none;
    z-index: 3;
}
.small-box-footer:hover { background: rgba(0, 0, 0, 0.22); color: #fff; }

/* box colors — navy theme (react to user's custom accent/primary) */
.bg-navy    { background: linear-gradient(135deg, var(--navy-primary) 0%, var(--navy-light) 100%); }
.bg-info    { background: linear-gradient(135deg, var(--navy-accent) 0%, #3393e0 100%); }
.bg-success { background: linear-gradient(135deg, #2e8b46 0%, var(--success) 100%); }
.bg-warning { background: linear-gradient(135deg, #e0a800 0%, var(--warning) 100%); color: #1f2d3d; }
.bg-warning .small-box-footer { color: rgba(0, 0, 0, 0.65); }
.bg-danger  { background: linear-gradient(135deg, #c5221f 0%, var(--danger) 100%); }

/* ===== Header tools: quick theme + language switcher ===== */
.header-tool-wrapper { position: relative; }
.header-tool-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 20px;
    color: #555;
    padding: 8px 10px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    line-height: 1;
    transition: all 0.25s;
}
.header-tool-btn:hover { background: #f0f0f0; color: var(--navy-primary); }
.header-tool-btn .lang-current { font-size: 12px; font-weight: 700; }
body.dark-mode .header-tool-btn { color: var(--text-secondary); }
body.dark-mode .header-tool-btn:hover { background: var(--bg-primary); color: var(--text-primary); }

.header-tool-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 12px 34px var(--shadow-hover);
    z-index: 1200;
    display: none;
    overflow: hidden;
}
.header-tool-dropdown.open { display: block; }
.header-tool-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
}
.header-tool-header strong { color: var(--text-primary); font-size: 14px; display: flex; align-items: center; gap: 7px; }
.mode-toggle-btn {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: 20px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    gap: 6px;
    align-items: center;
    transition: all 0.2s;
}
.mode-toggle-btn:hover { color: var(--navy-accent); border-color: var(--navy-accent); }

.theme-quick-menu { width: 264px; }
.theme-quick-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; padding: 14px; }
.theme-quick-swatch {
    padding: 0;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    height: 34px;
    cursor: pointer;
    overflow: hidden;
    background: none;
    transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.theme-quick-swatch span { display: block; width: 100%; height: 100%; }
.theme-quick-swatch:hover { transform: translateY(-2px); border-color: var(--navy-accent); }
.theme-quick-swatch.active { border-color: var(--navy-accent); box-shadow: 0 0 0 2px var(--navy-accent) inset; }
.header-tool-footer {
    display: block;
    text-align: center;
    padding: 11px;
    font-size: 13px;
    font-weight: 600;
    color: var(--navy-accent);
    text-decoration: none;
    border-top: 1px solid var(--border-color);
}
.header-tool-footer:hover { background: var(--bg-primary); }

.lang-menu { min-width: 214px; max-height: 340px; overflow-y: auto; padding: 6px; }
.lang-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    background: none;
    border: none;
    padding: 9px 11px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13.5px;
    color: var(--text-primary);
    text-align: left;
}
.lang-item:hover { background: var(--bg-primary); }
.lang-item.active { background: rgba(0, 116, 217, 0.12); color: var(--navy-accent); font-weight: 700; }
.lang-item .lang-flag { font-size: 18px; line-height: 1; }
.lang-item .lang-check { margin-left: auto; color: var(--navy-accent); font-size: 12px; }
[dir="rtl"] .header-tool-dropdown { right: auto; left: 0; }
[dir="rtl"] .lang-item { text-align: right; }

/* ===== Header: search + account menu ===== */
.hdr-search-wrap { flex: none; }
.hdr-search {
    display: flex; align-items: center; gap: 9px;
    height: 40px; padding: 0 14px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-primary);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.hdr-search:focus-within { border-color: var(--navy-accent); box-shadow: 0 0 0 3px rgba(var(--navy-accent-rgb), 0.14); }
.hdr-search i { color: var(--text-muted); font-size: 14px; flex-shrink: 0; }
.hdr-search input {
    flex: 1; min-width: 0;
    border: 0; outline: 0; background: none;
    color: var(--text-primary); font-family: inherit; font-size: 14px;
}
.hdr-search input::-webkit-search-cancel-button { -webkit-appearance: none; }

.search-menu { width: 340px; max-width: calc(100vw - 24px); padding: 6px; }
.search-menu .hdr-search { margin-bottom: 6px; }
.search-hit {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 11px;
    border-radius: 9px;
    color: var(--text-primary); text-decoration: none; font-size: 13.5px;
}
.search-hit i { color: var(--navy-accent); width: 17px; text-align: center; flex-shrink: 0; }
.search-hit span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-hit em {
    display: none;
    font-style: normal; font-size: 11px; color: var(--text-muted); white-space: nowrap;
}
.search-hit.on, .search-hit:hover { background: var(--bg-primary); }
.search-hit.on em { display: inline; }

.moon-btn { position: relative; }
.hdr-user {
    display: inline-flex; align-items: center; gap: 9px;
    max-width: 190px; padding: 5px 12px 5px 5px;
    border: 1px solid var(--border-color); border-radius: 999px;
    background: var(--bg-card);
    color: var(--text-primary); font-family: inherit; font-size: 14px; font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s;
}
.hdr-user:hover { border-color: var(--navy-accent); }
.hdr-user-av { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.hdr-user-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hdr-user-caret { font-size: 11px; color: var(--text-muted); transition: transform 0.2s; }
.hdr-user-wrap:has(.header-tool-dropdown.open) .hdr-user-caret { transform: rotate(180deg); }

.user-menu { width: 268px; padding: 6px; }
.user-card {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 12px 14px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 6px;
}
.user-card img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.user-card-txt { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.user-card-txt strong { font-size: 14.5px; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-card-txt small { font-size: 12.5px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-link {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 12px;
    border-radius: 9px;
    color: var(--text-primary); text-decoration: none; font-size: 14px; font-weight: 500;
}
.user-link i { width: 17px; text-align: center; color: var(--navy-accent); font-size: 15px; }
.user-link:hover { background: var(--bg-primary); }
.user-link.danger, .user-link.danger i { color: var(--danger); }

@media (max-width: 640px) { .hdr-user-name, .hdr-user-caret { display: none; } .hdr-user { padding: 4px; border: 0; } }

/* dark mode — span/div blanket at 3692 is (0,5,2) */
body.dark-mode .hdr-search { background: var(--bg-secondary); }
body.dark-mode .hdr-user-name,
body.dark-mode .user-card-txt strong { color: var(--text-primary) !important; }
body.dark-mode .user-card-txt small,
body.dark-mode .search-hit em { color: var(--text-muted) !important; }
body.dark-mode .search-hit span,
body.dark-mode .user-link { color: var(--text-primary) !important; }
body.dark-mode .user-link.danger { color: var(--danger) !important; }
body.dark-mode .search-hit.on, body.dark-mode .search-hit:hover,
body.dark-mode .user-link:hover { background: var(--bg-secondary); }
/* ===== Header messages dropdown ===== */
.msg-btn { position: relative; }
.msg-dot {
    position: absolute; top: 5px; right: 7px;
    width: 9px; height: 9px;
    border-radius: 50%;
    background: var(--danger);
    border: 2px solid var(--bg-card);
}
.msg-menu { width: 340px; max-width: calc(100vw - 24px); }
.msg-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 15px 18px 11px;
}
.msg-head strong { font-size: 15px; font-weight: 700; color: var(--text-primary); }
.msg-head a { font-size: 12.5px; font-weight: 600; color: var(--navy-accent); text-decoration: underline; }
.msg-body { max-height: 392px; overflow-y: auto; padding-bottom: 6px; }
.msg-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 18px;
    text-decoration: none;
    transition: background 0.15s;
}
.msg-item:hover { background: var(--bg-primary); }
.msg-av { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.msg-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.msg-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.msg-top strong { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.msg-time { font-size: 12px; color: var(--text-muted); flex-shrink: 0; white-space: nowrap; }
.msg-bot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.msg-prev {
    font-size: 12.5px; color: var(--text-muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.msg-item.unread .msg-prev { color: var(--text-primary); font-weight: 600; }
.msg-pill {
    flex-shrink: 0;
    min-width: 20px; height: 20px;
    padding: 0 6px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 10px;
    background: var(--danger);
    color: #fff; font-size: 11px; font-weight: 700; font-style: normal;
}
.msg-none {
    display: flex; flex-direction: column; align-items: center; gap: 9px;
    padding: 34px 18px;
    color: var(--text-muted); font-size: 13px;
}
.msg-none i { font-size: 26px; opacity: 0.45; }

/* dark mode — the span blanket at 3692 is (0,5,2), so these need !important */
body.dark-mode .msg-prev,
body.dark-mode .msg-time,
body.dark-mode .msg-none span { color: var(--text-muted) !important; }
body.dark-mode .msg-item.unread .msg-prev { color: var(--text-primary) !important; }
body.dark-mode .msg-item:hover { background: var(--bg-secondary); }
body.dark-mode .msg-dot { border-color: var(--bg-card); }

/* keep the GT widget rendered (so the combo builds) but off-screen — NOT display:none */
.gt-offscreen {
    position: absolute !important;
    left: -9999px !important;
    top: -9999px !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* extra google-translate chrome hiding */
.goog-te-gadget { font-size: 0 !important; }
.goog-te-gadget span, .goog-logo-link { display: none !important; }
.goog-tooltip, .goog-tooltip:hover, #goog-gt-tt, .goog-te-balloon-frame { display: none !important; }
.goog-text-highlight { background: none !important; box-shadow: none !important; }

/* ===== New Classes Mobile Responsive ===== */
@media (max-width: 768px) {
    .setup-guide-table th,
    .setup-guide-table td {
        padding: 10px 12px;
        font-size: 13px;
    }

    .setup-guide-table .step-name {
        min-width: 120px;
    }

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

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

    .login-options-row {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .form-grid-2col { grid-template-columns: 1fr; }
    .form-grid-3col { grid-template-columns: 1fr; }
    .palette-gallery { grid-template-columns: repeat(auto-fill, minmax(135px, 1fr)); gap: 10px; }
    .current-theme-meta { margin-left: 0; width: 100%; }
    .current-swatch { flex: 1; min-width: 120px; }
    .theme-action-row .btn { flex: 1; justify-content: center; }
    .theme-mode-options { flex-direction: column; gap: 10px; }
    .theme-preview-swatches { flex-direction: column; }
    .color-preview-box { width: 100%; }
    .logo-upload-row { flex-direction: column; align-items: flex-start; }
    .quick-actions-bar { justify-content: center; }

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

/* ===== Utility Classes ===== */
.initially-hidden {
    display: none;
}

/* ===== Breadcrumbs ===== */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 0 12px 0;
    font-size: 13px;
    color: var(--text-muted);
}

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

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

.breadcrumb a i {
    font-size: 12px;
}

.breadcrumb-sep {
    color: var(--text-muted);
    opacity: 0.5;
    font-weight: 300;
}

body.dark-mode .breadcrumb a:hover {
    color: #fff;
}

/* ===== Maintenance Page ===== */
.maintenance-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-primary);
    position: relative;
    padding: 20px;
}

.maintenance-admin-link {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--navy-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 16px;
    opacity: 0.3;
    transition: opacity 0.3s, transform 0.2s;
    z-index: 10;
}

.maintenance-admin-link:hover {
    opacity: 1;
    transform: scale(1.1);
}

.maintenance-content {
    text-align: center;
    max-width: 520px;
    width: 100%;
}

.maintenance-icon {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--navy-primary), var(--navy-accent));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 30px;
    box-shadow: 0 8px 32px rgba(0, 116, 217, 0.3);
}

.maintenance-icon i {
    font-size: 48px;
    color: #fff;
}

.maintenance-title {
    font-size: 32px;
    font-weight: 700;
    color: var(--navy-primary);
    margin-bottom: 16px;
}

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

.maintenance-desc {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 24px;
}

.maintenance-info {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #e3f2fd;
    padding: 14px 20px;
    border-radius: 8px;
    border-left: 4px solid var(--navy-accent);
    font-size: 14px;
    color: var(--navy-primary);
    margin-bottom: 30px;
    text-align: left;
}

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

.maintenance-brand {
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.maintenance-logo {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 10px;
    border: 2px solid var(--border-color);
}

.maintenance-brand p {
    font-size: 12px;
    color: var(--text-muted);
}

/* ===== Maintenance Card Warning (Settings) ===== */
.maintenance-card-warning {
    border-color: #ffc107;
}

.maintenance-card-warning:hover {
    border-color: #ff9800;
}

.icon-gradient-danger {
    background: linear-gradient(135deg, #ea4335, #ff6b6b);
}

.info-banner-warning {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    color: #856404;
}

body.dark-mode .info-banner-warning {
    background: rgba(255, 193, 7, 0.1);
    border-left-color: #ffc107;
    color: #ffc107;
}

.text-danger {
    color: #ea4335 !important;
}

/* ===== Notification Bell ===== */
/* view-transition-name (bottom of this file) turns .header-right into its own
   stacking context, so the panels inside it can't out-paint later content on
   z-index alone. Lift the whole context: above page content, still under the
   sidebar (999/1001) and modal overlays (1000). */
.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    z-index: 900;
}

.notification-bell-wrapper {
    position: relative;
}

.notification-bell-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 20px;
    color: #555;
    position: relative;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s;
}

.notification-bell-btn:hover {
    background: #f0f0f0;
    color: var(--navy-primary);
}

.notification-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: #ea4335;
    color: white;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
}

.notification-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 360px;
    max-height: 420px;
    background: white;
    border-radius: 4px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.15);
    border: 1px solid #e0e0e0;
    z-index: 1000;
    display: none;
    overflow: hidden;
}

.notification-dropdown.open {
    display: block;
}

.notification-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid #eee;
    background: #f8f9fa;
}

.notification-dropdown-header strong {
    font-size: 15px;
    color: var(--navy-primary);
}

.notification-dropdown-header button {
    background: transparent;
    border: none;
    color: var(--navy-accent);
    font-size: 12px;
    cursor: pointer;
    font-weight: 600;
}

.notification-dropdown-header button:hover {
    text-decoration: underline;
}

.notification-dropdown-body {
    max-height: 340px;
    overflow-y: auto;
}

.notification-empty {
    text-align: center;
    padding: 40px 20px;
    color: #999;
    font-size: 14px;
}

.notification-empty i {
    font-size: 32px;
    margin-bottom: 8px;
    display: block;
}

.notification-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #f5f5f5;
    cursor: pointer;
    transition: background 0.2s;
}

.notification-item:hover {
    background: #f8f9fa;
}

.notification-item.unread {
    background: #e8f4fd;
    border-left: 3px solid var(--navy-accent);
}

.notification-item.unread:hover {
    background: #d6ecfb;
}

.notification-item-icon {
    font-size: 18px;
    margin-top: 2px;
    flex-shrink: 0;
}

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

.notification-item-title {
    font-weight: 600;
    font-size: 13px;
    color: #333;
    margin-bottom: 2px;
}

.notification-item-message {
    font-size: 12px;
    color: #666;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.notification-item-time {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
}

.notification-item-mark {
    background: transparent;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 4px;
    font-size: 12px;
    flex-shrink: 0;
    margin-top: 2px;
}

.notification-item-mark:hover {
    color: #34a853;
}

/* Dark Mode — Notification Bell */
body.dark-mode .notification-bell-btn {
    color: var(--text-secondary);
}

body.dark-mode .notification-bell-btn:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

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

body.dark-mode .notification-dropdown-header {
    background: var(--bg-primary);
    border-bottom-color: var(--border-color);
}

body.dark-mode .notification-dropdown-header strong {
    color: var(--text-primary);
}

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

body.dark-mode .notification-item:hover {
    background: var(--bg-primary);
}

body.dark-mode .notification-item.unread {
    background: rgba(0, 116, 217, 0.1);
    border-left-color: var(--navy-accent);
}

body.dark-mode .notification-item.unread:hover {
    background: rgba(0, 116, 217, 0.15);
}

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

body.dark-mode .notification-item-message {
    color: var(--text-secondary);
}

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

/* ===== About 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;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.about-features li {
    padding: 14px 16px;
    background: #f8f9fa;
    border-radius: 8px;
    color: #333;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    align-items: flex-start;
    gap: 12px;
}

.about-features li i {
    color: var(--navy-primary);
    margin-right: 10px;
    font-size: 16px;
    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;
}

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

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

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

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

.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.email {
    background: var(--navy-primary);
    color: white;
}

.dev-link.email:hover {
    background: var(--navy-dark);
    transform: translateY(-2px);
}

.lets-work {
    font-weight: 700;
    font-size: 14px;
    color: var(--navy-primary);
    margin: 14px 0 8px;
    display: flex;
    align-items: center;
    gap: 7px;
}

/* 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: 7px;
}

.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: 5px;
    transition: color 0.15s;
}

.auth-contact-links a:hover { color: var(--navy-accent); }

/* the span blanket at 3692 is (0,5,2) — a plain class rule loses to it */
body.dark-mode .lets-work,
body.dark-mode .auth-contact-title { color: var(--text-primary) !important; }

.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;
}

/* Dark Mode — About Section */
body.dark-mode .about-card {
    background: var(--bg-secondary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

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

body.dark-mode .about-card p {
    color: var(--text-secondary);
}

body.dark-mode .about-features li {
    color: var(--text-secondary);
    background: var(--bg-secondary);
}

body.dark-mode .about-roles-table th {
    background: var(--navy-primary);
}

body.dark-mode .about-roles-table td {
    border-color: var(--border-color);
    color: var(--text-secondary);
}

body.dark-mode .about-roles-table td:first-child {
    background: var(--bg-primary);
}

body.dark-mode .developer-details h3 {
    color: var(--text-primary);
}

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

body.dark-mode .about-footer {
    color: var(--text-secondary);
}

body.dark-mode .about-version {
    color: var(--text-muted);
}

/* Mobile — Notification Dropdown */
@media (max-width: 768px) {
    .notification-dropdown {
        width: 300px;
        right: -40px;
    }

    .header-right {
        gap: 10px;
        font-size: 13px;
    }

    .about-header {
        flex-direction: column;
        text-align: center;
    }

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

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

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

/* RBAC matrix — sticky grid (roles.php) */
.rbac-wrap {
    overflow: auto;
    border: 1px solid var(--border-color);
    max-height: 72vh;
    margin: 15px 0;
}

.rbac-table {
    border-collapse: separate;
    border-spacing: 0;
    font-size: 12px;
    width: 100%;
    table-layout: fixed; /* role cols split equally, fills 100% */
}

.rbac-table th,
.rbac-table td {
    border-bottom: 1px solid var(--border-color);
    border-right: 1px solid var(--border-light);
    padding: 6px 8px;
    text-align: center;
    white-space: nowrap;
    background: var(--bg-card);
}

.rbac-table thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: #f5f8fc;
}

.rbac-rolehead {
    color: #fff;
    padding: 5px 9px;
    font-weight: 700;
    font-size: 11px;
    display: inline-block;
    min-width: 74px;
    border-radius: 3px;
}

.rbac-perm-legend {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 3px;
    letter-spacing: 1px;
}

.rbac-table th.rbac-pagecol,
.rbac-table td.rbac-pagecol {
    position: sticky;
    left: 0;
    z-index: 2;
    text-align: left;
    font-weight: 600;
    color: var(--navy-primary);
    background: var(--bg-card);
    width: 200px; /* fixed; rest splits equally among roles */
    box-shadow: 1px 0 0 var(--border-color);
}

.rbac-table thead th.rbac-pagecol {
    z-index: 4;
    background: #f5f8fc;
}

.rbac-grouprow td {
    background: #eef2f7 !important;
    color: #5a6b7b;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 10px;
    text-align: left;
}

.rbac-cell {
    display: flex;
    gap: 4px;
    justify-content: center;
    flex-wrap: wrap; /* wrap V·A·E·D when many roles shrink cols */
}

/* impersonation — "login as this user" */
.action-icon.loginas-icon { color: #0074D9; }
.action-icon.loginas-icon:hover { color: #005fa3; }
.impersonate-notice {
    margin: 10px;
    padding: 10px 12px;
    background: #fff3cd;
    border: 1px solid #ffe69c;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: #664d03;
}
.impersonate-notice > i { font-size: 18px; color: #997404; flex-shrink: 0; }
.impersonate-text { display: flex; flex-direction: column; gap: 2px; line-height: 1.3; }
.impersonate-text span { font-weight: 600; }
.impersonate-text a { color: #0074D9; font-weight: 700; text-decoration: none; }
.impersonate-text a:hover { text-decoration: underline; }
body.dark-mode .impersonate-notice { background: #3a2f00; border-color: #5c4a00; color: #ffe69c; }
body.dark-mode .impersonate-text a { color: #4aa3ff; }

.rbac-dot {
    width: 24px;
    height: 24px;
    border: 1px solid #d4d4d4;
    background: #fff;
    color: #bbb;
    font-size: 10px;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.12s;
    border-radius: 0;
}

.rbac-dot:hover {
    border-color: var(--navy-accent);
}

.rbac-dot.on {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}

.rbac-dot.locked {
    opacity: 0.45;
    cursor: not-allowed;
}

.rbac-dot.on.locked {
    background: #9bbf9e;
    border-color: #9bbf9e;
}

/* perm letters in About roles table */
.perm-on {
    display: inline-block;
    min-width: 16px;
    font-weight: 800;
    font-size: 12px;
    color: var(--success);
    letter-spacing: 1px;
}

.perm-off {
    display: inline-block;
    min-width: 16px;
    font-weight: 600;
    font-size: 12px;
    color: #c4c4c4;
    letter-spacing: 1px;
}

/* User role badge (Admin badge already defined above) */
.role-user {
    background: #cce5ff;
    color: #004085;
}

/* Per-user access (roles.php User Access tab) */
.rbac-tabs {
    display: flex;
    gap: 6px;
    margin: 0 0 16px;
    border-bottom: 2px solid var(--border-color);
}

.rbac-tab {
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    transition: all 0.15s;
}

.rbac-tab:hover { color: var(--navy-accent); }

.rbac-tab.active {
    color: var(--navy-primary);
    border-bottom-color: var(--navy-accent);
}

.rbac-userpick { max-width: 420px; margin-bottom: 16px; }

.rbac-userbar {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    padding: 12px 14px;
    margin-bottom: 12px;
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--navy-accent);
}

.rbac-userbar-main {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--navy-primary);
}

.rbac-userbar-main > i { font-size: 18px; color: var(--navy-accent); }

.rbac-userbar-sub {
    display: block;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
}

.rbac-ovr-chip {
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 700;
    background: #fdecd6;
    color: #c4701a;
    border: 1px solid #f8dab4;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.rbac-ovr-chip.off {
    background: #e2f6ea;
    color: #1f8b4c;
    border-color: #c7eed6;
}

.rbac-selfnote {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* the exception marker — this cell no longer follows the role */
.rbac-dot.ovr {
    box-shadow: 0 0 0 2px #e8a200;
    border-color: #e8a200;
}

.rbac-ovr-key {
    display: inline-block;
    width: 11px;
    height: 11px;
    vertical-align: -1px;
    background: var(--success);
    box-shadow: 0 0 0 2px #e8a200;
}

.rbac-utable { table-layout: auto; }
.rbac-utable td, .rbac-utable th { text-align: center; }

.rbac-hardnote {
    font-size: 11px;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.rbac-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
}

.rbac-empty > i { font-size: 34px; opacity: 0.4; display: block; margin-bottom: 10px; }
.rbac-empty p { font-size: 13px; margin: 0; }

/* users.php per-user access shortcut */
.act-perm { color: #6a1b9a; font-size: 15px; }
.act-perm:hover { transform: scale(1.18); }

/* Dark Mode — RBAC matrix */
body.dark-mode .rbac-wrap {
    border-color: var(--border-color);
}

body.dark-mode .rbac-table th,
body.dark-mode .rbac-table td {
    border-bottom-color: var(--border-color);
    border-right-color: var(--border-light);
    background: var(--bg-card);
    color: var(--text-secondary);
}

body.dark-mode .rbac-table thead th,
body.dark-mode .rbac-table thead th.rbac-pagecol {
    background: var(--navy-dark);
}

body.dark-mode .rbac-table td.rbac-pagecol {
    color: var(--text-primary);
    background: var(--bg-card);
    box-shadow: 1px 0 0 var(--border-color);
}

body.dark-mode .rbac-grouprow td {
    background: var(--bg-primary) !important;
    color: var(--text-muted);
}

body.dark-mode .rbac-dot {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-muted);
}

body.dark-mode .rbac-dot.on {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}

body.dark-mode .perm-off {
    color: #5a5a78;
}

/* ===== Slight curved feel — global rounding polish (subtle, dashboard-wide) ===== */
/* larger surfaces / cards */
.data-section,
.lte-card,
.account-info-card,
.settings-mega-card,
.theme-preview-container,
.notification-dropdown,
.header-tool-dropdown,
.about-table-wrapper,
.setup-guide-table,
.small-box,
.stat-card,
.info-box,
.modal-content,
.modal-box { border-radius: 14px !important; }

/* controls / chips / smaller elements */
.palette-card,
.notification-item,
.btn,
.mode-toggle-btn,
.lang-item,
.theme-quick-swatch,
.action-badge,
.hex-input,
.color-picker-input,
.data-section input:not([type="file"]),
.data-section select,
.data-section textarea,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="tel"],
input[type="url"],
input[type="date"],
select,
textarea { border-radius: 10px !important; }
/* file input stays squared per DaisyUI standard — do not round */

/* ===== Smooth SPA-like navigation (View Transitions) ===== */
/* opt every page into cross-document transitions — clicking the sidebar crossfades
   the content while the sidebar / bottom-nav / header tools stay put (no white flash).
   Unsupported browsers just navigate normally (graceful fallback). */
@view-transition { navigation: auto; }

.sidebar           { view-transition-name: app-sidebar; }
.mobile-bottom-nav { view-transition-name: app-mobilenav; }
.header-right      { view-transition-name: app-headertools; }

/* persistent chrome — snap instantly, don't crossfade */
::view-transition-group(app-sidebar),
::view-transition-group(app-mobilenav),
::view-transition-group(app-headertools) { animation-duration: 0s; }

/* content area — gentle crossfade + rise */
::view-transition-old(root) { animation: rsPageOut 0.16s ease both; }
::view-transition-new(root) { animation: rsPageIn 0.30s ease both; }
@keyframes rsPageOut { to { opacity: 0; } }
@keyframes rsPageIn { from { opacity: 0; transform: translateY(8px); } }

@media (prefers-reduced-motion: reduce) {
    ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}

/* ===== DaisyUI-style file input — squared button, follows the user's palette ===== */
.file-input {
    display: block;
    width: 100%;
    height: 48px;
    line-height: 46px;
    padding: 0;
    font-size: 16px;
    color: var(--text-secondary);
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 10px;
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.25s, box-shadow 0.25s;
}
.file-input:hover  { border-color: var(--navy-accent); }
.file-input:focus  { outline: none; border-color: var(--navy-accent); box-shadow: 0 0 0 3px rgba(var(--navy-accent-rgb), 0.18); }
.file-input:disabled { opacity: 0.55; cursor: not-allowed; }
.file-input::file-selector-button {
    height: 46px;
    margin: 0 14px 0 0;
    padding: 0 20px;
    border: 0;
    border-right: 1px solid var(--input-border);
    border-radius: 0;
    background: rgba(var(--navy-accent-rgb), 0.14);
    color: var(--navy-accent);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.25s, color 0.25s;
}
.file-input::file-selector-button:hover { background: var(--navy-accent); color: #fff; }

/* ===== My Account — themed cards (every colour here rides the theme vars) ===== */
.acct-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: 0 2px 10px var(--shadow-color);
    padding: 22px 24px 24px;
    margin-bottom: 20px;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}
.acct-head { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.acct-head-txt h2 { font-size: 17px; font-weight: 700; color: var(--text-primary); margin: 0; }
.acct-head-txt p  { font-size: 13px; color: var(--text-muted); margin: 3px 0 0; }
.acct-chip {
    flex: 0 0 38px; width: 38px; height: 38px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 11px;
    background: rgba(var(--navy-accent-rgb), 0.13);
    font-size: 16px;
}
.acct-chip i { color: var(--navy-accent); }

/* profile photo + upload */
.acct-photo { display: flex; align-items: flex-start; gap: 26px; flex-wrap: wrap; }
.acct-avatar-col { flex: 0 0 auto; text-align: center; }
.acct-avatar {
    position: relative;
    width: 116px; height: 116px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: rgba(var(--navy-accent-rgb), 0.12);
    border: 1px solid rgba(var(--navy-accent-rgb), 0.28);
}
.acct-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.acct-avatar #defaultProfileIcon { font-size: 52px; color: rgba(var(--navy-accent-rgb), 0.75); }
.acct-avatar-cam {
    position: absolute; right: 2px; bottom: 4px;
    width: 30px; height: 30px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: var(--navy-primary);
    border: 2px solid var(--bg-card);
}
.acct-avatar-cam i { color: #fff; font-size: 12px; }
.acct-avatar-label { margin-top: 12px; font-size: 12.5px; color: var(--text-muted); }

.acct-upload { flex: 1 1 320px; min-width: 260px; }
.acct-drop {
    padding: 16px 18px 18px;
    border: 1.5px dashed rgba(var(--navy-accent-rgb), 0.45);
    background: rgba(var(--navy-accent-rgb), 0.05);
    border-radius: 12px;
}
.acct-drop-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.acct-drop-head > i { font-size: 26px; color: var(--navy-accent); }
.acct-drop-head strong { display: block; font-size: 14.5px; color: var(--text-primary); }
.acct-drop-head small  { display: block; margin-top: 2px; font-size: 12.5px; color: var(--text-muted); }
.acct-hint { display: block; margin-top: 12px; font-size: 12.5px; color: var(--text-muted); }
.acct-hint i { color: var(--navy-accent); margin-right: 5px; }

/* account info tiles */
.acct-info-grid { display: grid; grid-template-columns: repeat(4, 1fr); }
.acct-info {
    display: flex; align-items: center; gap: 13px;
    padding: 4px 20px;
    border-left: 1px solid var(--border-light);
}
.acct-info:first-child { border-left: 0; padding-left: 0; }
.acct-info-icon {
    flex: 0 0 44px; width: 44px; height: 44px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 12px;
    background: rgba(var(--navy-accent-rgb), 0.13);
    font-size: 17px;
}
.acct-info-icon i { color: var(--navy-accent); }
.acct-info-txt { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.acct-info-label { font-size: 12.5px; color: var(--text-muted); }
.acct-info-value { font-size: 15px; font-weight: 700; color: var(--text-primary); word-break: break-word; }

/* forms inside account cards */
.acct-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px 22px; }
.acct-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px 22px; }
.acct-card .form-group { margin-bottom: 0; }
.acct-card .form-group label {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 8px;
    font-size: 13.5px; font-weight: 600; color: var(--text-secondary);
}
.acct-card .form-group label i { color: var(--navy-accent); }
.acct-req::after { content: ' *'; color: var(--danger); font-weight: 700; }
.acct-card input[type="text"],
.acct-card input[type="email"],
.acct-card input[type="password"] {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--input-border);
    background: var(--input-bg);
    color: var(--text-primary);
    font-size: 16px;
    transition: border-color 0.25s, box-shadow 0.25s;
}
.acct-card input:focus {
    outline: none;
    border-color: var(--navy-accent);
    box-shadow: 0 0 0 3px rgba(var(--navy-accent-rgb), 0.18);
}
.acct-pw { position: relative; }
.acct-pw input { padding-right: 46px !important; }
.acct-eye {
    position: absolute; right: 6px; top: 50%;
    transform: translateY(-50%);
    padding: 8px;
    background: none; border: 0; border-radius: 8px;
    color: var(--text-muted); font-size: 15px; line-height: 1;
    cursor: pointer; transition: all 0.2s;
}
.acct-eye:hover { color: var(--navy-accent); background: rgba(var(--navy-accent-rgb), 0.1); }

.acct-card .form-actions { display: flex; gap: 12px; margin-top: 22px; }
.acct-pw-actions { display: flex; align-items: center; gap: 16px; margin-top: 22px; flex-wrap: wrap; }
.acct-note {
    flex: 1; min-width: 240px;
    display: flex; align-items: center; gap: 9px;
    padding: 11px 15px;
    border-radius: 10px;
    background: rgba(var(--navy-accent-rgb), 0.08);
    border: 1px solid rgba(var(--navy-accent-rgb), 0.18);
    font-size: 13px; color: var(--text-secondary);
}
.acct-note i { color: var(--navy-accent); }
.acct-card .btn-primary {
    padding: 12px 22px;
    background: linear-gradient(135deg, var(--navy-accent) 0%, rgba(var(--navy-accent-rgb), 0.82) 100%);
    color: #fff;
}
.acct-card .btn-primary:hover { background: var(--navy-accent); filter: brightness(1.08); transform: translateY(-2px); }

/* dark mode — beat the blanket div/span colour rule */
body.dark-mode .acct-info-label,
body.dark-mode .acct-avatar-label,
body.dark-mode .acct-head-txt p { color: var(--text-muted) !important; }
body.dark-mode .acct-drop { background: rgba(var(--navy-accent-rgb), 0.09); }

@media (max-width: 1100px) {
    .acct-info-grid { grid-template-columns: repeat(2, 1fr); row-gap: 18px; }
    .acct-info:nth-child(odd) { border-left: 0; padding-left: 0; }
    .acct-grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    .acct-card { padding: 18px 16px 20px; }
    .acct-photo { flex-direction: column; align-items: center; }
    .acct-upload { width: 100%; min-width: 0; }
    .acct-info-grid { grid-template-columns: 1fr; }
    .acct-info { border-left: 0; padding: 0; }
    .acct-grid-2, .acct-grid-3 { grid-template-columns: 1fr; }
    .acct-pw-actions { flex-direction: column; align-items: stretch; }
    .acct-note { min-width: 0; }
}

/* ===== Auth — SaaS split: form left, showcase right ===== */
.auth-body {
    position: relative;
    min-height: 100dvh;
    display: flex;
    background-color: var(--bg-primary);
    /* soft theme-tinted glows — light wash, recolours with the site palette */
    background-image:
        radial-gradient(760px 470px at 10% 6%,   rgba(var(--navy-accent-rgb), 0.20), transparent 62%),
        radial-gradient(700px 430px at 90% 4%,   rgba(var(--navy-light-rgb), 0.16), transparent 60%),
        radial-gradient(860px 540px at 82% 98%,  rgba(var(--navy-accent-rgb), 0.16), transparent 64%),
        radial-gradient(660px 420px at 6% 96%,   rgba(var(--navy-primary-rgb), 0.12), transparent 62%);
    background-attachment: fixed;
    background-repeat: no-repeat;
}
/* faint dot texture over the wash */
.auth-body::before {
    content: '';
    position: fixed; inset: 0;
    background-image: radial-gradient(rgba(var(--navy-primary-rgb), 0.09) 1px, transparent 1px);
    background-size: 26px 26px;
    -webkit-mask-image: radial-gradient(1000px 700px at 30% 40%, #000 20%, transparent 78%);
            mask-image: radial-gradient(1000px 700px at 30% 40%, #000 20%, transparent 78%);
    pointer-events: none;
    z-index: 0;
}
/* full-bleed: the card IS the viewport. transparent so the body wash shows through */
.auth-wrap {
    position: relative;
    z-index: 1;
    flex: 1;
    display: flex; flex-direction: column;
    min-height: 100dvh;
}
.auth-card {
    flex: 1;
    width: 100%; min-height: 100dvh;
    display: grid; grid-template-columns: 1fr 1fr;
    background: transparent;
}

/* ---------- left: form column ---------- */
.auth-form-col {
    position: relative;
    display: flex; flex-direction: column;
    min-width: 0; max-height: 100dvh;
    padding: 24px 30px 20px;
    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: 15.5px; font-weight: 800;
    text-decoration: none; letter-spacing: -0.2px;
}
.auth-brandmark img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }
.auth-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px;
    border: 1px solid var(--border-color); border-radius: 50%;
    background: var(--bg-card); color: var(--text-secondary);
    font-size: 15px; cursor: pointer;
    box-shadow: 0 2px 8px var(--shadow-color);
    transition: color 0.2s, border-color 0.2s;
}
.auth-toggle:hover { color: var(--navy-accent); border-color: var(--navy-accent); }

.auth-form-inner { width: 100%; max-width: 392px; margin: auto; }
.auth-form-inner .error,
.auth-form-inner .success { margin: 0 0 16px; text-align: left; }

/* badge on a graph-paper wash, like the reference */
.auth-badge-wrap { position: relative; display: flex; justify-content: center; margin-bottom: 16px; }
.auth-badge-wrap::before {
    content: '';
    position: absolute; left: 50%; top: 50%;
    width: 300px; height: 150px;
    transform: translate(-50%, -50%);
    background-image:
        linear-gradient(rgba(var(--navy-primary-rgb), 0.07) 1px, transparent 1px),
        linear-gradient(90deg, rgba(var(--navy-primary-rgb), 0.07) 1px, transparent 1px);
    background-size: 22px 22px;
    -webkit-mask-image: radial-gradient(closest-side, #000 8%, transparent 76%);
            mask-image: radial-gradient(closest-side, #000 8%, transparent 76%);
    pointer-events: none;
}
.auth-badge {
    position: relative;
    display: flex; align-items: center; justify-content: center;
    width: 48px; height: 48px;
    border-radius: 15px;
    background: linear-gradient(140deg, var(--navy-accent) 0%, rgba(var(--navy-accent-rgb), 0.72) 100%);
    color: #fff; font-size: 19px;
    box-shadow: 0 10px 24px rgba(var(--navy-accent-rgb), 0.34);
}
.auth-form-inner h1 { font-size: 25px; font-weight: 800; color: var(--navy-primary); text-align: center; margin: 0 0 7px; }
.auth-sub { font-size: 14px; color: var(--text-muted); text-align: center; margin: 0 0 26px; }

.auth-group { margin-bottom: 16px; }
.auth-group label { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 13.5px; font-weight: 700; color: var(--text-primary); }
.auth-group label i { color: var(--navy-accent); }
.auth-field { position: relative; }
.auth-field-icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 15px; pointer-events: none; }
.auth-field input {
    width: 100%; height: 52px;
    padding: 0 16px;
    border: 1px solid var(--input-border);
    border-radius: 11px;
    background: var(--input-bg);
    color: var(--text-primary);
    font-size: 16px;
    transition: border-color 0.25s, box-shadow 0.25s, background 0.25s;
}
.auth-field-icon ~ input { padding-left: 46px; }
.auth-field input:focus {
    outline: none;
    border-color: var(--navy-accent);
    background: rgba(var(--navy-accent-rgb), 0.04);
    box-shadow: 0 0 0 4px rgba(var(--navy-accent-rgb), 0.14);
}
.auth-eye {
    position: absolute; right: 8px; top: 50%;
    transform: translateY(-50%);
    padding: 9px;
    background: none; border: 0; border-radius: 9px;
    color: var(--text-muted); font-size: 16px; line-height: 1;
    cursor: pointer; transition: all 0.2s;
}
.auth-eye:hover { color: var(--navy-accent); background: rgba(var(--navy-accent-rgb), 0.1); }

.auth-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 4px 0 20px; flex-wrap: wrap; }
.auth-check { display: inline-flex; align-items: center; gap: 9px; 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(--navy-accent); font-size: 13.5px; font-weight: 600; text-decoration: none; }
.auth-link:hover { text-decoration: underline; }

.auth-submit {
    width: 100%; height: 52px;
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    border: 0; border-radius: 11px;
    background: linear-gradient(120deg, var(--navy-accent) 0%, rgba(var(--navy-accent-rgb), 0.78) 100%);
    color: #fff; font-size: 16px; font-weight: 700;
    cursor: pointer;
    box-shadow: 0 10px 22px rgba(var(--navy-accent-rgb), 0.32);
    transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;
    touch-action: manipulation;
}
.auth-submit:hover  { transform: translateY(-2px); filter: brightness(1.06); box-shadow: 0 14px 28px rgba(var(--navy-accent-rgb), 0.40); }
.auth-submit:active { transform: translateY(0); }
.auth-submit:disabled { opacity: 0.65; cursor: not-allowed; pointer-events: none; transform: none; }

/* divider — flex rules, no opaque chip needed over the wash */
.auth-or { display: flex; align-items: center; gap: 12px; margin: 22px 0 16px; }
.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: 600; }

.auth-google {
    width: 100%; height: 52px;
    display: inline-flex; align-items: center; justify-content: center; gap: 12px;
    border: 1px solid var(--input-border);
    border-radius: 11px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 15px; font-weight: 600;
    font-family: inherit;                   /* verify_otp uses this on a <button> — buttons don't inherit */
    text-decoration: none; cursor: pointer;
    transition: all 0.25s;
}
.auth-google:hover { border-color: var(--navy-accent); background: rgba(var(--navy-accent-rgb), 0.05); }
.auth-signup { margin: 20px 0 0; text-align: center; font-size: 14px; color: var(--text-secondary); }
.auth-maint { margin-top: 16px; text-align: left; }

/* footer sits at the bottom of the column — flow, not absolute */
.auth-foot { width: 100%; padding-top: 18px; }
.auth-copy {
    position: static;
    display: flex; align-items: center; justify-content: center; gap: 9px;
    padding: 10px 0 0; text-align: center;
    font-size: 12.5px; color: var(--text-muted);
}
.auth-copy i { color: var(--navy-accent); }

/* ---------- right: showcase panel ---------- */
.auth-showcase { display: flex; padding: 14px; min-width: 0; }
.auth-showcase-card {
    position: relative;
    flex: 1; min-width: 0;
    display: flex; flex-direction: column; align-items: center;
    padding: 46px 38px 32px;
    border: 1px solid rgba(var(--navy-accent-rgb), 0.16);
    border-radius: 26px;
    overflow: hidden;
    background: linear-gradient(165deg,
        rgba(var(--navy-accent-rgb), 0.20) 0%,
        rgba(var(--navy-light-rgb), 0.10) 44%,
        var(--bg-card) 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.auth-show-title {
    margin: 0; text-align: center;
    font-size: clamp(22px, 2.1vw, 30px); font-weight: 800; letter-spacing: -0.4px;
    color: var(--navy-primary);
}
.auth-show-title span { color: var(--navy-accent); }

/* orbit — one size var drives rings + radii so nothing is hand-tuned per breakpoint */
.auth-orbit {
    position: relative;
    --d: clamp(230px, 22vw, 380px);
    width: var(--d); height: var(--d);
    margin: auto;
}
.auth-orbit::before {
    content: '';
    position: absolute; top: 50%; left: 50%;
    width: 62%; height: 62%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: radial-gradient(closest-side, rgba(var(--navy-accent-rgb), 0.30), transparent 72%);
    animation: authGlow 3.8s ease-in-out infinite;
    pointer-events: none;
}
.auth-ring {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    border: 1px solid rgba(var(--navy-accent-rgb), 0.20);
    border-radius: 50%;
}
.auth-ring.r1 { width: calc(var(--d) * 0.46); height: calc(var(--d) * 0.46); }
.auth-ring.r2 { width: calc(var(--d) * 0.72); height: calc(var(--d) * 0.72); }
.auth-ring.r3 { width: var(--d); height: var(--d); border-style: dashed; border-color: rgba(var(--navy-accent-rgb), 0.16); }

.auth-orbit-core {
    position: absolute; top: 50%; left: 50%;
    width: calc(var(--d) * 0.30); height: calc(var(--d) * 0.30);
    transform: translate(-50%, -50%);
    padding: 5px;
    border-radius: 50%;
    background: linear-gradient(140deg, var(--navy-accent) 0%, rgba(var(--navy-accent-rgb), 0.62) 100%);
    box-shadow: 0 18px 40px rgba(var(--navy-accent-rgb), 0.36), 0 0 0 7px rgba(255, 255, 255, 0.55);
    z-index: 2;
}
.auth-orbit-core img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }

/* slot places the chip on the ring; the trailing rotate keeps it upright */
.auth-orbit-slot {
    position: absolute; top: 50%; left: 50%;
    --sz: 46px;
    width: var(--sz); height: var(--sz);
    margin: calc(var(--sz) / -2);
    /* fallbacks matter: one undefined var invalidates the whole declaration and drops the chip dead centre */
    transform: rotate(var(--a, 0deg)) translateX(var(--r, 0px)) rotate(calc(-1 * var(--a, 0deg)));
    z-index: 1;
}
.auth-orbit-slot.s1 { --a: -75deg;  --r: calc(var(--d) * 0.23); --sz: 40px; }
.auth-orbit-slot.s2 { --a: 205deg;  --r: calc(var(--d) * 0.36); }
.auth-orbit-slot.s3 { --a: -25deg;  --r: calc(var(--d) * 0.36); }
.auth-orbit-slot.s4 { --a: 160deg;  --r: calc(var(--d) * 0.50); --sz: 44px; }
.auth-orbit-slot.s5 { --a: 35deg;   --r: calc(var(--d) * 0.50); --sz: 44px; }
.auth-orbit-slot.s6 { --a: 95deg;   --r: calc(var(--d) * 0.50); --sz: 42px; }

.auth-orbit-chip {
    display: flex; align-items: center; justify-content: center;
    width: 100%; height: 100%;
    border-radius: 50%;
    background: var(--bg-card);
    font-size: 18px;
    box-shadow: 0 8px 20px rgba(var(--navy-primary-rgb), 0.16), 0 0 0 1px rgba(var(--navy-primary-rgb), 0.05);
    animation: authFloat 5.4s ease-in-out infinite;
}
.auth-orbit-slot.s2 .auth-orbit-chip { animation-delay: -0.8s; }
.auth-orbit-slot.s3 .auth-orbit-chip { animation-delay: -1.7s; }
.auth-orbit-slot.s4 .auth-orbit-chip { animation-delay: -2.6s; }
.auth-orbit-slot.s5 .auth-orbit-chip { animation-delay: -3.4s; }
.auth-orbit-slot.s6 .auth-orbit-chip { animation-delay: -4.2s; }
.auth-orbit-chip.c-smtp   i { color: var(--navy-accent); }
.auth-orbit-chip.c-google i { color: #4285F4; }
.auth-orbit-chip.c-drive  i { color: #1FA463; }
.auth-orbit-chip.c-wa     i { color: #25D366; }
.auth-orbit-chip.c-ms     i { color: #00A4EF; }

@keyframes authFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes authGlow  { 0%, 100% { opacity: 0.65; transform: translate(-50%, -50%) scale(1); } 50% { opacity: 1; transform: translate(-50%, -50%) scale(1.07); } }

/* rotating captions + dots */
.auth-slides { position: relative; width: 100%; max-width: 430px; min-height: 66px; }
.auth-slide {
    position: absolute; inset: 0;
    margin: 0; text-align: center;
    font-size: 14.5px; line-height: 1.55; color: var(--text-secondary);
    opacity: 0; transform: translateY(7px);
    transition: opacity 0.45s ease, transform 0.45s ease;
    pointer-events: none;
}
.auth-slide.is-active { opacity: 1; transform: none; }
.auth-slide b { color: var(--navy-primary); font-weight: 700; }
.auth-dots { display: flex; align-items: center; justify-content: center; gap: 7px; margin-top: 12px; }
.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); }

/* ---------- dark mode — beat the blanket p/span/div/label colour rules ---------- */
body.dark-mode.auth-body {
    background-image:
        radial-gradient(760px 470px at 10% 6%,  rgba(var(--navy-accent-rgb), 0.22), transparent 64%),
        radial-gradient(700px 430px at 90% 4%,  rgba(var(--navy-light-rgb), 0.26), transparent 62%),
        radial-gradient(860px 540px at 82% 98%, rgba(var(--navy-accent-rgb), 0.15), transparent 66%);
}
body.dark-mode.auth-body::before { background-image: radial-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px); }
body.dark-mode .auth-brandmark,
body.dark-mode .auth-brandmark span { color: var(--text-primary) !important; }
body.dark-mode .auth-form-inner h1 { color: var(--text-primary) !important; }  /* h1-h6 blanket at 3683 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-check span { color: var(--text-muted) !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.28);
    box-shadow: none;
    background: linear-gradient(165deg,
        rgba(var(--navy-accent-rgb), 0.22) 0%,
        rgba(var(--navy-light-rgb), 0.30) 46%,
        var(--bg-card) 100%);
}
body.dark-mode .auth-show-title { color: var(--text-primary) !important; }
body.dark-mode .auth-show-title span { color: var(--navy-accent) !important; }
body.dark-mode .auth-slide { color: var(--text-secondary) !important; }
body.dark-mode .auth-slide b { color: var(--text-primary) !important; }
body.dark-mode .auth-ring { border-color: rgba(var(--navy-accent-rgb), 0.32); }
body.dark-mode .auth-orbit-chip { background: var(--bg-secondary); box-shadow: 0 8px 20px rgba(0, 0, 0, 0.38); }
body.dark-mode .auth-orbit-core { box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45), 0 0 0 7px rgba(255, 255, 255, 0.10); }
body.dark-mode .auth-dot { background: rgba(255, 255, 255, 0.22); }

/* ---------- responsive ---------- */
/* short windows — shrink the orbit before it crowds the caption out of the card */
@media (max-height: 780px) {
    .auth-orbit { --d: clamp(190px, 17vw, 290px); }
    .auth-showcase-card { padding: 32px 32px 26px; }
}
@media (max-width: 1024px) {
    .auth-card { grid-template-columns: 1fr; min-height: 0; }
    .auth-showcase { display: none; }
    .auth-form-col { max-height: none; overflow: visible; padding: 20px 24px 18px; }
}
@media (max-width: 560px) {
    .auth-form-col { padding: 16px 18px 16px; }
    .auth-form-inner h1 { font-size: 22px; }
    .auth-sub { margin-bottom: 22px; }
    .auth-brandmark { font-size: 14.5px; }
    .auth-brandmark img { width: 30px; height: 30px; }
}

/* ===== 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-orbit-chip, .auth-orbit::before { animation: none; }
    .auth-slide { transition: none; }
}

/* ===== Google Drive backup card ===== */
.gdrive-actions { display: flex; gap: 12px; flex-wrap: wrap; margin: 4px 0 14px; }
@media (max-width: 576px) {
    .gdrive-actions { flex-direction: column; }
    .gdrive-actions .btn { width: 100%; }
}

/* sidebar unread pill sits on the Chat nav item */
.sidebar-menu li { position: relative; }
.nav-pill {
    position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
    background: var(--danger); color: #fff; pointer-events: none;
    font-size: 10px; font-style: normal; font-weight: 700;
    min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
    display: inline-flex; align-items: center; justify-content: center;
}
/* collapsed rail has no room for a number — shrink to a dot */
.sidebar.collapsed .nav-pill {
    top: 8px; right: 12px; transform: none;
    min-width: 9px; width: 9px; height: 9px; padding: 0; font-size: 0;
}

/* bottom bar now carries up to 5 entries — tighten so nothing wraps on small phones */
.mobile-bottom-nav .mobile-nav-item { position: relative; padding: 8px 6px; min-width: 0; flex: 1; }
.mobile-nav-pill {
    position: absolute; top: 3px; right: 50%; margin-right: -20px;
    background: var(--danger); color: #fff; font-style: normal; font-weight: 700;
    font-size: 9px; min-width: 15px; height: 15px; padding: 0 4px; border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
}
@media (max-width: 360px) {
    .mobile-bottom-nav .mobile-nav-item { font-size: 9px; padding: 8px 3px; }
}

/* chat scope segmented control — same visual language as the V/A/E/D dots */
.rbac-scope { display: flex; gap: 3px; justify-content: center; flex-wrap: wrap; }
.rbac-scope-btn {
    padding: 4px 8px; border: 1px solid #d4d4d4; background: #fff; color: #999;
    font-size: 10px; font-weight: 700; cursor: pointer; border-radius: 0;
    transition: all .12s; white-space: nowrap;
}
.rbac-scope-btn:hover:not(:disabled) { border-color: var(--navy-accent); }
.rbac-scope-btn.on { background: var(--navy-accent); border-color: var(--navy-accent); color: #fff; }
.rbac-scope-btn.locked { opacity: .45; cursor: not-allowed; }
body.dark-mode .rbac-scope-btn { background: var(--input-bg); border-color: var(--input-border); color: var(--text-muted); }
body.dark-mode .rbac-scope-btn.on { background: var(--navy-accent); border-color: var(--navy-accent); color: #fff; }

/* ===== Chat — WhatsApp-style surface =====
   Page-scoped on purpose: everything here sits under .page-chat / .chat-*,
   so the navy dashboard theme is untouched everywhere else. */

body.page-chat {
    --wa-teal:      #008069;
    --wa-green:     #25d366;
    --wa-out:       #d9fdd3;   /* my bubble  */
    --wa-in:        #ffffff;   /* their bubble */
    --wa-bg:        #efeae2;   /* wallpaper base */
    --wa-panel:     #ffffff;
    --wa-head:      #f0f2f5;
    --wa-line:      #e9edef;
    --wa-txt:       #111b21;
    --wa-mut:       #667781;
    --wa-tick:      #53bdeb;
    --wa-wall-op:   .06;
}
body.page-chat.dark-mode {
    --wa-teal:      #00a884;
    --wa-out:       #005c4b;
    --wa-in:        #202c33;
    --wa-bg:        #0b141a;
    --wa-panel:     #111b21;
    --wa-head:      #202c33;
    --wa-line:      #222d34;
    --wa-txt:       #e9edef;
    --wa-mut:       #8696a0;
    --wa-wall-op:   .05;
}

.chat-banner {
    display: flex; align-items: center; gap: 10px;
    background: #fff3cd; color: #664d03;
    border-bottom: 1px solid #ffe69c;
    padding: 10px 16px; font-size: 13px;
}
body.page-chat.dark-mode .chat-banner { background: #332701; color: #ffda6a; border-bottom-color: #4a3800; }

/* thin indeterminate bar — reads and writes both drive it, never a blocking popup */
.chat-bar { height: 3px; background: transparent; overflow: hidden; }
.chat-bar.on::after {
    content: ''; display: block; height: 100%; width: 40%;
    background: var(--wa-green);
    animation: chat-bar-slide 1s linear infinite;
}
@keyframes chat-bar-slide {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(350%); }
}

.chat-wrap {
    display: grid; grid-template-columns: 380px 1fr;
    height: calc(100vh - 220px); min-height: 460px;
    background: var(--wa-panel);
}

/* ---------- left panel ---------- */
.chat-side { display: flex; flex-direction: column; overflow: hidden; background: var(--wa-panel); }
.chat-side-head {
    display: flex; gap: 8px; align-items: center;
    padding: 8px 12px; background: var(--wa-head); border-bottom: 1px solid var(--wa-line);
}
.chat-search { position: relative; flex: 1; }
.chat-search i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--wa-mut); font-size: 13px; }
.chat-search input {
    width: 100%; padding: 9px 14px 9px 40px; font-size: 16px;
    background: var(--wa-panel); color: var(--wa-txt);
    border: 1px solid transparent; border-radius: 8px;
}
.chat-search input::placeholder { color: var(--wa-mut); }
.chat-search input:focus { outline: none; border-color: var(--wa-teal); box-shadow: 0 0 0 3px rgba(0,168,132,.18); }
.chat-bcast-btn {
    white-space: nowrap; background: var(--wa-teal); border: none; color: #fff;
    padding: 9px 12px; border-radius: 8px; font-size: 13px; cursor: pointer;
}
.chat-bcast-btn:hover { filter: brightness(1.08); }

.chat-contacts { flex: 1; overflow-y: auto; background: var(--wa-panel); }
.chat-contact {
    display: flex; align-items: center; gap: 13px; width: 100%;
    padding: 10px 14px; background: none; border: none;
    text-align: left; cursor: pointer; color: var(--wa-txt);
}
.chat-contact:hover  { background: var(--wa-head); }
.chat-contact.active { background: var(--wa-head); box-shadow: inset 3px 0 0 var(--wa-teal); }
.chat-contact:focus-visible { outline: 2px solid var(--wa-teal); outline-offset: -3px; }
.chat-contact.has-unread .chat-contact-top strong { font-weight: 600; }
.chat-contact.has-unread .chat-contact-sub span { color: var(--wa-txt); }
body.page-chat.dark-mode .chat-contact.active { background: #2a3942; }
/* divider is indented past the avatar, the way a messenger list reads */
.chat-contact + .chat-contact::before {
    content: ''; position: absolute; left: 74px; right: 0; top: 0; height: 1px; background: var(--wa-line);
}
.chat-contact { position: relative; }
.chat-contact img { width: 49px; height: 49px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--wa-head); }
.chat-contact-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.chat-contact-top  { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.chat-contact-top strong { font-size: 16px; font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-contact-time { font-size: 12px; color: var(--wa-mut); flex-shrink: 0; }
.chat-contact.has-unread .chat-contact-time { color: var(--wa-green); }
.chat-contact-sub {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    font-size: 14px; color: var(--wa-mut);
}
.chat-contact-sub span {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0;
}
.chat-pill {
    background: var(--wa-green); color: #0b141a; font-size: 12px; font-style: normal; font-weight: 600;
    min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}

/* ---------- thread ---------- */
.chat-pane { position: relative; display: flex; flex-direction: column; overflow: hidden; background: var(--wa-bg); }
/* doodle wallpaper — inlined so nothing is fetched from outside. it lives on the pane, not the
   scrolling message list, otherwise it would only cover the first screenful of a long thread */
.chat-pane::before {
    content: ''; position: absolute; inset: 0; z-index: 0; pointer-events: none;
    background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMjAiIGhlaWdodD0iMjIwIiB2aWV3Qm94PSIwIDAgMjIwIDIyMCI+PGcgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjMDAwIiBzdHJva2Utd2lkdGg9IjEuNiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBvcGFjaXR5PSIuMzgiPjxjaXJjbGUgY3g9IjI4IiBjeT0iMjYiIHI9IjgiLz48cGF0aCBkPSJNNjAgMjBoMTh2MTRINjB6Ii8+PHBhdGggZD0iTTEwNCAzMmM0LTEwIDE0LTEwIDE0LTIgMCA2LTcgMTAtMTQgMTYtNy02LTE0LTEwLTE0LTE2IDAtOCAxMC04IDE0IDJ6Ii8+PHBhdGggZD0iTTE1MCAxOGw0IDkgMTAgMS03IDcgMiAxMC05LTUtOSA1IDItMTAtNy03IDEwLTF6Ii8+PHBhdGggZD0iTTE5MCAyMGM2IDAgMTAgNCAxMCA5cy00IDktMTAgOWgtNGwtNiA1di01Yy00LTEtNi01LTYtOSAwLTUgNC05IDEwLTl6Ii8+PHBhdGggZD0iTTIwIDcwYzgtNiAxNiA2IDI0IDAiLz48cGF0aCBkPSJNNjIgNjRoMTZ2MTZINjJ6IiB0cmFuc2Zvcm09InJvdGF0ZSgyMCA3MCA3MikiLz48Y2lyY2xlIGN4PSIxMTIiIGN5PSI3MiIgcj0iOSIvPjxwYXRoIGQ9Ik0xMDggNzJsMyAzIDYtNyIvPjxwYXRoIGQ9Ik0xNTAgNjR2MTZNMTQyIDcyaDE2Ii8+PHBhdGggZD0iTTE4NiA2MmwxMCAxMC0xMCAxMC0xMC0xMHoiLz48cGF0aCBkPSJNMTggMTE4YzAtNiA1LTEwIDExLTEwczExIDQgMTEgMTAtNSAxMC0xMSAxMGgtM2wtNSA0di01Yy0yLTItMy01LTMtOXoiLz48cGF0aCBkPSJNNjAgMTEwbDggMTZoLTE2eiIvPjxwYXRoIGQ9Ik0xMDAgMTA4aDIwdjhoLTIwek0xMDQgMTE2djEwTTExNiAxMTZ2MTAiLz48cGF0aCBkPSJNMTQ4IDExMmE4IDggMCAxIDEgMCAxMk0xNDggMTA2djIyIi8+PGNpcmNsZSBjeD0iMTkyIiBjeT0iMTE4IiByPSI5Ii8+PHBhdGggZD0iTTE5MiAxMTJ2Nmw0IDMiLz48cGF0aCBkPSJNMTYgMTYwaDIwbC00IDEySDIweiIvPjxwYXRoIGQ9Ik01OCAxNTZjNi00IDEyIDQgMTggMCIvPjxwYXRoIGQ9Ik01OCAxNjhjNi00IDEyIDQgMTggMCIvPjxwYXRoIGQ9Ik0xMDQgMTUybDYgMTItNiAxMi02LTEyeiIvPjxwYXRoIGQ9Ik0xNDQgMTU2aDE4djE0aC02bC00IDUtMi01aC02eiIvPjxwYXRoIGQ9Ik0xODggMTU0djE4TTE4MCAxNjNoMTYiLz48cGF0aCBkPSJNMjAgMTk4YzggMCA4IDggMTYgOCIvPjxwYXRoIGQ9Ik02NCAxOTZhNyA3IDAgMSAwIDE0IDAgNyA3IDAgMCAwLTE0IDB6TTcxIDIwM3Y2Ii8+PHBhdGggZD0iTTEwMiAxOTRoMTZ2MTJoLTE2eiIvPjxwYXRoIGQ9Ik0xMDYgMjA2bC0zIDZNMTE0IDIwNmwzIDYiLz48cGF0aCBkPSJNMTQ4IDE5Mmw4IDgtOCA4LTgtOHoiLz48cGF0aCBkPSJNMTg2IDE5NGM2IDIgOCA4IDQgMTIiLz48L2c+PC9zdmc+Cg==");
    background-repeat: repeat; background-size: 220px 220px;
    opacity: var(--wa-wall-op);
}
.chat-thread, .chat-blank { position: relative; z-index: 1; }
.chat-head, .chat-composer { position: relative; z-index: 1; }
.chat-thread[hidden], .chat-blank[hidden] { display: none; }
.chat-thread { display: flex; flex-direction: column; height: 100%; min-height: 0; }

.chat-blank, .chat-none {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 10px; padding: 40px 20px; text-align: center; color: var(--wa-mut);
    background: var(--wa-bg);
}
.chat-blank i {
    width: 96px; height: 96px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 38px; color: var(--wa-teal); background: rgba(0,168,132,.12);
}
.chat-blank h3 { color: var(--wa-txt); font-size: 22px; font-weight: 300; }
.chat-none i { font-size: 26px; opacity: .5; }
.chat-none-lg { height: 100%; background: transparent; }

.chat-head {
    display: flex; align-items: center; gap: 13px; flex-shrink: 0;
    padding: 9px 16px; background: var(--wa-head); border-bottom: 1px solid var(--wa-line);
}
.chat-head-img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.chat-head-info { display: flex; flex-direction: column; }
.chat-head-info strong { font-size: 16px; font-weight: 500; color: var(--wa-txt); }
.chat-head-info span  { font-size: 13px; color: var(--wa-mut); }
.chat-back { display: none; background: none; border: none; color: var(--wa-txt); font-size: 18px; cursor: pointer; padding: 4px 6px; }

/* ---------- messages + wallpaper ---------- */
.chat-msgs {
    flex: 1; overflow-y: auto; padding: 14px 6%;
    display: flex; flex-direction: column; gap: 2px;
    background: transparent;
}
/* doodle wallpaper, inlined so nothing is fetched from outside */

.chat-day { text-align: center; margin: 12px 0; }
.chat-day span {
    display: inline-block; padding: 5px 12px; font-size: 12.5px;
    text-transform: uppercase; color: var(--wa-mut);
    background: var(--wa-in); border-radius: 7.5px; box-shadow: 0 1px 0.5px rgba(11,20,26,.13);
}
body.page-chat.dark-mode .chat-day span { color: var(--wa-mut); background: var(--wa-head); }

.chat-msg { display: flex; max-width: 65%; }
.chat-msg.mine { align-self: flex-end; justify-content: flex-end; }
.chat-msg + .chat-msg { margin-top: 2px; }
.chat-msg.starts-run { margin-top: 12px; }

.chat-bub {
    position: relative; padding: 6px 9px 8px; font-size: 14.2px; line-height: 19px;
    background: var(--wa-in); color: var(--wa-txt);
    border-radius: 7.5px; box-shadow: 0 1px 0.5px rgba(11,20,26,.13);
    word-break: break-word; max-width: 100%;
}
.chat-msg.mine .chat-bub { background: var(--wa-out); }

/* the little tail — only on the first bubble of a run, like the real thing */
.chat-msg.starts-run .chat-bub::before {
    content: ''; position: absolute; top: 0; width: 8px; height: 13px;
}
.chat-msg.starts-run:not(.mine) .chat-bub { border-top-left-radius: 0; }
.chat-msg.starts-run:not(.mine) .chat-bub::before {
    left: -8px;
    background: var(--wa-in);
    clip-path: polygon(100% 0, 0 0, 100% 100%);
}
.chat-msg.starts-run.mine .chat-bub { border-top-right-radius: 0; }
.chat-msg.starts-run.mine .chat-bub::before {
    right: -8px;
    background: var(--wa-out);
    clip-path: polygon(0 0, 100% 0, 0 100%);
}

.chat-bub.gone { font-style: italic; color: var(--wa-mut); }
.chat-bub .chat-text { white-space: pre-wrap; }

.chat-tag {
    display: block; margin-bottom: 3px;
    font-size: 12.5px; font-weight: 600; color: var(--wa-teal);
}
.chat-msg.bcast .chat-bub {
    padding-left: 13px;
    box-shadow: 0 1px 0.5px rgba(11,20,26,.13), inset 3px 0 0 var(--wa-teal);
}

/* time + ticks tuck into the last line of text, dropping to their own line when it's tight */
.chat-meta {
    float: right; position: relative; top: 4px;
    margin: 0 -3px -4px 11px;
    font-size: 11px; color: var(--wa-mut); line-height: 15px; white-space: nowrap;
}
.chat-meta i { font-size: 12px; margin-left: 2px; vertical-align: -1px; }
.chat-meta i.read { color: var(--wa-tick); }
.chat-meta i.failed { color: #ea4335; }
/* optimistic bubble — on screen before the server has confirmed it */
.chat-msg.pending .chat-bub { opacity: .72; }

.chat-img { display: block; margin: -2px -5px 5px; cursor: zoom-in; }
.chat-img img { display: block; max-width: 320px; width: 100%; border-radius: 6px; }
.chat-doc {
    display: flex; align-items: center; gap: 11px; margin-bottom: 3px; padding: 9px 12px;
    background: rgba(11,20,26,.05); border-radius: 8px; color: inherit; text-decoration: none;
    transition: background 0.2s;
}
.chat-doc:hover { background: rgba(11,20,26,.1); }
body.page-chat.dark-mode .chat-doc { background: rgba(255,255,255,.06); }
body.page-chat.dark-mode .chat-doc:hover { background: rgba(255,255,255,.11); }
.chat-doc i {
    flex-shrink: 0; width: 38px; height: 38px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 15px; color: var(--wa-teal); background: rgba(0,168,132,.16);
}
.chat-doc span { display: flex; flex-direction: column; min-width: 0; }
.chat-doc strong { font-size: 13.5px; font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.chat-doc em { font-size: 11.5px; font-style: normal; color: var(--wa-mut); text-transform: uppercase; }

/* hover tools stay out of the way until you point at a bubble */
.chat-tools {
    position: absolute; top: 50%; transform: translateY(-50%); display: none; gap: 1px;
    background: var(--wa-panel); border: 1px solid var(--wa-line); border-radius: 20px; padding: 3px;
    box-shadow: 0 2px 10px rgba(11,20,26,.18);
}
.chat-msg:not(.mine) .chat-tools { right: -70px; }
.chat-msg.mine .chat-tools      { left: -70px; }
.chat-msg:hover .chat-tools { display: flex; }
.chat-tools button {
    background: none; border: none; cursor: pointer; font-size: 12px; color: var(--wa-mut);
    width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
}
.chat-tools button:hover { color: #ea4335; background: rgba(234,67,53,.1); }

/* ---------- composer ---------- */
.chat-composer {
    display: flex; align-items: flex-end; gap: 8px; flex-shrink: 0;
    padding: 8px 16px; background: var(--wa-head);
}
.chat-composer textarea {
    flex: 1; resize: none; max-height: 140px; padding: 10px 14px;
    font-size: 16px; font-family: inherit; line-height: 20px;
    background: var(--wa-panel); color: var(--wa-txt);
    border: none; border-radius: 8px;
}
.chat-composer textarea::placeholder { color: var(--wa-mut); }
.chat-composer textarea:focus { outline: none; box-shadow: 0 0 0 2px var(--wa-teal); }
.chat-file-hidden { display: none; }
.chat-attach, .chat-send {
    flex-shrink: 0; width: 42px; height: 42px; border: none; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%; touch-action: manipulation;
}
.chat-attach { background: none; color: var(--wa-mut); font-size: 21px; }
.chat-attach:hover { color: var(--wa-txt); }
.chat-send { background: var(--wa-teal); color: #fff; font-size: 17px; }
.chat-send { transition: filter 0.2s, transform 0.2s; }
.chat-send:hover:not(:disabled) { filter: brightness(1.08); transform: scale(1.06); }
.chat-send:active:not(:disabled) { transform: scale(0.96); }
.chat-send:disabled { opacity: .6; cursor: not-allowed; }
.chat-composer-off {
    justify-content: center; gap: 8px; color: var(--wa-mut); font-size: 13px; padding: 16px;
}

/* ---------- broadcast modal ---------- */
.chat-bcast-note { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; }
.chat-bcast-input {
    width: 100%; resize: vertical; padding: 11px 12px; font-size: 16px; font-family: inherit;
    background: var(--input-bg); border: 1px solid var(--input-border); color: var(--text-primary);
    border-radius: 8px;
}
.chat-bcast-input:focus { outline: none; border-color: var(--navy-accent); }
.chat-bcast-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

/* ---------- skeletons ---------- */
.chat-skel {
    height: 62px; margin: 8px 14px; border-radius: 8px;
    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;
}

/* ---- full screen: the shell stops scrolling, the thread owns the viewport ---- */
body.page-chat .main-content { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
body.page-chat .head-crumbs { display: none; }
body.page-chat .header {
    flex-shrink: 0; margin: 0; padding: 10px 16px; border-radius: 0; box-shadow: none;
    background: var(--wa-head); border-bottom: 1px solid var(--wa-line);
}
body.page-chat .header h1 { font-size: 18px; color: var(--wa-txt); }
body.page-chat .chat-wrap { flex: 1; height: auto; min-height: 0; }
body.page-chat .chat-side { border-right: 1px solid var(--wa-line); }

/* ---- mobile: one pane at a time ---- */
@media (max-width: 900px) {
    .chat-wrap { grid-template-columns: 1fr; }
    .chat-pane { display: none; }
    .chat-wrap.thread-open .chat-side { display: none; }
    .chat-wrap.thread-open .chat-pane { display: flex; }
    .chat-back { display: inline-block; }
    .chat-msg { max-width: 82%; }
    .chat-msgs { padding: 12px 4%; }
    .chat-img img { max-width: 240px; }
    .chat-msg:not(.mine) .chat-tools, .chat-msg.mine .chat-tools {
        top: -13px; right: 2px; left: auto; transform: none;
    }
    .chat-jump { right: 14px; bottom: 72px; }
}
@media (max-width: 768px) {
    body.page-chat .main-content { padding-bottom: max(65px, calc(65px + env(safe-area-inset-bottom))); }
    body.page-chat .header { padding: 9px 14px; }
    body.page-chat .header h1 { font-size: 17px; }
}

/* ---------- jump to latest ---------- */
.chat-jump {
    position: absolute; right: 22px; bottom: 76px; z-index: 3;
    width: 42px; height: 42px; border: none; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--wa-panel); color: var(--wa-mut); font-size: 15px;
    box-shadow: 0 3px 12px rgba(11,20,26,.25);
    opacity: 0; visibility: hidden; transform: translateY(10px);
    transition: opacity .2s ease, transform .2s ease, visibility .2s;
    cursor: pointer;
}
.chat-jump.on { opacity: 1; visibility: visible; transform: none; }
.chat-jump:hover { color: var(--wa-teal); }

/* ---------- thin themed scrollbars in both panes ---------- */
.chat-contacts, .chat-msgs { scrollbar-width: thin; scrollbar-color: rgba(11,20,26,.22) transparent; }
.chat-contacts::-webkit-scrollbar, .chat-msgs::-webkit-scrollbar { width: 7px; }
.chat-contacts::-webkit-scrollbar-track, .chat-msgs::-webkit-scrollbar-track { background: transparent; }
.chat-contacts::-webkit-scrollbar-thumb, .chat-msgs::-webkit-scrollbar-thumb {
    background: rgba(11,20,26,.2); border-radius: 4px;
}
.chat-contacts::-webkit-scrollbar-thumb:hover, .chat-msgs::-webkit-scrollbar-thumb:hover { background: rgba(11,20,26,.34); }
body.page-chat.dark-mode .chat-contacts, body.page-chat.dark-mode .chat-msgs { scrollbar-color: rgba(255,255,255,.2) transparent; }
body.page-chat.dark-mode .chat-contacts::-webkit-scrollbar-thumb,
body.page-chat.dark-mode .chat-msgs::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); }

@media (prefers-reduced-motion: reduce) {
    .chat-jump, .chat-send, .chat-doc { transition: none; }
    .chat-send:hover:not(:disabled), .chat-send:active:not(:disabled) { transform: none; }
}

/* ===== Users — profile photo (same column the sidebar + chat avatars read) ===== */
.form-group-full { grid-column: 1 / -1; }

.dt-photo { width: 64px; text-align: center; }
.user-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
    background: var(--bg-secondary);
    vertical-align: middle;
}

.user-photo-note { font-size: 12px; font-weight: 500; color: var(--text-muted); }
.user-photo-row { display: flex; align-items: center; gap: 16px; }
.user-photo-preview {
    width: 74px; height: 74px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--border-color);
    background: var(--bg-secondary);
    flex-shrink: 0;
}
.user-photo-fields { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 9px; }
.user-photo-remove {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 13.5px; font-weight: 600; color: var(--danger);
    cursor: pointer;
}
/* beat .form-group input { width:100% } — a checkbox must stay a checkbox */
.user-photo-fields .user-photo-remove input {
    width: 16px; min-width: 16px; height: 16px;
    accent-color: var(--danger);
    cursor: pointer;
}
.user-photo-hint { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-muted); }

body.dark-mode .user-avatar,
body.dark-mode .user-photo-preview { border-color: var(--input-border); }

@media (max-width: 560px) {
    .user-photo-row { flex-direction: column; align-items: flex-start; }
    .user-photo-fields { width: 100%; }
}

/* ===== Page head — title + crumb line | header filters + icon actions ===== */
.header { position: relative; z-index: 950; flex-wrap: nowrap; gap: 10px 16px; padding: 14px 18px; }
.header > .head-title { display: flex; flex-direction: column; gap: 5px; flex: 0 0 auto; max-width: 40%; min-width: 0; width: auto; text-align: left; font-size: inherit; }
.header .header-right { gap: 4px; }
.header .head-title h1 { margin: 0; font-size: 22px; line-height: 1.2; }
.head-crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 12.5px; line-height: 1.2; color: var(--text-muted); }
.head-crumbs a, .head-crumbs .crumb-group { display: inline-flex; align-items: center; gap: 5px; }
.head-crumbs a { color: var(--navy-accent); font-weight: 600; text-decoration: none; }
.head-crumbs a:hover { text-decoration: underline; }
.head-crumbs .crumb-now { color: var(--text-secondary); font-weight: 600; }
.head-crumbs .crumb-sep { font-size: 8px; opacity: 0.6; }

/* wrap-reverse: tools stay on the top line, filters drop under them when space runs out */
.head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap-reverse; justify-content: flex-end; flex: 1 1 0; min-width: 0; }
.head-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; padding: 0; position: relative;
    border: 1px solid rgba(var(--navy-accent-rgb), 0.28); border-radius: 3px;
    background: rgba(var(--navy-accent-rgb), 0.10);
    color: var(--navy-accent);
    font-family: inherit; font-size: 13.5px; font-weight: 600;
    white-space: nowrap; cursor: pointer;
    transition: background 0.2s, border-color 0.2s, transform 0.15s;
}
.head-btn i { font-size: 14px; }
.head-btn:hover { background: rgba(var(--navy-accent-rgb), 0.2); border-color: var(--navy-accent); }
.head-btn:active { transform: translateY(1px); }
.head-btn:focus-visible { outline: 2px solid var(--navy-accent); outline-offset: 2px; }
.head-btn.primary { background: var(--navy-accent); border-color: var(--navy-accent); color: #fff; }
.head-btn.primary:hover { filter: brightness(1.08); }
.head-btn[disabled] { opacity: 0.5; cursor: not-allowed; }
/* icon-only — label stays for screen readers, title gives the tooltip */
.head-btn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 768px) {
    .header { flex-wrap: wrap; gap: 12px; }
    .head-actions { width: 100%; justify-content: flex-start; }
    .header .head-title h1 { font-size: 18px; }
    .header > .head-title { max-width: none; }
}

/* ================= Chip-row dense table — only applies to .chip-table ================= */
/* min-width is 1200px in the reference doc for 6-9 grouped columns; ours run 3-4, where 1200
   clips the last column instead of filling space — 900 still guarantees the chips their room */

/* stacked chip rows in a cell */
.cell-stack{ display:flex; flex-direction:column; gap:3px; }
.chip-row{ display:flex; align-items:center; justify-content:space-between; gap:14px; min-width:152px; white-space:nowrap; }

/* the chip (squared tag = icon + label) — uniform size so values align across rows */
.chip{ display:inline-flex; align-items:center; gap:5px; padding:0 8px; height:21px; min-width:82px; border-radius:3px; font-size:10.8px; font-weight:700; line-height:1; white-space:nowrap; border:1px solid transparent; flex:none; }
.chip i{ font-size:10px; width:11px; text-align:center; }
.chip.is-btn{ cursor:pointer; }
.chip.is-btn:hover{ filter:brightness(.95); }

/* palettes — named by COLOUR/ROLE, never by domain */
.chip-navy   { background:#0b2545; color:#fff; }
.chip-green  { background:#1f9d57; color:#fff; }
.chip-teal   { background:#d4efef; color:#0d7878; border-color:#bbe6e6; }
.chip-link   { background:#e9f1fc; color:#0a66c2; border-color:#cfe0f7; }
.chip-soft-navy  { background:#e6edf6; color:#0b2545; border-color:#d3deec; }
.chip-soft-green { background:#e2f6ea; color:#1f8b4c; border-color:#c7eed6; }
.chip-soft-amber { background:#fdecd6; color:#c4701a; border-color:#f8dab4; }
.chip-soft-purple{ background:#ece2f9; color:#6a1b9a; border-color:#dccbf2; }
.chip-soft-tan   { background:#fbe7c6; color:#92520a; border-color:#f3d29b; }

/* values beside chips — pinned right */
.chip-row .val{ font-weight:800; font-size:12.5px; margin-left:auto; text-align:right; }
.val-amount{ color:#d35400; }   /* money */
.val-pos{ color:#1f8b4c; }      /* good / positive */
.val-neg{ color:#c0392b; }      /* bad / negative */
.val-navy{ color:#0b2545; }
.val-muted{ color:#9aa6b2; font-weight:700; }
.val-box{ background:#eef1f4; color:#33414f; padding:2px 7px; border-radius:3px; font-size:11px; font-weight:700; font-family:'Courier New',monospace; letter-spacing:.2px; }
.cell-title{ font-size:13px; font-weight:800; color:var(--navy-primary); margin-bottom:1px; }

/* media / thumbnail cell */
.media-stack{ display:flex; flex-direction:column; align-items:center; gap:4px; min-width:44px; }
.media-box{ width:36px; height:36px; border:1px solid #e2e6ea; border-radius:3px; background:#fff; display:flex; align-items:center; justify-content:center; font-size:15px; overflow:hidden; box-shadow:0 1px 2px rgba(0,0,0,.05); }
.media-box img{ width:100%; height:100%; object-fit:cover; }

/* squared action icons */
.actions-cell{ display:flex; align-items:center; justify-content:center; gap:6px; flex-wrap:nowrap; }
.act{ width:26px; height:26px; border:none; border-radius:3px; cursor:pointer; display:inline-flex; align-items:center; justify-content:center; font-size:12px; transition:all .2s; background:transparent; }
.act-info{ background:#1c2733; color:#fff; }
.act-info:hover{ background:#000; transform:scale(1.1); }
.act-edit{ color:#e8a200; font-size:15px; }
.act-del { color:#e23b2e; font-size:15px; }
.act-edit:hover,.act-del:hover{ transform:scale(1.18); }
.act[disabled]{ opacity:.32; cursor:not-allowed; }
.act[disabled]:hover{ transform:none; }

body.dark-mode .cell-title{ color:#e8edf3; }
body.dark-mode .val-box{ background:#2a3240; color:#cbd5e1; }
body.dark-mode .media-box{ background:#1e2430; border-color:#3a4454; }

/* import result popup — long skip lists stay readable */
.import-errors {
    max-height: 190px; overflow-y: auto; text-align: left;
    font-size: 12.5px; line-height: 1.7; color: var(--text-secondary);
    background: var(--bg-secondary); border-radius: 3px; padding: 10px 12px;
}

/* 4–5 grouped columns stretch a cell far wider than the doc's 6–9 column tables and the value
   drifts a screen away from its chip — cap the stack so each pair stays visually joined */

/* ===== AI settings card ===== */
.ai-model-row { display: flex; gap: 8px; align-items: center; }
.ai-model-row select { flex: 1; min-width: 0; }
.ai-model-row .btn { flex-shrink: 0; }
.ai-model-custom { margin-top: 8px; }
.ai-keys { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin: 4px 0 18px; }
.ai-key-input { display: flex; gap: 8px; align-items: center; }
.ai-key-input input { flex: 1; min-width: 0; }
.ai-key-input .btn { flex-shrink: 0; }
.ai-key-link { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--navy-accent); text-decoration: none; }
.ai-key-link:hover { text-decoration: underline; }
.ai-key-row label { display: flex; align-items: center; gap: 8px; }
.ai-test-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 4px 0 16px; }
.ai-test-result { font-size: 13.5px; font-weight: 600; }
.ai-test-result.ok  { color: var(--success, #1f8b4c); }
.ai-test-result.bad { color: var(--danger); }
.field-hint { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 12.5px; color: var(--text-muted); }
@media (max-width: 768px) { .ai-keys { grid-template-columns: 1fr; } }

/* ===== AI Assistant page ===== */
/* the borrowed .chat-skel / .chat-none / .chat-banner helpers read these — point them at the navy palette */
body.page-ai {
    --wa-mut: var(--text-muted);
    --wa-txt: var(--text-primary);
    --wa-head: var(--bg-secondary);
    --wa-panel: var(--bg-card);
    --wa-line: var(--border-color);
}

.ai-wrap {
    display: grid; grid-template-columns: 300px 1fr;
    height: calc(100vh - 250px); min-height: 430px;
    background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 3px;
    box-shadow: 0 2px 4px var(--shadow-color); overflow: hidden;
}

.ai-side { display: flex; flex-direction: column; min-width: 0; min-height: 0; border-right: 1px solid var(--border-color); background: var(--bg-secondary); }
.ai-side-head { padding: 12px; border-bottom: 1px solid var(--border-color); }
.ai-convs { flex: 1; min-height: 0; overflow-y: auto; padding: 8px; scrollbar-width: thin; }
.ai-side-foot {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    padding: 10px 12px; border-top: 1px solid var(--border-color);
    font-size: 12px; color: var(--text-muted);
}
.ai-quota { margin-left: auto; font-weight: 700; color: var(--navy-accent); }

.ai-conv {
    position: relative; display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 9px 10px; margin-bottom: 4px; border: none; border-radius: 3px;
    background: transparent; color: var(--text-primary); font-family: inherit; text-align: left; cursor: pointer;
    transition: background 0.15s;
}
.ai-conv:hover { background: rgba(var(--navy-accent-rgb), 0.08); }
.ai-conv.active { background: rgba(var(--navy-accent-rgb), 0.14); box-shadow: inset 3px 0 0 var(--navy-accent); }
.ai-conv > i { color: var(--navy-accent); font-size: 13px; flex-shrink: 0; }
.ai-conv-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ai-conv-main strong { font-size: 13.2px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-conv-main em { font-style: normal; font-size: 11px; color: var(--text-muted); }
.ai-conv-del { flex-shrink: 0; padding: 4px 6px; border-radius: 3px; color: var(--text-muted); font-size: 12px; opacity: 0; transition: opacity 0.15s, color 0.15s; }
.ai-conv:hover .ai-conv-del { opacity: 1; }
.ai-conv-del:hover { color: var(--danger); background: rgba(234, 67, 53, 0.12); }

.ai-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg-card); }
.ai-msgs { flex: 1; min-height: 0; overflow-y: auto; padding: 20px 22px; display: flex; flex-direction: column; gap: 16px; scrollbar-width: thin; }

.ai-blank { margin: auto; text-align: center; max-width: 460px; padding: 20px; }
.ai-blank i {
    width: 88px; height: 88px; border-radius: 50%; margin-bottom: 16px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 34px; color: var(--navy-accent); background: rgba(var(--navy-accent-rgb), 0.12);
}
.ai-blank h3 { font-size: 21px; font-weight: 700; color: var(--text-primary); margin: 0 0 6px; }
.ai-blank p { font-size: 14px; color: var(--text-muted); margin: 0; }
.ai-tips { display: flex; flex-direction: column; gap: 8px; margin-top: 20px; }
.ai-tip {
    padding: 10px 14px; border: 1px solid var(--border-color); border-radius: 3px;
    background: var(--bg-secondary); color: var(--text-secondary);
    font-family: inherit; font-size: 13.2px; text-align: left; cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
}
.ai-tip:hover { border-color: var(--navy-accent); color: var(--navy-accent); }

.ai-msg { display: flex; align-items: flex-start; gap: 11px; max-width: 84%; }
.ai-msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.ai-avatar {
    flex-shrink: 0; width: 32px; height: 32px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center; font-size: 13px;
    background: rgba(var(--navy-accent-rgb), 0.14); color: var(--navy-accent);
}
.ai-msg.mine .ai-avatar { background: var(--navy-primary); color: #fff; }
.ai-avatar-bad { background: rgba(234, 67, 53, 0.14); color: var(--danger); }
.ai-bub {
    padding: 11px 14px; border-radius: 3px; font-size: 14px; line-height: 1.65;
    background: var(--bg-secondary); color: var(--text-primary);
    border: 1px solid var(--border-color); word-break: break-word; min-width: 0;
}
.ai-msg.mine .ai-bub { background: rgba(var(--navy-accent-rgb), 0.1); border-color: rgba(var(--navy-accent-rgb), 0.25); }
.ai-bub-bad { background: rgba(234, 67, 53, 0.08); border-color: rgba(234, 67, 53, 0.3); color: var(--danger); }
.ai-bub code { padding: 1px 5px; border-radius: 3px; background: rgba(var(--navy-primary-rgb), 0.09); font-family: 'Courier New', monospace; font-size: 12.5px; }
.ai-code {
    margin: 8px 0; padding: 11px 13px; border-radius: 3px; overflow-x: auto;
    background: var(--navy-primary); color: #e6edf6;
    font-family: 'Courier New', monospace; font-size: 12.5px; line-height: 1.55; white-space: pre;
}
.ai-meta { display: block; margin-top: 6px; font-size: 11px; color: var(--text-muted); }

/* thinking indicator — three dots while the model is composing */
.ai-dots { display: inline-flex; gap: 5px; padding: 3px 0; }
.ai-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--navy-accent); opacity: 0.4; animation: aiDot 1.2s infinite ease-in-out; }
.ai-dots i:nth-child(2) { animation-delay: 0.18s; }
.ai-dots i:nth-child(3) { animation-delay: 0.36s; }
@keyframes aiDot { 0%, 60%, 100% { opacity: 0.3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-4px); } }

.ai-composer {
    display: flex; align-items: flex-end; gap: 10px; flex-shrink: 0;
    padding: 12px 16px; border-top: 1px solid var(--border-color); background: var(--bg-secondary);
}
.ai-composer textarea {
    flex: 1; resize: none; max-height: 160px; padding: 11px 14px;
    font-family: inherit; font-size: 16px; line-height: 21px;
    background: var(--bg-card); color: var(--text-primary);
    border: 1px solid var(--input-border); border-radius: 3px;
}
.ai-composer textarea:focus { outline: none; border-color: var(--navy-accent); box-shadow: 0 0 0 3px rgba(var(--navy-accent-rgb), 0.15); }
.ai-send {
    flex-shrink: 0; width: 44px; height: 44px; border: none; border-radius: 3px; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--navy-accent); color: #fff; font-size: 16px;
    transition: filter 0.2s, transform 0.2s;
}
.ai-send:hover:not(:disabled) { filter: brightness(1.08); transform: scale(1.05); }
.ai-send:disabled { opacity: 0.6; cursor: not-allowed; }
.ai-composer-off { justify-content: center; gap: 8px; color: var(--text-muted); font-size: 13px; padding: 18px; }

@media (max-width: 900px) {
    .ai-wrap { grid-template-columns: 1fr; grid-template-rows: auto 1fr; height: calc(100vh - 230px); }
    .ai-side { border-right: none; border-bottom: 1px solid var(--border-color); max-height: 168px; }
    .ai-msg { max-width: 94%; }
}
@media (prefers-reduced-motion: reduce) {
    .ai-dots i { animation: none; }
    .ai-send:hover:not(:disabled) { transform: none; }
}

/* Dark Mode — per-user access */
body.dark-mode .rbac-tabs { border-bottom-color: var(--border-color); }
body.dark-mode .rbac-tab { color: var(--text-muted); }
body.dark-mode .rbac-tab.active { color: #fff; border-bottom-color: var(--navy-accent); }
body.dark-mode .rbac-userbar { background: var(--bg-card); border-color: var(--border-color); }
body.dark-mode .rbac-userbar-main { color: var(--text-primary); }
body.dark-mode .rbac-ovr-chip { background: #3a2f00; color: #ffe69c; border-color: #5c4a00; }
body.dark-mode .rbac-ovr-chip.off { background: #10331f; color: #8fe0ac; border-color: #1d5836; }
body.dark-mode .rbac-empty { color: var(--text-muted); }

/* =====================================================================
   Construction kit — squared UI, tabs, split popup, forms, Tabulator,
   dropdowns, pipeline, feedback signals. Shared by every business page.
   ===================================================================== */

/* ---------- squared-corner tokens (one place, every file inherits) ---------- */
:root {
    --rs-radius: 3px;
    --r-sm: 2px; --r-md: 3px; --r-lg: 3px; --r-pill: 3px;
    --rs-paper-bg: color-mix(in srgb, var(--text-muted) 22%, var(--bg-primary));
    --rs-row-alt: color-mix(in srgb, var(--navy-accent) 3%, var(--bg-card));
    --rs-row-hover: color-mix(in srgb, var(--navy-accent) 7%, var(--bg-card));
    --t-fast: .15s; --t-base: .2s; --ease: cubic-bezier(.4, 0, .2, 1);
}

/* beats the 10px / 14px rounding polish and the mobile 6px card rule (both !important / later) */
:is(.data-section, .lte-card, .small-box, .info-box, .stat-card, .chart-card, .skeleton-card,
    .account-info-card, .about-card, .about-header, .filters-section, .header, .settings-mega-card,
    .security-card, .setup-container, .acct-card, .acct-drop, .acct-chip, .acct-info-icon,
    .theme-preview-container, .setup-guide-table, .about-table-wrapper,
    .notification-dropdown, .header-tool-dropdown, .modal, .modal-content, .modal-box, .modal-header,
    .btn, .head-btn, .header-tool-btn, .mode-toggle-btn, .action-icon, .close-btn,
    .sidebar-toggle-btn, .sidebar-user-role, .mobile-nav-item, .lang-item, .palette-card,
    .chip, .msg-pill, .tb-pill, .rs-pill, .status-badge, .role-badge, .action-badge, .searchable-multi-tag,
    .file-input, .filter-input, .hex-input, .hdr-search, .search-hit,
    .sd-trigger, .sd-panel, .searchable-dropdown-input, .searchable-dropdown-list,
    .tabulator, .tb-toolbar, .tb-bar, .tb-pop-menu, .tb-tbtn, .tb-bulk-btn, .act,
    .rs-tab, .rs-split-modal, .rs-seg-btn, .pipeline-stage,
    .swal2-popup, .swal2-styled, .swal2-input, .swal2-textarea, .swal2-select, .swal2-toast,
    .nav-pill, .mobile-nav-pill, .notification-bell-btn, .hdr-user, .about-features li, .dev-link, #rsInstallBtn, #rsPushBtn,
    .settings-card-icon, .control-group, .control-icon, .control-toggle-wrapper, .toggle-label-large, .toggle-slider-large,
    .stat-item-inline, .stat-item-icon, .stat-card-icon, .info-banner, .acct-note, .acct-eye, .chat-skel, .table-scroll-hint) {
    border-radius: var(--rs-radius) !important;
}
:is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select, textarea) { border-radius: var(--rs-radius) !important; }
.lte-card-tools button, .tabulator .tabulator-footer .tabulator-page { border-radius: var(--rs-radius) !important; }
.modal-header, .rs-sm-head { border-bottom-left-radius: 0 !important; border-bottom-right-radius: 0 !important; }

/* ---------- toggle switch (squared) + width guard ---------- */
.toggle { appearance: none; -webkit-appearance: none; width: 44px; height: 24px; border-radius: var(--rs-radius); background: var(--input-border); position: relative; cursor: pointer; transition: background .3s; border: none; outline: none; vertical-align: middle; flex: none; }
.toggle:checked { background: var(--navy-accent); }
.toggle::before { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 2px; background: #fff; transition: transform .3s; box-shadow: 0 1px 3px var(--shadow-hover); }
.toggle:checked::before { transform: translateX(20px); }
.toggle:focus-visible { outline: 2px solid var(--navy-accent); outline-offset: 2px; }
.toggle:disabled { opacity: .5; cursor: not-allowed; }
.form-group .toggle, .toggle-row .toggle { width: 44px; min-width: 44px; max-width: 44px; height: 24px; flex: 0 0 44px; padding: 0; }
.toggle-row { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.toggle-row label { margin: 0; cursor: pointer; }

/* ---------- file input — squared, navy button (overrides the 10px template rule) ---------- */
.file-input, .form-group .file-input { height: 44px; line-height: 42px; padding: 0; }
.file-input::file-selector-button { height: 42px; background: var(--navy-primary); color: #fff; border-right: 0; }
.file-input:hover::file-selector-button, .file-input::file-selector-button:hover { background: var(--navy-hover); color: #fff; }

/* ---------- feedback: top loading bar (reads) ---------- */
.top-loadbar { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 10001; overflow: hidden; pointer-events: none; }
.top-loadbar[hidden] { display: none; }
.top-loadbar > span { display: block; height: 100%; width: 38%; background: linear-gradient(90deg, transparent, var(--navy-accent), var(--navy-primary)); box-shadow: 0 0 8px rgba(var(--navy-accent-rgb), .5); animation: topLoadSlide 1.05s ease-in-out infinite; }
@keyframes topLoadSlide { 0% { transform: translateX(-105%); } 100% { transform: translateX(320%); } }

/* ---------- feedback: processing overlay (writes) ---------- */
.proc-ov { position: fixed; inset: 0; z-index: 3000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; background: rgba(var(--navy-primary-rgb), .72); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); animation: modalFade .16s ease-out; }
.proc-ov[hidden] { display: none; }
.proc-logo { width: 84px; height: 84px; border-radius: var(--rs-radius); object-fit: cover; background: #fff; box-shadow: 0 12px 34px var(--shadow-hover); animation: procPulse 1.5s ease-in-out infinite; }
.proc-bar { width: min(220px, 60vw); height: 4px; background: rgba(255, 255, 255, .25); overflow: hidden; }
.proc-bar i { display: block; width: 40%; height: 100%; background: var(--navy-accent); animation: procSlide 1.1s ease-in-out infinite; }
.proc-label { color: #fff; font-size: 14px; font-weight: 600; letter-spacing: .3px; }
@keyframes procPulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.06); opacity: .86; } }
@keyframes procSlide { 0% { transform: translateX(-110%); } 100% { transform: translateX(310%); } }

/* ---------- feedback: busy buttons ---------- */
.btn.is-busy, .head-btn.is-busy { cursor: progress; opacity: .8; }
.btn:disabled .fa-spinner, .head-btn:disabled .fa-spinner { opacity: 1; }
.act:disabled .fa-spinner { opacity: 1; }
.row-busy { opacity: .55; pointer-events: none; }

/* ---------- modal entrance ---------- */
@keyframes modalFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalRise { from { opacity: 0; transform: translateY(10px) scale(.99); } to { opacity: 1; transform: none; } }

/* ---------- empty state ---------- */
.rs-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 28px 16px; text-align: center; color: var(--text-muted); font-size: 14px; }
.rs-empty i { font-size: 30px; opacity: .45; }
.rs-empty b { color: var(--text-secondary); font-size: 15px; }

/* ---------- tabs strip ---------- */
.rs-tabs { display: flex; gap: 2px; margin: 0 0 16px; border-bottom: 2px solid var(--navy-primary); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.rs-tabs::-webkit-scrollbar { display: none; }
.rs-tab { flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 18px; border: 1px solid var(--border-color); border-bottom: 0; background: var(--bg-card); color: var(--text-secondary); font-family: inherit; font-size: 14px; font-weight: 600; white-space: nowrap; cursor: pointer; touch-action: manipulation; border-bottom-left-radius: 0 !important; border-bottom-right-radius: 0 !important; transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
.rs-tab:hover { color: var(--navy-accent); background: rgba(var(--navy-accent-rgb), .06); }
.rs-tab[aria-selected="true"] { background: var(--navy-primary); border-color: var(--navy-primary); color: #fff; }
.rs-tab:focus-visible { outline: 2px solid var(--navy-accent); outline-offset: -3px; }
.rs-tab .rs-tab-n { min-width: 20px; height: 18px; padding: 0 5px; display: inline-flex; align-items: center; justify-content: center; font-style: normal; font-size: 11px; font-weight: 700; background: rgba(var(--navy-accent-rgb), .14); color: var(--navy-accent); border-radius: var(--rs-radius); }
.rs-tab[aria-selected="true"] .rs-tab-n { background: rgba(255, 255, 255, .2); color: #fff; }
.rs-tab-panel[hidden] { display: none; }
.rs-tab-panel:focus-visible { outline: none; }

/* ---------- header page-actions mount (buttons flow inside .head-actions) ---------- */
.rs-page-actions { display: contents; }

/* ---------- chevron pipeline (status filter) ---------- */
.pipeline-stages { display: flex; width: 100%; margin-bottom: 14px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.pipeline-stages::-webkit-scrollbar { display: none; }
.pipeline-stage { flex: 1 1 0; min-width: 0; position: relative; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 12px 20px 12px 28px; border: 0; cursor: pointer; font-family: inherit; color: #fff; background: var(--navy-light); touch-action: manipulation; transition: filter var(--t-base), opacity var(--t-base); -webkit-clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 50%, calc(100% - 18px) 100%, 0 100%, 18px 50%); clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 50%, calc(100% - 18px) 100%, 0 100%, 18px 50%); }
.pipeline-stage + .pipeline-stage { margin-left: -14px; }
.pipeline-stage:first-child { padding-left: 16px; -webkit-clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 50%, calc(100% - 18px) 100%, 0 100%); clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 50%, calc(100% - 18px) 100%, 0 100%); }
.pipeline-stage:last-child { -webkit-clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 18px 50%); clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 18px 50%); }
.pipeline-stage:only-child { -webkit-clip-path: none; clip-path: none; }
.pipeline-stage:hover { filter: brightness(1.15); }
.pipeline-stage:focus-visible { outline: none; filter: brightness(1.3); text-decoration: underline; }
.pipeline-stage.active { filter: brightness(1.25); box-shadow: inset 0 -4px 0 rgba(255, 255, 255, .55); }
.pipeline-stage.pipeline-empty { opacity: .6; }
.pipeline-stage.pipeline-empty:hover { opacity: .85; }
.pipeline-stage-name { font-size: 11px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-transform: uppercase; letter-spacing: .3px; color: inherit; }
.pipeline-stage-count { font-size: 14px; font-weight: 800; white-space: nowrap; color: inherit; }
.pipeline-stage.pipe-navy   { background: var(--navy-primary); }
.pipeline-stage.pipe-accent { background: var(--navy-accent); }
.pipeline-stage.pipe-ok     { background: var(--success); }
.pipeline-stage.pipe-bad    { background: var(--danger); }
.pipeline-stage.pipe-wait   { background: var(--warning); color: var(--navy-dark); }
.pipeline-stage.pipe-muted  { background: var(--text-muted); }
@media (max-width: 992px) { .pipeline-stage { padding: 10px 16px 10px 24px; } .pipeline-stage-name { font-size: 10px; } .pipeline-stage-count { font-size: 12px; } }
@media (max-width: 768px) { .pipeline-stage { min-width: 104px; flex: 0 0 auto; padding: 10px 14px 10px 24px; } .pipeline-stage-name { font-size: 9.5px; } }

/* ---------- status pills (squared, tone by role) ---------- */
:is(.rs-pill, .tb-pill) { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; font-size: 11.5px; font-weight: 700; line-height: 1.4; white-space: nowrap; background: rgba(var(--navy-accent-rgb), .12); color: var(--navy-accent); }
:is(.rs-pill, .tb-pill) > i:empty { width: 6px; height: 6px; background: currentColor; }
:is(.rs-pill, .tb-pill).ok   { background: color-mix(in srgb, var(--success) 15%, transparent); color: color-mix(in srgb, var(--success) 75%, var(--text-primary)); }
:is(.rs-pill, .tb-pill).bad,
:is(.rs-pill, .tb-pill).off  { background: color-mix(in srgb, var(--danger) 13%, transparent); color: color-mix(in srgb, var(--danger) 80%, var(--text-primary)); }
:is(.rs-pill, .tb-pill).wait { background: color-mix(in srgb, var(--warning) 22%, transparent); color: color-mix(in srgb, var(--warning) 45%, var(--text-primary)); }
:is(.rs-pill, .tb-pill).muted { background: var(--border-light); color: var(--text-muted); }
:is(.rs-pill, .tb-pill).navy { background: var(--navy-primary); color: #fff; }

/* ---------- searchable dropdown / multi-select (vanilla port, .sd-*) ---------- */
.searchable-dropdown { position: relative; width: 100%; min-width: 0; }
.rs-native-select { display: none !important; }
.sd-trigger { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 44px; padding: 5px 10px 5px 12px; border: 2px solid var(--input-border); background: var(--input-bg); color: var(--text-primary); font-size: 16px; line-height: 1.3; cursor: pointer; user-select: none; touch-action: manipulation; transition: border-color var(--t-base), box-shadow var(--t-base); }
.searchable-dropdown.open .sd-trigger, .sd-trigger:focus-visible { outline: none; border-color: var(--navy-accent); box-shadow: 0 0 0 3px rgba(var(--navy-accent-rgb), .15); }
.sd-trigger.is-disabled { opacity: .6; cursor: not-allowed; background: var(--border-light); }
.sd-ico { color: var(--text-muted); font-size: 13px; flex: none; }
.sd-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sd-label.sd-placeholder { color: var(--text-muted); }
.sd-tags { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.sd-clear { flex: none; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; border: 0; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 13px; border-radius: var(--rs-radius); }
.sd-clear:hover { background: var(--border-light); color: var(--danger); }
.sd-clear[hidden] { display: none; }
.sd-arrow { flex: none; font-size: 11px; color: var(--text-muted); transition: transform var(--t-base); }
.searchable-dropdown.open .sd-arrow { transform: rotate(180deg); }
.sd-panel { position: fixed; z-index: 1100; display: flex; flex-direction: column; max-height: 300px; background: var(--bg-card); border: 2px solid var(--navy-accent); box-shadow: 0 8px 24px var(--shadow-hover); animation: modalFade .12s ease-out; }
.sd-search-wrap { position: relative; flex: none; border-bottom: 1px solid var(--border-color); }
.sd-search-wrap i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 13px; color: var(--text-muted); pointer-events: none; }
.sd-panel .sd-search { width: 100%; height: 42px; padding: 0 12px 0 34px; border: 0; outline: none; background: transparent; color: var(--text-primary); font-size: 16px; border-radius: 0 !important; }
.sd-list { overflow-y: auto; overscroll-behavior: contain; }
.sd-item { display: flex; align-items: center; gap: 8px; padding: 10px 12px; font-size: 14px; color: var(--text-primary); cursor: pointer; border-bottom: 1px solid var(--border-light); }
.sd-item small { margin-left: auto; font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.sd-item:hover, .sd-item.hl { background: rgba(var(--navy-accent-rgb), .1); }
.sd-item.selected { background: var(--navy-primary); color: #fff; }
.sd-item.selected small { color: rgba(255, 255, 255, .75); }
.sd-chk { flex: none; width: 16px; height: 16px; display: inline-flex; align-items: center; justify-content: center; border: 2px solid var(--input-border); font-size: 9px; color: transparent; border-radius: 2px; }
.sd-item.checked .sd-chk { background: var(--navy-accent); border-color: var(--navy-accent); color: #fff; }
.sd-empty { padding: 14px 12px; text-align: center; font-size: 13px; color: var(--text-muted); font-style: italic; }
.searchable-multi-tag { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 3px 4px 3px 8px; background: var(--navy-primary); color: #fff; font-size: 12px; font-weight: 600; line-height: 1.3; }
.searchable-multi-tag-remove { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; padding: 0; border: 0; background: transparent; color: #fff; opacity: .75; cursor: pointer; font-size: 11px; }
.searchable-multi-tag-remove:hover { opacity: 1; }
fieldset:disabled .sd-trigger { opacity: .75; cursor: default; background: var(--border-light); }
fieldset:disabled .sd-clear, fieldset:disabled .searchable-multi-tag-remove { display: none; }

/* ---------- 90% split popup ---------- */
body.rs-modal-open { overflow: hidden; }
.rs-split-ov { position: fixed; inset: 0; z-index: 1050; display: flex; align-items: center; justify-content: center; padding: 0; background: rgba(0, 0, 0, .6); animation: modalFade .16s ease-out; }
body.dark-mode .rs-split-ov { background: rgba(0, 0, 0, .8); }
.rs-split-modal { width: 90vw; height: 90vh; display: flex; flex-direction: column; overflow: hidden; background: var(--bg-card); box-shadow: 0 12px 44px var(--shadow-hover); animation: modalRise .2s var(--ease); }
.rs-sm-head { flex: none; display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 18px; background: var(--navy-primary); color: #fff; }
body.dark-mode .rs-sm-head { background: var(--navy-light); }
.rs-sm-head h3 { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; margin: 0; font-size: 18px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rs-sm-tools { display: flex; align-items: center; gap: 2px; flex: none; }
.rs-sm-tools .close-btn { width: 38px; height: 38px; font-size: 20px; }
.demo-seed-btn { opacity: .75; }
.demo-seed-btn:hover { opacity: 1; color: var(--warning); transform: none; }
.rs-sm-switch { display: none; }
.rs-sm-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 45fr) minmax(0, 55fr); }
.rs-split-modal.no-preview .rs-sm-body { grid-template-columns: minmax(0, 1fr); }
.rs-split-modal.no-preview .rs-sm-preview { display: none; }
.rs-sm-form { min-width: 0; overflow-y: auto; overscroll-behavior: contain; padding: 18px 20px 8px; border-right: 1px solid var(--border-color); container-type: inline-size; }
.rs-sm-preview { position: relative; min-width: 0; overflow: auto; overscroll-behavior: contain; padding: 16px; background: var(--rs-paper-bg); }
.rs-sm-stage { position: relative; margin: 0 auto; transition: opacity var(--t-base); }
.rs-sm-preview.is-loading .rs-sm-stage { opacity: .75; }
.rs-sm-frame { display: block; width: 794px; height: 1123px; border: 0; background: #fff; transform-origin: 0 0; box-shadow: 0 4px 18px var(--shadow-hover); }
.rs-sm-pstate { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 12px; margin-bottom: 12px; font-size: 13px; font-weight: 600; color: var(--text-secondary); background: var(--bg-card); border: 1px solid var(--border-color); }
.rs-sm-pstate[hidden] { display: none; }
.rs-sm-pstate.is-err { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.rs-sm-foot { flex: none; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 16px; border-top: 1px solid var(--border-color); background: var(--bg-card); }
.rs-sm-foot .rs-foot-spacer { flex: 1; }
.rs-sm-foot .btn { min-height: 42px; }
.rs-split-modal.is-ro .rs-sm-form { background: var(--bg-secondary); }
body.rs-preview-doc { margin: 0; padding: 0; background: #fff; overflow: hidden; }

/* ---------- form sections inside the popup (or any page form) ---------- */
.rs-fs { border: 0; margin: 0; padding: 0; min-width: 0; }
.rs-fsec { margin-bottom: 18px; }
.rs-fsec-h { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; padding-bottom: 7px; border-bottom: 2px solid var(--navy-primary); font-size: 13px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--navy-primary); }
.rs-fsec-h i { color: var(--navy-accent); }
.rs-fgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.rs-fgrid > .span-2 { grid-column: 1 / -1; }
.rs-form .form-group { margin-bottom: 14px; min-width: 0; }
.rs-form .form-group label { margin-bottom: 6px; font-size: 13.5px; font-weight: 600; }
.rs-form .form-group :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), textarea) { min-height: 44px; padding: 9px 12px; border-width: 2px; }
.rs-form .form-group textarea { min-height: 76px; resize: vertical; }
.rs-form .form-group input[readonly] { background: var(--border-light); color: var(--text-secondary); cursor: default; }
.rs-hint { display: flex; align-items: center; gap: 6px; margin-top: 5px; font-size: 12.5px; color: var(--text-muted); }
.rs-calc { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; padding: 8px 12px; border: 2px dashed var(--border-color); font-weight: 700; color: var(--navy-primary); font-variant-numeric: tabular-nums; }
.rs-calc.is-neg { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.form-group.has-error :is(input, textarea, .sd-trigger, .file-input) { border-color: var(--danger) !important; box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 14%, transparent); }
.rs-field-err { display: flex; align-items: center; gap: 6px; margin-top: 5px; font-size: 12.5px; font-weight: 600; color: var(--danger); }
@container (max-width: 460px) { .rs-fgrid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- line-items editor ---------- */
.rs-lines { border: 1px solid var(--border-color); background: var(--bg-card); }
.rs-lines-head, .rs-line { display: flex; align-items: stretch; gap: 6px; padding: 6px 8px; }
.rs-lines-head { background: var(--navy-primary); color: #fff; font-size: 11.5px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase; }
.rs-lines-head > *, .rs-line > .rs-cell { flex: 1 1 0; min-width: 0; }
.rs-lines-head > .w2, .rs-line > .w2 { flex-grow: 2; }
.rs-lines-head > .num, .rs-line > .num { text-align: right; }
.rs-lines-head > .rs-line-x, .rs-line > .rs-line-del { flex: 0 0 34px; }
.rs-line { border-top: 1px solid var(--border-light); }
.rs-line:nth-child(even) { background: var(--rs-row-alt); }
.rs-line .rs-cell :is(input, textarea) { width: 100%; min-height: 40px; padding: 7px 8px; border: 1px solid var(--input-border); background: var(--input-bg); color: var(--text-primary); font-family: inherit; }
.rs-line .rs-cell.num input { text-align: right; font-variant-numeric: tabular-nums; }
.rs-line .rs-cell .sd-trigger { min-height: 40px; border-width: 1px; }
.rs-line .rs-cell-out { display: flex; align-items: center; justify-content: flex-end; min-height: 40px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--navy-primary); }
.rs-line .rs-cell.is-warn :is(input, .rs-cell-out) { border-color: var(--warning); color: color-mix(in srgb, var(--warning) 50%, var(--text-primary)); }
.rs-line-del { display: inline-flex; align-items: center; justify-content: center; height: 40px; border: 0; background: transparent; color: var(--danger); cursor: pointer; font-size: 15px; border-radius: var(--rs-radius); }
.rs-line-del:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }
.rs-lines-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 8px; border-top: 1px solid var(--border-color); }
.rs-line-add { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 14px; border: 1px dashed var(--navy-accent); background: transparent; color: var(--navy-accent); font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer; border-radius: var(--rs-radius); }
.rs-line-add:hover { background: rgba(var(--navy-accent-rgb), .08); }
.rs-totals { display: grid; grid-template-columns: auto auto; gap: 4px 18px; margin-left: auto; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.rs-totals dt { color: var(--text-secondary); }
.rs-totals dd { margin: 0; text-align: right; font-weight: 700; color: var(--text-primary); }
.rs-totals .grand { font-size: 15.5px; color: var(--navy-primary); border-top: 2px solid var(--navy-primary); padding-top: 4px; }
@container (max-width: 520px) {
    .rs-lines-head { display: none; }
    .rs-line { flex-wrap: wrap; padding: 10px 8px; }
    .rs-line > .rs-cell { flex: 1 1 45%; }
    .rs-line > .rs-cell.w2 { flex-basis: 100%; }
    .rs-line > .rs-cell[data-label]::before { content: attr(data-label); display: block; margin-bottom: 3px; font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); }
    .rs-line > .rs-line-del { flex: 0 0 100%; justify-content: flex-end; height: 32px; }
}

/* ---------- Tabulator — navy skin, squared ---------- */
.rs-tb { position: relative; min-width: 0; }
.tb-table { margin-top: 4px; min-width: 0; }
.tabulator { background: var(--bg-card); border: 1px solid var(--border-color); font-size: 13px; overflow: hidden; }
.tabulator .tabulator-header { background: var(--navy-primary); border-bottom: 0; color: #fff; font-weight: 600; }
.tabulator .tabulator-header .tabulator-col { background: transparent; border-right: 1px solid rgba(255, 255, 255, .1); color: #fff; }
.tabulator .tabulator-header .tabulator-col .tabulator-col-content { padding: 0; }
.tabulator .tabulator-header .tabulator-col-title { font-size: 12.5px; letter-spacing: .3px; padding: 11px 10px; }
.tabulator .tabulator-header .tabulator-col.tabulator-sortable:hover { background: rgba(255, 255, 255, .08); }
.tabulator .tabulator-header .tabulator-col .tabulator-col-sorter .tabulator-arrow { border-bottom-color: rgba(255, 255, 255, .55); }
.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort="ascending"] .tabulator-col-sorter .tabulator-arrow { border-bottom-color: #fff; }
.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort="descending"] .tabulator-col-sorter .tabulator-arrow { border-top-color: #fff; border-bottom-color: transparent; }
.tabulator .tabulator-tableholder { background: var(--bg-card); }
.tabulator .tabulator-tableholder .tabulator-table { background: var(--bg-card); color: var(--text-primary); }
.tabulator-row { background: var(--bg-card); border-bottom: 1px solid var(--border-light); color: var(--text-primary); }
.tabulator-row.tabulator-row-even { background: var(--rs-row-alt); }
.tabulator-row.tabulator-selectable:hover, .tabulator-row:hover { background: var(--rs-row-hover); }
.tabulator-row.tabulator-selected, .tabulator-row.tabulator-selected:hover { background: rgba(var(--navy-accent-rgb), .14); }
.tabulator-row .tabulator-cell { border-right: 0; padding: 10px; color: var(--text-primary); }
.tabulator-row .tabulator-cell input[type="checkbox"], .tabulator .tabulator-header input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--navy-accent); cursor: pointer; }
.tabulator .tabulator-footer { background: var(--bg-secondary); border-top: 1px solid var(--border-color); color: var(--text-secondary); padding: 6px 10px; }
.tabulator .tabulator-footer .tabulator-page { border: 1px solid var(--border-color); background: var(--bg-card); color: var(--navy-primary); font-size: 12.5px; padding: 5px 10px; }
.tabulator .tabulator-footer .tabulator-page:not(:disabled):hover { background: rgba(var(--navy-accent-rgb), .1); color: var(--navy-accent); }
.tabulator .tabulator-footer .tabulator-page.active { background: var(--navy-primary); color: #fff; border-color: var(--navy-primary); }
.tabulator .tabulator-footer .tabulator-page:disabled { opacity: .45; }
.tabulator .tabulator-footer .tabulator-page-size { height: 32px; padding: 0 6px; border: 1px solid var(--border-color); background: var(--input-bg); color: var(--text-primary); font-size: 13px !important; }
.tabulator .tabulator-footer .searchable-dropdown { display: inline-block; width: 78px; vertical-align: middle; text-align: left; }
.tabulator .tabulator-footer .sd-trigger { min-height: 32px; padding: 2px 8px; border-width: 1px; font-size: 13px; }
.tabulator-responsive-collapse { padding: 6px 10px 10px; border-top: 1px dashed var(--border-color); }
.tabulator-responsive-collapse table { width: 100%; table-layout: fixed; font-size: 12.5px; }
.tabulator-responsive-collapse table td { padding: 4px 10px 4px 0; vertical-align: top; color: var(--text-primary); }
.tabulator-responsive-collapse table td:first-child { width: 110px; font-weight: 700; color: var(--text-secondary); white-space: normal; }
.tabulator-responsive-collapse .chip-row { min-width: 0; white-space: normal; }
.tabulator-responsive-collapse .chip-row .val { min-width: 0; overflow-wrap: anywhere; }
.tabulator .tabulator-header .tabulator-col:is([tabulator-field="_sel"], [tabulator-field="_rc"]) .tabulator-col-title { padding-left: 0; padding-right: 0; text-align: center; text-overflow: clip; }
.tabulator-row .tabulator-cell .tabulator-responsive-collapse-toggle { width: 22px; height: 22px; border-radius: var(--rs-radius); background: var(--navy-accent); }
/* tall html placeholder loops Tabulator's resize <-> reposition — absolute placement breaks the loop */
.tabulator .tabulator-tableholder .tabulator-placeholder { position: absolute; inset: 0; min-height: 180px; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.tabulator .tabulator-tableholder .tabulator-placeholder .tabulator-placeholder-contents { pointer-events: auto; color: var(--text-muted); font-size: 13px; }
.tabulator .tabulator-tableholder { min-height: 180px; }
.rs-tb.is-loading .tabulator-placeholder { visibility: hidden; }
.rs-tb-skel { position: absolute; left: 1px; right: 1px; z-index: 2; display: none; flex-direction: column; gap: 10px; padding: 14px; background: var(--bg-card); }
.rs-tb.is-loading .rs-tb-skel { display: flex; }
.rs-tb-skel .skeleton { height: 34px; }

/* filter toolbar + popovers */
.tb-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px; margin-bottom: 10px; background: var(--bg-card); border: 1px solid var(--border-color); }
.tb-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.tb-search { position: relative; display: flex; align-items: center; }
.tb-search > i { position: absolute; left: 12px; font-size: 13px; color: var(--text-muted); pointer-events: none; }
.tb-search input { width: 230px; height: 40px; padding: 0 12px 0 34px; border: 2px solid var(--input-border); background: var(--input-bg); color: var(--text-primary); font-family: inherit; font-weight: 500; transition: border-color var(--t-base), box-shadow var(--t-base); }
.tb-search input:focus { outline: none; border-color: var(--navy-accent); box-shadow: 0 0 0 3px rgba(var(--navy-accent-rgb), .14); }
.tb-sel { min-width: 150px; max-width: 200px; }
.tb-toolbar > .tb-tools:first-child { flex: 1 1 auto; }
.chip-table .chip-row .val { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tb-sel .sd-trigger { min-height: 40px; padding-top: 3px; padding-bottom: 3px; font-size: 14px; }
.tb-tbtn { display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 13px; border: 1px solid var(--border-color); background: var(--bg-card); color: var(--text-primary); font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; touch-action: manipulation; transition: all var(--t-fast); }
.tb-tbtn:hover { border-color: var(--navy-accent); color: var(--navy-accent); }
.tb-tbtn:focus-visible, .tb-bulk-btn:focus-visible { outline: 2px solid var(--navy-accent); outline-offset: 2px; }
.tb-tbtn.ghost { border-style: dashed; color: var(--text-muted); width: 100%; justify-content: center; margin-top: 6px; }
.tb-dot { min-width: 17px; height: 17px; padding: 0 5px; display: inline-flex; align-items: center; justify-content: center; background: var(--navy-accent); color: #fff; font-size: 10px; font-style: normal; font-weight: 700; border-radius: var(--rs-radius); }
.tb-dot[hidden] { display: none; }
.tb-pop { position: relative; }
.tb-pop-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; max-width: min(320px, 90vw); padding: 10px; background: var(--bg-card); border: 1px solid var(--border-color); box-shadow: 0 10px 28px var(--shadow-hover); z-index: 400; display: none; }
.tb-pop.open .tb-pop-menu { display: block; }
.tb-pop.pop-left .tb-pop-menu { right: auto; left: 0; }
.tb-pop-h { font-size: 10.5px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--text-muted); margin-bottom: 8px; }
.tb-pop-menu label { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 5px 2px; font-size: 12.5px; font-weight: 600; color: var(--text-secondary); }
.tb-pop-menu label.tb-chk { justify-content: flex-start; gap: 9px; padding: 7px 8px; font-size: 13px; cursor: pointer; }
.tb-pop-menu label.tb-chk:hover { background: var(--border-light); }
.tb-pop-menu :is(input[type="date"], input[type="number"], input[type="text"]) { width: 150px; height: 36px; padding: 0 8px; border: 1px solid var(--input-border); background: var(--input-bg); color: var(--text-primary); font-family: inherit; }
.tb-pop-menu input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--navy-accent); cursor: pointer; }

/* bulk bar */
.tb-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 8px 12px; margin-bottom: 10px; background: var(--bg-secondary); border: 1px solid var(--border-color); }
.tb-count { font-size: 12.5px; font-weight: 600; color: var(--text-muted); }
.tb-bulk { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tb-all { width: 18px; height: 18px; accent-color: var(--navy-accent); cursor: pointer; }
.tb-bulk-n { display: inline-flex; align-items: center; gap: 7px; margin-right: 4px; font-size: 12.5px; font-weight: 700; color: var(--navy-primary); }
.tb-bulk-btn { display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding: 6px 12px; border: 1px solid var(--border-color); background: var(--bg-card); color: var(--text-primary); font-family: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; touch-action: manipulation; transition: all var(--t-fast); }
.tb-bulk-btn:hover:not(:disabled) { border-color: var(--navy-accent); color: var(--navy-accent); }
.tb-bulk-btn.ok     { background: color-mix(in srgb, var(--success) 10%, transparent); border-color: color-mix(in srgb, var(--success) 35%, transparent); color: color-mix(in srgb, var(--success) 75%, var(--text-primary)); }
.tb-bulk-btn.warn   { background: color-mix(in srgb, var(--warning) 14%, transparent); border-color: color-mix(in srgb, var(--warning) 45%, transparent); color: color-mix(in srgb, var(--warning) 45%, var(--text-primary)); }
.tb-bulk-btn.danger { background: color-mix(in srgb, var(--danger) 10%, transparent); border-color: color-mix(in srgb, var(--danger) 35%, transparent); color: color-mix(in srgb, var(--danger) 80%, var(--text-primary)); }
.tb-bulk-btn.info   { background: rgba(var(--navy-accent-rgb), .1); border-color: rgba(var(--navy-accent-rgb), .3); color: var(--navy-accent); }
.tb-bulk-btn:disabled { opacity: .45; cursor: not-allowed; }

/* chip grouping on Tabulator */
.chip-table .tabulator { min-width: 900px; }
.chip-table .tabulator-col { text-align: center; font-weight: 700; white-space: nowrap; }
.chip-table .tabulator-row .tabulator-cell { padding: 6px 9px; font-size: 12.5px; vertical-align: middle; }
.chip-table .tabulator-cell .cell-stack, .chip-table .tabulator-cell .cell-title { max-width: 340px; }
.chip-table .tabulator-cell.ctr, .chip-table .tabulator-col.ctr, .chip-table .tabulator-cell.col-media { text-align: center; }
.chip-table .tabulator-cell.col-actions { white-space: nowrap; overflow: visible; }
.chip-table .tabulator-row.row-good .tabulator-cell { background: color-mix(in srgb, var(--success) 9%, var(--bg-card)) !important; }
.chip-table .tabulator-row.row-bad  .tabulator-cell { background: color-mix(in srgb, var(--danger) 8%, var(--bg-card)) !important; }
.chip-table .tabulator-row.row-wait .tabulator-cell { background: color-mix(in srgb, var(--warning) 12%, var(--bg-card)) !important; }
.tb-table.chip-table { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.chip-soft-red { background: color-mix(in srgb, var(--danger) 10%, var(--bg-card)); color: color-mix(in srgb, var(--danger) 85%, var(--text-primary)); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.cell-sub { font-size: 11.5px; color: var(--text-muted); white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.act-view  { background: var(--navy-primary); color: #fff; }
.act-view:hover { background: var(--navy-accent); }
.act-print { color: var(--navy-accent); font-size: 14px; }
.act-ok    { color: var(--success); font-size: 15px; }
.act-bad   { color: var(--danger); font-size: 15px; }
.act-print:hover, .act-ok:hover, .act-bad:hover, .act-view:hover { transform: scale(1.12); }
.act:focus-visible { outline: 2px solid var(--navy-accent); outline-offset: 1px; }
@media (max-width: 768px) {
    .chip-table .tabulator { min-width: 0; }
    .tabulator { font-size: 12.5px; }
    .tb-toolbar, .tb-bar { gap: 8px; padding: 8px; }
    .tb-tools { width: 100%; }
    .tb-search, .tb-search input { flex: 1 1 100%; width: auto; min-width: 0; }
    .tb-sel { flex: 1 1 140px; max-width: none; min-width: 0; }
    .tb-pop { flex: 0 0 auto; }
    .tb-bulk-btn { padding: 6px 10px; font-size: 12px; }
    .rs-tb .actions-cell { flex-wrap: wrap; gap: 4px; }
    .rs-tb .chip-row { gap: 8px; min-width: 0; }
    .rs-tb .chip { min-width: 64px; padding: 0 6px; }
    .rs-tb .tabulator-row .tabulator-cell { padding: 6px; }
    .tabulator-responsive-collapse table td:first-child { width: 84px; }
}

/* ---------- mobile: split popup goes full-screen with a Form | Preview switch ---------- */
@media (max-width: 767.98px) {
    .rs-split-modal { width: 100vw; height: 100vh; height: 100dvh; }
    .rs-sm-head { padding: 8px 8px 8px 14px; }
    .rs-sm-head h3 { font-size: 16px; }
    .rs-sm-switch { flex: none; display: flex; gap: 0; padding: 8px 10px; background: var(--bg-secondary); border-bottom: 1px solid var(--border-color); }
    .rs-seg-btn { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; border: 2px solid var(--navy-primary); background: var(--bg-card); color: var(--navy-primary); font-family: inherit; font-size: 14px; font-weight: 700; cursor: pointer; touch-action: manipulation; }
    .rs-seg-btn + .rs-seg-btn { border-left: 0; }
    .rs-seg-btn.is-on { background: var(--navy-primary); color: #fff; }
    .rs-sm-body { grid-template-columns: minmax(0, 1fr); }
    .rs-sm-form { border-right: 0; padding: 14px 14px 6px; }
    .rs-split-modal.show-preview .rs-sm-form, .rs-split-modal:not(.show-preview) .rs-sm-preview { display: none; }
    .rs-sm-preview { padding: 10px; }
    .rs-sm-foot { padding: 8px 10px; gap: 6px; }
    .rs-sm-foot .rs-foot-spacer { display: none; }
    .rs-sm-foot .btn { flex: 1 1 calc(50% - 6px); padding: 8px 10px; font-size: 13px; }
    .rs-fgrid { grid-template-columns: minmax(0, 1fr); }
    .rs-tab { padding: 0 14px; font-size: 13.5px; }
}

/* ---------- reduced motion: less movement, indicators still show ---------- */
@media (prefers-reduced-motion: reduce) {
    .proc-logo { animation: none; }
    .proc-bar i { animation-duration: 2.6s; }
    .top-loadbar > span { animation-duration: 2.4s; }
    .rs-split-ov, .rs-split-modal, .proc-ov, .sd-panel { animation: none; }
    .rs-tab, .pipeline-stage, .toggle, .toggle::before, .sd-arrow { transition: none; }
}

/* ---------- dark mode: the blanket span/div/label/h* colour rules lose to these ---------- */
body.dark-mode :is(.rs-tab, .head-btn, .pipeline-stage, .rs-seg-btn, .tb-tbtn, .tb-bulk-btn, .sd-trigger, .sd-item, .rs-pill, .tb-pill, .chip, .searchable-multi-tag, .btn) :is(span, div, label) { color: inherit !important; }
body.dark-mode .rs-sm-head h3, body.dark-mode .proc-label, body.dark-mode .rs-lines-head, body.dark-mode .rs-lines-head > *,
body.dark-mode .tabulator .tabulator-header .tabulator-col, body.dark-mode .tabulator .tabulator-header .tabulator-col-title,
body.dark-mode .searchable-multi-tag, body.dark-mode .sd-item.selected, body.dark-mode .tb-dot,
body.dark-mode .chip-navy, body.dark-mode .chip-green, body.dark-mode :is(.rs-pill, .tb-pill).navy { color: #fff !important; }
body.dark-mode .rs-fsec-h, body.dark-mode .tb-bulk-n, body.dark-mode .rs-calc, body.dark-mode .rs-line .rs-cell-out, body.dark-mode .rs-totals .grand { color: var(--navy-accent) !important; }
body.dark-mode .rs-fsec-h, body.dark-mode .rs-totals .grand, body.dark-mode .rs-tabs { border-color: var(--navy-accent); }
body.dark-mode .rs-tab[aria-selected="true"], body.dark-mode .rs-seg-btn.is-on { background: var(--navy-accent); border-color: var(--navy-accent); }
body.dark-mode .rs-seg-btn { border-color: var(--navy-accent); color: var(--navy-accent); }
body.dark-mode .rs-field-err { color: var(--danger) !important; }
body.dark-mode .sd-label.sd-placeholder, body.dark-mode .rs-hint, body.dark-mode .cell-sub { color: var(--text-muted) !important; }
body.dark-mode :is(.rs-pill, .tb-pill).ok   { color: color-mix(in srgb, var(--success) 70%, #fff) !important; }
body.dark-mode :is(.rs-pill, .tb-pill):is(.bad, .off) { color: color-mix(in srgb, var(--danger) 65%, #fff) !important; }
body.dark-mode :is(.rs-pill, .tb-pill).wait { color: var(--warning) !important; }
body.dark-mode :is(.rs-pill, .tb-pill):not(.ok):not(.bad):not(.off):not(.wait):not(.navy):not(.muted) { color: color-mix(in srgb, var(--navy-accent) 65%, #fff) !important; }
body.dark-mode .chip:is(.chip-teal, .chip-link, .chip-soft-navy, .chip-soft-green, .chip-soft-amber, .chip-soft-purple, .chip-soft-tan, .chip-soft-red) { filter: saturate(1.1); }
body.dark-mode .chip-teal { color: #0d7878 !important; }
body.dark-mode .chip-link { color: #0a66c2 !important; }
body.dark-mode .chip-soft-navy { color: #0b2545 !important; }
body.dark-mode .chip-soft-green { color: #1f8b4c !important; }
body.dark-mode .chip-soft-amber { color: #c4701a !important; }
body.dark-mode .chip-soft-purple { color: #6a1b9a !important; }
body.dark-mode .chip-soft-tan { color: #92520a !important; }
body.dark-mode .chip-soft-red { color: color-mix(in srgb, var(--danger) 85%, #000) !important; background: color-mix(in srgb, var(--danger) 18%, #fff); }
body.dark-mode .chip-row .val.val-amount { color: color-mix(in srgb, #d35400 70%, #fff) !important; }
body.dark-mode .chip-row .val.val-pos { color: color-mix(in srgb, var(--success) 70%, #fff) !important; }
body.dark-mode .chip-row .val.val-neg { color: color-mix(in srgb, var(--danger) 70%, #fff) !important; }
body.dark-mode .chip-row .val.val-navy { color: var(--text-primary) !important; }
body.dark-mode .chip-row .val.val-muted { color: var(--text-muted) !important; }
body.dark-mode .chip-row .val-box { color: #cbd5e1 !important; }
body.dark-mode .tabulator .tabulator-header { background: var(--navy-light); }
body.dark-mode .tabulator-row.tabulator-selected { background: rgba(var(--navy-accent-rgb), .22); }
body.dark-mode .chip-table .tabulator-row.row-good .tabulator-cell { background: color-mix(in srgb, var(--success) 14%, var(--bg-card)) !important; }
body.dark-mode .chip-table .tabulator-row.row-bad  .tabulator-cell { background: color-mix(in srgb, var(--danger) 14%, var(--bg-card)) !important; }
body.dark-mode .chip-table .tabulator-row.row-wait .tabulator-cell { background: color-mix(in srgb, var(--warning) 14%, var(--bg-card)) !important; }
body.dark-mode .file-input::file-selector-button { background: var(--navy-accent); }
body.dark-mode .pipeline-stage.pipe-navy { background: var(--navy-light); }

/* ---------- mobile safety: 360px, no sideways page scroll ---------- */
@media (max-width: 480px) {
    .main-content { overflow-x: hidden; }
    .rs-tab-panel, .rs-tb, .tb-table { max-width: 100%; }
}

/* ===== A4 print engine (print.php + popup preview) ===== */

/* A4 print engine — .a4-sheet is shared by the popup preview and print.php */
.a4-sheet {
    --paper: #ffffff;
    --ink: #1a1a1a;
    --ink-soft: #555555;
    --ink-faint: #8a8a8a;
    --rule: #cfcfcf;
    --rule-soft: #e6e6e6;
    --band: #f4f4f4;
    width: 210mm; min-height: 297mm; padding: 12mm;
    margin: 0 auto; background: var(--paper); color: var(--ink);
    box-shadow: 0 2px 14px var(--shadow-color); border-radius: 0;
    font: 10pt/1.45 "Segoe UI", Roboto, Arial, sans-serif;
    display: flex; flex-direction: column; gap: 5mm;
    text-align: left; -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.a4-sheet[data-orientation="landscape"] { width: 297mm; min-height: 210mm; }
.a4-sheet * { box-sizing: border-box; }
/* paper stays white in dark mode */
body.dark-mode .a4-sheet { color: var(--ink); background: var(--paper); }

.a4-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8mm; padding-bottom: 4mm; border-bottom: 2px solid var(--navy-primary); }
.a4-co { display: flex; gap: 4mm; align-items: flex-start; min-width: 0; }
.a4-logo { width: 16mm; height: 16mm; object-fit: contain; border-radius: 2px; flex: 0 0 16mm; }
.a4-co-name { font-size: 15pt; font-weight: 700; color: var(--navy-primary); line-height: 1.2; margin-bottom: 1mm; }
.a4-co-line { font-size: 8.5pt; color: var(--ink-soft); }
.a4-doc { text-align: right; min-width: 62mm; }
.a4-title {
    display: inline-block; font-size: 12.5pt; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
    color: #ffffff; background: var(--navy-primary); padding: 1.5mm 4mm; border-radius: 2px; margin-bottom: 2mm;
}
.a4-doc-meta { display: flex; justify-content: flex-end; gap: 3mm; font-size: 9pt; align-items: center; }
.a4-doc-meta span { color: var(--ink-faint); text-transform: uppercase; font-size: 7.5pt; letter-spacing: .05em; }
.a4-doc-meta b { color: var(--ink); font-weight: 600; }

.a4-status { display: inline-block; padding: .4mm 2.5mm; border-radius: 2px; font-size: 8pt; font-weight: 700; text-transform: uppercase; border: 1px solid currentColor; }
.a4-sheet .a4-status-approved { color: var(--success); }
.a4-sheet .a4-status-pending { color: var(--ink-soft); }
.a4-sheet .a4-status-rejected { color: var(--danger); }

.a4-kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: 1px solid var(--rule); border-radius: 2px; }
.a4-kv-wide { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.a4-kv-item { display: flex; flex-direction: column; padding: 2mm 3mm; border-bottom: 1px solid var(--rule-soft); border-right: 1px solid var(--rule-soft); min-width: 0; }
.a4-kv-item span { font-size: 7.5pt; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .05em; }
.a4-kv-item b { font-weight: 600; overflow-wrap: anywhere; }

.a4-table { width: 100%; border-collapse: collapse; font-size: 9pt; }
.a4-table th {
    background: var(--navy-primary); color: #ffffff; font-weight: 600; font-size: 8pt; text-transform: uppercase;
    letter-spacing: .04em; padding: 2mm 2.5mm; border: 1px solid var(--navy-primary);
}
.a4-table td { padding: 1.6mm 2.5mm; border: 1px solid var(--rule); vertical-align: top; overflow-wrap: anywhere; }
.a4-table tbody tr:nth-child(even) td { background: var(--band); }
.a4-table tfoot td { font-weight: 700; background: var(--band); border-top: 2px solid var(--navy-primary); }
.a4-table .a4-r { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.a4-table .a4-c { text-align: center; }
.a4-table .a4-l { text-align: left; }
.a4-table-voucher td:first-child { width: 10mm; }
.a4-table-voucher td:last-child { width: 40mm; }
.a4-table-report { font-size: 8.5pt; }
.a4-empty { color: var(--ink-faint); font-style: italic; }

.a4-amount { display: grid; grid-template-columns: 58mm 1fr; border: 1px solid var(--navy-primary); border-radius: 2px; }
.a4-amount > div { display: flex; flex-direction: column; padding: 2.5mm 3mm; }
.a4-amount span { font-size: 7.5pt; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .05em; }
.a4-amount-fig { background: var(--navy-primary); }
.a4-amount-fig span { color: rgba(255, 255, 255, .75); }
.a4-amount-fig b { color: #ffffff; font-size: 14pt; font-variant-numeric: tabular-nums; }
.a4-amount-words b { font-style: italic; font-weight: 600; }

.a4-note { margin: 0; font-size: 8.5pt; padding: 1.5mm 3mm; border-left: 3px solid var(--rule); background: var(--band); color: var(--ink-soft); }
.a4-note-ok { border-left-color: var(--success); }
.a4-note-warn { border-left-color: var(--warning); color: var(--ink); font-weight: 600; }
.a4-note-status { border-left-color: var(--navy-accent); }
.a4-thumb { margin: 0; }
.a4-thumb img { max-width: 60mm; max-height: 45mm; object-fit: contain; border: 1px solid var(--rule); border-radius: 2px; }

.a4-signs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6mm; margin-top: auto; padding-top: 12mm; }
.a4-signs-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.a4-signs-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.a4-sign { text-align: center; }
.a4-sign-name { height: 6.5mm; line-height: 5.5mm; font-size: 9pt; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-bottom: 1px solid var(--ink); padding-bottom: 1mm; }
.a4-sign-label { font-size: 8pt; color: var(--ink-soft); padding-top: 1mm; text-transform: uppercase; letter-spacing: .05em; }

.a4-foot { display: flex; justify-content: space-between; gap: 4mm; font-size: 7.5pt; color: var(--ink-faint); border-top: 1px solid var(--rule); padding-top: 2mm; }

/* print.php screen shell */
body.page-print { background: var(--bg-primary); min-height: 100vh; }
.print-toolbar {
    position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 10px 16px; background: var(--navy-primary); color: #ffffff; box-shadow: 0 2px 8px var(--shadow-color);
}
.print-toolbar-title { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.print-toolbar .btn { border-radius: 3px; touch-action: manipulation; }
.print-stage { padding: 24px 16px 48px; overflow-x: auto; }
.print-error { max-width: 480px; margin: 12vh auto; padding: 32px 24px; text-align: center; background: var(--bg-card); color: var(--text-primary); border: 1px solid var(--border-color); border-radius: 3px; }
.print-error i { font-size: 40px; color: var(--navy-accent); margin-bottom: 12px; }
.print-error h2 { font-size: 18px; font-weight: 600; }

/* sidebar: group parent pill pins to its own row (the li is as tall as its open submenu) and clears the + */
.sidebar-menu .nav-pill-parent { top: 23px; right: 40px; }
.sidebar-menu .submenu-toggle.open ~ .nav-pill-parent { display: none; }

/* print */
@page {
    size: A4 portrait; margin: 12mm;
    @bottom-right { content: "Page " counter(page) " of " counter(pages); font: 8pt Arial, sans-serif; color: #666666; }
}
@page a4land {
    size: A4 landscape; margin: 12mm;
    @bottom-right { content: "Page " counter(page) " of " counter(pages); font: 8pt Arial, sans-serif; color: #666666; }
}
@media print {
    html, body, body.page-print { background: #ffffff !important; margin: 0; padding: 0; min-height: 0; }
    body.page-print > :not(.print-stage) { display: none !important; }
    .print-stage { padding: 0; overflow: visible; }
    .a4-sheet {
        display: block; width: auto; min-height: 0; padding: 0; margin: 0; box-shadow: none;
        -webkit-print-color-adjust: exact; print-color-adjust: exact;
    }
    .a4-sheet[data-orientation="landscape"] { page: a4land; width: auto; min-height: 0; }
    .a4-sheet > * + * { margin-top: 4mm; } /* block flow in print, flex gaps don't fragment reliably */
    .a4-table thead { display: table-header-group; }
    .a4-table tfoot { display: table-row-group; } /* totals once, at the end */
    .a4-table tr, .a4-kv-item, .a4-amount, .a4-signs, .a4-sign, .a4-note, .a4-thumb { break-inside: avoid; page-break-inside: avoid; }
    .a4-head { break-after: avoid; }
    .a4-amount, .a4-signs { break-before: avoid; }
    .a4-signs { margin-top: 0; padding-top: 14mm; }
}

/* sites.php — site picker, budget grid bars */
body.page-sites .site-pick { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
body.page-sites .site-pick > label { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 600; color: var(--text-secondary); }
body.page-sites .site-pick .searchable-dropdown { flex: 1 1 280px; max-width: 440px; }
body.page-sites .site-pick-meta { font-size: 13px; color: var(--text-muted); }
body.page-sites .site-note { display: flex; align-items: center; gap: 6px; margin: 0 0 12px; font-size: 13px; color: var(--text-muted); }
body.page-sites .bud-used { display: flex; align-items: center; gap: 8px; width: 100%; }
body.page-sites .bud-used > span { min-width: 52px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
body.page-sites .bud-bar { flex: 1 1 auto; min-width: 60px; height: 10px; appearance: none; -webkit-appearance: none; border: 1px solid var(--border-color); border-radius: 0; background: var(--border-light); color: var(--success); overflow: hidden; }
body.page-sites .bud-bar::-webkit-progress-bar { background: var(--border-light); border-radius: 0; }
body.page-sites .bud-bar::-webkit-progress-value { background: var(--success); border-radius: 0; }
body.page-sites .bud-bar::-moz-progress-bar { background: var(--success); border-radius: 0; }
body.page-sites .bud-bar.wait::-webkit-progress-value { background: var(--warning); }
body.page-sites .bud-bar.wait::-moz-progress-bar { background: var(--warning); }
body.page-sites .bud-bar.bad::-webkit-progress-value { background: var(--danger); }
body.page-sites .bud-bar.bad::-moz-progress-bar { background: var(--danger); }
body.page-sites .tabulator-cell.bud-edit { cursor: text; box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--navy-accent) 45%, transparent); }
body.page-sites .site-total { margin-top: 4px; font-size: 14px; }
body.page-sites .site-total b { color: var(--text-primary); }
body.dark-mode.page-sites .site-total b { color: var(--navy-accent) !important; }
@media (max-width: 600px) { body.page-sites .site-pick .searchable-dropdown { max-width: none; flex-basis: 100%; } }

/* masters.php — category code caps, rate history chart + stats */
body.page-masters #cfCode { text-transform: uppercase; }
body.page-masters .toggle-row > span { font-size: 14px; color: var(--text-secondary); }
body.page-masters .mst-lock { font-weight: 600; color: var(--text-secondary); }
body.page-masters .mst-lock[hidden], body.page-masters .mst-chart-empty[hidden], body.page-masters .mst-chart[hidden] { display: none; }
body.page-masters .mst-stats { margin-bottom: 14px; }
body.page-masters .mst-chart { position: relative; height: 280px; padding: 8px; border: 1px solid var(--border-color); background: var(--bg-card); }
body.page-masters .mst-chart-empty { border: 1px dashed var(--border-color); }
@media (max-width: 600px) { body.page-masters .mst-chart { height: 220px; } }
/* parties — ledger picker bar + summary strip */
body.page-parties .pty-pick { display: flex; align-items: flex-end; gap: 10px 14px; flex-wrap: wrap; margin-bottom: 14px; }
body.page-parties .pty-pick > div { display: flex; flex-direction: column; gap: 4px; }
body.page-parties .pty-pick label { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 600; color: var(--text-secondary); }
body.page-parties .pty-pick-party { flex: 1 1 300px; max-width: 460px; }
body.page-parties .pty-pick-date { flex: 0 1 170px; }
body.page-parties .pty-pick-date input { width: 100%; min-height: 40px; }
body.page-parties .pty-clear { min-height: 40px; }
body.page-parties .pty-sum { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 14px; margin-bottom: 12px; padding: 10px 12px; border: 1px solid var(--border-color); background: var(--bg-card); }
body.page-parties .pty-sum[hidden] { display: none; }
body.page-parties .pty-part { white-space: normal; overflow-wrap: anywhere; }
body.page-parties .form-group.toggle-row { flex-direction: row; }
@media (max-width: 900px) { body.page-parties .pty-sum { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) {
    body.page-parties .pty-pick-party { max-width: none; flex-basis: 100%; }
    body.page-parties .pty-pick-date { flex: 1 1 calc(50% - 7px); }
    body.page-parties .pty-clear { flex: 1 1 100%; }
    body.page-parties .pty-sum { grid-template-columns: minmax(0, 1fr); }
}
/* party statement print — short columns never wrap, particulars takes the rest */
.a4-sheet[data-doc="party_statement"] .a4-table-stmt td:nth-child(-n+4) { white-space: nowrap; overflow-wrap: normal; }
.a4-sheet[data-doc="party_statement"] .a4-table-stmt td:nth-child(5) { width: 100%; }
/* inline active toggle — beat the 16px tabulator checkbox rule + the rounded input blanket */
body.page-parties .pty-pick > div { min-width: 0; }
body.page-parties .pty-pick .searchable-dropdown { width: 100%; min-width: 0; }
body.page-parties .toggle-row .toggle { height: 24px; min-height: 24px; max-height: 24px; padding: 0; }

/* kit: table toggles + totals row (shared by every list page) */
.tabulator-cell input.toggle { width: 44px; min-width: 44px; max-width: 44px; height: 24px; flex: 0 0 44px; border-radius: var(--rs-radius) !important; vertical-align: middle; } /* beat the 16px tabulator checkbox rule */
.tabulator .tabulator-footer .tabulator-calcs-holder { margin: -6px -10px 6px; width: calc(100% + 20px); } /* footer padding pushed totals right */
.tabulator-calcs-holder .tabulator-cell { font-weight: 700; }

/* accounts — type-driven form sections, statement summary, statement print widths */
body.page-accounts [data-types][hidden], body.page-accounts .acc-lock[hidden], body.page-accounts .acc-req[hidden] { display: none; }
body.page-accounts .form-group.toggle-row { flex-direction: row; align-items: center; }
body.page-accounts .toggle-row .toggle { height: 24px; min-height: 24px; max-height: 24px; padding: 0; }
body.page-accounts .acc-req { color: var(--danger); }
body.page-accounts .acc-sum { padding: 10px 12px; border: 1px solid var(--border-color); background: var(--bg-card); }
body.page-accounts .acc-words { display: flex; align-items: flex-start; gap: 8px; margin-top: 10px; font-size: 13px; font-weight: 600; color: var(--text-secondary); }
body.page-accounts .acc-words:empty { display: none; }
body.page-accounts .chip-table .cell-title { white-space: normal; overflow-wrap: anywhere; }
.a4-sheet[data-doc="account_statement"] .a4-table-stmt td:nth-child(-n+4) { white-space: nowrap; overflow-wrap: normal; }
.a4-sheet[data-doc="account_statement"] .a4-table-stmt :is(td, th):nth-child(5) { width: 16%; }
.a4-sheet[data-doc="account_statement"] .a4-table-stmt :is(td, th):nth-child(6) { width: 40%; }

/* cash book — range bar, summary strip, proof thumbs, b/f calc row, view timeline */
body.page-cash_book [data-for][hidden], body.page-cash_book .rs-hint[hidden], body.page-cash_book .cb-sum[hidden], body.page-cash_book .cb-note[hidden] { display: none; }
body.page-cash_book .cb-range { display: flex; align-items: flex-end; gap: 10px 14px; flex-wrap: wrap; margin-bottom: 12px; }
body.page-cash_book .cb-range > div { display: flex; flex-direction: column; gap: 4px; flex: 0 1 170px; min-width: 0; }
body.page-cash_book .cb-range label { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 600; color: var(--text-secondary); }
body.page-cash_book .cb-range input { width: 100%; min-height: 40px; }
body.page-cash_book .cb-range .btn { min-height: 40px; }
body.page-cash_book .cb-sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px 14px; margin-bottom: 12px; padding: 10px 12px; border: 1px solid var(--border-color); background: var(--bg-card); }
body.page-cash_book .cb-note { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; padding: 9px 12px; border: 1px solid color-mix(in srgb, var(--warning) 45%, transparent); background: color-mix(in srgb, var(--warning) 12%, var(--bg-card)); font-size: 13px; font-weight: 600; color: var(--text-primary); }
body.page-cash_book .cb-thumb { display: inline-block; width: 40px; height: 40px; border: 1px solid var(--border-color); overflow: hidden; vertical-align: middle; background: var(--border-light); }
body.page-cash_book .cb-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
body.page-cash_book .cb-pdf { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--danger); text-decoration: none; }
body.page-cash_book .cb-no-bf .tabulator-calcs-top { display: none; }
body.page-cash_book .tabulator-calcs-top .tabulator-cell { font-weight: 700; background: color-mix(in srgb, var(--navy-accent) 7%, var(--bg-card)); }
body.page-cash_book .rs-calc small { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; }
body.page-cash_book .cb-facts .cell-stack { max-width: none; }
body.page-cash_book .cb-proof-now { margin: 10px 0 0; font-weight: 600; }
body.page-cash_book .cb-tl { list-style: none; margin: 0 0 0 8px; padding: 0; border-left: 2px solid var(--border-color); }
body.page-cash_book .cb-tl li { position: relative; padding: 0 0 14px 18px; }
body.page-cash_book .cb-tl li > i { position: absolute; left: -9px; top: 1px; width: 16px; text-align: center; background: var(--bg-secondary); color: var(--navy-accent); font-size: 14px; }
body.page-cash_book .cb-tl li.is-ok > i { color: var(--success); }
body.page-cash_book .cb-tl li.is-bad > i { color: var(--danger); }
body.page-cash_book .cb-tl li.is-wait > i { color: var(--warning); }
body.page-cash_book .cb-tl b { display: block; font-size: 13.5px; color: var(--text-primary); }
body.page-cash_book .cb-tl span { font-size: 12.5px; color: var(--text-muted); }
body.page-cash_book .cb-tl p { margin: 4px 0 0; font-size: 13px; color: var(--text-secondary); }
body.page-cash_book .cb-view-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; padding-top: 12px; border-top: 1px solid var(--border-color); }
@media (max-width: 600px) {
    body.page-cash_book .cb-range > div { flex: 1 1 calc(50% - 7px); }
    body.page-cash_book .cb-range .btn { flex: 1 1 100%; }
    body.page-cash_book .cb-sum { grid-template-columns: minmax(0, 1fr); }
}
body.page-cash_book .cb-acts2 .actions-cell { flex-wrap: wrap; gap: 4px 6px; }
body.page-cash_book .cb-amt { display: flex; align-items: center; justify-content: flex-end; gap: 6px; font-size: 14px; font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
body.page-cash_book .cb-amt i { font-size: 11px; }

/* approvals — proof thumbs, amount, read-only popup facts + zoom, timeline */
body.page-approvals .ap-thumb { display: inline-block; width: 40px; height: 40px; border: 1px solid var(--border-color); overflow: hidden; vertical-align: middle; background: var(--border-light); }
body.page-approvals .ap-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
body.page-approvals .ap-pdf, body.page-approvals .ap-proof-pdf a { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--danger); text-decoration: none; }
body.page-approvals .ap-amt { text-align: right; font-size: 14px; font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--text-primary); }
body.page-approvals .ap-facts .cell-stack { max-width: none; }
body.page-approvals .ap-proof { display: block; position: relative; width: 100%; max-width: 360px; padding: 0; border: 1px solid var(--border-color); background: var(--border-light); cursor: zoom-in; }
body.page-approvals .ap-proof img { display: block; width: 100%; max-height: 260px; object-fit: contain; }
body.page-approvals .ap-proof span { position: absolute; right: 0; bottom: 0; display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; font-size: 12px; font-weight: 600; color: #fff; background: rgba(0, 31, 63, .78); }
body.page-approvals .ap-proof-none { margin: 0; font-size: 13px; color: var(--text-muted); }
body.page-approvals .ap-zoom { position: fixed; inset: 0; z-index: 12000; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0, 0, 0, .86); cursor: zoom-out; }
body.page-approvals .ap-zoom img { max-width: 100%; max-height: 100%; object-fit: contain; background: #fff; }
body.page-approvals .ap-zoom .close-btn { position: absolute; top: 12px; right: 12px; color: #fff; }
body.page-approvals .ap-tl { list-style: none; margin: 0 0 0 8px; padding: 0; border-left: 2px solid var(--border-color); }
body.page-approvals .ap-tl li { position: relative; padding: 0 0 14px 18px; }
body.page-approvals .ap-tl li > i { position: absolute; left: -9px; top: 1px; width: 16px; text-align: center; background: var(--bg-secondary); color: var(--navy-accent); font-size: 14px; }
body.page-approvals .ap-tl li.is-ok > i { color: var(--success); }
body.page-approvals .ap-tl li.is-bad > i { color: var(--danger); }
body.page-approvals .ap-tl li.is-wait > i { color: var(--warning); }
body.page-approvals .ap-tl b { display: block; font-size: 13.5px; color: var(--text-primary); }
body.page-approvals .ap-tl span { font-size: 12.5px; color: var(--text-muted); }
body.page-approvals .ap-tl p { margin: 4px 0 0; font-size: 13px; color: var(--text-secondary); }
@media (max-width: 767.98px) {
    body.page-approvals .rs-sm-foot { flex-wrap: wrap; }
    body.page-approvals .ap-proof { max-width: none; }
}

/* day close — wallet cards, denomination grid, view remarks, report widths */
body.page-day_close :is(.rs-fsec, .rs-hint, .dc-req, .dc-why)[hidden] { display: none; }
body.page-day_close .dc-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
body.page-day_close .dc-cards > .skeleton { height: 260px; }
body.page-day_close .dc-cards > .rs-empty { grid-column: 1 / -1; background: var(--bg-card); border: 1px solid var(--border-color); }
body.page-day_close .dc-card { display: flex; flex-direction: column; gap: 12px; min-width: 0; padding: 16px; background: var(--bg-card); border: 1px solid var(--border-color); border-top: 3px solid var(--navy-accent); box-shadow: 0 2px 6px var(--shadow-color); }
body.page-day_close .dc-card.is-blocked { border-top-color: var(--warning); }
body.page-day_close .dc-card-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
body.page-day_close .dc-card-t { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; }
body.page-day_close .dc-card-t .cell-title { font-size: 15px; overflow-wrap: anywhere; }
body.page-day_close .dc-card-bal { display: flex; flex-direction: column; align-items: flex-end; flex: none; }
body.page-day_close .dc-card-bal span { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; color: var(--text-muted); }
body.page-day_close .dc-card-bal b { font-size: 16px; color: var(--navy-primary); font-variant-numeric: tabular-nums; white-space: nowrap; }
body.page-day_close .dc-card-date { margin: 0; }
body.page-day_close .dc-card-date input { width: 100%; min-height: 40px; }
body.page-day_close .dc-card-figs .rs-empty { padding: 14px 8px; }
body.page-day_close .dc-card-foot { display: flex; flex-direction: column; gap: 8px; margin-top: auto; }
body.page-day_close .dc-card-foot .btn { width: 100%; justify-content: center; }
body.page-day_close .dc-why { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid color-mix(in srgb, var(--warning) 45%, transparent); background: color-mix(in srgb, var(--warning) 12%, var(--bg-card)); font-size: 12.5px; font-weight: 600; color: var(--text-primary); }
body.page-day_close .dc-book { display: grid; gap: 8px; padding: 10px 12px; border: 1px solid var(--border-color); background: var(--bg-card); }
body.page-day_close .dc-grid { border: 1px solid var(--border-color); }
body.page-day_close :is(.dc-grid-h, .dc-grid-r, .dc-grid-f) { display: grid; grid-template-columns: minmax(0, 1fr) 120px minmax(0, 1fr); align-items: center; gap: 10px; padding: 6px 12px; }
body.page-day_close .dc-grid-h { background: var(--navy-primary); color: #fff; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; }
body.page-day_close .dc-grid-h span:last-child, body.page-day_close .dc-sub { text-align: right; }
body.page-day_close .dc-grid-r + .dc-grid-r { border-top: 1px solid var(--border-color); }
body.page-day_close .dc-grid-r label { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 700; color: var(--text-primary); white-space: nowrap; }
body.page-day_close .dc-grid-r label i { color: var(--success); }
body.page-day_close .dc-grid-r input { width: 100%; min-height: 38px; text-align: right; font-size: 16px; touch-action: manipulation; }
body.page-day_close .dc-sub { font-variant-numeric: tabular-nums; color: var(--text-secondary); white-space: nowrap; }
body.page-day_close .dc-grid-f { border-top: 2px solid var(--navy-primary); background: color-mix(in srgb, var(--navy-accent) 7%, var(--bg-card)); font-weight: 700; }
body.page-day_close .dc-grid-f span { grid-column: 1 / 3; display: flex; align-items: center; gap: 8px; }
body.page-day_close .dc-grid-f b { text-align: right; font-size: 15px; color: var(--navy-primary); font-variant-numeric: tabular-nums; white-space: nowrap; }
body.page-day_close .rs-calc.is-ok { color: var(--success); border-color: color-mix(in srgb, var(--success) 45%, transparent); }
body.page-day_close .dc-rmk { margin-top: 12px; }
body.page-day_close .dc-req { color: var(--danger); }
body.page-day_close .dc-rmk-cell { max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.page-day_close .dc-view-rmk { margin: 0; padding: 10px 12px; border: 1px solid var(--border-color); background: var(--bg-card); font-size: 14px; color: var(--text-primary); white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 600px) {
    body.page-day_close .dc-cards { grid-template-columns: minmax(0, 1fr); }
    body.page-day_close :is(.dc-grid-h, .dc-grid-r, .dc-grid-f) { grid-template-columns: minmax(0, 1fr) 92px minmax(0, 1fr); gap: 8px; padding: 6px 8px; }
}
.a4-sheet[data-doc="daily_cash_report"] .a4-table-dcr td:nth-child(-n+3) { white-space: nowrap; overflow-wrap: normal; }
.a4-sheet[data-doc="daily_cash_report"] .a4-table-dcr :is(td, th):nth-child(5) { width: 40%; }
.a4-sheet[data-doc="daily_cash_report"] .a4-kv-dcr .a4-kv-item:is(:nth-child(4), :nth-child(6), :nth-child(7)) b { font-weight: 800; }

/* fund transfers — summary strip, amount, Confirm Receipt button, view facts + trail, voucher status tones */
body.page-transfers .trf-sum[hidden], body.page-transfers .rs-hint[hidden] { display: none; }
body.page-transfers .trf-sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px 14px; margin-bottom: 12px; padding: 10px 12px; border: 1px solid var(--border-color); background: var(--bg-card); }
body.page-transfers .trf-amt { font-size: 14px; font-weight: 800; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--navy-primary); }
body.dark-mode.page-transfers .trf-amt { color: var(--navy-accent); }
body.page-transfers .trf-confirm { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; min-height: 36px; margin-top: 6px; padding: 6px 10px; font-size: 13px; font-weight: 700; white-space: nowrap; touch-action: manipulation; }
body.page-transfers .trf-acts2 .actions-cell { flex-wrap: wrap; gap: 4px 6px; }
body.page-transfers .rs-calc small { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; }
body.page-transfers .trf-facts .cell-stack { max-width: none; }
body.page-transfers .trf-tl { list-style: none; margin: 0 0 0 8px; padding: 0; border-left: 2px solid var(--border-color); }
body.page-transfers .trf-tl li { position: relative; padding: 0 0 14px 18px; }
body.page-transfers .trf-tl li > i { position: absolute; left: -9px; top: 1px; width: 16px; text-align: center; background: var(--bg-secondary); color: var(--navy-accent); font-size: 14px; }
body.page-transfers .trf-tl li.is-ok > i { color: var(--success); }
body.page-transfers .trf-tl li.is-bad > i { color: var(--danger); }
body.page-transfers .trf-tl li.is-wait > i { color: var(--warning); }
body.page-transfers .trf-tl b { display: block; font-size: 13.5px; color: var(--text-primary); }
body.page-transfers .trf-tl span { font-size: 12.5px; color: var(--text-muted); }
body.page-transfers .trf-tl p { margin: 4px 0 0; font-size: 13px; color: var(--text-secondary); }
body.page-transfers .trf-view-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; padding-top: 12px; border-top: 1px solid var(--border-color); }
@media (max-width: 600px) {
    body.page-transfers .trf-sum { grid-template-columns: minmax(0, 1fr); }
    body.page-transfers .trf-view-acts .btn { flex: 1 1 100%; justify-content: center; }
}
.a4-sheet .a4-status-requested { color: var(--ink-soft); }
.a4-sheet .a4-status-sent { color: var(--warning); }
.a4-sheet .a4-status-received { color: var(--success); }

/* bills — summary strip, item register range, two-row line editor, totals, confirm received, view facts + payments, A4 bill table */
body.page-bills .bl-sum[hidden], body.page-bills .bl-note[hidden], body.page-bills .rs-hint[hidden] { display: none; }
body.page-bills .bl-sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px 14px; margin-bottom: 12px; padding: 10px 12px; border: 1px solid var(--border-color); background: var(--bg-card); }
body.page-bills .bl-note { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; padding: 9px 12px; border: 1px solid color-mix(in srgb, var(--warning) 45%, transparent); background: color-mix(in srgb, var(--warning) 12%, var(--bg-card)); font-size: 13px; font-weight: 600; color: var(--text-primary); }
body.page-bills .bl-range { display: flex; align-items: flex-end; gap: 10px 14px; flex-wrap: wrap; margin-bottom: 12px; }
body.page-bills .bl-range > div { display: flex; flex-direction: column; gap: 4px; flex: 0 1 170px; min-width: 0; }
body.page-bills .bl-range label { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 600; color: var(--text-secondary); }
body.page-bills .bl-range input { width: 100%; min-height: 40px; }
body.page-bills .bl-range .btn { min-height: 40px; }
body.page-bills .bl-acts2 .actions-cell { flex-wrap: wrap; gap: 4px 6px; }
body.page-bills .bl-lines .rs-lines-head { display: none; }
body.page-bills .bl-lines .rs-line { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)) 34px; gap: 8px; padding: 10px 8px; align-items: end; }
body.page-bills .bl-lines .rs-line > .bl-mat { grid-column: 1 / span 3; }
body.page-bills .bl-lines .rs-line > .bl-desc { grid-column: 4 / span 3; }
body.page-bills .bl-lines .rs-line > .rs-line-del { grid-column: 7; grid-row: 1; }
body.page-bills .bl-lines .rs-cell[data-label]::before { content: attr(data-label); display: block; margin-bottom: 3px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; color: var(--text-muted); }
body.page-bills .bl-line-note { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 12.5px; color: var(--text-muted); }
body.page-bills .bl-line-note:empty { display: none; }
body.page-bills :is(.bl-line-note, .bl-rcv-row .rs-hint) .is-warn, body.page-bills .bl-rcv-row .rs-hint.is-warn { color: color-mix(in srgb, var(--warning) 55%, var(--text-primary)); font-weight: 600; }
@container (max-width: 560px) {
    body.page-bills .bl-lines .rs-line { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    body.page-bills .bl-lines .rs-line > :is(.bl-mat, .bl-desc) { grid-column: 1 / -1; }
    body.page-bills .bl-lines .rs-line > .bl-line-note { order: 98; }
    body.page-bills .bl-lines .rs-line > .rs-line-del { order: 99; grid-column: 1 / -1; grid-row: auto; justify-self: end; width: 40px; height: 32px; }
}
body.page-bills .bl-totals dd.val-neg { color: var(--danger); }
body.page-bills .bl-rcv-row label small { margin-left: 6px; font-weight: 500; color: var(--text-muted); }
body.page-bills .bl-rcv-in { display: flex; gap: 8px; }
body.page-bills .bl-rcv-in input { flex: 1 1 auto; min-width: 0; }
body.page-bills .bl-rcv-in .btn { flex: 0 0 auto; min-height: 44px; touch-action: manipulation; }
body.page-bills .bl-facts .cell-stack { max-width: none; }
body.page-bills .bl-proof-now { margin: 10px 0 0; font-weight: 600; }
body.page-bills .bl-pays { list-style: none; margin: 0 0 0 8px; padding: 0; border-left: 2px solid var(--border-color); }
body.page-bills .bl-pays li { position: relative; padding: 0 0 14px 18px; }
body.page-bills .bl-pays li > i { position: absolute; left: -9px; top: 1px; width: 16px; text-align: center; background: var(--bg-secondary); color: var(--navy-accent); font-size: 14px; }
body.page-bills .bl-pays li.is-ok > i { color: var(--success); }
body.page-bills .bl-pays li.is-bad > i { color: var(--danger); }
body.page-bills .bl-pays li.is-wait > i { color: var(--warning); }
body.page-bills .bl-pays b { display: block; font-size: 13.5px; color: var(--text-primary); }
body.page-bills .bl-pays span { font-size: 12.5px; color: var(--text-muted); text-transform: capitalize; }
body.page-bills .bl-view-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; padding-top: 12px; border-top: 1px solid var(--border-color); }
@media (max-width: 600px) {
    body.page-bills .bl-sum { grid-template-columns: minmax(0, 1fr); }
    body.page-bills .bl-view-acts .btn { flex: 1 1 100%; justify-content: center; }
}
.a4-sheet:is([data-doc="bill"], [data-doc="grn"]) .a4-table-bill :is(td, th):nth-child(2) { width: 34%; }
.a4-sheet:is([data-doc="bill"], [data-doc="grn"]) .a4-table-bill td:nth-child(n+4) { white-space: nowrap; overflow-wrap: normal; }
.a4-sheet:is([data-doc="bill"], [data-doc="grn"]) .a4-table-bill td:nth-child(3) { overflow-wrap: normal; }
.a4-sheet .a4-status-unpaid { color: var(--warning); }
.a4-sheet .a4-status-partial { color: var(--navy-accent); }
.a4-sheet .a4-status-paid { color: var(--success); }
.a4-sheet .a4-status-cancelled { color: var(--danger); }

/* labour + equipment — summary strip, month pickers, amounts, trade grid, proof thumbs + zoom, view trail, A4 sheet tones */
:is(body.page-labour, body.page-equipment) :is(.ops-sum, .rs-hint, [data-hired], .rs-line-add, .rs-line-del)[hidden] { display: none; }
:is(body.page-labour, body.page-equipment) .ops-sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px 14px; margin-bottom: 12px; padding: 10px 12px; border: 1px solid var(--border-color); background: var(--bg-card); }
:is(body.page-labour, body.page-equipment) .ops-pick { display: flex; align-items: flex-end; gap: 10px 14px; flex-wrap: wrap; margin-bottom: 14px; }
:is(body.page-labour, body.page-equipment) .ops-pick > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
:is(body.page-labour, body.page-equipment) .ops-pick label { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 600; color: var(--text-secondary); }
:is(body.page-labour, body.page-equipment) .ops-pick-main { flex: 1 1 300px; max-width: 460px; }
:is(body.page-labour, body.page-equipment) .ops-pick-month { flex: 0 1 190px; }
:is(body.page-labour, body.page-equipment) .ops-pick-month input { width: 100%; min-height: 40px; font-size: 16px; }
:is(body.page-labour, body.page-equipment) .ops-pick .searchable-dropdown { width: 100%; min-width: 0; }
:is(body.page-labour, body.page-equipment) .ops-amt { font-size: 14px; font-weight: 800; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--navy-primary); }
body.dark-mode:is(.page-labour, .page-equipment) .ops-amt { color: var(--navy-accent); }
:is(body.page-labour, body.page-equipment) .ops-acts2 .actions-cell { flex-wrap: wrap; gap: 4px 6px; }
:is(body.page-labour, body.page-equipment) .rs-calc small { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; }
:is(body.page-labour, body.page-equipment) .rs-hint.is-warn { color: color-mix(in srgb, var(--warning) 55%, var(--text-primary)); font-weight: 600; }
@media (min-width: 768px) {
    body.page-labour .lab-lines .rs-lines-head > .num:nth-child(2), body.page-labour .lab-lines .rs-line > .rs-cell:nth-child(2) { flex: 0.7 1 0; }
    body.page-labour .lab-lines .rs-line .rs-cell.num input { padding: 7px 4px; }
}
body.page-labour .lab-lines .rs-totals dd { font-variant-numeric: tabular-nums; }
:is(body.page-labour, body.page-equipment) .ap-thumb { display: inline-block; width: 40px; height: 40px; border: 1px solid var(--border-color); overflow: hidden; vertical-align: middle; background: var(--border-light); }
:is(body.page-labour, body.page-equipment) .ap-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
:is(body.page-labour, body.page-equipment) :is(.ap-pdf, .ap-proof-pdf a) { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--danger); text-decoration: none; }
:is(body.page-labour, body.page-equipment) .ap-facts .cell-stack { max-width: none; }
:is(body.page-labour, body.page-equipment) .ap-proof { display: block; position: relative; width: 100%; max-width: 360px; padding: 0; border: 1px solid var(--border-color); background: var(--border-light); cursor: zoom-in; }
:is(body.page-labour, body.page-equipment) .ap-proof img { display: block; width: 100%; max-height: 260px; object-fit: contain; }
:is(body.page-labour, body.page-equipment) .ap-proof span { position: absolute; right: 0; bottom: 0; display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; font-size: 12px; font-weight: 600; color: #fff; background: rgba(0, 31, 63, .78); }
:is(body.page-labour, body.page-equipment) .ap-proof-none { margin: 0; font-size: 13px; color: var(--text-muted); }
:is(body.page-labour, body.page-equipment) .ap-zoom { position: fixed; inset: 0; z-index: 12000; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0, 0, 0, .86); cursor: zoom-out; }
:is(body.page-labour, body.page-equipment) .ap-zoom img { max-width: 100%; max-height: 100%; object-fit: contain; background: #fff; }
:is(body.page-labour, body.page-equipment) .ap-zoom .close-btn { position: absolute; top: 12px; right: 12px; color: #fff; }
:is(body.page-labour, body.page-equipment) .ap-tl { list-style: none; margin: 0 0 0 8px; padding: 0; border-left: 2px solid var(--border-color); }
:is(body.page-labour, body.page-equipment) .ap-tl li { position: relative; padding: 0 0 14px 18px; }
:is(body.page-labour, body.page-equipment) .ap-tl li > i { position: absolute; left: -9px; top: 1px; width: 16px; text-align: center; background: var(--bg-secondary); color: var(--navy-accent); font-size: 14px; }
:is(body.page-labour, body.page-equipment) .ap-tl li.is-ok > i { color: var(--success); }
:is(body.page-labour, body.page-equipment) .ap-tl li.is-bad > i { color: var(--danger); }
:is(body.page-labour, body.page-equipment) .ap-tl li.is-wait > i { color: var(--warning); }
:is(body.page-labour, body.page-equipment) .ap-tl b { display: block; font-size: 13.5px; color: var(--text-primary); }
:is(body.page-labour, body.page-equipment) .ap-tl span { font-size: 12.5px; color: var(--text-muted); }
:is(body.page-labour, body.page-equipment) .ap-tl p { margin: 4px 0 0; font-size: 13px; color: var(--text-secondary); }
@media (max-width: 767.98px) {
    :is(body.page-labour, body.page-equipment) .rs-sm-foot { flex-wrap: wrap; }
    :is(body.page-labour, body.page-equipment) .ap-proof { max-width: none; }
    :is(body.page-labour, body.page-equipment) .ops-pick-main { max-width: none; flex-basis: 100%; }
    :is(body.page-labour, body.page-equipment) .ops-pick-month { flex: 1 1 100%; }
    :is(body.page-labour, body.page-equipment) .ops-sum { grid-template-columns: minmax(0, 1fr); }
}
.a4-sheet .a4-status-verified { color: var(--success); }
.a4-sheet .a4-status-mixed { color: var(--warning); }
.a4-sheet .a4-cap { margin: 2mm 0 1mm; font-size: 8.5pt; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; color: var(--ink-soft); }
.a4-sheet .a4-table-lab td:nth-child(2), .a4-sheet .a4-table-hire td:nth-child(2) { white-space: normal; }
.a4-sheet .a4-table-hire td:first-child, .a4-sheet .a4-table-lab td:last-child { white-space: nowrap; }
.a4-sheet .a4-table-meter td { font-size: 11pt; font-weight: 700; font-variant-numeric: tabular-nums; }

/* diesel — AdminLTE info-box (shared: dashboard reuses it), summary strip, pay-via cards, live calc, slip thumbs, stock boxes, chart, A4 tones */
.info-box { display: flex; align-items: center; gap: 12px; min-height: 80px; padding: 12px; background: var(--bg-card); border: 1px solid var(--border-color); box-shadow: 0 2px 6px var(--shadow-color); min-width: 0; }
.info-box-icon { display: flex; align-items: center; justify-content: center; flex: 0 0 56px; width: 56px; height: 56px; font-size: 24px; color: #fff; border-radius: var(--rs-radius, 3px); }
.info-box-content { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.info-box-text { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .3px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.info-box-number { font-size: 20px; font-weight: 700; color: var(--navy-primary); font-variant-numeric: tabular-nums; }
.info-box-desc { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.dark-mode .info-box-number { color: var(--navy-accent); }
body.page-diesel :is(.dsl-sum, .dsl-note, .rs-hint, .dsl-flag, .dsl-chart, .rs-empty)[hidden] { display: none; }
body.page-diesel .dsl-sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px 14px; margin-bottom: 12px; padding: 10px 12px; border: 1px solid var(--border-color); background: var(--bg-card); }
body.page-diesel .dsl-note { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; padding: 9px 12px; border: 1px solid color-mix(in srgb, var(--warning) 45%, transparent); background: color-mix(in srgb, var(--warning) 12%, var(--bg-card)); font-size: 13px; font-weight: 600; color: var(--text-primary); }
body.page-diesel .dsl-range { display: flex; align-items: flex-end; gap: 10px 14px; flex-wrap: wrap; margin-bottom: 14px; }
body.page-diesel .dsl-range > div { display: flex; flex-direction: column; gap: 4px; flex: 0 1 170px; min-width: 0; }
body.page-diesel .dsl-range > .dsl-range-site { flex: 1 1 260px; max-width: 380px; }
body.page-diesel .dsl-range label { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 600; color: var(--text-secondary); }
body.page-diesel .dsl-range input { width: 100%; min-height: 40px; font-size: 16px; }
body.page-diesel .dsl-range .btn { min-height: 40px; touch-action: manipulation; }
body.page-diesel .dsl-range .searchable-dropdown { width: 100%; min-width: 0; }
body.page-diesel .dsl-boxes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
body.page-diesel .dsl-site-boxes { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); margin-bottom: 0; }
body.page-diesel .dsl-chart { position: relative; height: 300px; }
body.page-diesel .dsl-chart-empty { margin: 0; }
body.page-diesel fieldset.dsl-sec { min-width: 0; margin: 0 0 18px; padding: 0; border: 0; }
body.page-diesel .dsl-pay { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
body.page-diesel .dsl-pay-opt { display: flex; align-items: center; gap: 10px; margin: 0; padding: 10px 12px; border: 2px solid var(--border-color); background: var(--bg-card); cursor: pointer; touch-action: manipulation; }
body.page-diesel .dsl-pay-opt input { flex: 0 0 18px; width: 18px; height: 18px; margin: 0; accent-color: var(--navy-accent); }
body.page-diesel .dsl-pay-opt > i { font-size: 20px; color: var(--navy-accent); }
body.page-diesel .dsl-pay-opt span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
body.page-diesel .dsl-pay-opt b { color: var(--text-primary); }
body.page-diesel .dsl-pay-opt small { font-size: 12px; color: var(--text-muted); }
body.page-diesel .dsl-pay-opt:has(input:checked) { border-color: var(--navy-accent); background: color-mix(in srgb, var(--navy-accent) 8%, var(--bg-card)); }
body.page-diesel .dsl-calc { margin-left: 0; }
body.page-diesel .dsl-calc-wide { grid-template-columns: minmax(0, 1fr) auto; max-width: 520px; }
body.page-diesel .dsl-calc dd.val-neg { color: var(--danger); }
body.page-diesel .dsl-flag { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding: 9px 12px; border: 1px solid var(--border-color); font-size: 13px; font-weight: 600; color: var(--text-secondary); background: var(--bg-card); }
body.page-diesel .dsl-flag.is-bad { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); background: color-mix(in srgb, var(--danger) 8%, var(--bg-card)); }
body.page-diesel .dsl-thumb { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 1px solid var(--border-color); overflow: hidden; background: var(--border-light); color: var(--danger); font-size: 20px; }
body.page-diesel .dsl-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
body.page-diesel .dsl-noslip { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
body.page-diesel .dsl-facts .cell-stack { max-width: none; }
body.page-diesel .dsl-slip-now { margin: 10px 0 0; font-weight: 600; }
body.page-diesel .dsl-view-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; padding-top: 12px; border-top: 1px solid var(--border-color); }
@media (max-width: 1100px) { body.page-diesel .dsl-boxes:not(.dsl-site-boxes) { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 767.98px) {
    body.page-diesel .dsl-sum, body.page-diesel .dsl-boxes:not(.dsl-site-boxes) { grid-template-columns: minmax(0, 1fr); }
    body.page-diesel .dsl-range > div, body.page-diesel .dsl-range > .dsl-range-site { flex: 1 1 100%; max-width: none; }
    body.page-diesel .dsl-range .btn { flex: 1 1 100%; justify-content: center; }
    body.page-diesel .dsl-view-acts .btn { flex: 1 1 100%; justify-content: center; }
    body.page-diesel .dsl-chart { height: 240px; }
    body.page-diesel .rs-sm-foot { flex-wrap: wrap; }
}
.a4-sheet .a4-status-flagged, .a4-sheet .a4-status-rejected, .a4-sheet .a4-status-deleted { color: var(--danger); }
.a4-sheet .a4-table-dsl td { white-space: nowrap; }
.a4-sheet .a4-table-dsl td:nth-child(2) { white-space: normal; }

/* dashboard — filters, kpi sub-line, info grid, lte-card grid, compact tables, supervisor wait list, waiting-user state, welcome tour */
body.page-dashboard .db-filters { display: flex; align-items: flex-end; gap: 10px 14px; flex-wrap: wrap; margin-bottom: 16px; }
body.page-dashboard .db-filters > div { display: flex; flex-direction: column; gap: 4px; flex: 0 1 170px; min-width: 0; }
body.page-dashboard .db-filters > .db-f-site { flex: 1 1 260px; max-width: 380px; }
body.page-dashboard .db-filters label { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 600; color: var(--text-secondary); }
body.page-dashboard .db-filters input { width: 100%; min-height: 40px; font-size: 16px; }
body.page-dashboard .db-filters .btn { min-height: 40px; touch-action: manipulation; }
body.page-dashboard .db-filters .searchable-dropdown { width: 100%; min-width: 0; }
body.page-dashboard .small-box, body.page-dashboard .info-box, body.page-dashboard .lte-card, body.page-dashboard .tour-modal { border-radius: var(--rs-radius, 3px); }
body.page-dashboard .small-box .inner h3 { overflow: hidden; text-overflow: ellipsis; }
body.page-dashboard .db-sub { display: block; margin-top: 4px; font-size: 12px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.page-dashboard .db-skel { display: inline-block; width: 60%; height: .9em; vertical-align: middle; }
body.page-dashboard .db-skel-block { height: 180px; }
body.page-dashboard .db-info-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
body.page-dashboard a.db-ibox { color: inherit; text-decoration: none; transition: border-color .2s, transform .2s; }
body.page-dashboard a.db-ibox:hover { border-color: var(--navy-accent); transform: translateY(-2px); }
body.page-dashboard a.db-ibox:focus-visible { outline: 2px solid var(--navy-accent); outline-offset: 2px; }
body.page-dashboard .db-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
body.page-dashboard .db-grid-2 > .lte-card { min-width: 0; }
body.page-dashboard .db-count:not(:empty) { margin-left: 6px; padding: 1px 7px; font-style: normal; font-size: 12px; font-weight: 700; color: #fff; background: var(--navy-accent); border-radius: var(--rs-radius, 3px); }
body.page-dashboard .db-chart { position: relative; height: 280px; }
body.page-dashboard .db-chart .db-skel-block { position: absolute; inset: 0; height: auto; }
body.page-dashboard :is(.db-chart, .rs-empty)[hidden] { display: none; }
body.page-dashboard .db-tw { margin: 0; }
body.page-dashboard .db-table { font-size: 13px; }
body.page-dashboard .db-table th, body.page-dashboard .db-table td { padding: 8px 10px; text-align: left; vertical-align: top; border-color: var(--border-color); }
body.page-dashboard .db-table td:first-child { background: none; white-space: nowrap; }
body.page-dashboard .db-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
body.page-dashboard .db-table a { color: var(--navy-accent); font-weight: 600; text-decoration: none; }
body.page-dashboard .db-table a:hover { text-decoration: underline; }
body.page-dashboard .db-table .rs-pill { white-space: nowrap; }
body.page-dashboard .db-late { color: var(--warning); font-weight: 700; }
body.page-dashboard .db-wait { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border-color); }
body.page-dashboard .db-wait:last-child { border-bottom: 0; }
body.page-dashboard .db-wait-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
body.page-dashboard .db-wait-main b { font-size: 18px; color: var(--navy-primary); font-variant-numeric: tabular-nums; }
body.page-dashboard .db-wait-main span { font-size: 13px; color: var(--text-secondary); }
body.page-dashboard .db-wait .btn { flex: 0 0 auto; min-height: 44px; touch-action: manipulation; }
body.dark-mode.page-dashboard .db-wait-main b { color: var(--navy-accent); }
body.page-dashboard .db-waiting .rs-empty { padding: 48px 16px; }
body.page-dashboard .db-waiting .rs-empty span { max-width: 460px; }
body.page-dashboard .db-waiting-acts { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 10px; }
.tour-ov { z-index: 10002; }
.tour-modal { width: 100%; max-width: 430px; }
.tour-body { padding: 30px 26px 16px; text-align: center; }
.tour-ico { display: flex; align-items: center; justify-content: center; width: 74px; height: 74px; margin: 0 auto; font-size: 30px; color: #fff; background: linear-gradient(135deg, var(--navy-accent), var(--navy-primary)); border-radius: var(--rs-radius, 3px); box-shadow: 0 10px 26px rgba(var(--navy-accent-rgb), .35); }
.tour-title { margin: 14px 0 8px; font-size: 20px; color: var(--navy-primary); }
body.dark-mode .tour-title { color: var(--navy-accent); }
.tour-desc { margin: 0; font-size: 14px; line-height: 1.6; color: var(--text-secondary); }
.tour-dots { display: flex; justify-content: center; gap: 7px; margin-top: 18px; }
.tour-dots button { width: 10px; height: 10px; padding: 0; border: 0; background: var(--border-color); border-radius: var(--rs-radius, 3px); cursor: pointer; transition: width .2s, background .2s; }
.tour-dots button.on { width: 24px; background: var(--navy-accent); }
.tour-step { margin: 10px 0 0; font-size: 12px; color: var(--text-muted); }
.tour-foot { display: flex; justify-content: space-between; gap: 10px; padding: 0 26px 24px; }
.tour-foot .btn { min-height: 44px; touch-action: manipulation; }
@media (prefers-reduced-motion: reduce) { .tour-dots button, body.page-dashboard a.db-ibox { transition: none; } }
@media (max-width: 1100px) { body.page-dashboard .db-info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 991.98px) { body.page-dashboard .db-grid-2 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 767.98px) {
    body.page-dashboard .db-filters > div, body.page-dashboard .db-filters > .db-f-site { flex: 1 1 100%; max-width: none; }
    body.page-dashboard .db-filters .btn { flex: 1 1 100%; justify-content: center; }
    body.page-dashboard .db-info-grid { grid-template-columns: minmax(0, 1fr); }
    body.page-dashboard .db-chart { height: 240px; }
    body.page-dashboard .db-wait { flex-direction: column; align-items: stretch; }
    body.page-dashboard .db-wait .btn { justify-content: center; }
}

/* reports */
body.page-reports :is(.rpt-sum, .rpt-note, .rs-empty)[hidden] { display: none; }
body.page-reports .rpt-filters { display: flex; align-items: flex-end; gap: 10px 14px; flex-wrap: wrap; margin: 0 0 8px; }
body.page-reports .rpt-f { display: flex; flex-direction: column; gap: 4px; flex: 0 1 170px; min-width: 0; }
body.page-reports .rpt-f-wide { flex: 1 1 240px; max-width: 360px; }
body.page-reports .rpt-f label { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 600; color: var(--text-secondary); }
body.page-reports .rpt-f input { width: 100%; min-height: 40px; font-size: 16px; touch-action: manipulation; }
body.page-reports .rpt-f .searchable-dropdown { width: 100%; min-width: 0; }
body.page-reports .rpt-filters .btn { min-height: 40px; touch-action: manipulation; }
body.page-reports .rpt-hint { display: flex; align-items: flex-start; gap: 6px; margin: 0 0 12px; font-size: 12.5px; color: var(--text-muted); }
body.page-reports .rpt-hint i { margin-top: 2px; color: var(--navy-accent); }
body.page-reports .rpt-sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px 14px; margin-bottom: 12px; padding: 10px 12px; border: 1px solid var(--border-color); background: var(--bg-card); }
body.page-reports .rpt-note { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; padding: 9px 12px; border: 1px solid color-mix(in srgb, var(--warning) 45%, transparent); background: color-mix(in srgb, var(--warning) 12%, var(--bg-card)); font-size: 13px; font-weight: 600; color: var(--text-primary); }
body.page-reports .bud-used { display: flex; align-items: center; gap: 8px; width: 100%; }
body.page-reports .bud-used > span { min-width: 52px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
body.page-reports .bud-bar { flex: 1 1 auto; min-width: 60px; height: 10px; appearance: none; -webkit-appearance: none; border: 1px solid var(--border-color); border-radius: 0; background: var(--border-light); color: var(--success); overflow: hidden; }
body.page-reports .bud-bar::-webkit-progress-bar { background: var(--border-light); border-radius: 0; }
body.page-reports .bud-bar::-webkit-progress-value { background: var(--success); border-radius: 0; }
body.page-reports .bud-bar::-moz-progress-bar { background: var(--success); border-radius: 0; }
body.page-reports .bud-bar.wait::-webkit-progress-value { background: var(--warning); }
body.page-reports .bud-bar.wait::-moz-progress-bar { background: var(--warning); }
body.page-reports .bud-bar.bad::-webkit-progress-value { background: var(--danger); }
body.page-reports .bud-bar.bad::-moz-progress-bar { background: var(--danger); }
@media (max-width: 767.98px) {
    body.page-reports .rpt-sum { grid-template-columns: minmax(0, 1fr); }
    body.page-reports .rpt-f, body.page-reports .rpt-f-wide { flex: 1 1 100%; max-width: none; }
    body.page-reports .rpt-filters .btn { flex: 1 1 100%; justify-content: center; }
}
body.page-dashboard .db-note { display: flex; align-items: center; gap: 6px; margin: 10px 0 0; font-size: 12px; color: var(--text-muted); }
body.page-dashboard .db-note[hidden] { display: none; }
body.page-dashboard .small-box .inner h3 { font-size: clamp(22px, 2.1vw, 30px); }
body.page-dashboard .db-table td { white-space: nowrap; }
body.page-dashboard .db-table td.wrap { white-space: normal; min-width: 150px; }
body.page-dashboard .db-waiting-acts .btn { text-decoration: none; }
body.page-dashboard .db-waiting-acts i { font-size: inherit; opacity: 1; }
@media (max-width: 767.98px) {
    body.page-dashboard .db-table thead { display: none; }
    body.page-dashboard .db-table, body.page-dashboard .db-table tbody, body.page-dashboard .db-table tr { display: block; width: 100%; }
    body.page-dashboard .db-table tr { margin-bottom: 10px; border: 1px solid var(--border-color); }
    body.page-dashboard .db-table td, body.page-dashboard .db-table td.wrap { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; min-width: 0; padding: 7px 10px; border: 0; border-bottom: 1px solid var(--border-color); white-space: normal; text-align: right; }
    body.page-dashboard .db-table td:last-child { border-bottom: 0; }
    body.page-dashboard .db-table td::before { content: attr(data-l); flex: 0 0 auto; font-weight: 600; color: var(--text-secondary); text-align: left; }
    body.page-dashboard .db-table td[data-l=""]::before { content: none; }
    body.page-dashboard .db-table .db-v { min-width: 0; overflow-wrap: anywhere; }
}
/* dashboard — about page registry tables (group rows, left-aligned logic columns) */
.about-roles-table tr.about-group td { text-align: left; font-weight: 700; font-size: 13px; letter-spacing: .3px; text-transform: uppercase; color: var(--navy-primary); background: color-mix(in srgb, var(--navy-accent) 10%, var(--bg-card)); }
.about-roles-table tr.about-group td i { margin-right: 6px; color: var(--navy-accent); }
body.dark-mode .about-roles-table tr.about-group td { color: var(--navy-accent); }
.about-roles-table.about-logic td { text-align: left; vertical-align: top; line-height: 1.55; }
.about-roles-table.about-logic td:first-child { min-width: 170px; }
.about-roles-table.about-logic td:last-child { min-width: 180px; }
.about-roles-table.about-matrix td { white-space: nowrap; }
.about-roles-table .role-badge { white-space: nowrap; }

/* settings: revert-to-English button under the language picker */
.revert-lang-btn { margin-top: 8px; }

/* users: remove-photo row only in edit mode */
body.page-users .user-photo-remove[hidden] { display: none; }

/* ===== Header filters — kept last so page strip rules (same specificity) never win ===== */
/* header filter strips (moved in by app.js) — icon label + control, squared */
.head-filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; text-align: left; }
.head-filters:not([hidden]) { margin-right: 4px; }
.header .head-filters .hf-strip { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; }
.header .head-filters .hf-strip[hidden] { display: none; }
.header .head-filters .hf-strip > div { display: flex; flex-direction: row; align-items: stretch; gap: 0; flex: 0 0 auto; min-width: 0; max-width: none; }
.header .head-filters .hf-strip > div:has(.searchable-dropdown) { flex: 0 1 auto; }
.header .head-filters .hf-strip label {
    display: inline-flex; align-items: center; justify-content: center; flex: 0 0 34px; width: 34px; min-width: 34px;
    height: 38px; margin: 0; font-size: 0;
    border: 1px solid var(--input-border); border-right: 0; border-radius: 3px 0 0 3px;
    background: rgba(var(--navy-accent-rgb), 0.08); color: var(--navy-accent);
}
.header .head-filters .hf-strip label i { font-size: 14px; }
.header .head-filters .hf-strip input {
    flex: 0 0 140px; width: 140px; height: 38px; min-height: 38px; margin: 0; padding: 0 6px;
    border: 1px solid var(--input-border); border-radius: 0 3px 3px 0;
    background: var(--input-bg); color: var(--text-primary); font-family: inherit; font-size: 14px;
}
.header .head-filters .hf-strip .searchable-dropdown { flex: 0 1 230px; width: auto; min-width: 150px; }
.header .head-filters .hf-strip .sd-trigger { min-height: 38px; height: 38px; padding: 2px 10px; border-width: 1px; border-radius: 0 3px 3px 0; font-size: 14px; }
.header .head-filters .hf-strip .btn {
    display: inline-flex; align-items: center; justify-content: center; flex: 0 0 38px;
    width: 38px; height: 38px; min-height: 38px; padding: 0; gap: 0; font-size: 0;
    border: 1px solid rgba(var(--navy-accent-rgb), 0.28); border-radius: 3px;
    background: rgba(var(--navy-accent-rgb), 0.10); color: var(--navy-accent);
}
.header .head-filters .hf-strip .btn i { font-size: 14px; }
.header .head-filters .hf-strip .btn:hover { background: rgba(var(--navy-accent-rgb), 0.2); border-color: var(--navy-accent); }
body.dark-mode .header .head-filters .hf-strip input { color-scheme: dark; }
/* filters with no header yet (before app.js runs) stay out of the page body */
[data-head-filter]:not(.hf-strip) { display: none !important; }
@media (max-width: 768px) {
    .head-filters, .header .head-filters .hf-strip { width: 100%; }
    .header .head-filters .hf-strip > div { flex: 1 1 calc(50% - 4px); }
    .header .head-filters .hf-strip > div:has(.searchable-dropdown) { flex-basis: 100%; }
    .header .head-filters .hf-strip input { flex: 1 1 auto; width: auto; min-width: 0; font-size: 16px; }
    .header .head-filters .hf-strip .searchable-dropdown { width: auto; flex: 1 1 auto; min-width: 0; }
    .header .head-filters .hf-strip .sd-trigger { font-size: 16px; }
}
