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

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

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

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

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

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

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

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

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

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

/* ===== Sidebar ===== */
.sidebar {
    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);
}

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

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

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

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

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

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

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

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

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

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

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

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

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

/* a table must stay a table — a flex/grid display on it makes the browser
   wrap the rows in an anonymous shrink-to-fit table (collapsed narrow header) */
table.dataTable,
table.doc-list {
    display: table !important;
}

/* toolbar row: [exports] .......... [show N] [search] , then table, then info + pages */
.dataTables_wrapper {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.dataTables_wrapper > * {
    flex: 0 0 100%;
}

.dt-buttons {
    order: 1;
    flex: 0 1 auto;
    margin-right: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.dataTables_length {
    order: 2;
    flex: 0 0 auto;
    float: none !important;
}

.dataTables_filter {
    order: 3;
    flex: 0 0 auto;
    float: none !important;
}

.dataTables_wrapper > table.dataTable,
.dataTables_wrapper > .dataTables_scroll {
    order: 4;
    margin: 0 !important;
}

.dataTables_info {
    order: 5;
    flex: 1 1 auto;
    float: none !important;
    padding-top: 0 !important;
    color: var(--text-muted);
    font-size: 13px;
}

.dataTables_paginate {
    order: 6;
    flex: 0 0 auto;
    float: none !important;
    margin-top: 0 !important;
    padding-top: 0 !important;
}

.dt-button {
    background: var(--navy-primary) !important;
    color: white !important;
    border: none !important;
    padding: 10px 16px !important;
    border-radius: 3px !important;
    font-size: 14px !important;
    font-weight: 500;
    margin: 0 !important;
    cursor: pointer !important;
    min-height: 40px;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background 0.2s, transform 0.2s;
}

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

/* search + page-length inputs match the app's form controls */
.dataTables_filter label,
.dataTables_length label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 14px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.dataTables_filter input,
.dataTables_length select {
    margin: 0 !important;
    padding: 9px 12px;
    min-height: 40px;
    border: 1px solid var(--input-border);
    border-radius: 3px;
    background: var(--input-bg);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.dataTables_filter input {
    min-width: 220px;
}

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

/* sort arrows sit on the navy header — keep them light */
table.dataTable thead th:before,
table.dataTable thead th:after {
    color: #fff !important;
}

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

table.dataTable td.dataTables_empty {
    text-align: center !important;
    padding: 28px 14px !important;
    color: var(--text-muted) !important;
}

.dataTables_paginate .paginate_button {
    padding: 7px 13px !important;
    margin-left: 4px !important;
    border: 1px solid var(--border-light) !important;
    border-radius: 3px !important;
    background: var(--bg-card) !important;
    color: var(--text-secondary) !important;
    cursor: pointer;
}

.dataTables_paginate .paginate_button.current {
    background: var(--navy-accent) !important;
    border-color: var(--navy-accent) !important;
    color: #fff !important;
}

.dataTables_paginate .paginate_button:hover:not(.disabled) {
    background: var(--navy-primary) !important;
    border-color: var(--navy-primary) !important;
    color: #fff !important;
}

.dataTables_paginate .paginate_button.disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

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

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

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

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

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

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

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

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

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

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

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

/* ===== 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 Sections (flat nav, no dropdowns) ===== */
.nav-section + .nav-section {
    margin-top: 16px;
}

.sidebar-menu-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    padding: 0 6px;
    font-size: 11px;
    letter-spacing: 1.2px;
}

.sidebar-menu-title i {
    font-size: 11px;
    opacity: 0.85;
}

.sidebar-menu-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255,255,255,0.14);
}

/* denser rows — the flat list is long */
.sidebar-menu a {
    padding: 11px 14px;
    font-size: 14.5px;
    gap: 12px;
}

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

.sidebar-menu a:hover {
    transform: translateX(3px);
}

.sidebar-menu a.active {
    position: relative;
}

.sidebar-menu a.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 7px;
    bottom: 7px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: #fff;
}

/* menu scrolls by itself — logo/theme/logout stay pinned */
.sidebar-menu-section {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.2) transparent;
}

.sidebar-menu-section::-webkit-scrollbar {
    width: 6px;
}

.sidebar-menu-section::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 3px;
}

.sidebar-menu-section::-webkit-scrollbar-track {
    background: transparent;
}

/* collapsed — heading shrinks to its icon, sections still readable */
.sidebar.collapsed .sidebar-menu-title {
    display: flex;
    justify-content: center;
    padding: 0;
    margin-bottom: 4px;
    opacity: 0.5;
}

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

.sidebar.collapsed .nav-section + .nav-section {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,0.12);
}

/* collapsed tooltip — fixed, so the scrolling menu can't clip it */
.sidebar-tip {
    position: fixed;
    z-index: 1200;
    transform: translateY(-50%);
    background: var(--navy-dark);
    color: #fff;
    padding: 7px 12px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: 0 4px 14px rgba(0,0,0,0.35);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease;
    pointer-events: none;
}

.sidebar-tip.show {
    opacity: 1;
    visibility: visible;
}

@media (max-width: 768px) {
    /* drawer is full width on mobile — headings stay full */
    .sidebar.collapsed .sidebar-menu-title {
        display: flex !important;
        justify-content: flex-start;
        padding: 0 6px;
        opacity: 1;
    }

    .sidebar.collapsed .sidebar-menu-title span {
        display: inline !important;
    }

    .sidebar.collapsed .sidebar-menu-title::after {
        display: block;
    }

    .sidebar.collapsed .nav-section + .nav-section {
        border-top: none;
        padding-top: 0;
        margin-top: 16px;
    }

    .sidebar-tip {
        display: none;
    }
}

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

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

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

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

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

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

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

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

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

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

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

    .dataTables_paginate {
        padding-top: 15px;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    .filters-grid {
        gap: 12px;
    }

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

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

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

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

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

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

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

    .header {
        padding: 12px;
    }

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

    .data-section {
        padding: 12px;
    }

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

    .stat-card {
        padding: 15px;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    .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,
    .dt-buttons {
        display: none !important;
    }

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

    .app-container {
        display: block;
    }
}

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

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

body.dark-mode p,
body.dark-mode span:not(.status-badge):not(.role-badge):not(.version-badge):not(.upload-badge):not(.status-pill):not(.points-chip),
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-select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.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-upload-btn {
    margin: 0;
    cursor: pointer;
    font-size: 13px;
    padding: 8px 16px;
}
.logo-file-name {
    color: var(--text-muted);
    font-size: 13px;
}
.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: 1300; /* theme + language menus, same layer as the bell dropdown */
    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; }

/* 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 lives at the very END of this file — it has to out-order every
   component display rule (.store-grid, .file-grid, …) or it silently stops hiding. */

/* ===== Select2 Theme Integration ===== */
.select2-container {
    width: 100% !important;
}

.select2-container--default .select2-selection--single {
    height: 42px;
    border: 1px solid var(--input-border);
    border-radius: 6px;
    background: var(--input-bg);
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 40px;
    color: var(--text-primary);
    padding-left: 12px;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 40px;
}

.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: var(--text-muted);
}

.select2-dropdown {
    background: var(--bg-secondary);
    border: 1px solid var(--input-border);
    border-radius: 6px;
    z-index: 10060;
}

.select2-container--default .select2-search--dropdown .select2-search__field {
    border: 1px solid var(--input-border);
    border-radius: 4px;
    padding: 6px 10px;
    background: var(--input-bg);
    color: var(--text-primary);
}

/* Select2 4.1 renamed its state hooks: options gained --selectable and the selected
   one is --selected instead of [aria-selected=true]. Match BOTH spellings so the theme
   survives either version, and always set colour WITH a background so no state can end
   up rendering text on its own colour. */
.select2-container--default .select2-results__option,
.select2-container--default .select2-results__option--selectable {
    padding: 8px 12px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

.select2-container--default .select2-results__option[aria-selected=true],
.select2-container--default .select2-results__option--selected {
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

/* highlighted always wins, including when it is also the selected row */
.select2-container--default .select2-results__option--highlighted,
.select2-container--default .select2-results__option--highlighted[aria-selected],
.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable,
.select2-container--default .select2-results__option--highlighted.select2-results__option--selected {
    background-color: var(--navy-accent);
    color: #fff;
}

/* group headers + disabled rows stay legible instead of inheriting a blank pairing */
.select2-container--default .select2-results__option--group,
.select2-container--default .select2-results__option[aria-disabled=true],
.select2-container--default .select2-results__option--disabled {
    background-color: var(--bg-secondary);
    color: var(--text-muted);
}

body.dark-mode .select2-container--default .select2-selection--single {
    background: var(--input-bg);
    border-color: var(--input-border);
}

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

body.dark-mode .select2-container--default .select2-search--dropdown .select2-search__field {
    background: var(--input-bg);
    border-color: var(--input-border);
    color: var(--text-primary);
}

body.dark-mode .select2-container--default .select2-results__option,
body.dark-mode .select2-container--default .select2-results__option--selectable {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

body.dark-mode .select2-container--default .select2-results__option[aria-selected=true],
body.dark-mode .select2-container--default .select2-results__option--selected {
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

body.dark-mode .select2-container--default .select2-results__option--highlighted,
body.dark-mode .select2-container--default .select2-results__option--highlighted.select2-results__option--selectable,
body.dark-mode .select2-container--default .select2-results__option--highlighted.select2-results__option--selected {
    background-color: var(--navy-accent);
    color: #fff;
}

/* ===== 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 ===== */
.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.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: 1300; /* above any positioned page content, below modals (1400) */
    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.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;
}

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

/* ===== young books role badges + status pills ===== */
/* .role-badge base already defined above (~line 5574) - reused as-is, just adding tyb role colors */
.role-badge.role-super-admin { background: #7C3AED; color: #fff; }
.role-badge.role-admin { background: #155724; color: #fff; } /* overrides legacy pastel admin variant for tyb 9-role set */
.role-badge.role-tyb-member { background: #0EA5E9; color: #04283e; } /* dark text - white fails contrast on sky blue */
.role-badge.role-author { background: #0074D9; color: #fff; }
.role-badge.role-collab-team-admin { background: #F59E0B; color: #212529; } /* dark text - white fails contrast on amber */
.role-badge.role-collaborator { background: #D97706; color: #212529; } /* dark text - low contrast w/ white */
.role-badge.role-collab-team-member { background: #B45309; color: #fff; }
.role-badge.role-support { background: #DC3545; color: #fff; }
.role-badge.role-customer { background: #6B7280; color: #fff; }

/* status pill - user active/suspended/pending state */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.status-pill::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}
.status-pill.status-active { background: rgba(52, 168, 83, 0.12); color: var(--success); }
.status-pill.status-suspended { background: rgba(234, 67, 53, 0.12); color: var(--danger); }
.status-pill.status-pending { background: rgba(251, 188, 4, 0.15); color: var(--warning); }

/* points balance chip - coin icon + qty */
.points-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    background: rgba(0, 116, 217, 0.1);
    color: var(--navy-accent);
    font-size: 12px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.points-chip i { font-size: 11px; }

/* header install / enable-alerts icon buttons — stay hidden until actionable */
.header-tool-btn[hidden] { display: none !important; }

/* merged curved page header — breadcrumb strip sits on top of the title/tools bar as ONE rounded card.
   breadcrumb = top of card (curved top), .header = bottom (curved bottom); same bg, no seam, single bottom shadow */
.main-content > .breadcrumb {
    background: var(--bg-card);
    margin: 0;
    padding: 14px 22px 4px 22px;
    border-radius: 18px 18px 0 0;
    transition: background-color 0.3s ease;
}
.main-content > .header {
    border-radius: 0 0 18px 18px;
    margin-top: 0;
}
/* if a page ever has a .header with no breadcrumb above it, keep it fully curved */
.main-content > .header:first-child { border-radius: 18px; }

/* =====================================================================
   Phase 2 — books + Canva editor
   ===================================================================== */

/* ---------- Books list ---------- */
.book-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

/* status filter chip row above the books table */
.book-status-filters {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.status-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    cursor: pointer;
    user-select: none;
    transition: all 0.3s;
}
.status-chip:hover {
    border-color: var(--navy-accent);
    color: var(--navy-accent);
}
.status-chip.active {
    background: var(--navy-primary);
    border-color: var(--navy-primary);
    color: #fff;
    box-shadow: 0 2px 6px var(--shadow-color);
}
/* active chip tints to match its own status color */
.status-chip.active[data-status="draft"]      { background: var(--text-secondary); border-color: var(--text-secondary); }
.status-chip.active[data-status="in_review"]  { background: var(--warning); border-color: var(--warning); color: #212529; }
.status-chip.active[data-status="approved"]   { background: var(--navy-accent); border-color: var(--navy-accent); }
.status-chip.active[data-status="published"]  { background: var(--success); border-color: var(--success); }
.status-chip.active[data-status="rejected"]   { background: var(--danger); border-color: var(--danger); }
.status-chip.active[data-status="archived"]   { background: var(--text-muted); border-color: var(--text-muted); }

/* cover thumb in books table */
.book-cover-thumb {
    display: block;
    width: 34px;
    height: 48px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    flex-shrink: 0;
}

/* title cell - cover + title/subtitle stack */
.book-title-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}
.book-title-cell strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}
.book-title-cell span {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* book status badge - base + 6 colored variants (tinted bg, readable text both themes) */
.book-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}
.book-status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}
.book-status-draft     { background: rgba(108, 117, 125, 0.15); color: var(--text-secondary); } /* gray */
.book-status-in_review { background: rgba(251, 188, 4, 0.18); color: #8a5a00; } /* amber - dark text, white fails on light bg */
.book-status-approved  { background: rgba(0, 116, 217, 0.12); color: var(--navy-accent); } /* blue */
.book-status-published { background: rgba(52, 168, 83, 0.12); color: var(--success); } /* green */
.book-status-rejected  { background: rgba(234, 67, 53, 0.12); color: var(--danger); } /* red */
.book-status-archived  { background: var(--border-light); color: var(--text-muted); } /* muted */
body.dark-mode .book-status-in_review { background: rgba(251, 188, 4, 0.22); color: #ffd873; } /* lighten amber text on dark card */

/* ---------- Categories ---------- */
/* icon chip for category rows */
.cat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--navy-primary) 0%, var(--navy-light) 100%);
    color: #fff;
    font-size: 16px;
    flex-shrink: 0;
    box-shadow: 0 2px 6px var(--shadow-color);
}

/* small active/inactive dot next to category name */
.cat-active-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 3px rgba(52, 168, 83, 0.15);
}
.cat-active-dot.is-inactive {
    background: var(--text-muted);
    box-shadow: 0 0 0 3px rgba(102, 102, 102, 0.12);
}

/* ---------- Editor shell/topbar/tabs ---------- */
.editor-shell {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border-radius: 6px;
    box-shadow: 0 2px 4px var(--shadow-color);
    overflow: hidden;
    min-height: 70vh;
    transition: background-color 0.3s ease;
}

.editor-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.editor-topbar-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
}
.editor-topbar-title i {
    color: var(--navy-accent);
}

.editor-tabs {
    display: flex;
    gap: 6px;
    background: var(--bg-primary);
    padding: 4px;
    border-radius: 8px;
}

.editor-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}
.editor-tab:hover {
    color: var(--navy-accent);
}
.editor-tab.active {
    background: var(--navy-primary);
    color: #fff;
    box-shadow: 0 2px 6px var(--shadow-color);
}

/* 3-column grid: chapters/pages | canvas or writing surface | assets+versions */
.editor-body {
    display: grid;
    grid-template-columns: 260px 1fr 300px;
    gap: 1px;
    background: var(--border-color);
    flex: 1;
    min-height: 0;
}

.editor-col-left,
.editor-col-center,
.editor-col-right {
    background: var(--bg-card);
    padding: 16px;
    overflow-y: auto;
    max-height: calc(100vh - 220px);
    transition: background-color 0.3s ease;
}

@media (max-width: 1024px) {
    .editor-body {
        grid-template-columns: 1fr;
    }
    .editor-col-left,
    .editor-col-center,
    .editor-col-right {
        max-height: none;
    }
}

/* ---------- Chapters (Write tab) ---------- */
.chapter-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.chapter-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 6px;
    background: var(--bg-primary);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.3s;
}
.chapter-item:hover {
    border-color: var(--navy-accent);
}
.chapter-item.active {
    background: rgba(0, 116, 217, 0.1);
    border-color: var(--navy-accent);
}

.chapter-item-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chapter-item-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

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

.chapter-add-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 10px;
    border: 2px dashed var(--navy-accent);
    border-radius: 6px;
    background: transparent;
    color: var(--navy-accent);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}
.chapter-add-btn:hover {
    background: rgba(0, 116, 217, 0.08);
}

.chapter-editor {
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: 100%;
}

.chapter-title-input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--input-border);
    border-radius: 4px;
    background: var(--input-bg);
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 700;
    font-family: inherit;
}
.chapter-title-input:focus {
    outline: none;
    border-color: var(--navy-accent);
    box-shadow: 0 0 0 3px rgba(0, 116, 217, 0.15);
}

.chapter-format-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    padding: 8px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
}
.chapter-format-toolbar button {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s;
}
.chapter-format-toolbar button:hover {
    background: var(--table-hover);
    color: var(--navy-accent);
}
.chapter-format-toolbar button.active {
    background: var(--navy-primary);
    color: #fff;
}

.chapter-content {
    flex: 1;
    min-height: 400px;
    padding: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.7;
    overflow-y: auto;
    transition: border-color 0.3s;
}
.chapter-content:focus {
    outline: none;
    border-color: var(--navy-accent);
    box-shadow: 0 0 0 3px rgba(0, 116, 217, 0.15);
}

.chapter-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    height: 100%;
    padding: 60px 20px;
    color: var(--text-muted);
}
.chapter-empty i {
    font-size: 36px;
    margin-bottom: 12px;
    color: var(--border-color);
}

/* ---------- Canvas (Design tab) ---------- */
.page-tabs {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.page-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
    cursor: pointer;
    transition: all 0.3s;
}
.page-tab:hover {
    color: var(--navy-accent);
}
.page-tab.active {
    background: var(--navy-primary);
    border-color: var(--navy-primary);
    color: #fff;
}

.page-add-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    border: 2px dashed var(--navy-accent);
    border-radius: 6px;
    background: transparent;
    color: var(--navy-accent);
    cursor: pointer;
    transition: all 0.3s;
}
.page-add-btn:hover {
    background: rgba(0, 116, 217, 0.08);
}

.canvas-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px;
    margin-bottom: 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.canvas-stage {
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 30px;
    overflow: auto;
    background: var(--bg-primary);
    border-radius: 6px;
    min-height: 500px;
}

/* the printed page is always a white sheet, like paper - stays white in dark mode on purpose */
.canvas-page {
    position: relative;
    flex-shrink: 0;
    background: #fff;
    box-shadow: 0 4px 20px var(--shadow-hover);
}

.canvas-el {
    position: absolute;
    border: 1px dashed transparent;
    cursor: move;
    transition: border-color 0.15s;
}
.canvas-el:hover {
    border-color: var(--navy-accent);
}
.canvas-el.selected {
    border: 2px solid var(--navy-accent);
    box-shadow: 0 0 0 1px #fff, 0 0 0 3px rgba(0, 116, 217, 0.25);
}
/* corner handles on selected element */
.canvas-el.selected::before,
.canvas-el.selected::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--navy-accent);
    border: 1px solid #fff;
    border-radius: 50%;
    z-index: 4;
}
.canvas-el.selected::before { top: -5px; left: -5px; }
.canvas-el.selected::after { bottom: -5px; right: -5px; }

.canvas-el-text {
    padding: 4px;
    color: #000;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
}

.canvas-el-image {
    display: block;
    width: 100%;
    height: 100%;
    overflow: hidden;
}
.canvas-el-image img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    object-fit: contain;
}

.canvas-el-shape {
    width: 100%;
    height: 100%;
}

.el-delete {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    border-radius: 50%;
    background: var(--danger);
    color: #fff;
    font-size: 11px;
    cursor: pointer;
    box-shadow: 0 2px 6px var(--shadow-color);
    z-index: 5;
    transition: all 0.3s;
}
.el-delete:hover {
    background: #c8392b;
    transform: scale(1.1);
}

.el-style-bar {
    position: absolute;
    top: -44px;
    left: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    max-width: 280px;
    padding: 6px 8px;
    background: var(--navy-primary);
    border-radius: 6px;
    box-shadow: 0 4px 12px var(--shadow-hover);
    z-index: 6;
}
.el-style-bar button {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s;
}
.el-style-bar button:hover {
    background: rgba(255, 255, 255, 0.2);
}
.el-style-bar select,
.el-style-bar input {
    font-size: 12px !important;
    height: 26px;
    border: none;
    border-radius: 4px;
}

/* ---------- Assets panel ---------- */
.asset-panel {
    margin-bottom: 20px;
}
.asset-panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.asset-upload {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    margin-bottom: 14px;
    background: var(--bg-primary);
    border: 2px dashed var(--input-border);
    border-radius: 6px;
    transition: border-color 0.3s;
}
.asset-upload:hover {
    border-color: var(--navy-accent);
}
.asset-upload input[type="file"] {
    flex: 1;
    color: var(--text-secondary);
    font-size: 13px !important;
}

.asset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    gap: 10px;
}

.asset-item {
    position: relative;
    aspect-ratio: 1 / 1;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
    cursor: grab;
    transition: all 0.3s;
}
.asset-item:hover {
    border-color: var(--navy-accent);
    box-shadow: 0 2px 8px var(--shadow-color);
}

.asset-thumb {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.asset-item-actions {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: rgba(0, 31, 63, 0.55);
    opacity: 0;
    transition: opacity 0.3s;
}
.asset-item:hover .asset-item-actions {
    opacity: 1;
}
.asset-item-actions button {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    color: var(--navy-primary);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.3s;
}
.asset-item-actions button:hover {
    background: #fff;
    transform: scale(1.1);
}

/* ---------- Versions panel ---------- */
.version-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.version-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 100%;
    overflow-y: auto;
}

.version-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    transition: border-color 0.3s;
}
.version-item:hover {
    border-color: var(--navy-accent);
}

.version-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 12px;
    min-width: 0;
}
.version-meta strong {
    color: var(--text-primary);
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.version-meta span {
    color: var(--text-muted);
}

.version-restore-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    background: var(--navy-accent);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}
.version-restore-btn:hover {
    background: var(--navy-hover);
}

/* ---------- Misc ---------- */
.editor-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 50vh;
    padding: 80px 20px;
    color: var(--text-muted);
}
.editor-empty i {
    font-size: 48px;
    margin-bottom: 16px;
    color: var(--border-color);
}
.editor-empty h3 {
    margin-bottom: 8px;
    color: var(--text-primary);
}

/* book picker lives at the end of this file — see "editor shelf picker" */

/* mobile - status chips + tabs scroll instead of wrapping */
@media (max-width: 768px) {
    .book-status-filters {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
    }
    .status-chip {
        flex-shrink: 0;
    }
    .editor-topbar {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* =====================================================================
   Phase 3 — publishing & pricing
   ===================================================================== */

/* ---------- Plans ---------- */
/* plan type badge - dot + tinted bg, same recipe as book-status-badge */
.plan-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}
.plan-type-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}
.plan-basic     { background: var(--border-light); color: var(--text-muted); } /* gray */
.plan-standard  { background: rgba(0, 116, 217, 0.12); color: var(--navy-accent); } /* blue */
.plan-premium   { background: rgba(124, 58, 237, 0.14); color: #7C3AED; } /* violet, matches role-super-admin hue */
.plan-custom    { background: rgba(251, 188, 4, 0.18); color: #8a5a00; } /* amber - dark text, white fails on light bg */
body.dark-mode .plan-premium { color: #b794f6; } /* lighten violet text on dark card */
body.dark-mode .plan-custom  { background: rgba(251, 188, 4, 0.22); color: #ffd873; }

/* bold price pill on plan cards */
.plan-price-tag {
    display: inline-flex;
    align-items: baseline;
    gap: 2px;
    padding: 5px 14px;
    border-radius: 20px;
    background: var(--navy-primary);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
body.dark-mode .plan-price-tag { background: var(--navy-light); }

/* feature list as wrapped chips under a plan */
.plan-features-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.plan-feature-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
}
.plan-feature-chip i { color: var(--navy-accent); font-size: 10px; }

/* ---------- Publishing wizard ---------- */
.pub-wizard {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border-radius: 8px;
    box-shadow: 0 2px 4px var(--shadow-color);
    overflow: hidden;
    transition: background-color 0.3s ease;
}

/* horizontal numbered stepper */
.wizard-steps {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    padding: 20px 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}
.wizard-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex: 1;
    position: relative;
    text-align: center;
}
/* connector line between step numbers */
.wizard-step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 15px;
    left: calc(50% + 24px);
    right: calc(-50% + 24px);
    height: 2px;
    background: var(--border-color);
}
.wizard-step-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
    transition: all 0.3s;
}
.wizard-step-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}
/* current step - accent ring */
.wizard-step.active .wizard-step-num {
    background: var(--navy-accent);
    border-color: var(--navy-accent);
    color: #fff;
    box-shadow: 0 2px 6px var(--shadow-color);
}
.wizard-step.active .wizard-step-label { color: var(--navy-accent); font-weight: 700; }
/* completed step - success + check icon swapped in via JS */
.wizard-step.done .wizard-step-num {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}
.wizard-step.done .wizard-step-label { color: var(--success); }
.wizard-step.done:not(:last-child)::after { background: var(--success); }

.wizard-body {
    padding: 24px;
}

/* back/next footer row */
.wizard-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 24px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

/* plan choice cards inside step 1 */
.plan-pick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}
.plan-pick-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 18px;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}
.plan-pick-card:hover {
    border-color: var(--navy-accent);
    box-shadow: 0 6px 16px var(--shadow-hover);
    transform: translateY(-2px);
}
.plan-pick-card.selected {
    border-color: var(--navy-accent);
    background: rgba(0, 116, 217, 0.06);
    box-shadow: 0 2px 8px var(--shadow-color);
}
body.dark-mode .plan-pick-card.selected { background: rgba(0, 116, 217, 0.1); }
.plan-pick-card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}
.plan-pick-card-desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
    flex: 1;
}

/* ---------- Pricing ---------- */
/* lined breakdown list - cost/fee/commission rows down to author net */
.pricing-breakdown {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 4px 18px;
}
.pricing-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
    color: var(--text-secondary);
}
.pricing-line:last-child { border-bottom: none; }
.pricing-line span:last-child {
    font-weight: 600;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}
/* final total line - bold, separated by top rule */
.pricing-line-total {
    border-top: 2px solid var(--border-color);
    border-bottom: none;
    margin-top: 4px;
    padding-top: 14px;
    padding-bottom: 14px;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}
.pricing-line-total span:last-child {
    color: var(--navy-accent);
    font-size: 16px;
    font-weight: 700;
}

/* profit guard banner - live margin check, ok/bad tint (same recipe as info-banner) */
.margin-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 6px;
    border-left: 4px solid var(--border-color);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.5;
}
.margin-banner i { font-size: 18px; flex-shrink: 0; }
.margin-banner.ok {
    background: rgba(52, 168, 83, 0.08);
    border-left-color: var(--success);
    color: #1e7e34;
}
.margin-banner.ok i { color: var(--success); }
.margin-banner.bad {
    background: rgba(234, 67, 53, 0.08);
    border-left-color: var(--danger);
    color: #a52820;
}
.margin-banner.bad i { color: var(--danger); }
body.dark-mode .margin-banner.ok { background: rgba(52, 168, 83, 0.14); color: #6fe08e; }
body.dark-mode .margin-banner.bad { background: rgba(234, 67, 53, 0.14); color: #ff8f85; }

/* ---------- Publications ---------- */
/* publication status badge - dot + tinted bg, own namespace from book-status-badge */
.pub-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}
.pub-status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}
.pub-status-pending     { background: rgba(251, 188, 4, 0.18); color: #8a5a00; } /* amber - dark text, white fails on light bg */
.pub-status-approved    { background: rgba(0, 116, 217, 0.12); color: var(--navy-accent); } /* blue */
.pub-status-published   { background: rgba(52, 168, 83, 0.12); color: var(--success); } /* green */
.pub-status-unpublished { background: var(--border-light); color: var(--text-muted); } /* gray */
.pub-status-rejected    { background: rgba(234, 67, 53, 0.12); color: var(--danger); } /* red */
body.dark-mode .pub-status-pending { background: rgba(251, 188, 4, 0.22); color: #ffd873; } /* lighten amber text on dark card */

/* staff approval queue + author's own publications list - same row-card recipe as book-picker */
.approval-queue,
.pub-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.approval-queue > *,
.pub-list > * {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.3s;
}
.approval-queue > *:hover,
.pub-list > *:hover {
    border-color: var(--navy-accent);
    box-shadow: 0 4px 12px var(--shadow-color);
}

/* mobile - stepper labels shrink, plan grid single column */
@media (max-width: 768px) {
    .wizard-steps { padding: 16px; }
    .wizard-step-label { font-size: 10px; }
    .wizard-body { padding: 16px; }
    .wizard-nav { padding: 12px 16px; }
    .plan-pick-grid { grid-template-columns: 1fr; }
    .approval-queue > *,
    .pub-list > * {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* =====================================================================
   Phase 4 — e-commerce (store / cart / orders / docs)
   ===================================================================== */

/* ---------- Bookstore ---------- */
/* filter row above store grid - search + category/sort selects */
.store-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    margin-bottom: 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
}
.store-filters > * { flex: 1 1 200px; min-width: 160px; }

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

/* card recipe - same lift/hover as book-picker */
.store-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s;
}
.store-card:hover {
    border-color: var(--navy-accent);
    box-shadow: 0 6px 16px var(--shadow-hover);
    transform: translateY(-3px);
}

.store-cover {
    width: 100%;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.store-card-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px;
    flex: 1;
}

.store-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.store-author {
    font-size: 12px;
    color: var(--text-muted);
}

.store-price {
    font-size: 17px;
    font-weight: 700;
    color: var(--navy-accent);
    margin-top: 2px;
}

/* small pill next to price - physical/ebook */
.store-format-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    align-self: flex-start;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    background: var(--border-light);
    color: var(--text-secondary);
}

.store-add-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-top: auto;
    padding: 9px 14px;
    border: none;
    border-radius: 2px;
    background: var(--navy-primary);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    touch-action: manipulation;
    transition: all 0.3s;
}
.store-add-btn:hover { background: var(--navy-hover); transform: translateY(-2px); }
.store-add-btn:disabled { background: var(--text-muted); cursor: not-allowed; transform: none; }

/* no books match filters / empty catalog */
.store-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 40vh;
    padding: 60px 20px;
    color: var(--text-muted);
}
.store-empty i { font-size: 44px; margin-bottom: 14px; color: var(--border-color); }
.store-empty h3 { margin-bottom: 6px; color: var(--text-primary); }

/* ---------- Cart ---------- */
.cart-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 22px;
}

/* thumb | info | qty | line-total | remove */
.cart-row {
    display: grid;
    grid-template-columns: 56px 1fr 130px 100px 40px;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.3s;
}
.cart-row:hover { border-color: var(--navy-accent); box-shadow: 0 4px 12px var(--shadow-color); }

.cart-thumb {
    width: 56px;
    height: 76px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    flex-shrink: 0;
}

.cart-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cart-info strong { font-size: 14px; color: var(--text-primary); }
.cart-info span { font-size: 12px; color: var(--text-muted); }

/* compact qty stepper - minus/plus + number input */
.cart-qty {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.cart-qty button {
    width: 26px;
    height: 26px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-secondary);
    color: var(--navy-accent);
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}
.cart-qty button:hover { background: var(--navy-accent); color: #fff; border-color: var(--navy-accent); }
.cart-qty input[type="number"] {
    width: 42px;
    padding: 5px 2px;
    text-align: center;
    border: 1px solid var(--input-border);
    border-radius: 4px;
    background: var(--input-bg);
    color: var(--text-primary);
    -moz-appearance: textfield;
}
.cart-qty input[type="number"]::-webkit-outer-spin-button,
.cart-qty input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* danger icon btn - same recipe as .action-icon.delete-icon */
.cart-remove {
    background: transparent;
    border: none;
    color: var(--danger);
    font-size: 17px;
    padding: 6px 8px;
    border-radius: 2px;
    cursor: pointer;
    transition: all 0.3s;
    justify-self: end;
}
.cart-remove:hover { background: rgba(234,67,53,0.1); transform: scale(1.15); }

.cart-summary {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 2px 6px var(--shadow-color);
    padding: 20px 22px;
    max-width: 380px;
    margin-left: auto;
}
.cart-summary-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 0;
    font-size: 14px;
    color: var(--text-secondary);
}
.cart-summary-line strong { color: var(--text-primary); font-weight: 600; }
.cart-summary-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 14px;
    margin-top: 8px;
    border-top: 2px solid var(--border-color);
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}
.cart-summary-total span:last-child { color: var(--navy-accent); }

/* shipping details - 2col, collapses on mobile */
.checkout-form,
.manual-order-form {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 40vh;
    padding: 60px 20px;
    color: var(--text-muted);
}
.cart-empty i { font-size: 44px; margin-bottom: 14px; color: var(--border-color); }
.cart-empty h3 { margin-bottom: 6px; color: var(--text-primary); }

/* ---------- Orders ---------- */
.order-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
/* same row-card recipe as pub-list/approval-queue */
.order-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.3s;
}
.order-card:hover { border-color: var(--navy-accent); box-shadow: 0 4px 12px var(--shadow-color); }

/* order status badge - dot + tinted bg, own namespace from book-status-badge */
.order-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}
.order-status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}
.order-status-placed     { background: rgba(0, 116, 217, 0.12); color: var(--navy-accent); } /* blue */
.order-status-processing { background: rgba(251, 188, 4, 0.18); color: #8a5a00; } /* amber - dark text, white fails on light bg */
.order-status-completed  { background: rgba(0, 150, 136, 0.14); color: #00695c; } /* teal */
.order-status-delivered  { background: rgba(52, 168, 83, 0.12); color: var(--success); } /* green */
.order-status-cancelled  { background: var(--border-light); color: var(--text-muted); } /* gray */
.order-status-refunded   { background: rgba(234, 67, 53, 0.12); color: var(--danger); } /* red */
body.dark-mode .order-status-processing { background: rgba(251, 188, 4, 0.22); color: #ffd873; } /* lighten amber text on dark card */
body.dark-mode .order-status-completed  { background: rgba(0, 150, 136, 0.22); color: #4dd0c4; } /* lighten teal text on dark card */

/* payment status badge - dot + tinted bg, own namespace */
.pay-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}
.pay-status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}
.pay-unpaid   { background: var(--border-light); color: var(--text-muted); } /* gray */
.pay-pending  { background: rgba(251, 188, 4, 0.18); color: #8a5a00; } /* amber */
.pay-paid     { background: rgba(52, 168, 83, 0.12); color: var(--success); } /* green */
.pay-refunded { background: rgba(234, 67, 53, 0.12); color: var(--danger); } /* red */
body.dark-mode .pay-pending { background: rgba(251, 188, 4, 0.22); color: #ffd873; } /* lighten amber text on dark card */

/* clean line-items table - same recipe as about-roles-table, theme vars instead of hardcoded */
.order-items-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.order-items-table th,
.order-items-table td {
    padding: 10px 14px;
    text-align: left;
    border: 1px solid var(--border-color);
}
.order-items-table th {
    background: var(--navy-primary);
    color: #fff;
    font-weight: 600;
    font-size: 13px;
}
.order-items-table tbody tr:hover { background: var(--table-hover); }
.order-items-table td.num,
.order-items-table th.num { text-align: right; }

/* vertical status timeline - placed -> processing -> ... */
.order-timeline {
    display: flex;
    flex-direction: column;
    padding-left: 6px;
}
.order-timeline > * {
    position: relative;
    padding: 0 0 22px 24px;
    border-left: 2px solid var(--border-color);
}
.order-timeline > *:last-child { border-left-color: transparent; padding-bottom: 0; }
.order-timeline > *::before {
    content: '';
    position: absolute;
    left: -7px;
    top: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--border-color);
    border: 2px solid var(--bg-card);
}
.order-timeline > *.done::before      { background: var(--success); }
.order-timeline > *.current::before   { background: var(--navy-accent); box-shadow: 0 0 0 4px rgba(0,116,217,0.15); }
.order-timeline > *.cancelled::before { background: var(--danger); }
.order-timeline-label strong { display: block; font-size: 14px; color: var(--text-primary); }
.order-timeline-label small  { color: var(--text-muted); }

/* ---------- Docs (invoices/receipts) ---------- */
.doc-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
/* doc status badge - draft/issued/paid/void */
.doc-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}
.doc-status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}
.doc-status-draft  { background: var(--border-light); color: var(--text-muted); } /* gray */
.doc-status-issued { background: rgba(0, 116, 217, 0.12); color: var(--navy-accent); } /* blue */
.doc-status-paid   { background: rgba(52, 168, 83, 0.12); color: var(--success); } /* green */
.doc-status-void   { background: rgba(234, 67, 53, 0.12); color: var(--danger); } /* red */

/* printable A4-ish sheet - deliberately fixed paper colors, ignores dark-mode vars */
.doc-sheet {
    max-width: 800px;
    margin: 24px auto;
    padding: 40px;
    background: #ffffff;
    color: #1a1a1a;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.doc-sheet-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    padding-bottom: 20px;
    margin-bottom: 24px;
    border-bottom: 2px solid #1a1a1a;
}
.doc-sheet-head img { max-height: 48px; }
.doc-sheet-head h2 { font-size: 20px; margin-bottom: 4px; }
.doc-sheet-head .doc-sheet-num { text-align: right; font-size: 13px; color: #555; }

.doc-sheet-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px 40px;
    margin-bottom: 24px;
}
.doc-sheet-meta > div { display: flex; flex-direction: column; gap: 3px; }
.doc-sheet-meta label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #888;
}
/* :not() so the status badge keeps its own colour — a bare `span` here out-specified it */
.doc-sheet-meta span:not(.doc-status-badge) { font-size: 14px; color: #1a1a1a; }

.doc-sheet-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-bottom: 20px;
}
.doc-sheet-table th,
.doc-sheet-table td {
    padding: 9px 12px;
    text-align: left;
    border: 1px solid #ddd;
}
.doc-sheet-table th { background: #f4f4f4; color: #1a1a1a; font-weight: 700; }
.doc-sheet-table td.num,
.doc-sheet-table th.num { text-align: right; }

.doc-sheet-total {
    text-align: right;
    font-size: 18px;
    font-weight: 700;
    padding-top: 14px;
    border-top: 2px solid #1a1a1a;
    color: #1a1a1a;
}

.doc-print-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 2px;
    background: var(--navy-primary);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    touch-action: manipulation;
    transition: all 0.3s;
}
.doc-print-btn:hover { background: var(--navy-hover); transform: translateY(-2px); }

/* mobile - stack rows/columns, tighter grids */
@media (max-width: 768px) {
    .store-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
    .cart-row {
        grid-template-columns: 50px 1fr auto;
        grid-template-areas:
            "thumb info remove"
            "qty qty linetotal";
        row-gap: 8px;
    }
    .cart-thumb { grid-area: thumb; }
    .cart-info { grid-area: info; }
    .cart-remove { grid-area: remove; }
    .cart-qty { grid-area: qty; }
    .cart-summary { max-width: 100%; }
    .checkout-form,
    .manual-order-form { grid-template-columns: 1fr; }
    .order-card { flex-direction: column; align-items: flex-start; }
    .doc-sheet { padding: 20px; margin: 12px; }
    .doc-sheet-meta { grid-template-columns: 1fr; }
}

/* print - invoice/receipt sheet only, everything else hidden */
@media print {
    .sidebar,
    .mobile-bottom-nav,
    .sidebar-overlay,
    .header,
    .breadcrumb,
    .notification-bell-wrapper,
    .header-right,
    .doc-print-btn,
    nav {
        display: none !important;
    }
    .app-container { display: block; }
    .main-content {
        margin: 0 !important;
        padding: 0 !important;
    }
    .doc-sheet {
        max-width: 100%;
        width: 100%;
        margin: 0;
        padding: 20px;
        border: none;
        box-shadow: none;
        border-radius: 0;
        color: #000;
    }
    .doc-sheet-table th { background: #fff !important; color: #000 !important; border: 1px solid #000; }
    .doc-sheet-table td { border: 1px solid #000; }
    .doc-sheet-total,
    .doc-sheet-head { border-color: #000; }

    /* page chrome around the sheet — the sheet carries its own title */
    .lte-card-header,
    .section-header,
    .filters-section,
    .pipeline-stages,
    .lte-kpi-grid,
    .bulk-banner,
    .list-summary,
    .dataTables_wrapper,
    .empty-state,
    .modal-overlay,
    .rs-dlg-overlay,
    .payment-mode-note {
        display: none !important;
    }
    .lte-card { border: none !important; box-shadow: none !important; padding: 0 !important; }

    /* black ink everywhere inside the document, whatever the screen theme did */
    .doc-sheet,
    .doc-sheet * { color: #000 !important; }
    .doc-sheet-meta label { color: #444 !important; }

    /* badges lose their fill on most printers — keep the tint where supported and
       always draw a border so the state still reads as a badge in plain B/W */
    .doc-status-badge {
        border: 1px solid #000;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .doc-sheet-table { page-break-inside: auto; }
    .doc-sheet-table tr { page-break-inside: avoid; }
    .doc-sheet-total { page-break-inside: avoid; }
}

/* =====================================================================
   Phase 5 — payments & delivery
   ===================================================================== */

/* ---------- Payments ---------- */
/* method picker on submit-payment form - same card recipe as plan-pick-card */
.payment-method-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 16px;
}
.payment-method-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
    padding: 20px 16px;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}
.payment-method-card:hover {
    border-color: var(--navy-accent);
    box-shadow: 0 6px 16px var(--shadow-hover);
    transform: translateY(-2px);
}
.payment-method-card.selected {
    border-color: var(--navy-accent);
    background: rgba(0, 116, 217, 0.06);
    box-shadow: 0 2px 8px var(--shadow-color);
}
body.dark-mode .payment-method-card.selected { background: rgba(0, 116, 217, 0.1); }
.payment-method-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-primary);
    color: var(--navy-accent);
    font-size: 19px;
    flex-shrink: 0;
    transition: all 0.3s;
}
.payment-method-card.selected .payment-method-card-icon { background: var(--navy-accent); color: #fff; }
.payment-method-card-title { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.payment-method-card-desc { font-size: 12px; color: var(--text-muted); line-height: 1.4; }
/* stripe/paypal - enum exists, not wired up yet */
.payment-method-card.disabled,
.payment-method-card.is-disabled {
    opacity: 0.55;
    cursor: not-allowed;
}
.payment-method-card.disabled:hover,
.payment-method-card.is-disabled:hover {
    border-color: var(--border-color);
    box-shadow: none;
    transform: none;
}

/* upi/bank proof screenshot - small preview, click opens full size */
.pay-proof-thumb {
    display: block;
    width: 90px;
    height: 110px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    cursor: zoom-in;
    transition: all 0.3s;
}
.pay-proof-thumb:hover { border-color: var(--navy-accent); box-shadow: 0 4px 12px var(--shadow-color); }

/* payment status badge - dot + tinted bg, own namespace from book-status-badge recipe */
.payment-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}
.payment-status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}
.payment-pending   { background: var(--border-light); color: var(--text-muted); } /* gray */
.payment-submitted { background: rgba(251, 188, 4, 0.18); color: #8a5a00; } /* amber - dark text, white fails on light bg */
.payment-approved  { background: rgba(52, 168, 83, 0.12); color: var(--success); } /* green */
.payment-rejected  { background: rgba(234, 67, 53, 0.12); color: var(--danger); } /* red */
.payment-refunded  { background: rgba(0, 116, 217, 0.12); color: var(--navy-accent); } /* blue */
body.dark-mode .payment-submitted { background: rgba(251, 188, 4, 0.22); color: #ffd873; } /* lighten amber text on dark card */

/* submit-payment fields - same 2col recipe as checkout-form/manual-order-form */
.payment-submit-form {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

/* manual/COD mode banner above submit form - same recipe as info-banner */
.payment-mode-note {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    margin-bottom: 20px; /* keeps the 20px rhythm — it sat flush on the kpi strip below */
    border-radius: 6px;
    background: rgba(0, 116, 217, 0.05);
    border: 1px solid rgba(0, 116, 217, 0.2);
    border-left: 4px solid var(--navy-accent);
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}
.payment-mode-note i { color: var(--navy-accent); font-size: 18px; flex-shrink: 0; }
body.dark-mode .payment-mode-note { background: rgba(0, 116, 217, 0.1); border-color: rgba(0, 116, 217, 0.3); }

/* order+payment recap - same lined recipe as pricing-breakdown */
.pay-summary {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 4px 18px;
}
.pay-summary-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
    color: var(--text-secondary);
}
.pay-summary-line:last-child { border-bottom: none; }
.pay-summary-line span:last-child { font-weight: 600; color: var(--text-primary); font-variant-numeric: tabular-nums; }

/* ---------- Delivery ---------- */
/* horizontal status tracker - same connector-line recipe as wizard-steps */
.delivery-pipeline {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    padding: 20px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}
.delivery-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex: 1;
    position: relative;
    text-align: center;
}
.delivery-step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 15px;
    left: calc(50% + 24px);
    right: calc(-50% + 24px);
    height: 2px;
    background: var(--border-color);
}
.delivery-step-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    color: var(--text-muted);
    font-size: 13px;
    flex-shrink: 0;
    transition: all 0.3s;
}
.delivery-step-label { font-size: 12px; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
/* current step - accent ring, same as wizard-step.active */
.delivery-step.active .delivery-step-icon {
    background: var(--navy-accent);
    border-color: var(--navy-accent);
    color: #fff;
    box-shadow: 0 2px 6px var(--shadow-color);
}
.delivery-step.active .delivery-step-label { color: var(--navy-accent); font-weight: 700; }
/* completed step - success, connector behind it turns green too */
.delivery-step.done .delivery-step-icon { background: var(--success); border-color: var(--success); color: #fff; }
.delivery-step.done .delivery-step-label { color: var(--success); }
.delivery-step.done:not(:last-child)::after { background: var(--success); }
/* returned - exception state, red overrides active/done */
.delivery-step.returned .delivery-step-icon { background: var(--danger); border-color: var(--danger); color: #fff; }
.delivery-step.returned .delivery-step-label { color: var(--danger); font-weight: 700; }

/* order row in delivery list - same row-card recipe as order-card */
.delivery-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.3s;
}
.delivery-card:hover { border-color: var(--navy-accent); box-shadow: 0 4px 12px var(--shadow-color); }

/* delivery status badge - dot + tinted bg, own namespace from book-status-badge recipe */
.delivery-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}
.delivery-status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}
.delivery-printing         { background: var(--border-light); color: var(--text-muted); } /* gray */
.delivery-packaging        { background: rgba(0, 116, 217, 0.12); color: var(--navy-accent); } /* blue */
.delivery-out_for_delivery { background: rgba(251, 188, 4, 0.18); color: #8a5a00; } /* amber - dark text, white fails on light bg */
.delivery-delivered        { background: rgba(52, 168, 83, 0.12); color: var(--success); } /* green */
.delivery-returned         { background: rgba(234, 67, 53, 0.12); color: var(--danger); } /* red */
body.dark-mode .delivery-out_for_delivery { background: rgba(251, 188, 4, 0.22); color: #ffd873; } /* lighten amber text on dark card */

/* courier tracking link - pill button, external site opens in new tab */
.tracking-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 20px;
    background: var(--navy-primary);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    touch-action: manipulation;
    transition: all 0.3s;
}
.tracking-link:hover { background: var(--navy-hover); transform: translateY(-2px); box-shadow: 0 4px 12px var(--shadow-color); }
.tracking-link i:last-child { font-size: 11px; opacity: 0.85; } /* external-link glyph */

/* customer read-only history - same vertical recipe as order-timeline */
.delivery-timeline {
    display: flex;
    flex-direction: column;
    padding-left: 6px;
}
.delivery-timeline > * {
    position: relative;
    padding: 0 0 22px 24px;
    border-left: 2px solid var(--border-color);
}
.delivery-timeline > *:last-child { border-left-color: transparent; padding-bottom: 0; }
.delivery-timeline > *::before {
    content: '';
    position: absolute;
    left: -7px;
    top: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--border-color);
    border: 2px solid var(--bg-card);
}
.delivery-timeline > *.done::before      { background: var(--success); }
.delivery-timeline > *.current::before   { background: var(--navy-accent); box-shadow: 0 0 0 4px rgba(0,116,217,0.15); }
.delivery-timeline > *.returned::before  { background: var(--danger); }
.delivery-timeline-label strong { display: block; font-size: 14px; color: var(--text-primary); }
.delivery-timeline-label small  { color: var(--text-muted); }

/* staff update fields - same 2col recipe as checkout-form/manual-order-form */
.delivery-form {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

/* mobile - pipeline drops to a vertical list, grids/forms stack */
@media (max-width: 768px) {
    .payment-method-grid { grid-template-columns: 1fr; }
    .payment-submit-form,
    .delivery-form { grid-template-columns: 1fr; }
    .pay-proof-thumb { width: 70px; height: 90px; }
    .delivery-pipeline {
        flex-direction: column;
        align-items: stretch;
        gap: 18px;
        padding: 16px;
    }
    .delivery-step { flex-direction: row; text-align: left; gap: 12px; }
    .delivery-step:not(:last-child)::after { content: none; }
    .delivery-step-label { white-space: normal; }
    .delivery-card { flex-direction: column; align-items: flex-start; }
}

/* =====================================================================
   Phase 6 — earnings / points / withdrawals / donations
   ===================================================================== */

/* ---------- Earnings ---------- */
/* kpi row - lighter cousin of lte-kpi-grid, 4 -> 2 -> 1 same breakpoints */
.earnings-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}
@media (max-width: 1200px) { .earnings-summary { grid-template-columns: repeat(2, 1fr); } }

/* stat card - border-left accent recipe (same as account-info-card) + corner icon like small-box */
.earnings-kpi {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 18px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--navy-accent);
    border-radius: 8px;
    box-shadow: 0 2px 8px var(--shadow-color);
    overflow: hidden;
    transition: transform 0.25s, box-shadow 0.25s;
}
.earnings-kpi:hover { transform: translateY(-3px); box-shadow: 0 4px 14px var(--shadow-hover); }
.earnings-kpi-icon {
    position: absolute;
    top: 12px;
    right: 14px;
    font-size: 32px;
    color: var(--navy-accent);
    opacity: 0.16;
}
.earnings-kpi-value {
    font-size: clamp(20px, 3.2vw, 26px);
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}
.earnings-kpi-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

/* accent variants - border + icon swap, card itself stays neutral bg-card */
.earnings-kpi-earned    { border-left-color: var(--navy-accent); }
.earnings-kpi-earned    .earnings-kpi-icon { color: var(--navy-accent); }
.earnings-kpi-available { border-left-color: var(--success); }
.earnings-kpi-available .earnings-kpi-icon { color: var(--success); }
.earnings-kpi-available .earnings-kpi-value { color: var(--success); } /* actionable balance - extra emphasis */
.earnings-kpi-pending   { border-left-color: var(--warning); }
.earnings-kpi-pending   .earnings-kpi-icon { color: var(--warning); }
.earnings-kpi-withdrawn { border-left-color: var(--text-muted); }
.earnings-kpi-withdrawn .earnings-kpi-icon { color: var(--text-muted); }

/* withdraw/donate button row above or below the kpi grid */
.earn-cta-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin: 4px 0 20px;
}

/* ledger credit/debit chip - same shape as pay-status-badge, sign glyph instead of dot */
.ledger-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.ledger-credit { background: rgba(52, 168, 83, 0.12); color: var(--success); }
.ledger-credit::before { content: '+'; font-weight: 800; }
.ledger-debit { background: rgba(234, 67, 53, 0.12); color: var(--danger); }
.ledger-debit::before { content: '\2212'; font-weight: 800; } /* minus sign, not hyphen */

/* ---------- Withdrawals ---------- */
/* withdrawal status badge - dot + tinted bg, own namespace from book-status-badge recipe */
.wd-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}
.wd-status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}
.wd-pending  { background: rgba(251, 188, 4, 0.18); color: #8a5a00; } /* amber - dark text, white fails on light bg */
.wd-approved { background: rgba(0, 116, 217, 0.12); color: var(--navy-accent); } /* blue */
.wd-paid     { background: rgba(52, 168, 83, 0.12); color: var(--success); } /* green */
.wd-rejected { background: rgba(234, 67, 53, 0.12); color: var(--danger); } /* red */
body.dark-mode .wd-pending { background: rgba(251, 188, 4, 0.22); color: #ffd873; } /* lighten amber text on dark card */

/* request-withdrawal fields - same 2col recipe as checkout-form/manual-order-form */
.withdraw-form {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

/* ---------- Donations ---------- */
/* 3 donation types - same card grid recipe as plan-pick-grid/payment-method-grid */
.donate-type-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}
.donate-type-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
    padding: 20px 16px;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}
.donate-type-card:hover {
    border-color: var(--navy-accent);
    box-shadow: 0 6px 16px var(--shadow-hover);
    transform: translateY(-2px);
}
.donate-type-card.selected {
    border-color: var(--navy-accent);
    background: rgba(0, 116, 217, 0.06);
    box-shadow: 0 0 0 3px rgba(0, 116, 217, 0.18), 0 2px 8px var(--shadow-color); /* accent ring */
}
body.dark-mode .donate-type-card.selected { background: rgba(0, 116, 217, 0.1); }
.donate-type-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-primary);
    color: var(--navy-accent);
    font-size: 19px;
    flex-shrink: 0;
    transition: all 0.3s;
}
.donate-type-card.selected .donate-type-card-icon { background: var(--navy-accent); color: #fff; }
.donate-type-card-title { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.donate-type-card-desc { font-size: 12px; color: var(--text-muted); line-height: 1.4; }

/* donation type badge - dot + tinted bg, own palette (violet/green/blue) */
.donation-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}
.donation-type-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}
.donation-type-young_books   { background: rgba(124, 58, 237, 0.12); color: #7C3AED; } /* violet - matches role-super-admin */
.donation-type-charity       { background: rgba(52, 168, 83, 0.12); color: var(--success); } /* green */
.donation-type-bank_transfer { background: rgba(0, 116, 217, 0.12); color: var(--navy-accent); } /* blue */
body.dark-mode .donation-type-young_books { background: rgba(124, 58, 237, 0.22); color: #b794f6; } /* lighten violet text on dark card */

/* make-a-donation fields - same 2col recipe as checkout-form/manual-order-form */
.donate-form {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

/* ---------- Certificates ---------- */
/* certificate status badge - dot + tinted bg, own namespace from book-status-badge recipe */
.cert-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}
.cert-status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}
.cert-pending  { background: rgba(251, 188, 4, 0.18); color: #8a5a00; } /* amber */
.cert-approved { background: rgba(52, 168, 83, 0.12); color: var(--success); } /* green */
.cert-rejected { background: rgba(234, 67, 53, 0.12); color: var(--danger); } /* red */
body.dark-mode .cert-pending { background: rgba(251, 188, 4, 0.22); color: #ffd873; } /* lighten amber text on dark card */

/* printable award certificate - deliberately fixed parchment colors, ignores dark-mode vars, same intent as doc-sheet */
.cert-sheet {
    position: relative;
    max-width: 700px;
    margin: 24px auto;
    padding: 46px 44px;
    background: #fffdf6;
    color: #1a1a1a;
    text-align: center;
    border: 3px double var(--navy-accent);
    border-radius: 6px;
    box-shadow: 0 4px 22px rgba(0, 0, 0, 0.16);
}
/* ornamental hairline echoing the outer double border */
.cert-sheet::before {
    content: '';
    position: absolute;
    inset: 10px;
    border: 1px solid rgba(0, 116, 217, 0.3);
    border-radius: 3px;
    pointer-events: none;
}
.cert-sheet-inner { position: relative; z-index: 1; }
.cert-sheet-inner .cert-sheet-seal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--navy-primary);
    color: #fff;
    font-size: 22px;
    margin-bottom: 14px;
}
.cert-sheet-inner h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--navy-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}
.cert-sheet-sub {
    font-size: 12px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 22px;
}
.cert-sheet-name {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 16px 0 6px;
}
.cert-sheet-amount {
    font-size: 28px;
    font-weight: 700;
    color: var(--navy-accent);
    font-variant-numeric: tabular-nums;
    margin-bottom: 18px;
}
.cert-sheet-meta {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 30px;
    margin-top: 22px;
    padding-top: 16px;
    border-top: 1px solid #e0d8c0;
    font-size: 12px;
    color: #888;
}
.cert-sheet-meta strong { display: block; color: #1a1a1a; font-size: 13px; font-weight: 700; }

/* locked state - blur the sheet + centered lock icon until staff approves (page markup: <i class="fas fa-lock cert-locked-icon">) */
.cert-locked .cert-sheet-inner { filter: blur(5px); user-select: none; pointer-events: none; }
.cert-locked-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    width: 84px;
    height: 84px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    color: var(--navy-primary);
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}
.cert-locked-note {
    position: absolute;
    top: calc(50% + 56px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.9);
    padding: 4px 14px;
    border-radius: 20px;
    white-space: nowrap;
}

/* same button recipe as doc-print-btn, own namespace */
.cert-print-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 2px;
    background: var(--navy-primary);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    touch-action: manipulation;
    transition: all 0.3s;
}
.cert-print-btn:hover { background: var(--navy-hover); transform: translateY(-2px); }

/* mobile - kpi grid / donate grid / forms all drop to a single column */
@media (max-width: 768px) {
    .earnings-summary,
    .donate-type-grid,
    .withdraw-form,
    .donate-form { grid-template-columns: 1fr; }
    .earn-cta-row { flex-direction: column; align-items: stretch; }
    .cert-sheet { padding: 30px 22px; margin: 12px; }
    .cert-sheet::before { inset: 8px; }
    .cert-sheet-meta { gap: 18px; }
}

/* print - certificate sheet only, same intent as doc-sheet print handling but keeps its accent-color ink */
@media print {
    .cert-print-btn,
    .cert-locked-icon,
    .cert-locked-note { display: none !important; }
    .cert-sheet {
        max-width: 100%;
        width: 100%;
        margin: 0;
        box-shadow: none;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* =====================================================================
   Phase 7 — Tasks (Kanban board + list)
   ===================================================================== */

/* board / list segmented toggle */
.task-view-toggle {
    display: inline-flex;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}
.task-view-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--bg-card);
    color: var(--text-secondary);
    border: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    touch-action: manipulation;
    transition: all 0.2s;
}
.task-view-btn:not(:last-child) { border-right: 1px solid var(--border-color); }
.task-view-btn.active { background: var(--navy-primary); color: #fff; }

/* board = 4 columns, scrolls sideways when tight */
.kanban-board {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    overflow-x: auto;
    padding-bottom: 8px;
}
.kanban-col {
    flex: 1 1 0;
    min-width: 260px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    max-height: 72vh;
    transition: border-color 0.2s, background 0.2s;
}
.kanban-col.drag-over { border-color: var(--navy-accent); background: rgba(0, 116, 217, 0.06); }
.kanban-col-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    font-weight: 700;
    font-size: 14px;
    color: var(--text-primary);
    border-bottom: 2px solid var(--navy-accent);
}
.kanban-col-header i { color: var(--navy-accent); }
.kanban-col-count {
    min-width: 22px;
    text-align: center;
    padding: 2px 8px;
    border-radius: 20px;
    background: var(--navy-primary);
    color: #fff;
    font-size: 12px;
}
.kanban-col-body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    flex: 1;
}

/* card */
.kanban-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--navy-accent);
    border-radius: 6px;
    padding: 12px;
    cursor: grab;
    box-shadow: 0 1px 3px var(--shadow-color);
    transition: box-shadow 0.2s, transform 0.2s;
}
.kanban-card:hover { box-shadow: 0 4px 12px var(--shadow-color); transform: translateY(-1px); }
.kanban-card.dragging { opacity: 0.5; }
.kanban-card.locked { cursor: default; border-left-color: var(--border-color); }
.kanban-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}
.kanban-card-actions { display: inline-flex; gap: 4px; }
.kanban-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.35;
    margin-bottom: 6px;
}
.kanban-card-project {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 10px;
}
.kanban-card-project i { margin-right: 4px; }
.kanban-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

/* assignee avatar - initials circle */
.task-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}
.task-avatar-empty { background: var(--border-color); color: var(--text-muted); }

/* priority badge */
.task-priority {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}
.task-priority i { font-size: 10px; }
.task-priority-low    { background: var(--border-light); color: var(--text-muted); }
.task-priority-medium { background: rgba(0, 116, 217, 0.12); color: var(--navy-accent); }
.task-priority-high   { background: rgba(251, 188, 4, 0.18); color: #8a5a00; }
.task-priority-urgent { background: rgba(234, 67, 53, 0.12); color: var(--danger); }
body.dark-mode .task-priority-high { background: rgba(251, 188, 4, 0.22); color: #ffd873; }

/* status badge (list view) */
.task-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}
.task-status-todo        { background: var(--border-light); color: var(--text-muted); }
.task-status-in_progress { background: rgba(0, 116, 217, 0.12); color: var(--navy-accent); }
.task-status-review      { background: rgba(251, 188, 4, 0.18); color: #8a5a00; }
.task-status-done        { background: rgba(52, 168, 83, 0.12); color: var(--success); }
body.dark-mode .task-status-review { background: rgba(251, 188, 4, 0.22); color: #ffd873; }

/* due-date chip - red-state when overdue */
.kanban-due {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}
.kanban-due.overdue {
    color: var(--danger);
    font-weight: 700;
    background: rgba(234, 67, 53, 0.1);
    padding: 2px 8px;
    border-radius: 12px;
}

/* per-column empty + page error */
.kanban-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    padding: 24px 12px;
    border: 1px dashed var(--border-color);
    border-radius: 6px;
}
.kanban-empty i { display: block; font-size: 22px; margin-bottom: 8px; opacity: 0.6; }
.task-error {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}
.task-error p { margin-bottom: 16px; font-size: 15px; }
.task-error i { color: var(--warning); }

/* skeleton kanban */
.kanban-skeleton { display: flex; gap: 16px; overflow: hidden; }
.kanban-skel-col {
    flex: 1;
    min-width: 240px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.kanban-skel-head { height: 24px; border-radius: 4px; }
.kanban-skel-card { height: 92px; border-radius: 6px; }

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

@media (max-width: 768px) {
    .kanban-col { min-width: 82vw; max-height: none; }
    .task-form .form-grid { grid-template-columns: 1fr; }
}

/* ================= Projects page ================= */
/* status chevron pipeline - click to filter the list/board by stage */
.proj-pipeline {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0;
    margin-bottom: 20px;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
}
.proj-chevron {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 22px 9px 28px;
    margin-right: -12px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    flex-shrink: 0;
    clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 50%, calc(100% - 14px) 100%, 0 100%, 14px 50%);
    transition: background 0.25s, color 0.25s;
}
.proj-chevron:first-child {
    padding-left: 18px;
    clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 50%, calc(100% - 14px) 100%, 0 100%);
}
.proj-chevron:last-child { margin-right: 0; }
.proj-chevron:hover { color: var(--navy-accent); }
.proj-chevron.active { background: var(--navy-primary); border-color: var(--navy-primary); color: #fff; }
.proj-chevron .count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    padding: 1px 6px;
    border-radius: 10px;
    background: var(--border-color);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 700;
}
.proj-chevron.active .count { background: rgba(255, 255, 255, 0.3); color: #fff; }

/* list name cell - title over a small counts line */
.proj-name-cell { display: flex; flex-direction: column; gap: 2px; }
.proj-name-cell strong { font-size: 14px; color: var(--text-primary); line-height: 1.3; }
.proj-name-cell .text-muted { font-size: 12px; }

/* owner cell - initials avatar + name */
.proj-owner { display: inline-flex; align-items: center; gap: 8px; }
.proj-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--navy-primary) 0%, var(--navy-light) 100%);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

/* team badge / unassigned pill */
.team-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    background: rgba(0, 116, 217, 0.12);
    color: var(--navy-accent);
    white-space: nowrap;
}
.team-badge.unassigned { background: var(--border-light); color: var(--text-muted); }

/* visibility icon+label */
.vis-icon { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-secondary); }
.vis-icon i { color: var(--navy-accent); }

/* progress bar (table + board card) - fill width set at runtime */
.proj-progress {
    display: inline-block;
    width: 90px;
    height: 8px;
    border-radius: 6px;
    background: var(--border-light);
    overflow: hidden;
    vertical-align: middle;
}
.proj-progress-fill {
    display: block;
    height: 100%;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--navy-accent), var(--success));
    transition: width 0.4s ease;
}
.proj-progress-text { margin-left: 8px; font-size: 12px; font-weight: 700; color: var(--text-secondary); vertical-align: middle; }

/* deadline countdown chip - amber when soon, red when overdue */
.deadline-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    white-space: nowrap;
}
.deadline-chip.none { color: var(--text-muted); }
.deadline-chip.soon { background: rgba(251, 188, 4, 0.18); border-color: transparent; color: #8a5a00; }
.deadline-chip.overdue { background: rgba(234, 67, 53, 0.12); border-color: transparent; color: var(--danger); font-weight: 700; }
body.dark-mode .deadline-chip.soon { background: rgba(251, 188, 4, 0.22); color: #ffd873; }

/* project status colors - reuse .book-status-badge pill+dot recipe */
.proj-planning    { background: var(--border-light); color: var(--text-secondary); }
.proj-in_progress { background: rgba(0, 116, 217, 0.12); color: var(--navy-accent); }
.proj-review      { background: rgba(251, 188, 4, 0.18); color: #8a5a00; }
.proj-completed   { background: rgba(52, 168, 83, 0.12); color: var(--success); }
.proj-archived    { background: var(--border-light); color: var(--text-muted); }
body.dark-mode .proj-review { background: rgba(251, 188, 4, 0.22); color: #ffd873; }

/* page-level empty state spacing (sits on the shared .kanban-empty box) */
.proj-empty { margin-top: 10px; }
.proj-empty p { margin-top: 8px; }

/* ---- Member Access side panel ---- */
.member-panel-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease;
    z-index: 1400;
}
.member-panel-overlay.open { opacity: 1; visibility: visible; }
.member-panel {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: 420px;
    max-width: 92vw;
    background: var(--bg-card);
    box-shadow: -4px 0 24px var(--shadow-hover);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 1401;
    display: flex;
    flex-direction: column;
}
.member-panel.open { transform: translateX(0); }
.member-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px;
    border-bottom: 2px solid var(--navy-accent);
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
}
.member-panel-title { display: flex; align-items: center; gap: 12px; }
.member-panel-title > i { font-size: 20px; color: var(--navy-accent); }
.member-panel-title strong { display: block; font-size: 16px; color: var(--text-primary); }
.member-panel-title span { display: block; font-size: 12px; margin-top: 3px; }
.member-panel-body { padding: 18px 20px; overflow-y: auto; flex: 1; }
.member-add {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.member-list { display: flex; flex-direction: column; gap: 12px; }
.member-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-card);
}
.member-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--navy-primary) 0%, var(--navy-light) 100%);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}
.member-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.member-name { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.member-name i.fa-crown { color: var(--warning); margin-left: 4px; }
.member-sub { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.member-role { margin-top: 2px; }
.member-role-select { max-width: 170px; }
.member-access { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.member-access-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
}
.member-access-item.on { color: var(--success); }
.member-access-item.off { color: var(--text-muted); }
.member-empty { text-align: center; color: var(--text-muted); font-size: 13px; padding: 24px 12px; }
.member-empty i { display: block; font-size: 22px; margin-bottom: 8px; opacity: 0.6; }

@media (max-width: 768px) {
    .proj-progress { width: 70px; }
    .member-panel { width: 100vw; max-width: 100vw; }
}

/* ================= Teams page ================= */
/* form-control - selects/inputs used outside .form-group (drawers, roster rows) */
.form-control {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--input-border);
    border-radius: 2px;
    font-size: 16px;
    font-family: inherit;
    background: var(--input-bg);
    color: var(--text-primary);
    transition: all 0.3s;
}
.form-control:focus {
    outline: none;
    border-color: var(--navy-accent);
    box-shadow: 0 0 0 2px rgba(0, 116, 217, 0.2);
}
.form-control::placeholder { color: var(--text-muted); }

/* add/edit modal form wrappers - fill the modal body, layout comes from .form-group */
.team-form,
.proj-form { width: 100%; }

/* team-admin cell (list) - avatar + name inline */
.team-admin-cell { display: inline-flex; align-items: center; gap: 8px; }

/* member/admin avatar - initials circle or profile photo */
.team-member-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--navy-primary) 0%, var(--navy-light) 100%);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
    overflow: hidden;
}
img.team-member-avatar { object-fit: cover; }

/* members count pill (list) */
.team-count-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    background: rgba(0, 116, 217, 0.12);
    color: var(--navy-accent);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}
.team-count-badge i { font-size: 11px; }

/* ---- team members slide-in drawer ---- */
.team-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease;
    z-index: 1400;
}
.team-drawer-overlay.active { opacity: 1; visibility: visible; }
.team-drawer {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: 420px;
    max-width: 92vw;
    background: var(--bg-card);
    box-shadow: -4px 0 24px var(--shadow-hover);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 1401;
    display: flex;
    flex-direction: column;
}
.team-drawer.active { transform: translateX(0); }
.team-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px;
    border-bottom: 2px solid var(--navy-accent);
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
}
.team-drawer-title {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}
.team-drawer-title i { color: var(--navy-accent); }
.team-drawer-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    flex-shrink: 0;
    transition: background 0.2s, color 0.2s;
}
.team-drawer-close:hover { background: var(--border-light); color: var(--danger); }
.team-drawer-body { padding: 18px 20px; overflow-y: auto; flex: 1; }

/* add-member block inside the drawer */
.team-drawer-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 18px;
}
.team-drawer-section > label {
    display: block;
    margin-bottom: 10px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
}
.team-drawer-section > label i { color: var(--navy-accent); margin-right: 6px; }
.team-add-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 10px;
    align-items: center;
}

/* member roster chip */
.team-member-chip {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    margin-bottom: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-card);
}
.team-member-main { flex: 1; min-width: 0; }
.team-member-name { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.team-member-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 3px;
    font-size: 12px;
    color: var(--text-muted);
}
.team-member-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.team-member-actions .form-control { max-width: 132px; padding: 8px 10px; }

/* drawer empty / error message (also the page-level teams error/empty state) */
.team-drawer-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    padding: 24px 12px;
}
.team-drawer-empty i { display: block; font-size: 22px; margin-bottom: 8px; opacity: 0.6; }
.team-drawer-empty i.fa-triangle-exclamation { color: var(--warning); }
.team-drawer-empty a { color: var(--navy-accent); font-weight: 600; }

@media (max-width: 768px) {
    .team-drawer { width: 100vw; max-width: 100vw; }
    .team-add-row { grid-template-columns: 1fr; }
}

/* ===== Phase 8 — Chat ===== */
/* full-height messenger: main-content stops scrolling, chat fills the rest */
.page-chat .main-content { display: flex; flex-direction: column; overflow: hidden; }

.chat-layout {
    flex: 1;
    min-height: 0;
    display: flex;
    gap: 16px;
}

/* ---- left pane (conversation list) ---- */
.chat-sidebar {
    flex: 0 0 340px;
    max-width: 340px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 2px 8px var(--shadow-color);
    overflow: hidden;
}
.chat-pane-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
}
.chat-pane-header h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}
.chat-pane-header h2 i { color: var(--navy-accent); }

/* round icon button reused across the pane */
.chat-icon-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    transition: background .2s, color .2s;
}
.chat-icon-btn:hover { background: var(--bg-primary); color: var(--navy-accent); }

.chat-search {
    position: relative;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}
.chat-search > i {
    position: absolute;
    left: 28px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 13px;
    pointer-events: none;
}
.chat-search-input {
    width: 100%;
    padding: 9px 14px 9px 34px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: border-color .2s;
}
.chat-search-input:focus { border-color: var(--navy-accent); }

.chat-filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

/* the scrollable list area (skeleton + live list share this) */
.chat-conv-list { overflow-y: auto; min-height: 0; }
.chat-sidebar > .chat-conv-list { flex: 1 1 auto; }

/* skeleton rows while loading */
.chat-skel-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.chat-skel-avatar { width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0; }
.chat-skel-lines { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.chat-skel-line { height: 10px; border-radius: 5px; }

/* archived drop-down at the bottom of the list */
.chat-archived-section {
    flex: 0 0 auto;
    border-top: 1px solid var(--border-color);
}
.chat-archived-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    cursor: pointer;
    user-select: none;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .4px;
    text-transform: uppercase;
    color: var(--text-secondary);
}
.chat-archived-header:hover { color: var(--navy-accent); }
.chat-archived-header i { font-size: 12px; }
.chat-archived-section .chat-conv-list { max-height: 220px; }

/* conversation row */
.chat-conv-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: background .15s;
}
.chat-conv-item:hover { background: var(--bg-primary); }
.chat-conv-item.active { background: rgba(0, 116, 217, .10); }
.chat-conv-item.active::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--navy-accent);
}
.chat-conv-body { flex: 1; min-width: 0; }
.chat-conv-line1, .chat-conv-line2 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.chat-conv-line2 { margin-top: 3px; }
.chat-conv-title {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    font-size: 14.5px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chat-conv-item.unread .chat-conv-title { font-weight: 700; }
.chat-conv-time { flex-shrink: 0; font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.chat-conv-preview {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chat-conv-item.unread .chat-conv-preview { color: var(--text-secondary); font-weight: 600; }
.chat-conv-preview em { opacity: .7; }
.chat-conv-meta { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.chat-conv-type { font-size: 11px; color: var(--navy-accent); }
.chat-unread-badge {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: var(--navy-accent);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.chat-muted-icon { font-size: 11px; color: var(--text-muted); }
.chat-pin-icon { font-size: 11px; color: var(--navy-accent); transform: rotate(45deg); }

/* empty / error card inside the list */
.chat-list-msg { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.chat-list-msg i { display: block; font-size: 34px; opacity: .5; margin-bottom: 12px; }
.chat-list-msg p { margin: 0 0 12px; font-size: 14px; }
.chat-list-msg-sm { padding: 22px 16px; }
.chat-list-msg-sm i { font-size: 24px; margin-bottom: 8px; }

/* avatars (span, so the dark-mode div rule leaves them alone) */
.chat-avatar {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 50%;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, var(--navy-light), var(--navy-accent));
}
.chat-avatar img { width: 100%; height: 100%; object-fit: cover; }
.chat-avatar-group { background: linear-gradient(135deg, var(--navy-primary), var(--navy-light)); }
.chat-avatar-lg { width: 84px; height: 84px; font-size: 28px; }

/* ---- right pane ---- */
.chat-main {
    flex: 1;
    min-width: 0;
    min-height: 0;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 2px 8px var(--shadow-color);
}
.chat-empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
}
.chat-empty-state i { font-size: 56px; opacity: .35; margin-bottom: 16px; }
.chat-empty-state p { margin: 0 0 18px; font-size: 16px; }
/* placeholder shows only when no thread is open (jQuery .show() sets inline block, so re-assert) */
body:not(.chat-thread-open) .chat-empty-state { display: flex !important; }
body.chat-thread-open .chat-empty-state { display: none !important; }

/* the active thread — jQuery .show() writes inline block, force the column back while open */
.chat-thread { flex: 1 1 auto; min-height: 0; }
body.chat-thread-open .chat-thread { display: flex !important; flex-direction: column; }

.chat-thread-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
}
.chat-back-btn { display: none; }
.chat-thread-avatar { flex-shrink: 0; }
.chat-thread-avatar .chat-avatar { width: 40px; height: 40px; font-size: 14px; }
.chat-thread-titles { flex: 1; min-width: 0; }
.chat-thread-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chat-thread-sub {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 2px;
}
.chat-presence { color: var(--success); font-size: 8px; }
.chat-thread-actions { display: flex; align-items: center; gap: 2px; }
.chat-overflow-wrap { position: relative; }

/* in-conversation search bar (toggled) */
.chat-thread-searchbar {
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-primary);
}
.chat-thread-searchbar[style*="display: block"] { display: flex !important; }
.chat-thread-searchbar .chat-search-input { flex: 1; }

/* ---- messages ---- */
.chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 16px;
    background: var(--bg-primary);
}
.chat-date-sep { text-align: center; margin: 14px 0; }
.chat-date-sep span {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
}
.chat-load-older {
    text-align: center;
    padding: 8px;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--navy-accent);
    cursor: pointer;
    border-radius: 4px;
}
.chat-load-older:hover { background: var(--bg-card); }

.chat-msg-row { display: flex; margin: 3px 0; }
.chat-msg-row.mine { justify-content: flex-end; }
.chat-bubble {
    position: relative;
    max-width: 72%;
    padding: 8px 12px;
    border-radius: 14px 14px 14px 4px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 2px var(--shadow-color);
    word-wrap: break-word;
    overflow-wrap: anywhere;
}
.chat-bubble.mine {
    border-radius: 14px 14px 4px 14px;
    background: var(--navy-accent);
    border-color: var(--navy-accent);
    color: #fff;
}
.chat-msg-row.sending .chat-bubble { opacity: .65; }
.chat-msg-row.failed .chat-bubble { border-color: var(--danger); }

.chat-bubble-forwarded {
    font-size: 11px;
    font-style: italic;
    color: var(--text-muted);
    margin-bottom: 3px;
    display: flex;
    align-items: center;
    gap: 5px;
}
.chat-bubble.mine .chat-bubble-forwarded { color: rgba(255, 255, 255, .8); }
.chat-bubble-reply {
    border-left: 3px solid var(--navy-accent);
    padding: 3px 8px;
    margin-bottom: 5px;
    border-radius: 4px;
    background: rgba(0, 0, 0, .05);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.chat-bubble.mine .chat-bubble-reply { border-left-color: #fff; background: rgba(255, 255, 255, .18); }
.chat-reply-name { font-size: 12px; font-weight: 700; color: var(--navy-accent); }
.chat-bubble.mine .chat-reply-name { color: #fff; }
.chat-reply-text {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 240px;
}
.chat-bubble.mine .chat-reply-text { color: rgba(255, 255, 255, .85); }
.chat-bubble-sender { font-size: 12px; font-weight: 700; color: var(--navy-accent); margin-bottom: 2px; }
.chat-bubble-body { font-size: 14px; line-height: 1.45; color: var(--text-primary); white-space: pre-wrap; }
.chat-bubble.mine .chat-bubble-body { color: #fff; }
.chat-bubble-img {
    display: block;
    max-width: 240px;
    max-height: 280px;
    border-radius: 8px;
    margin-bottom: 4px;
    cursor: pointer;
}
.chat-bubble-file {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(0, 0, 0, .05);
    text-decoration: none;
    color: inherit;
    margin-bottom: 4px;
}
.chat-bubble.mine .chat-bubble-file { background: rgba(255, 255, 255, .18); }
.chat-bubble-file > i { font-size: 22px; color: var(--navy-accent); }
.chat-bubble.mine .chat-bubble-file > i { color: #fff; }
.chat-file-meta { display: flex; flex-direction: column; min-width: 0; }
.chat-file-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.chat-file-size { font-size: 11px; opacity: .75; }
.chat-bubble-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
    margin-top: 3px;
}
.chat-bubble-time { font-size: 10px; color: var(--text-muted); }
.chat-bubble.mine .chat-bubble-time { color: rgba(255, 255, 255, .8); }
.chat-edited-tag { font-size: 10px; font-style: italic; color: var(--text-muted); }
.chat-bubble.mine .chat-edited-tag { color: rgba(255, 255, 255, .75); }
.chat-tick { font-size: 11px; color: rgba(255, 255, 255, .8); }
.chat-tick.read { color: #7fd4ff; }
.chat-fail { font-size: 11px; color: var(--danger); display: inline-flex; align-items: center; gap: 4px; }
.chat-resend-btn {
    border: none;
    background: transparent;
    color: var(--navy-accent);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
}
/* per-message dropdown trigger (shows on hover) */
.chat-msg-menu-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, .12);
    color: inherit;
    font-size: 10px;
    cursor: pointer;
    opacity: 0;
    transition: opacity .15s;
}
.chat-bubble:hover .chat-msg-menu-btn { opacity: 1; }

/* shared dropdown menu (thread overflow, message actions, participant actions) */
.chat-msg-menu, .chat-part-menu {
    position: absolute;
    right: 0;
    top: 100%;
    z-index: 30;
    min-width: 168px;
    padding: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 6px 20px var(--shadow-hover);
}
.chat-msg-menu { top: auto; }
.chat-msg-menu-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-primary);
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    transition: background .15s;
}
.chat-msg-menu-item i { width: 16px; color: var(--text-secondary); }
.chat-msg-menu-item:hover { background: var(--bg-primary); }
.chat-msg-menu-item.danger, .chat-msg-menu-item.danger i { color: var(--danger); }

/* highlight when jumping to / searching a message */
@keyframes chatFlash { 0% { box-shadow: 0 0 0 3px rgba(251, 188, 4, .55); } 100% { box-shadow: 0 1px 2px var(--shadow-color); } }
.chat-msg-row.chat-flash .chat-bubble { animation: chatFlash 1.2s ease; }
.chat-msg-row.chat-search-hit .chat-bubble { box-shadow: 0 0 0 2px var(--warning); }

/* ---- composer ---- */
.chat-composer {
    border-top: 1px solid var(--border-color);
    padding: 10px 12px;
    background: var(--bg-card);
}
.chat-reply-preview-bar, .chat-attach-preview {
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    margin-bottom: 8px;
    border-radius: 6px;
    background: var(--bg-primary);
    border-left: 3px solid var(--navy-accent);
    font-size: 13px;
}
.chat-reply-preview-bar[style*="display: block"],
.chat-attach-preview[style*="display: block"] { display: flex !important; }
.chat-context-text { flex: 1; min-width: 0; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-attach-preview { color: var(--text-secondary); }
.chat-attach-preview span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-composer-row { display: flex; align-items: flex-end; gap: 8px; }
.chat-attach-btn {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 17px;
    transition: background .2s, color .2s;
}
.chat-attach-btn:hover { background: var(--bg-primary); color: var(--navy-accent); }
.chat-file-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); opacity: 0; }
.chat-composer-input {
    flex: 1;
    resize: none;
    max-height: 140px;
    min-height: 42px;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    outline: none;
    transition: border-color .2s;
}
.chat-composer-input:focus { border-color: var(--navy-accent); }
.chat-send-btn {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 50%;
    background: var(--navy-accent);
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .2s, transform .1s;
}
.chat-send-btn:hover { background: var(--navy-primary); }
.chat-send-btn:active { transform: scale(.92); }

/* ---- group info / participants drawer ---- */
.chat-drawer-overlay {
    position: absolute;
    inset: 0;
    z-index: 15;
    background: rgba(0, 0, 0, .35);
}
.chat-drawer {
    position: absolute;
    top: 0; right: 0; bottom: 0;
    z-index: 20;
    width: 340px;
    max-width: 88%;
    flex-direction: column;
    background: var(--bg-card);
    border-left: 1px solid var(--border-color);
    box-shadow: -4px 0 16px var(--shadow-hover);
    transform: translateX(100%);
    transition: transform .25s ease;
}
.chat-drawer.open { display: flex !important; transform: translateX(0); }
.chat-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: var(--navy-primary);
    color: #fff;
}
.chat-drawer-header h3 { margin: 0; font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.chat-drawer-header .close-btn { width: 32px; height: 32px; font-size: 22px; }
.chat-drawer-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; }
.chat-drawer-profile { text-align: center; padding: 8px 0 18px; }
.chat-drawer-profile .chat-avatar { margin: 0 auto 10px; }
.chat-drawer-name { font-size: 18px; font-weight: 700; color: var(--text-primary); }
.chat-role-account { font-size: 13px; color: var(--text-muted); margin-top: 3px; }
.chat-drawer-section-title {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .4px;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin: 14px 0 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.chat-part-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 4px;
    border-bottom: 1px solid var(--border-color);
}
.chat-part-row .chat-avatar { width: 40px; height: 40px; font-size: 14px; }
.chat-part-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.chat-part-name { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.chat-part-sub { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.chat-part-menu-wrap { position: relative; flex-shrink: 0; }
.chat-role-badge {
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: #fff;
    background: var(--text-muted);
}
.chat-role-owner { background: var(--navy-primary); }
.chat-role-admin { background: var(--navy-accent); }
.chat-role-member { background: var(--text-secondary); }
.chat-drawer-add { width: 100%; margin-top: 14px; justify-content: center; }
.chat-drawer-footer { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border-color); }
.chat-drawer-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}
.chat-drawer-toggle-row span { display: flex; align-items: center; gap: 8px; }
.chat-drawer-leave { width: 100%; justify-content: center; }

/* ---- new conversation modal ---- */
.chat-mode-tabs {
    display: flex;
    gap: 6px;
    padding: 5px;
    margin-bottom: 18px;
    border-radius: 8px;
    background: var(--bg-primary);
}
.chat-mode-tab {
    flex: 1;
    padding: 9px 12px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    transition: background .2s, color .2s;
}
.chat-mode-tab.active { background: var(--navy-primary); color: #fff; }
/* wizard step is jQuery-toggled (inline block) — space children display-agnostically */
.chat-wizard-step > * + * { margin-top: 14px; }
.chat-user-picker { display: flex; flex-direction: column; gap: 10px; }
.chat-user-search { position: relative; }
.chat-user-search > i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 13px; pointer-events: none; }
.chat-user-search .form-control { padding-left: 34px; }
.chat-user-list {
    max-height: 320px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}
.swal-user-list { max-height: 300px; overflow-y: auto; text-align: left; }
.chat-user-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background .15s;
}
.chat-user-option:last-child { border-bottom: none; }
.chat-user-option:hover { background: var(--bg-primary); }
.chat-user-option .chat-avatar { width: 38px; height: 38px; font-size: 13px; }
.chat-user-check { width: 17px; height: 17px; accent-color: var(--navy-accent); cursor: pointer; flex-shrink: 0; }
.chat-user-name { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-user-role {
    flex-shrink: 0;
    padding: 2px 9px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    color: var(--navy-accent);
    background: rgba(0, 116, 217, .12);
}
.chat-tag-list { display: flex; flex-wrap: wrap; gap: 8px; min-height: 24px; margin-bottom: 4px; }
.chat-tag {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 4px 10px;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    background: var(--navy-accent);
}
.chat-tag i { cursor: pointer; opacity: .85; }
.chat-tag i:hover { opacity: 1; }

/* ---- dark mode: the global `body.dark-mode div` rule greys inner text, re-assert chat colors ---- */
body.dark-mode .chat-thread-title,
body.dark-mode .chat-drawer-name,
body.dark-mode .chat-bubble:not(.mine) .chat-bubble-body { color: var(--text-primary) !important; }
body.dark-mode .chat-bubble.mine .chat-bubble-body { color: #fff !important; }
body.dark-mode .chat-bubble-sender { color: var(--navy-accent) !important; }
body.dark-mode .chat-bubble-reply { background: rgba(0, 0, 0, .25); }
body.dark-mode .chat-bubble-file { background: rgba(0, 0, 0, .25); }
body.dark-mode .chat-msg-menu-btn { background: rgba(255, 255, 255, .15); }

/* ---- responsive: single pane messenger on phones ---- */
@media (max-width: 768px) {
    .chat-layout { gap: 0; }
    .chat-sidebar { flex: 1 1 auto; max-width: 100%; }
    .chat-main { display: none; }
    body.chat-thread-open .chat-sidebar { display: none; }
    body.chat-thread-open .chat-main { display: flex; }
    .chat-back-btn { display: inline-flex; }
    .chat-drawer { width: 100%; max-width: 100%; }
    .chat-bubble { max-width: 85%; }
    .chat-search-input, .chat-composer-input { font-size: 16px; }
}

/* ===== Website Pages — CMS block editor (Phase 9) ===== */
.wp-editor-meta {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: end;
    gap: 16px;
    margin-bottom: 20px;
}
@media (max-width: 768px) {
    .wp-editor-meta { grid-template-columns: 1fr; }
}
.wp-section-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 22px 0 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}
.wp-section-label i { color: var(--navy-accent); }
.wp-hero-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
}
.wp-blocks {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.wp-block {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--navy-accent);
    border-radius: 8px;
    padding: 14px 16px;
    transition: box-shadow 0.2s ease;
}
.wp-block:hover { box-shadow: 0 2px 8px var(--shadow-color); }
.wp-block-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}
.wp-block-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    text-transform: capitalize;
}
.wp-block-title i { color: var(--navy-accent); }
.wp-block-ctrls { display: inline-flex; align-items: center; gap: 4px; }
.wp-block-body { display: flex; flex-direction: column; gap: 10px; }
.wp-block-body .form-group { margin-bottom: 0; }
.wp-add-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 2px dashed var(--border-color);
}
.wp-seo {
    margin-top: 22px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    overflow: hidden;
}
.wp-seo > summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 16px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    cursor: pointer;
    list-style: none;
    user-select: none;
}
.wp-seo > summary::-webkit-details-marker { display: none; }
.wp-seo > summary i.wp-seo-icon { color: var(--navy-accent); }
.wp-seo > summary .wp-seo-caret { margin-left: auto; transition: transform 0.2s ease; }
.wp-seo[open] > summary .wp-seo-caret { transform: rotate(180deg); }
.wp-seo-body { padding: 4px 16px 18px; }
.wp-img-thumb {
    display: block;
    max-width: 160px;
    max-height: 100px;
    margin-top: 8px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    object-fit: cover;
}
.wp-save-error {
    display: none;
    align-items: center;
    gap: 8px;
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c2c7;
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-weight: 600;
    font-size: 14px;
}
.wp-save-error.show { display: flex; }
.wp-skel-editor { display: flex; flex-direction: column; gap: 14px; padding: 8px 0; }
.wp-skel-editor .skeleton { height: 42px; border-radius: 6px; }
.wp-skel-editor .skeleton.tall { height: 96px; }
body.dark-mode .wp-save-error { background: rgba(220, 53, 69, .18); color: #f1aeb5; border-color: rgba(220, 53, 69, .4); }

/* ---------- Reviews moderation ---------- */
/* review status badge - dot + tinted bg, own namespace from book-status-badge recipe */
.rev-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}
.rev-status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}
.rev-pending  { background: rgba(251, 188, 4, 0.18); color: #8a5a00; } /* amber - dark text, white fails on light bg */
.rev-approved { background: rgba(52, 168, 83, 0.12); color: var(--success); } /* green */
.rev-rejected { background: rgba(234, 67, 53, 0.12); color: var(--danger); } /* red */
body.dark-mode .rev-pending { background: rgba(251, 188, 4, 0.22); color: #ffd873; } /* lighten amber on dark card */

/* star rating - gold filled + muted empty */
.rev-stars { display: inline-flex; gap: 2px; color: #f59e0b; font-size: 13px; white-space: nowrap; }
.rev-stars .off { color: var(--border-color); }

/* verified-purchase pill - green tick chip */
.rev-verified {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    background: rgba(52, 168, 83, 0.12);
    color: var(--success);
    white-space: nowrap;
}

/* review book/testimonial cell - title over a small reviewer/excerpt line */
.rev-book-cell { display: flex; flex-direction: column; gap: 2px; }
.rev-book-cell strong { font-size: 13px; color: var(--text-primary); line-height: 1.3; }
.rev-book-cell .rev-testimonial { color: var(--navy-accent); font-style: italic; }

/* excerpt - clamp long review bodies to 2 lines in the table */
.rev-excerpt {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-width: 320px;
    font-size: 12.5px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* inline retry banner (load error) - same tone as payment-mode-note but danger-tinted */
.rev-error-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    margin-bottom: 18px;
    background: rgba(234, 67, 53, 0.08);
    border: 1px solid rgba(234, 67, 53, 0.25);
    border-radius: 8px;
    color: var(--danger);
    font-size: 14px;
}
.rev-error-banner i { font-size: 18px; flex-shrink: 0; }
.rev-error-banner .btn { margin-left: auto; }
body.dark-mode .rev-error-banner { background: rgba(234, 67, 53, 0.12); }

/* submit-review fields - same 2col recipe as withdraw-form */
.rev-submit-form { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.rev-submit-form .rev-span-2 { grid-column: 1 / -1; }
@media (max-width: 600px) { .rev-submit-form { grid-template-columns: 1fr; } }

/* ============================================================
   Public Site (Phase 9) — site.php only, self-contained light theme
   ============================================================ */
.public-site {
    margin: 0;
    background: #f4f7fb;
    color: #1f2a3a;
    font-family: 'Segoe UI', Tahoma, sans-serif;
    -webkit-font-smoothing: antialiased;
}
.public-site * { box-sizing: border-box; }
.site-container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 20px; }

/* header */
.site-header { position: sticky; top: 0; z-index: 40; background: #001f3f; box-shadow: 0 2px 12px rgba(0,0,0,.18); }
.site-header-inner { display: flex; align-items: center; justify-content: space-between; height: 68px; gap: 16px; }
.site-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; font-weight: 700; }
.site-logo { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; background: #fff; }
.site-brand-name { font-size: 1.15rem; letter-spacing: .2px; }
.site-nav { display: flex; align-items: center; gap: 6px; }
.site-nav-link { display: inline-flex; align-items: center; gap: 7px; padding: 9px 13px; border-radius: 8px; color: #cdd8e6; text-decoration: none; font-size: .92rem; font-weight: 500; transition: background .15s, color .15s; }
.site-nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.site-nav-link.active { background: #0074D9; color: #fff; }
.site-nav-cta { display: inline-flex; align-items: center; gap: 7px; margin-left: 8px; padding: 9px 16px; border-radius: 8px; background: #fff; color: #001f3f; text-decoration: none; font-weight: 600; font-size: .92rem; }
.site-nav-cta:hover { background: #eaf2fb; }
.site-nav-toggle { display: none; background: transparent; border: 0; color: #fff; font-size: 1.4rem; cursor: pointer; }

/* buttons */
.site-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 20px; border: 2px solid transparent; border-radius: 8px; font-size: .95rem; font-weight: 600; cursor: pointer; text-decoration: none; transition: all .15s; line-height: 1; }
.site-btn-primary { background: #0074D9; color: #fff; }
.site-btn-primary:hover { background: #005fb0; }
.site-btn-primary:disabled { background: #9db4cc; cursor: not-allowed; }
.site-btn-light { background: #fff; color: #001f3f; }
.site-btn-light:hover { background: #eaf2fb; }
.site-btn-outline-light { background: transparent; color: #fff; border-color: rgba(255,255,255,.6); }
.site-btn-outline-light:hover { background: rgba(255,255,255,.12); }
.site-btn-block { width: 100%; margin-top: 4px; }

/* hero */
.site-hero { background: linear-gradient(135deg, #001f3f 0%, #003366 60%, #0074D9 140%); color: #fff; padding: 66px 0; }
.site-hero-slim { padding: 44px 0; }
.site-hero-inner { display: flex; align-items: center; gap: 40px; }
.site-hero-text { flex: 1 1 auto; }
.site-hero-title { font-size: 2.5rem; line-height: 1.15; margin: 0 0 14px; font-weight: 800; }
.site-hero-subtitle { font-size: 1.15rem; color: #d7e4f2; margin: 0 0 26px; max-width: 620px; }
.site-hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.site-hero-media { flex: 0 0 40%; }
.site-hero-media img { width: 100%; max-width: 100%; border-radius: 14px; box-shadow: 0 14px 40px rgba(0,0,0,.3); }

/* sections */
.site-section { padding: 56px 0; }
.site-section-alt { background: #eef3f9; }
.site-section-head { text-align: center; margin-bottom: 32px; }
.site-section-head-mt { margin-top: 48px; }
.site-section-title { font-size: 1.8rem; font-weight: 800; color: #001f3f; margin: 0 0 8px; display: inline-flex; align-items: center; gap: 10px; }
.site-section-title i { color: #0074D9; }
.site-section-sub { color: #5a6b80; font-size: 1.02rem; margin: 0; }
.site-center-cta { text-align: center; margin-top: 32px; }

/* content prose blocks */
.site-prose { max-width: 820px; margin: 0 auto; }
.site-content-block { margin-bottom: 26px; }
.site-block-text h2 { font-size: 1.5rem; color: #001f3f; margin: 0 0 12px; }
.site-block-text p { font-size: 1.06rem; line-height: 1.75; color: #37475c; margin: 0; }
.site-block-image img { width: 100%; border-radius: 12px; }
.site-block-caption { text-align: center; color: #6b7c90; font-size: .9rem; margin: 8px 0 0; }
.site-block-cta { text-align: center; }

/* grids */
.site-grid { display: grid; gap: 24px; }
.site-grid-books { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.site-grid-events { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }

/* book cards */
.site-book-card { background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 4px 16px rgba(0,31,63,.08); transition: transform .15s, box-shadow .15s; }
.site-book-card:hover { transform: translateY(-4px); box-shadow: 0 10px 28px rgba(0,31,63,.15); }
.site-book-cover { aspect-ratio: 3 / 4; background: #dfe8f2; }
.site-book-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.site-book-cover-fallback { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 2.4rem; color: #9db4cc; }
.site-book-body { padding: 14px 16px 18px; }
.site-book-title { font-size: 1.05rem; color: #001f3f; margin: 0 0 6px; line-height: 1.3; }
.site-book-author { font-size: .86rem; color: #6b7c90; margin: 0 0 8px; }
.site-book-rating { display: flex; align-items: center; gap: 6px; font-size: .9rem; }
.site-stars { color: #f5a623; letter-spacing: 1px; }
.site-book-count { color: #8a99ac; font-size: .82rem; }

/* testimonials carousel */
.site-carousel { position: relative; }
.site-testi-track { display: flex; gap: 24px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 6px 2px 12px; scrollbar-width: thin; }
.site-testi-card { scroll-snap-align: start; flex: 0 0 340px; max-width: 340px; background: #fff; border-radius: 12px; padding: 24px; box-shadow: 0 4px 16px rgba(0,31,63,.08); border-top: 4px solid #0074D9; }
.site-testi-title { font-size: 1.08rem; color: #001f3f; margin: 10px 0 8px; }
.site-testi-body { font-size: .98rem; line-height: 1.6; color: #37475c; margin: 0 0 14px; }
.site-testi-name { font-weight: 600; color: #001f3f; margin: 0; font-size: .92rem; }
.site-verified { color: #34a853; font-size: .8rem; margin-left: 6px; }
.site-testi-book { font-size: .82rem; color: #6b7c90; margin: 6px 0 0; }
.site-carousel-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 42px; height: 42px; border-radius: 50%; border: 0; background: #001f3f; color: #fff; cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,.2); z-index: 2; }
.site-carousel-nav:hover { background: #0074D9; }
.site-carousel-prev { left: -10px; }
.site-carousel-next { right: -10px; }

/* event cards */
.site-event-card { background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 4px 16px rgba(0,31,63,.08); display: flex; flex-direction: column; }
.site-event-banner { position: relative; aspect-ratio: 16 / 9; background: #dfe8f2; }
.site-event-banner img { width: 100%; height: 100%; object-fit: cover; display: block; }
.site-event-banner-fallback { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 2.6rem; color: #9db4cc; }
.site-badge { position: absolute; padding: 4px 10px; border-radius: 20px; font-size: .74rem; font-weight: 700; color: #fff; }
.site-badge-type { top: 10px; left: 10px; background: #0074D9; }
.site-badge-online { top: 10px; right: 10px; background: #34a853; }
.site-event-body { padding: 16px 18px 20px; display: flex; flex-direction: column; flex: 1; }
.site-event-title { font-size: 1.15rem; color: #001f3f; margin: 0 0 12px; line-height: 1.3; }
.site-event-meta { font-size: .88rem; color: #5a6b80; margin: 0 0 7px; display: flex; align-items: center; gap: 8px; }
.site-event-meta i { color: #0074D9; width: 15px; text-align: center; }
.site-seats { margin: 8px 0 14px; }
.site-seat-bar { height: 7px; border-radius: 4px; background: #e2e9f1; overflow: hidden; margin-bottom: 5px; }
.site-seat-fill { display: block; height: 100%; background: linear-gradient(90deg, #0074D9, #34a853); }
.site-seats small { color: #6b7c90; font-size: .8rem; }
.site-register-btn { margin-top: auto; }

/* contact form */
.site-contact { max-width: 760px; margin: 0 auto; background: #fff; border-radius: 14px; padding: 34px; box-shadow: 0 6px 24px rgba(0,31,63,.09); }
.site-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.site-field { margin-bottom: 18px; display: flex; flex-direction: column; }
.site-field label { font-size: .88rem; font-weight: 600; color: #33455c; margin-bottom: 7px; display: flex; align-items: center; gap: 7px; }
.site-field label i { color: #0074D9; }
.site-input { width: 100%; padding: 11px 14px; border: 1.5px solid #d3dce6; border-radius: 8px; font-size: 16px; color: #1f2a3a; background: #fff; transition: border-color .15s, box-shadow .15s; }
.site-input:focus { outline: none; border-color: #0074D9; box-shadow: 0 0 0 3px rgba(0,116,217,.15); }
.site-textarea { resize: vertical; min-height: 120px; }
.site-select { cursor: pointer; }
.site-form-actions { text-align: right; margin-top: 4px; }

/* policy pages */
.site-policy { padding: 52px 0; }
.site-policy .site-container { max-width: 860px; }
.site-policy-head { border-bottom: 2px solid #e2e9f1; padding-bottom: 22px; margin-bottom: 26px; }
.site-policy-head h1 { font-size: 2rem; color: #001f3f; margin: 0 0 12px; display: flex; align-items: center; gap: 12px; }
.site-policy-head h1 i { color: #0074D9; }
.site-policy-meta { display: flex; flex-wrap: wrap; gap: 18px; color: #6b7c90; font-size: .9rem; margin: 0 0 12px; }
.site-policy-meta i { color: #0074D9; margin-right: 5px; }
.site-policy-summary { font-size: 1.05rem; color: #37475c; margin: 0; font-style: italic; }
.site-policy-body { font-size: 1.05rem; line-height: 1.8; color: #33455c; }

/* empty state */
.site-empty { text-align: center; padding: 60px 20px; color: #6b7c90; }
.site-empty i { font-size: 3rem; color: #b7c5d6; margin-bottom: 16px; }
.site-empty p { font-size: 1.1rem; margin: 0 0 20px; }

/* footer */
.site-footer { background: #001529; color: #b9c6d6; padding: 46px 0 0; }
.site-footer-inner { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 30px; padding-bottom: 36px; }
.site-footer-brand .site-logo { margin-bottom: 10px; }
.site-footer-brand .site-brand-name { display: block; color: #fff; font-size: 1.15rem; font-weight: 700; margin-bottom: 10px; }
.site-footer-brand p { font-size: .9rem; line-height: 1.6; color: #8ea1b8; max-width: 300px; }
.site-footer-col h4 { color: #fff; font-size: 1rem; margin: 0 0 14px; }
.site-footer-col ul { list-style: none; padding: 0; margin: 0; }
.site-footer-col li { margin-bottom: 9px; }
.site-footer-link { color: #b9c6d6; text-decoration: none; font-size: .9rem; transition: color .15s; }
.site-footer-link:hover { color: #0074D9; }
.site-footer-muted { color: #6b7c90; font-size: .88rem; }
.site-footer-bottom { border-top: 1px solid rgba(255,255,255,.08); padding: 20px; text-align: center; font-size: .85rem; color: #7f92a9; }

/* responsive */
@media (max-width: 860px) {
    .site-nav-toggle { display: block; }
    .site-nav { position: absolute; top: 68px; left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 4px; background: #001f3f; padding: 12px 20px 18px; box-shadow: 0 8px 20px rgba(0,0,0,.25); display: none; }
    .site-nav.open { display: flex; }
    .site-nav-cta { margin: 6px 0 0; justify-content: center; }
    .site-hero-inner { flex-direction: column; text-align: center; }
    .site-hero-title { font-size: 1.9rem; }
    .site-hero-actions { justify-content: center; }
    .site-hero-media { flex-basis: auto; width: 100%; margin-top: 10px; }
    .site-form-row { grid-template-columns: 1fr; }
    .site-footer-inner { grid-template-columns: 1fr 1fr; }
    .site-carousel-prev { left: -4px; }
    .site-carousel-next { right: -4px; }
}
@media (max-width: 520px) {
    .site-footer-inner { grid-template-columns: 1fr; }
    .site-testi-card { flex-basis: 82vw; max-width: 82vw; }
    .site-contact { padding: 22px; }
}

/* ============================================================
   Phase 9 — Events admin badges + registrations, public-site
   hooks & DaisyUI file input (append-only, theme-aware)
   ============================================================ */

/* ---------- Events admin — status + registration badges ---------- */
/* dot + tinted pill, same recipe as rev-status-badge / status-pill */
.event-status-badge, .event-reg-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}
.event-status-badge::before, .event-reg-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}
/* event lifecycle */
.event-draft     { background: rgba(90, 107, 128, 0.15); color: #5a6b80; }         /* neutral slate */
.event-published { background: rgba(0, 116, 217, 0.14); color: var(--navy-accent); } /* blue - live listing */
.event-ongoing   { background: rgba(52, 168, 83, 0.14); color: var(--success); }    /* green - happening now */
.event-completed { background: rgba(0, 31, 63, 0.10); color: #45566e; }             /* muted navy - done */
.event-cancelled { background: rgba(234, 67, 53, 0.12); color: var(--danger); }     /* red */
/* registration status */
.event-reg-registered { background: rgba(0, 116, 217, 0.14); color: var(--navy-accent); }
.event-reg-attended   { background: rgba(52, 168, 83, 0.14); color: var(--success); }
.event-reg-cancelled  { background: rgba(234, 67, 53, 0.12); color: var(--danger); }
.event-reg-waitlist   { background: rgba(251, 188, 4, 0.18); color: #8a5a00; }       /* amber - dark text on light */
/* dark card legibility - lift text on the low-contrast tints */
body.dark-mode .event-draft     { background: rgba(140, 158, 178, 0.20); color: #a9b6c6; }
body.dark-mode .event-completed { background: rgba(180, 200, 220, 0.14); color: #b7c5d6; }
body.dark-mode .event-published,
body.dark-mode .event-reg-registered { color: #6db3ff; }
body.dark-mode .event-ongoing,
body.dark-mode .event-reg-attended { color: #5fd08a; }
body.dark-mode .event-reg-waitlist { background: rgba(251, 188, 4, 0.22); color: #ffd873; }

/* "Full" tag beside the seats progress bar */
.event-seats-full {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 6px;
    background: rgba(234, 67, 53, 0.12);
    color: var(--danger);
    font-size: 11px;
    font-weight: 700;
}

/* registrations table (inside the reg modal) */
.event-reg-table { width: 100%; }

/* ---------- Public site — remaining hooks (site.php, light theme) ---------- */
/* main wrapper - keep footer low on short pages */
.site-main { display: block; min-height: 42vh; }
/* when the hero carries an image, cap the copy so the two columns balance */
.site-hero-media-on .site-hero-text { max-width: 560px; }
/* contact form element wrapper */
.site-form { margin: 0; }

/* ---------- DaisyUI-style file input (app-wide `.file-input`) ---------- */
/* navy squared file-selector button - the mandated upload look */
.file-input {
    width: 100%;
    font-size: 16px;
    color: var(--text-primary);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    cursor: pointer;
    transition: border-color 0.15s;
}
.file-input:focus { outline: none; border-color: var(--navy-accent); }
.file-input::file-selector-button {
    margin-right: 14px;
    padding: 10px 16px;
    border: 0;
    border-radius: 0;
    background: var(--navy-primary);
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s;
}
.file-input::file-selector-button:hover { background: var(--navy-accent); }

/* ---------- AI Config page (aic-*) ---------- */
.aic-intro {
    margin: 4px 0 18px;
    font-size: 14px;
    color: var(--text-secondary);
}
.aic-intro i { color: var(--navy-accent); margin-right: 6px; }

.aic-provider {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}
.aic-provider.openai { background: rgba(16, 163, 127, 0.14); color: #10a37f; }
.aic-provider.gemini { background: rgba(0, 116, 217, 0.14); color: var(--navy-accent); }

.aic-feature-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 600;
    background: rgba(0, 31, 63, 0.08);
    color: var(--navy-primary);
    white-space: nowrap;
}

.aic-model {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    padding: 3px 8px;
    border-radius: 3px;
    color: var(--text-primary);
}

.aic-quota { min-width: 150px; }
.aic-quota-bar {
    height: 8px;
    background: var(--border-light);
    border-radius: 6px;
    overflow: hidden;
}
.aic-quota-fill {
    display: block;
    height: 100%;
    background: var(--success);
    border-radius: 6px;
    transition: width 0.3s ease;
}
.aic-quota-fill.warn { background: var(--warning); }
.aic-quota-fill.over { background: var(--danger); }
.aic-quota-text {
    margin-top: 5px;
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
}
.aic-warn-ic { color: var(--warning); }
.aic-remaining-out { color: var(--danger); font-weight: 700; }

.aic-pwd-wrap { position: relative; }
.aic-pwd-wrap .form-control { padding-right: 44px; }
.aic-pwd-toggle {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: 42px;
    border: 0;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 15px;
}
.aic-pwd-toggle:hover { color: var(--navy-accent); }
.aic-help {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-muted);
}
.aic-req { color: var(--danger); font-weight: 700; }

body.dark-mode .aic-feature-badge { background: rgba(255, 255, 255, 0.08); color: var(--text-primary); }
body.dark-mode .aic-model { background: var(--bg-primary); }

/* ===== AI Tools (Phase 10) ===== */
/* top loading bar — thin indeterminate, non-blocking (Generate / Save feedback) */
.ai-top-loader {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 3px;
    z-index: 3000;
    background: transparent;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s;
}
.ai-top-loader.active { opacity: 1; }
.ai-top-loader-bar {
    position: absolute;
    height: 100%;
    width: 40%;
    background: linear-gradient(90deg, var(--navy-accent), #4aa3ff);
    animation: ai-tlb 1.1s ease-in-out infinite;
}
@keyframes ai-tlb {
    0%   { left: -40%; }
    50%  { left: 40%; }
    100% { left: 110%; }
}

/* panels toggled by the tab bar (reuses .chat-mode-tabs / .chat-mode-tab) */
.ai-panel { display: none; }
.ai-panel.active { display: block; }
.ai-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.ai-panel-head h2 { margin: 0; font-size: 17px; color: var(--text-primary); display: inline-flex; align-items: center; gap: 8px; }

/* live remaining-quota badge */
.ai-quota-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 13px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid transparent;
    white-space: nowrap;
}
.ai-quota-ok      { color: var(--success); background: rgba(52, 168, 83, .12); border-color: rgba(52, 168, 83, .3); }
.ai-quota-low     { color: #b9770a; background: rgba(251, 188, 4, .15); border-color: rgba(251, 188, 4, .4); }
.ai-quota-blocked { color: var(--danger); background: rgba(234, 67, 53, .12); border-color: rgba(234, 67, 53, .35); }

/* writing assist — prompt column + response pane */
.ai-writing-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}
.ai-response-pane {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-primary);
    padding: 16px;
    min-height: 240px;
    max-height: 460px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
}
.ai-response-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 210px;
    color: var(--text-muted);
    text-align: center;
}
.ai-response-placeholder i { font-size: 34px; opacity: .5; }
.ai-response-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.ai-inline-error {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px 14px;
    border-radius: 10px;
    background: rgba(234, 67, 53, .1);
    border: 1px solid rgba(234, 67, 53, .3);
    color: var(--danger);
    font-size: 14px;
    margin-top: 12px;
}

/* shimmer while generating */
.ai-shimmer-lines { padding: 6px 0; }
.ai-shimmer-line {
    height: 13px;
    border-radius: 6px;
    margin-bottom: 12px;
    background: linear-gradient(90deg, var(--border-light) 25%, var(--border-color) 37%, var(--border-light) 63%);
    background-size: 400% 100%;
    animation: ai-shimmer 1.3s ease infinite;
}
.ai-shimmer-line:nth-child(2) { width: 92%; }
.ai-shimmer-line:nth-child(3) { width: 78%; }
.ai-shimmer-line:nth-child(4) { width: 86%; }
.ai-shimmer-line:nth-child(5) { width: 64%; }
@keyframes ai-shimmer {
    0%   { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

/* image / pdf editor */
.ai-editor-grid {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 20px;
    align-items: start;
}
.ai-editor-tools { display: flex; flex-direction: column; gap: 16px; }
.ai-tool-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ai-tool-row label { font-size: 13px; font-weight: 600; color: var(--text-secondary); margin: 0; }
.ai-brush-range { flex: 1; min-width: 120px; accent-color: var(--navy-accent); }
.ai-canvas-wrap {
    position: relative;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background-color: #eee;
    background-image:
        linear-gradient(45deg, #ddd 25%, transparent 25%),
        linear-gradient(-45deg, #ddd 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #ddd 75%),
        linear-gradient(-45deg, transparent 75%, #ddd 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    padding: 12px;
}
.ai-canvas { max-width: 100%; height: auto; display: block; cursor: crosshair; touch-action: none; border-radius: 4px; box-shadow: 0 2px 10px rgba(0,0,0,.15); }
.ai-editor-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: #777;
    text-align: center;
    padding: 30px;
}
.ai-editor-empty i { font-size: 40px; opacity: .5; }
.ai-editor-hint { font-size: 12px; color: var(--text-muted); }

/* usage-history view modal blocks */
.ai-view-block {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    padding: 12px 14px;
    margin-top: 8px;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 13px;
    line-height: 1.55;
    color: var(--text-primary);
    max-height: 260px;
    overflow-y: auto;
}
.ai-view-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); margin-top: 14px; display: block; }
.ai-feat-badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--navy-accent);
    background: rgba(0, 116, 217, .12);
}
.ai-prov-badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    background: var(--navy-light);
    text-transform: capitalize;
}
.ai-log-prompt { max-width: 260px; display: inline-block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }

@media (max-width: 900px) {
    .ai-writing-grid,
    .ai-editor-grid { grid-template-columns: 1fr; }
}

/* ===== AdminLTE info-box (secondary metrics) ===== */
.info-box {
    display: flex;
    align-items: stretch;
    background: var(--bg-card);
    box-shadow: 0 2px 6px var(--shadow-color);
    border: 1px solid var(--border-color);
    overflow: hidden;
    min-height: 84px;
}
.info-box-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 68px;
    flex-shrink: 0;
    font-size: 26px;
    color: #fff;
    background: linear-gradient(135deg, var(--navy-primary) 0%, var(--navy-light) 100%);
}
.info-box-content { padding: 10px 16px; flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.info-box-text {
    display: block;
    font-size: 12.5px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.info-box-number { display: block; font-size: 22px; font-weight: 700; color: var(--text-primary); margin-top: 2px; }
.info-box-more { display: inline-block; margin-top: 4px; font-size: 12px; color: var(--navy-accent); text-decoration: none; }
.info-box-more:hover { text-decoration: underline; }

/* ===== Reports & Analytics ===== */
.sb-trend {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 6px;
    padding: 2px 9px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
}
.bg-warning .sb-trend { background: rgba(0, 0, 0, 0.14); color: #1f2d3d; }
.report-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.report-grid-2 .lte-card { margin-bottom: 22px; }
@media (max-width: 992px) { .report-grid-2 { grid-template-columns: 1fr; } }
.report-filter-note { margin: 14px 0 0; font-size: 12.5px; color: var(--text-muted); display: flex; align-items: center; gap: 7px; }
.skeleton-kpi { height: 118px; border-radius: 14px; }
.chart-container .chart-empty { position: absolute; inset: 0; margin: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ai-insight-text { color: var(--text-primary); line-height: 1.7; margin: 0 0 8px; white-space: pre-line; }
.ai-insight-meta { display: flex; align-items: center; gap: 7px; font-size: 12.5px; margin: 0; }

/* ===== Phase 10 — Files & Documents ===== */
/* split layout: left folder/scope rail + right browser */
.files-layout { display: flex; gap: 20px; align-items: flex-start; }
.files-rail { flex: 0 0 230px; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 4px; padding: 12px; position: sticky; top: 16px; }
.files-rail-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); margin: 10px 6px 6px; }
.files-scope, .files-folder { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 4px; cursor: pointer; color: var(--text-primary); font-size: 14px; font-weight: 500; transition: background .15s, color .15s; }
.files-scope i, .files-folder i { color: var(--navy-accent); width: 16px; text-align: center; }
.files-scope:hover, .files-folder:hover { background: var(--bg-secondary); }
.files-scope.active, .files-folder.active { background: var(--navy-accent); color: #fff; }
.files-scope.active i, .files-folder.active i { color: #fff; }
.files-scope .scope-count { margin-left: auto; font-size: 12px; opacity: .85; }
.files-rail-folders { margin-top: 8px; border-top: 1px solid var(--border-color); padding-top: 8px; max-height: 340px; overflow-y: auto; }
.files-main { flex: 1 1 auto; min-width: 0; }

.files-view-toggle { display: inline-flex; border: 1px solid var(--border-color); border-radius: 4px; overflow: hidden; }
.files-view-btn { background: var(--bg-secondary); color: var(--text-secondary); border: none; padding: 8px 13px; cursor: pointer; font-size: 14px; transition: background .15s, color .15s; }
.files-view-btn.active { background: var(--navy-accent); color: #fff; }

/* grid view cards */
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(185px, 1fr)); gap: 16px; }
.file-card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 6px; overflow: hidden; display: flex; flex-direction: column; transition: transform .15s, box-shadow .15s; }
.file-card:hover { transform: translateY(-3px); box-shadow: 0 6px 18px var(--shadow-color); }
.file-card-thumb { height: 118px; background: var(--bg-secondary); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.file-card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-card-thumb i { font-size: 42px; color: var(--navy-accent); }
.file-card-body { padding: 10px 12px; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.file-card-name { font-size: 13px; font-weight: 600; color: var(--text-primary); word-break: break-word; line-height: 1.3; }
.file-card-meta { font-size: 12px; color: var(--text-muted); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.file-card-actions { display: flex; gap: 4px; padding: 8px 10px; border-top: 1px solid var(--border-color); flex-wrap: wrap; }

/* type + visibility chips */
.file-type-badge, .file-vis-badge { padding: 3px 9px; border-radius: 3px; font-size: 11px; font-weight: 600; display: inline-block; text-transform: capitalize; }
.file-type-image { background: #e3f2fd; color: #1565c0; }
.file-type-pdf { background: #fdecea; color: #b71c1c; }
.file-type-document { background: #ede7f6; color: #4527a0; }
.file-type-spreadsheet { background: #e8f5e9; color: #1b5e20; }
.file-type-other { background: #eceff1; color: #37474f; }
.file-vis-private { background: #f5f5f5; color: #616161; }
.file-vis-team { background: #fff3e0; color: #e65100; }
.file-vis-public { background: #e8f5e9; color: #2e7d32; }
.file-shared-icon { color: var(--navy-accent); }
.file-ai-icon { color: #8B5CF6; }

/* version history slide-in drawer */
.version-drawer-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); opacity: 0; visibility: hidden; transition: opacity .25s ease; z-index: 1400; }
.version-drawer-overlay.active { opacity: 1; visibility: visible; }
.version-drawer { position: fixed; top: 0; right: 0; height: 100vh; width: 470px; max-width: 94vw; background: var(--bg-card); box-shadow: -4px 0 24px var(--shadow-hover); transform: translateX(100%); transition: transform .3s ease; z-index: 1401; display: flex; flex-direction: column; }
.version-drawer.active { transform: translateX(0); }
.version-drawer-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 2px solid var(--navy-accent); background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%); }
.version-drawer-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 15px; font-weight: 700; color: var(--text-primary); }
.version-drawer-title i { color: var(--navy-accent); }
.version-drawer-close { background: none; border: none; color: var(--text-muted); font-size: 18px; cursor: pointer; padding: 4px 8px; border-radius: 6px; transition: background .2s, color .2s; }
.version-drawer-close:hover { background: var(--border-light); color: var(--danger); }
.version-drawer-body { padding: 16px 18px; overflow-y: auto; flex: 1; }
.version-row { display: flex; gap: 12px; padding: 12px; border: 1px solid var(--border-color); border-radius: 8px; margin-bottom: 12px; background: var(--bg-card); }
.version-row.current { border-color: var(--navy-accent); box-shadow: 0 0 0 1px var(--navy-accent) inset; }
.version-avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--navy-accent); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex-shrink: 0; overflow: hidden; }
.version-avatar img { width: 100%; height: 100%; object-fit: cover; }
.version-main { flex: 1; min-width: 0; }
.version-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.version-num { font-weight: 700; color: var(--text-primary); font-size: 14px; }
.version-current-badge { background: #e3f2fd; color: #1565c0; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 3px; }
.version-uploader { font-size: 13px; color: var(--text-secondary); margin-top: 3px; }
.version-summary { font-size: 13px; color: var(--text-primary); margin-top: 5px; }
.version-meta { font-size: 12px; color: var(--text-muted); margin-top: 4px; display: flex; gap: 10px; flex-wrap: wrap; }
.version-actions { display: flex; gap: 5px; margin-top: 8px; flex-wrap: wrap; }

/* preview + compare */
.file-preview-frame { width: 100%; height: 60vh; border: 1px solid var(--border-color); border-radius: 4px; background: var(--bg-secondary); }
.file-preview-frame img { width: 100%; height: 100%; object-fit: contain; }
.file-compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.file-compare-grid figure { margin: 0; }
.file-compare-grid figcaption { font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; text-align: center; }

/* upload dropzone + progress */
.file-dropzone { border: 2px dashed var(--border-color); border-radius: 6px; padding: 26px; text-align: center; color: var(--text-muted); cursor: pointer; transition: border-color .2s, background .2s; margin-bottom: 14px; }
.file-dropzone.dragover { border-color: var(--navy-accent); background: rgba(0,116,217,.06); color: var(--navy-accent); }
.file-dropzone i { font-size: 30px; color: var(--navy-accent); display: block; margin-bottom: 8px; }
.file-upload-list { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.file-upload-item { font-size: 13px; color: var(--text-secondary); background: var(--bg-secondary); border-radius: 4px; padding: 8px 10px; }
.file-upload-bar { height: 5px; border-radius: 3px; background: var(--border-light); margin-top: 6px; overflow: hidden; }
.file-upload-bar > span { display: block; height: 100%; background: var(--navy-accent); width: 0; transition: width .2s; }

.files-empty { text-align: center; color: var(--text-muted); padding: 48px 16px; }
.files-empty i { font-size: 40px; color: var(--navy-accent); opacity: .5; display: block; margin-bottom: 12px; }
.files-skeleton-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(185px,1fr)); gap: 16px; }
.files-skeleton-grid .skeleton { height: 180px; border-radius: 6px; }

/* files small utilities (kept here so no page carries inline styles) */
.file-name-cell { display: inline-flex; align-items: center; gap: 8px; }
.file-thumb-xs { width: 34px; height: 34px; object-fit: cover; border-radius: 4px; vertical-align: middle; }
.file-ico-xs { color: var(--navy-accent); font-size: 20px; width: 34px; text-align: center; }
.ico-dim { opacity: .6; }
.ico-warn { color: var(--warning); }
.clickable { cursor: pointer; }
.mt-10 { margin-top: 10px; }

@media (max-width: 900px) {
    .files-layout { flex-direction: column; }
    .files-rail { position: static; width: 100%; flex-basis: auto; }
    .file-compare-grid { grid-template-columns: 1fr; }
    .version-drawer { width: 100vw; max-width: 100vw; }
}

/* ===== Phase 10 — reports trend chips, toggle hooks & upload form ===== */
/* KPI trend chips (modifiers of .sb-trend, inside colored small-boxes) */
.sb-trend.trend-up   { background: rgba(46, 125, 50, .92); color: #fff; }
.sb-trend.trend-down { background: rgba(198, 40, 40, .92); color: #fff; }
.sb-trend.trend-flat i { opacity: .85; }
.bg-warning .sb-trend.trend-up,
.bg-warning .sb-trend.trend-down { color: #fff; }

/* reports JS-toggle helpers (base visuals via .filter-group / .skeleton-chart) */
.report-custom-range { min-width: 150px; }
.chart-skel { display: block; }

/* AI Tools: select2 base hook — full width before upgrade */
.ai-ss { width: 100%; }

/* Files: upload modal form — stacks dropzone + list + actions */
.upload-form { display: flex; flex-direction: column; gap: 14px; }

/* ===== Rounded controls — every button carries the 6px card radius =====
   !important because several older button rules already shipped with one */
.btn,
.btn-sm,
.dt-button,
.action-icon,
.close-btn,
.row-menu-item,
.page-action-btn,
.rec-tab,
.dev-link,
.header-tool-btn,
.dataTables_paginate .paginate_button,
.sidebar-menu a,
.sidebar-menu button,
.sidebar-logout button,
.sidebar .sidebar-theme button,
.lte-card-tools button {
    border-radius: 6px !important;
}

/* ===== Header page actions — section buttons live beside the bell ===== */
.header-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.page-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 14px;
    min-height: 40px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

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

.page-action-btn.primary {
    background: var(--navy-primary);
    border-color: var(--navy-primary);
    color: #fff;
}

.page-action-btn.primary:hover {
    background: var(--navy-hover);
    border-color: var(--navy-hover);
    color: #fff;
}

.page-action-btn.danger {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

.page-action-btn.danger:hover {
    filter: brightness(1.1);
    color: #fff;
}

.bulk-count {
    font-size: 13px;
    font-weight: 700;
    color: var(--navy-accent);
    padding-right: 4px;
}

/* ===== Pipeline Chevron Tabs ===== */
.pipeline-stages {
    display: flex;
    width: 100%;
    margin-bottom: 18px;
    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: 14px 20px 14px 28px;
    cursor: pointer;
    transition: filter 0.2s, opacity 0.2s;
    color: #fff;
    text-decoration: none;
    background: var(--navy-primary);
    -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:first-child {
    -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%);
    padding-left: 16px;
}

.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:hover {
    filter: brightness(1.15);
}

.pipeline-stage.active {
    filter: brightness(1.25);
    box-shadow: inset 0 0 0 100px rgba(255,255,255,0.15);
}

.pipeline-stage-name {
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: inherit;
}

.pipeline-stage-count {
    font-size: 14px;
    font-weight: 800;
    color: inherit;
    white-space: nowrap;
}

.pipeline-stage.pipeline-empty {
    opacity: 0.6;
}

.pipeline-stage.pipeline-empty:hover {
    opacity: 0.85;
}

/* shared stage palette — every module maps its own statuses onto these */
.pipeline-stage.st-neutral { background: #2c3e50; }
.pipeline-stage.st-muted   { background: #6c757d; }
.pipeline-stage.st-info    { background: #0074D9; }
.pipeline-stage.st-warn    { background: #f39c12; }
.pipeline-stage.st-success { background: #27ae60; }
.pipeline-stage.st-danger  { background: #e74c3c; }
.pipeline-stage.st-purple  { background: #7d5fff; }
.pipeline-stage.st-teal    { background: #16a085; }

@media (max-width: 992px) {
    .pipeline-stage { padding: 10px 16px 10px 24px; }
    .pipeline-stage-name { font-size: 10px; }
    .pipeline-stage-count { font-size: 12px; }
}

/* ===== Branded processing overlay — every write, never a read ===== */
.rs-overlay {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 12, 28, 0.55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

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

.rs-overlay-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 30px 40px;
    background: var(--bg-card);
    border-radius: 6px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    min-width: 260px;
}

.rs-overlay-logo {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    animation: rsPulse 1.4s ease-in-out infinite;
}

.rs-overlay-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
    color: var(--navy-accent);
}

.rs-overlay-bar {
    width: 200px;
    height: 4px;
    border-radius: 3px;
    background: var(--border-light);
    overflow: hidden;
}

.rs-overlay-bar span {
    display: block;
    width: 40%;
    height: 100%;
    border-radius: 3px;
    background: var(--navy-accent);
    animation: rsSlide 1.1s ease-in-out infinite;
}

.rs-overlay-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

body.rs-locked {
    overflow: hidden;
}

@keyframes rsPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%      { transform: scale(1.08); opacity: 0.85; }
}

@keyframes rsSlide {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(350%); }
}

@media (prefers-reduced-motion: reduce) {
    .rs-overlay-logo { animation: none; }
    .rs-overlay-bar span { animation-duration: 2.4s; }
}

/* ===== Row overflow menu ===== */
.row-actions {
    position: relative;
    display: inline-block;
}

.row-menu {
    position: fixed;
    z-index: 2200;
    display: none;
    min-width: 190px;
    padding: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 10px 28px var(--shadow-hover);
    text-align: left;
}

.row-menu.open {
    display: block;
}

.row-menu-group + .row-menu-group {
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px solid var(--border-light);
}

.row-menu-label {
    display: block;
    padding: 4px 10px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--text-muted);
}

.row-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 10px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.row-menu-item i {
    width: 16px;
    text-align: center;
    font-size: 13px;
}

.row-menu-item:hover {
    background: var(--bg-secondary);
    color: var(--navy-accent);
}

.row-menu-group.danger .row-menu-item {
    color: var(--danger);
}

.row-menu-group.danger .row-menu-item:hover {
    background: rgba(231, 76, 60, 0.1);
    color: var(--danger);
}

/* ===== Bulk selection ===== */
.dt-check {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--navy-accent);
}

table.dataTable tbody tr.row-selected,
table.dataTable tbody tr.row-selected:nth-child(even) {
    background: rgba(0, 116, 217, 0.12);
}

.bulk-banner {
    display: none;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    padding: 10px 14px;
    border-radius: 6px;
    background: rgba(0, 116, 217, 0.1);
    border: 1px solid rgba(0, 116, 217, 0.3);
    font-size: 13px;
    color: var(--text-secondary);
}

.bulk-banner.active {
    display: flex;
}

.bulk-banner button {
    border: none;
    background: transparent;
    color: var(--navy-accent);
    font-weight: 700;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    text-decoration: underline;
}

/* ===== Record modal tabs (the 360 / detail hub) ===== */
.rec-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--border-light);
}

.rec-tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 14px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.2s, border-color 0.2s;
}

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

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

.rec-pane {
    display: none;
}

.rec-pane.active {
    display: block;
}

/* identity strip at the top of a detail modal */
.rec-identity {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    margin-bottom: 16px;
    border-radius: 6px;
    background: var(--bg-secondary);
}

.rec-identity img,
.rec-identity .rec-identity-ph {
    width: 64px;
    height: 84px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--navy-primary);
    color: #fff;
    font-size: 22px;
}

.rec-identity-main h4 {
    font-size: 17px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.rec-identity-sub {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.rec-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.rec-kpi {
    padding: 10px 12px;
    border-radius: 6px;
    background: var(--bg-secondary);
    border-left: 3px solid var(--navy-accent);
}

.rec-kpi-val {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.rec-kpi-lbl {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-muted);
}

/* reverse-chron timeline feed */
.rec-timeline {
    list-style: none;
    position: relative;
    padding-left: 26px;
}

.rec-timeline::before {
    content: '';
    position: absolute;
    left: 9px;
    top: 6px;
    bottom: 6px;
    width: 2px;
    background: var(--border-light);
}

.rec-timeline li {
    position: relative;
    padding: 0 0 16px 6px;
}

.rec-timeline li::before {
    content: '';
    position: absolute;
    left: -21px;
    top: 5px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--navy-accent);
    box-shadow: 0 0 0 3px var(--bg-card);
}

.rec-timeline-what {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 600;
}

.rec-timeline-meta {
    font-size: 12px;
    color: var(--text-muted);
}

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

/* ===== List summary footer ===== */
.list-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border-light);
    font-size: 13px;
    color: var(--text-muted);
}

.list-summary strong {
    color: var(--text-primary);
}

/* ===== Empty state with CTA ===== */
.empty-state {
    padding: 46px 20px;
    text-align: center;
}

.empty-state i {
    font-size: 42px;
    color: var(--border-color);
    margin-bottom: 14px;
}

.empty-state h3 {
    font-size: 17px;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.empty-state p {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

/* status row tints intentionally render no colour bar — status is shown by the
   pipeline + the badge in the row. tint-* classes stay on the rows as hooks. */

/* ===== Transaction / formula modal — wide split, form left, live preview right =====
   Only for popups that move money, stock or a balance, or run a formula.
   Plain CRUD keeps the standard .modal — widening a 4-field form is its own failure. */
.modal-txn {
    width: 80%;
    max-width: 1400px;
}

.txn-split {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 20px;
    align-items: start;
}

.txn-form,
.txn-preview {
    max-height: 68vh;
    overflow-y: auto;
}

.txn-preview {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding-inline: 18px;
    padding-block: 16px;
}

.txn-preview h4 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.txn-line {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding: 7px 0;
    border-bottom: 1px dashed var(--border-light);
    font-size: 13px;
}

.txn-line-label {
    color: var(--text-secondary);
}

.txn-line-formula {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
}

.txn-line-val {
    font-weight: 600;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.txn-line.total {
    border-bottom: none;
    padding-top: 12px;
}

.txn-line.total .txn-line-val {
    font-size: 17px;
    color: var(--navy-accent);
}

.txn-impact {
    margin-top: 14px;
    padding: 10px 12px;
    border-radius: 6px;
    background: var(--bg-card);
    border-left: 3px solid var(--navy-accent);
    font-size: 13px;
    color: var(--text-secondary);
}

.txn-impact b {
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.txn-invalid {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 6px;
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid rgba(231, 76, 60, 0.35);
    color: var(--danger);
    font-size: 13px;
    font-weight: 600;
}

.txn-preview-foot {
    position: sticky;
    bottom: 0;
    margin: 14px -18px -16px;
    padding: 14px 18px;
    background: var(--bg-card);
    border-top: 2px solid var(--navy-primary);
}

.txn-items th,
.txn-items td {
    padding: 6px 8px;
    font-size: 13px;
}

@media (max-width: 992px) {
    .modal-txn { width: 95%; }
    .txn-split { grid-template-columns: 1fr; }
    .txn-form, .txn-preview { max-height: none; }
}

/* =====================================================================
   Book Editor — shelf picker (replaces the old .book-picker grid)
   cards read as books on a shelf: 2:3 cover plate + spine edge
   ===================================================================== */

.shelf-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.shelf-sub {
    margin: 4px 0 0;
    font-size: 13px;
    color: var(--text-muted);
}
.shelf-tools {
    display: flex;
    align-items: center;
    gap: 12px;
}
.shelf-count {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-muted);
    white-space: nowrap;
}
.shelf-search { position: relative; }
.shelf-search > i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 13px;
    color: var(--text-muted);
    pointer-events: none;
}
.shelf-search input {
    padding-left: 34px;
    min-width: 230px;
}

.book-shelf {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.shelf-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    color: var(--text-primary);
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.shelf-card:hover,
.shelf-card:focus-visible {
    transform: translateY(-4px);
    border-color: var(--navy-accent);
    box-shadow: 0 12px 24px var(--shadow-hover);
}
.shelf-card:focus-visible {
    outline: 2px solid var(--navy-accent);
    outline-offset: 2px;
}
/* own hide class so filtering never depends on utility ordering */
.shelf-card.is-hidden,
.shelf-noresults.is-hidden { display: none; }

/* cover plate — the spine strip is the signature */
.shelf-cover {
    position: relative;
    aspect-ratio: 2 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--navy-light), var(--navy-primary));
    overflow: hidden;
}
.shelf-cover img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.shelf-spine {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 10px;
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.38), rgba(0, 0, 0, 0.06) 62%, rgba(255, 255, 255, 0.14));
    transition: width 0.25s ease;
}
.shelf-card:hover .shelf-spine,
.shelf-card:focus-visible .shelf-spine { width: 16px; }
/* !important beats the broad body.dark-mode span/div colour rule — on-navy text stays white */
.shelf-monogram {
    font-size: 34px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: #ffffff !important;
    opacity: 0.92;
}
.shelf-type {
    position: absolute;
    right: 8px;
    top: 8px;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    background: rgba(0, 0, 0, 0.42);
    color: #ffffff !important;
}

.shelf-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    padding: 14px 14px 12px;
}
.shelf-card h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s ease;
}
.shelf-card:hover h4,
.shelf-card:focus-visible h4 { color: var(--navy-accent); }
.shelf-subtitle {
    font-size: 12px;
    line-height: 1.35;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.shelf-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    margin-top: 2px;
    font-size: 11.5px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}
.shelf-meta > span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.shelf-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: auto;
    padding-top: 10px;
}
.shelf-when {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
}

.shelf-noresults {
    padding: 30px 4px;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
}

@media (max-width: 600px) {
    .book-shelf {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 14px;
    }
    .shelf-tools { width: 100%; }
    .shelf-search { flex: 1; }
    .shelf-search input {
        min-width: 0;
        width: 100%;
    }
    .shelf-monogram { font-size: 26px; }
}

@media (prefers-reduced-motion: reduce) {
    .shelf-card,
    .shelf-spine,
    .shelf-card h4 { transition: none; }
    .shelf-card:hover,
    .shelf-card:focus-visible { transform: none; }
}

/* =====================================================================
   Dialogs — custom html popups (rs-ui.js). Replaces the third-party popup
   layer app-wide, so every confirm / alert / prompt wears the house theme.
   ===================================================================== */

.rs-dlg-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1600; /* above modals (1400) — a confirm can open from inside one */
    opacity: 0;
    transition: opacity 0.16s ease;
}
.rs-dlg-overlay.open { opacity: 1; }
body.dark-mode .rs-dlg-overlay { background: rgba(0, 0, 0, 0.8); }
body.rs-dlg-lock { overflow: hidden; }

.rs-dlg {
    position: relative;
    width: 100%;
    max-width: 460px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 30px 28px 24px;
    background: var(--bg-card);
    border-radius: 4px;
    box-shadow: 0 12px 40px var(--shadow-hover);
    text-align: center;
    color: var(--text-primary);
    transform: translateY(10px) scale(0.98);
    transition: transform 0.16s ease;
}
.rs-dlg-overlay.open .rs-dlg { transform: none; }

.rs-dlg-x {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    font-size: 26px;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.2s ease, color 0.2s ease;
}
.rs-dlg-x:hover { background: var(--bg-primary); color: var(--text-primary); }

.rs-dlg-icon {
    width: 76px;
    height: 76px;
    margin: 4px auto 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 38px;
}
.rs-dlg-icon.is-success { background: rgba(52, 168, 83, 0.12);  color: var(--success); }
.rs-dlg-icon.is-error   { background: rgba(234, 67, 53, 0.12);  color: var(--danger); }
.rs-dlg-icon.is-warning { background: rgba(251, 188, 4, 0.16);  color: #d79b00; }
.rs-dlg-icon.is-info    { background: rgba(0, 116, 217, 0.12);  color: var(--navy-accent); }
.rs-dlg-icon.is-question{ background: rgba(0, 31, 63, 0.10);    color: var(--navy-primary); }
body.dark-mode .rs-dlg-icon.is-question { color: var(--navy-accent); }

.rs-dlg-title {
    margin: 0 0 8px;
    font-size: 20px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}
.rs-dlg-text {
    font-size: 14.5px;
    line-height: 1.5;
    color: var(--text-secondary);
    word-break: break-word;
}
.rs-dlg-html { margin-top: 12px; text-align: left; }
.rs-dlg-input { margin-top: 18px; text-align: left; }
.rs-dlg-input .form-control { width: 100%; }
.rs-dlg-check {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-size: 14px;
    cursor: pointer;
}

.rs-dlg-err {
    display: none;
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 4px;
    background: rgba(234, 67, 53, 0.10);
    color: var(--danger);
    font-size: 13px;
    text-align: left;
}
.rs-dlg-err.on { display: block; }

.rs-dlg-load { display: none; margin-top: 18px; font-size: 26px; color: var(--navy-accent); }
.rs-dlg.is-loading .rs-dlg-load { display: block; }
.rs-dlg.is-loading .rs-dlg-actions { display: none; }

.rs-dlg-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 24px;
}
.rs-dlg-actions .btn { min-width: 104px; }

.rs-dlg-footer {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--border-light);
    font-size: 12.5px;
    color: var(--text-muted);
}

.rs-dlg-timerbar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: var(--border-light);
}
.rs-dlg-timerbar span {
    display: block;
    height: 100%;
    width: 100%;
    background: var(--navy-accent);
}

/* toast — corner strip, no backdrop, click to dismiss */
.rs-dlg-overlay.is-toast {
    background: transparent;
    align-items: flex-start;
    justify-content: flex-end;
    pointer-events: none;
    padding: 18px;
}
.rs-dlg-overlay.is-toast.pos-top-start   { justify-content: flex-start; }
.rs-dlg-overlay.is-toast.pos-bottom-end  { align-items: flex-end; }
.rs-dlg-overlay.is-toast.pos-bottom-start{ align-items: flex-end; justify-content: flex-start; }
.rs-dlg-overlay.is-toast.pos-center      { align-items: center; justify-content: center; }
.rs-dlg-toast {
    width: auto;
    max-width: 380px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
    pointer-events: auto;
    cursor: pointer;
    box-shadow: 0 8px 26px var(--shadow-hover);
}
.rs-dlg-toast .rs-dlg-icon {
    width: 34px;
    height: 34px;
    margin: 0;
    font-size: 18px;
    flex-shrink: 0;
}
.rs-dlg-toast .rs-dlg-title { margin: 0; font-size: 14.5px; }
.rs-dlg-toast .rs-dlg-text { font-size: 13px; }
.rs-dlg-toast .rs-dlg-actions { display: none; }

@media (max-width: 600px) {
    .rs-dlg { padding: 26px 20px 20px; }
    .rs-dlg-actions .btn { flex: 1; min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .rs-dlg-overlay, .rs-dlg { transition: none; }
    .rs-dlg { transform: none; }
}

/* =====================================================================
   MUST STAY LAST IN THIS FILE
   Any component rule that sets `display` (.store-grid{grid}, .file-grid{grid},
   .shelf-card{flex}, …) has the same specificity as this class, so whichever
   comes later wins. Declared here it always hides. Never add !important —
   jQuery .show() writes an inline display, which already beats a class.
   ===================================================================== */
.initially-hidden {
    display: none;
}
