/* IPW Dashboard — refined UI */

:root {
    --primary: #1a5f7a;
    --primary-dark: #134a5f;
    --primary-light: #2a7a9a;
    --secondary: #f97316;
    --secondary-dark: #ea580c;
    --accent: #fbbf24;
    --dark: #0f172a;
    --dark-light: #1e293b;
    --white: #ffffff;
    --gray-900: #0f172a;
    --gray-800: #1e293b;
    --gray-700: #334155;
    --gray-600: #475569;
    --gray-500: #64748b;
    --gray-400: #94a3b8;
    --gray-300: #cbd5e1;
    --gray-200: #e2e8f0;
    --gray-100: #f1f5f9;
    --gray-50: #f8fafc;
    --success: #22c55e;
    --error: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --font-heading: 'Montserrat', sans-serif;
    --font-body: 'Open Sans', sans-serif;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --transition: all 0.2s ease;
    --sidebar-width: 260px;
}

/* ========================
   DARK MODE — DOS Terminal Theme
   ======================== */

[data-theme="dark"] {
    /* Phosphor green on black — CRT/DOS palette */
    --primary: #00ff41;
    --primary-dark: #00cc33;
    --primary-light: #33ff66;
    --secondary: #ff3333;
    --secondary-dark: #cc0000;
    --accent: #ffcc00;
    --dark: #000000;
    --dark-light: #030a04;
    --white: #000000;
    --gray-50: #020602;
    --gray-100: #050f07;
    --gray-200: #0d1f0f;
    --gray-300: #1a3d1e;
    --gray-400: #008822;
    --gray-500: #00aa2a;
    --gray-600: #00cc33;
    --gray-700: #00ee44;
    --gray-800: #00ff41;
    --gray-900: #ccffdd;
    --success: #00ff41;
    --error: #ff3333;
    --warning: #ffcc00;
    --info: #00e5ff;
    --font-body: 'Courier New', Courier, monospace;
    --font-heading: 'Courier New', Courier, monospace;
    --radius: 0px;
    --radius-lg: 0px;
    --radius-xl: 2px;
    --shadow-sm: 0 0 0 1px rgba(0, 255, 65, 0.2);
    --shadow: 0 0 0 1px rgba(0, 255, 65, 0.3);
    --shadow-md: 0 0 0 1px rgba(0, 255, 65, 0.4);
    --shadow-lg: 0 0 0 1px rgba(0, 255, 65, 0.5), 0 0 16px rgba(0, 255, 65, 0.1);
    --shadow-xl: 0 0 0 1px rgba(0, 255, 65, 0.6), 0 0 24px rgba(0, 255, 65, 0.15);
    color-scheme: dark;
}

/* ---- Base ---- */
[data-theme="dark"] body {
    font-family: 'Courier New', Courier, monospace;
    color: #00ff41;
    background: #000000;
}
[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4 {
    font-family: 'Courier New', Courier, monospace;
    color: #ccffdd;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
[data-theme="dark"] p,
[data-theme="dark"] span,
[data-theme="dark"] td,
[data-theme="dark"] th,
[data-theme="dark"] label,
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea,
[data-theme="dark"] button {
    font-family: 'Courier New', Courier, monospace;
}

/* ---- Layout ---- */
[data-theme="dark"] .dashboard-page { background: #000000; }
[data-theme="dark"] .main-content { background: #000000; }
[data-theme="dark"] .filter-bar,
[data-theme="dark"] .filter-chips { background: #000000; }

/* ---- Sidebar ---- */
[data-theme="dark"] .sidebar {
    background: #000000;
    border-right: 1px solid rgba(0, 255, 65, 0.15);
}
[data-theme="dark"] .sidebar-brand {
    border-bottom-color: rgba(0, 255, 65, 0.15);
}
[data-theme="dark"] .sidebar-brand h2 { color: #00ff41; }
[data-theme="dark"] .brand-logo {
    background: transparent;
    border: 1px solid #00ff41;
    color: #00ff41;
}
[data-theme="dark"] .nav-section-label { color: #008822; }
[data-theme="dark"] .nav-item { color: #00aa2a; border-radius: 0; }
[data-theme="dark"] .nav-item:hover {
    color: #00ff41;
    background: rgba(0, 255, 65, 0.07);
}
[data-theme="dark"] .nav-item.active {
    background: #00ff41;
    color: #000000;
    box-shadow: none;
}
[data-theme="dark"] .sidebar-footer { border-top-color: rgba(0, 255, 65, 0.15); }
[data-theme="dark"] .user-name { color: #00ff41; }
[data-theme="dark"] .user-role { color: #008822; }
[data-theme="dark"] .user-avatar {
    background: transparent;
    border: 1px solid #00ff41;
    color: #00ff41;
}

/* ---- Mobile header ---- */
[data-theme="dark"] .mobile-header {
    background: #000000;
    border-bottom: 1px solid rgba(0, 255, 65, 0.2);
}
[data-theme="dark"] .mobile-header h1 { color: #00ff41; }
[data-theme="dark"] .menu-toggle span { background: #00ff41; }

/* ---- Cards / surfaces ---- */
[data-theme="dark"] .stat-card {
    background: #050f07;
    border: 1px solid #0d1f0f;
}
[data-theme="dark"] .stat-card:hover {
    border-color: #00ff41;
    box-shadow: 0 0 10px rgba(0, 255, 65, 0.12);
    transform: translateY(-2px);
}
[data-theme="dark"] .stat-value { color: #00ff41; }
[data-theme="dark"] .stat-label { color: #008822; }
[data-theme="dark"] .stat-icon { background: #0d1f0f; color: #00ff41; }
[data-theme="dark"] .stat-icon-week  { background: #1a0000; color: #ff3333; }
[data-theme="dark"] .stat-icon-new   { background: #0d1f0f; color: #00ff41; }
[data-theme="dark"] .stat-icon-reviewed { background: #1a1400; color: #ffcc00; }
[data-theme="dark"] .stat-icon-contacted { background: #001a05; color: #00ff41; }
[data-theme="dark"] .stat-icon-closed { background: #0d1f0f; color: #008822; }

/* ---- Inputs ---- */
[data-theme="dark"] .form-group input:not([type="checkbox"]),
[data-theme="dark"] .settings-form-group input:not([type="checkbox"]),
[data-theme="dark"] .search-input,
[data-theme="dark"] .date-input,
[data-theme="dark"] .select-filter,
[data-theme="dark"] .add-note-form textarea,
[data-theme="dark"] .note-edit-area,
[data-theme="dark"] .pagination-per-page {
    background-color: #000000;
    border-color: #1a3d1e;
    color: #00ff41;
    border-radius: 0;
}

[data-theme="dark"] .form-group input:not([type="checkbox"]):focus,
[data-theme="dark"] .settings-form-group input:not([type="checkbox"]):focus,
[data-theme="dark"] .search-input:focus,
[data-theme="dark"] .date-input:focus,
[data-theme="dark"] .select-filter:focus,
[data-theme="dark"] .add-note-form textarea:focus,
[data-theme="dark"] .note-edit-area:focus {
    background-color: #030a04;
    border-color: #00ff41;
    box-shadow: 0 0 0 2px rgba(0, 255, 65, 0.15);
}

[data-theme="dark"] .form-group input::placeholder,
[data-theme="dark"] .settings-form-group input::placeholder,
[data-theme="dark"] .search-input::placeholder,
[data-theme="dark"] .add-note-form textarea::placeholder {
    color: #008822;
}

[data-theme="dark"] .form-group label { color: #00cc33; }

[data-theme="dark"] .select-filter {
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2300ff41' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

[data-theme="dark"] .pagination-per-page {
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2300ff41' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* ---- Buttons ---- */
[data-theme="dark"] .btn-primary {
    background: #00ff41;
    color: #000000;
    border-radius: 0;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    box-shadow: none;
}
[data-theme="dark"] .btn-primary:hover {
    background: #33ff66;
    box-shadow: 0 0 12px rgba(0, 255, 65, 0.4);
    transform: translateY(-1px);
}
[data-theme="dark"] .btn-sm {
    background: #000000;
    color: #00ff41;
    border: 1px solid rgba(0, 255, 65, 0.35);
    border-radius: 0;
}
[data-theme="dark"] .btn-sm:hover {
    background: #00ff41;
    color: #000000;
    border-color: #00ff41;
}
[data-theme="dark"] .btn-logout {
    border-color: #1a3d1e;
    color: #008822;
    border-radius: 0;
}
[data-theme="dark"] .btn-logout:hover {
    background: rgba(255, 51, 51, 0.08);
    border-color: rgba(255, 51, 51, 0.5);
    color: #ff3333;
}
[data-theme="dark"] .btn-github { background: #0d1f0f; border-radius: 0; }
[data-theme="dark"] .btn-github:hover { background: #1a3d1e; }

/* ---- Chips / filters ---- */
[data-theme="dark"] .chip {
    background: #000000;
    border-color: #1a3d1e;
    color: #008822;
    border-radius: 0;
}
[data-theme="dark"] .chip:hover {
    border-color: #00ff41;
    color: #00ff41;
    background: rgba(0, 255, 65, 0.05);
}
[data-theme="dark"] .chip.active {
    background: #00ff41;
    border-color: #00ff41;
    color: #000000;
    box-shadow: 0 0 8px rgba(0, 255, 65, 0.3);
    border-radius: 0;
}

/* ---- Login card ---- */
[data-theme="dark"] .login-card {
    background: #050f07;
    border: 1px solid rgba(0, 255, 65, 0.2);
    box-shadow: 0 0 30px rgba(0, 255, 65, 0.08);
}

/* ---- Modals ---- */
[data-theme="dark"] .modal-overlay { background: rgba(0, 0, 0, 0.92); }
[data-theme="dark"] .modal,
[data-theme="dark"] .modal-header {
    background: #050f07;
    border: 1px solid #0d1f0f;
}
[data-theme="dark"] .modal-header { border-bottom-color: #0d1f0f; }

/* ---- Toasts / errors ---- */
[data-theme="dark"] .error-message {
    background: #1a0000;
    border-color: #ff3333;
    color: #ff3333;
}
[data-theme="dark"] .toast-error {
    background: #1a0000;
    color: #ff3333;
    border-color: #ff3333;
}
[data-theme="dark"] .toast-info {
    background: #001a1a;
    color: #00e5ff;
    border-color: #00e5ff;
}
[data-theme="dark"] .toast-success {
    background: #001a05;
    color: #00ff41;
    border-color: #00ff41;
}

/* ---- Status badges ---- */
[data-theme="dark"] .status-select.status-new,
[data-theme="dark"] .status-badge.status-new {
    background: #001a1a;
    color: #00e5ff;
    border: 1px solid rgba(0, 229, 255, 0.35);
}
[data-theme="dark"] .status-select.status-reviewed,
[data-theme="dark"] .status-badge.status-reviewed {
    background: #1a1400;
    color: #ffcc00;
    border: 1px solid rgba(255, 204, 0, 0.35);
}
[data-theme="dark"] .status-select.status-contacted,
[data-theme="dark"] .status-badge.status-contacted {
    background: #001a05;
    color: #00ff41;
    border: 1px solid rgba(0, 255, 65, 0.35);
}
[data-theme="dark"] .status-select.status-pending,
[data-theme="dark"] .status-badge.status-pending {
    background: #001a1a;
    color: #00e5ff;
    border: 1px solid rgba(0, 229, 255, 0.35);
}
[data-theme="dark"] .status-select.status-confirmed,
[data-theme="dark"] .status-badge.status-confirmed {
    background: #001a05;
    color: #00ff41;
    border: 1px solid rgba(0, 255, 65, 0.35);
}
[data-theme="dark"] .status-select.status-completed,
[data-theme="dark"] .status-badge.status-completed {
    background: #0a001a;
    color: #cc99ff;
    border: 1px solid rgba(204, 153, 255, 0.35);
}
[data-theme="dark"] .status-select.status-cancelled,
[data-theme="dark"] .status-badge.status-cancelled {
    background: #0d1f0f;
    color: #008822;
    border: 1px solid rgba(0, 136, 34, 0.35);
}
[data-theme="dark"] .status-select.status-no_show,
[data-theme="dark"] .status-badge.status-no_show {
    background: #1a0000;
    color: #ff3333;
    border: 1px solid rgba(255, 51, 51, 0.35);
}

/* ---- Role badges ---- */
[data-theme="dark"] .role-badge-admin {
    background: #0a001a;
    color: #cc99ff;
}
[data-theme="dark"] .role-badge-client {
    background: #001a1a;
    color: #00e5ff;
}

/* ---- Notes ---- */
[data-theme="dark"] .note-delete:hover { background: #1a0000; color: #ff3333; }
[data-theme="dark"] .note-edit:hover { background: #001a05; color: #00ff41; }

/* ---- Settings ---- */
[data-theme="dark"] .settings-method-status.connected {
    background: #001a05;
    color: #00ff41;
    border: 1px solid rgba(0, 255, 65, 0.35);
}

/* ---- Tables ---- */
[data-theme="dark"] .quotes-table tbody tr:nth-child(even),
[data-theme="dark"] .users-table tbody tr:nth-child(even),
[data-theme="dark"] .reservations-table tbody tr:nth-child(even) {
    background: rgba(0, 255, 65, 0.02);
}

[data-theme="dark"] .activity-dot { border-color: #000000; }

@media (max-width: 768px) {
    [data-theme="dark"] .quotes-table tr,
    [data-theme="dark"] .users-table tr,
    [data-theme="dark"] .reservations-table tr {
        background: #050f07;
        border-color: #0d1f0f;
    }
    [data-theme="dark"] .quotes-table tbody tr:nth-child(even),
    [data-theme="dark"] .users-table tbody tr:nth-child(even),
    [data-theme="dark"] .reservations-table tbody tr:nth-child(even) {
        background: #050f07;
    }
    [data-theme="dark"] .table-container,
    [data-theme="dark"] #users-table-container {
        background: transparent;
    }
}

/* Theme toggle button */
.theme-toggle {
    width: 100%;
    padding: 0.5rem;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius);
    color: var(--gray-400);
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--white);
}

[data-theme="dark"] .theme-toggle {
    border: 1px solid rgba(0, 255, 65, 0.25);
    color: #008822;
    font-family: 'Courier New', Courier, monospace;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border-radius: 0;
    font-size: 0.75rem;
}
[data-theme="dark"] .theme-toggle:hover {
    background: rgba(0, 255, 65, 0.07);
    border-color: #00ff41;
    color: #00ff41;
}

/* Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    color: var(--gray-800);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.2;
}

/* ========================
   LOGIN PAGE
   ======================== */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--dark);
    position: relative;
    overflow: hidden;
    padding: 1rem;
}

.login-page::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse at 30% 50%, rgba(26, 95, 122, 0.15) 0%, transparent 60%),
                radial-gradient(ellipse at 70% 80%, rgba(249, 115, 22, 0.08) 0%, transparent 50%);
    pointer-events: none;
}

.login-card {
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl), 0 0 0 1px rgba(255, 255, 255, 0.05);
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
}

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

.login-header h1 {
    font-size: 1.75rem;
    color: var(--dark);
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--gray-500);
    font-size: 0.95rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--gray-700);
    margin-bottom: 0.375rem;
}

.form-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--gray-800);
    background: var(--gray-50);
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(26, 95, 122, 0.12);
}

.form-group input::placeholder {
    color: var(--gray-400);
}

.error-message {
    background: #fef2f2;
    color: var(--error);
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    margin-bottom: 1rem;
    border: 1px solid #fecaca;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
    gap: 0.5rem;
}

.btn-primary {
    width: 100%;
    padding: 0.875rem;
    background: var(--primary);
    color: var(--white);
    font-size: 1rem;
    border-radius: var(--radius);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(26, 95, 122, 0.3);
}

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

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.forgot-password-link {
    display: block;
    text-align: center;
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: var(--gray-500);
    text-decoration: none;
    transition: var(--transition);
}

.forgot-password-link:hover {
    color: var(--primary);
}

.login-divider {
    display: flex;
    align-items: center;
    margin: 1.5rem 0;
    gap: 1rem;
}

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

.login-divider span {
    font-size: 0.8rem;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.btn-github {
    width: 100%;
    padding: 0.875rem;
    background: #24292e;
    color: var(--white);
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    border-radius: var(--radius);
}

.btn-github:hover {
    background: #1a1e22;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.btn-github:active {
    transform: translateY(0);
}

.btn-github:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-sm {
    padding: 0.375rem 0.875rem;
    font-size: 0.8rem;
    background: var(--gray-50);
    color: var(--primary);
    border: 1.5px solid var(--gray-200);
    border-radius: 6px;
}

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

/* ========================
   DASHBOARD LAYOUT
   ======================== */

.dashboard-page {
    display: flex;
    min-height: 100vh;
    background: var(--gray-100);
    overflow-x: hidden;
}

/* Mobile header */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--dark);
    color: var(--white);
    align-items: center;
    padding: 0 1rem;
    z-index: 100;
    gap: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.mobile-header h1 {
    font-size: 1.1rem;
}

.menu-toggle {
    background: none;
    border: none;
    cursor: pointer;
    width: 28px;
    height: 20px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.menu-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--white);
    border-radius: 2px;
    transition: var(--transition);
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--dark);
    color: var(--white);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 200;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-brand {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.brand-logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--white);
}

.sidebar-brand h2 {
    font-size: 1.15rem;
    color: var(--white);
    letter-spacing: -0.01em;
}

.sidebar-nav {
    flex: 1;
    padding: 0.75rem 0;
    overflow-y: auto;
}

.nav-section-label {
    display: block;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.75rem 1.5rem 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1.5rem;
    color: var(--gray-400);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: var(--transition);
    margin: 2px 0.5rem;
    border-radius: var(--radius);
    position: relative;
}

.nav-item[hidden],
.btn[hidden] {
    display: none;
}

.nav-item:hover {
    color: var(--white);
    background: rgba(255, 255, 255, 0.06);
}

.nav-item.active {
    color: var(--white);
    background: var(--primary);
    border-right: none;
    box-shadow: 0 2px 8px rgba(26, 95, 122, 0.3);
}

.nav-label {
    flex: 1;
}

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--white);
    flex-shrink: 0;
    text-transform: uppercase;
}

.user-details {
    min-width: 0;
    flex: 1;
}

.user-name {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    display: block;
    font-size: 0.7rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.btn-logout {
    width: 100%;
    padding: 0.5rem;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius);
    color: var(--gray-400);
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--error);
}

.sidebar-overlay {
    display: none;
}

/* Main content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 1.5rem 2rem;
    max-width: calc(100vw - var(--sidebar-width));
    min-width: 0;
    overflow-x: hidden;
}

.view-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.75rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.view-header h2 {
    font-size: 1.5rem;
    color: var(--gray-900);
    letter-spacing: -0.02em;
}

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

/* Filters */
.select-filter {
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 0.875rem;
    color: var(--gray-700);
    background: var(--white);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2364748b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    transition: var(--transition);
}

.select-filter:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 95, 122, 0.1);
}

.filter-chips {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    position: sticky;
    top: 52px;
    z-index: 10;
    background: var(--gray-100);
    padding: 0.5rem 0;
}

.chip {
    padding: 0.375rem 1rem;
    border: 1.5px solid var(--gray-200);
    border-radius: 9999px;
    background: var(--white);
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-500);
    cursor: pointer;
    transition: var(--transition);
}

.chip:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(26, 95, 122, 0.04);
}

.chip.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
    box-shadow: 0 2px 6px rgba(26, 95, 122, 0.25);
}

/* ========================
   NOTIFICATION BADGE
   ======================== */

.nav-badge {
    background: var(--error);
    color: var(--white);
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    animation: badge-pop 0.3s ease;
}

@keyframes badge-pop {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* ========================
   STATS CARDS
   ======================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    border: 1px solid var(--gray-200);
    transition: var(--transition);
    cursor: pointer;
}

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

.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius);
    background: var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--gray-500);
}

.stat-icon-week { background: #fff7ed; color: var(--secondary); }
.stat-icon-new { background: #eff6ff; color: var(--info); }
.stat-icon-reviewed { background: #fffbeb; color: var(--warning); }
.stat-icon-contacted { background: #f0fdf4; color: var(--success); }
.stat-icon-closed { background: var(--gray-100); color: var(--gray-500); }

.stat-content {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    min-width: 0;
}

.stat-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stat-value {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1.2;
}

/* ========================
   FILTER BAR
   ======================== */

.filter-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--gray-100);
    padding: 0.75rem 0;
}

.search-wrapper {
    position: relative;
    flex: 1;
    min-width: 200px;
    max-width: 360px;
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 0.5rem 0.75rem 0.5rem 2.25rem;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 0.875rem;
    color: var(--gray-700);
    background: var(--white);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 95, 122, 0.1);
}

.search-input::placeholder {
    color: var(--gray-400);
}

.date-range {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.date-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-500);
}

.date-input {
    padding: 0.5rem 0.5rem;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 0.8rem;
    color: var(--gray-700);
    background: var(--white);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.date-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 95, 122, 0.1);
}

.btn-clear-dates {
    padding: 0.5rem 0.75rem;
    background: var(--white);
    color: var(--gray-600);
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-clear-dates:hover {
    background: var(--gray-100);
    border-color: var(--gray-300);
}

/* Date presets */
.date-presets {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.date-preset-btn {
    padding: 0.35rem 0.75rem;
    background: var(--white);
    color: var(--gray-600);
    border: 1.5px solid var(--gray-200);
    border-radius: 50px;
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.date-preset-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

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

/* ========================
   EXPORT BUTTON
   ======================== */

.btn-export {
    gap: 0.375rem;
    background: var(--white);
    color: var(--primary);
    border: 1.5px solid var(--primary);
    border-radius: var(--radius);
}

.btn-export:hover {
    background: var(--primary);
    color: var(--white);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(26, 95, 122, 0.25);
}

.btn-export svg {
    flex-shrink: 0;
}

.btn-clear-filters {
    gap: 0.375rem;
    background: var(--white);
    color: var(--danger, #e74c3c);
    border: 1.5px solid var(--danger, #e74c3c);
    border-radius: var(--radius);
    font-size: 0.85rem;
    padding: 0.5rem 1rem;
}
.btn-clear-filters:hover {
    background: var(--danger, #e74c3c);
    color: var(--white);
    transform: translateY(-1px);
}

/* ========================
   NOTES (modal)
   ======================== */

.notes-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 2px solid var(--gray-100);
}

.notes-header {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 1rem;
}

.notes-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.note-item {
    background: var(--gray-50);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    border: 1px solid var(--gray-100);
    transition: var(--transition);
}

.note-item:hover {
    border-color: var(--gray-200);
}

.note-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.375rem;
}

.note-author {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--primary);
}

.note-date {
    font-size: 0.75rem;
    color: var(--gray-400);
}

.note-text {
    font-size: 0.875rem;
    color: var(--gray-700);
    white-space: pre-wrap;
    word-break: break-word;
}

.note-delete {
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    font-size: 0.75rem;
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius);
    transition: var(--transition);
}

.note-delete:hover {
    background: #fef2f2;
    color: var(--error);
}

.note-edit {
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    font-size: 0.75rem;
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius);
    transition: var(--transition);
}

.note-edit:hover {
    background: #eff6ff;
    color: var(--primary);
}

.note-edit-area {
    width: 100%;
    padding: 0.5rem 0.75rem;
    margin-top: 0.375rem;
    border: 1.5px solid var(--primary);
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 0.875rem;
    color: var(--gray-700);
    resize: vertical;
    min-height: 60px;
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(26, 95, 122, 0.1);
}

.note-edit-area:focus {
    outline: none;
}

.note-edit-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.375rem;
    margin-top: 0.375rem;
}

.note-edit-save,
.note-edit-cancel {
    padding: 0.3rem 0.75rem;
    border: none;
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.note-edit-save {
    background: var(--primary);
    color: var(--white);
}

.note-edit-save:hover {
    background: var(--primary-dark);
}

.note-edit-cancel {
    background: var(--gray-100);
    color: var(--gray-600);
}

.note-edit-cancel:hover {
    background: var(--gray-200);
}

/* Note count badge */
.note-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    margin-left: 6px;
    background: var(--primary);
    color: var(--white);
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 50px;
    vertical-align: middle;
}

.notes-empty {
    font-size: 0.85rem;
    color: var(--gray-400);
    text-align: center;
    padding: 1rem;
}

.add-note-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.add-note-form textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 0.875rem;
    color: var(--gray-700);
    resize: vertical;
    min-height: 70px;
    background: var(--gray-50);
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.add-note-form textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(26, 95, 122, 0.1);
}

.add-note-form textarea::placeholder {
    color: var(--gray-400);
}

.btn-add-note {
    align-self: flex-end;
    padding: 0.5rem 1.25rem;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-add-note:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(26, 95, 122, 0.25);
}

.btn-add-note:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ========================
   ACTIVITY LOG (modal)
   ======================== */

.activity-log-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 2px solid var(--gray-100);
}

.activity-log-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.activity-log-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.625rem 0;
    position: relative;
}

.activity-log-item:not(:last-child)::before {
    content: '';
    position: absolute;
    left: 5px;
    top: 1.5rem;
    bottom: 0;
    width: 1px;
    background: var(--gray-200);
}

.activity-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--primary-light);
    border: 2px solid var(--white);
    outline: 1px solid var(--gray-300);
    flex-shrink: 0;
    margin-top: 0.25rem;
}

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

.activity-text {
    font-size: 0.825rem;
    color: var(--gray-700);
    line-height: 1.5;
}

.activity-text strong {
    color: var(--primary);
    font-weight: 600;
}

.activity-text .status-badge {
    font-size: 0.7rem;
    padding: 0.125rem 0.5rem;
    vertical-align: middle;
}

.activity-date {
    display: block;
    font-size: 0.7rem;
    color: var(--gray-400);
    margin-top: 0.125rem;
}

/* ========================
   QUOTES TABLE
   ======================== */

.table-container {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
    border: 1px solid var(--gray-200);
}

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

.quotes-table thead {
    background: var(--gray-50);
    border-bottom: 2px solid var(--gray-200);
}

.quotes-table th {
    padding: 0.625rem 0.75rem;
    text-align: left;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.7rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.quotes-table th[data-sort] {
    cursor: pointer;
    user-select: none;
    transition: color 0.15s;
}

.quotes-table th[data-sort]:hover {
    color: var(--primary);
}

.quotes-table th[data-sort]:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
    color: var(--primary);
    border-radius: 4px;
}

.quotes-table th[data-sort]::after {
    content: '⇅';
    margin-left: 0.375rem;
    font-size: 0.65rem;
    opacity: 0.35;
}

.quotes-table th[data-sort].sort-asc::after {
    content: '▲';
    opacity: 0.8;
    color: var(--primary);
}

.quotes-table th[data-sort].sort-desc::after {
    content: '▼';
    opacity: 0.8;
    color: var(--primary);
}

.quotes-table th[data-sort].sort-asc,
.quotes-table th[data-sort].sort-desc {
    color: var(--primary);
}

.quotes-table td {
    padding: 0.625rem 0.75rem;
    font-size: 0.8rem;
    color: var(--gray-700);
    border-bottom: 1px solid var(--gray-100);
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.quotes-table tbody tr {
    cursor: pointer;
    transition: background 0.15s;
}

.quotes-table tbody tr:hover {
    background: var(--gray-50);
}

.quotes-table tbody tr:active {
    background: var(--gray-100);
}

/* Alternate row striping */
.quotes-table tbody tr:nth-child(even) {
    background: rgba(241, 245, 249, 0.4);
}

.quotes-table tbody tr:nth-child(even):hover {
    background: var(--gray-50);
}

/* Status select in table */
.status-select {
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    border: none;
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    appearance: auto;
    transition: var(--transition);
}

.status-select:focus {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}

.status-select.status-new,
.status-badge.status-new {
    background: #dbeafe;
    color: #1e40af;
}

.status-select.status-reviewed,
.status-badge.status-reviewed {
    background: #fef3c7;
    color: #78350f;
}

.status-select.status-contacted,
.status-badge.status-contacted {
    background: #d1fae5;
    color: #064e3b;
}

.status-select.status-closed,
.status-badge.status-closed {
    background: var(--gray-100);
    color: var(--gray-700);
}

/* Reservation status colors */
.status-select.status-pending,
.status-badge.status-pending {
    background: #dbeafe;
    color: #1e40af;
}

.status-select.status-confirmed,
.status-badge.status-confirmed {
    background: #d1fae5;
    color: #064e3b;
}

.status-select.status-completed,
.status-badge.status-completed {
    background: #e0e7ff;
    color: #3730a3;
}

.status-select.status-cancelled,
.status-badge.status-cancelled {
    background: var(--gray-100);
    color: var(--gray-700);
}

.status-select.status-no_show,
.status-badge.status-no_show {
    background: #fee2e2;
    color: #991b1b;
}

/* Status badges (used in modal) */
.status-badge {
    display: inline-block;
    padding: 0.2rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* ========================
   RESERVATIONS TABLE
   ======================== */

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

.reservations-table thead {
    background: var(--gray-50);
    border-bottom: 2px solid var(--gray-200);
}

.reservations-table th {
    padding: 0.625rem 0.75rem;
    text-align: left;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.7rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.reservations-table th[data-sort] {
    cursor: pointer;
    user-select: none;
    transition: color 0.15s;
}

.reservations-table th[data-sort]:hover {
    color: var(--primary);
}

.reservations-table th[data-sort]:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
    color: var(--primary);
    border-radius: 4px;
}

.reservations-table th[data-sort]::after {
    content: '\u21C5';
    margin-left: 0.375rem;
    font-size: 0.65rem;
    opacity: 0.35;
}

.reservations-table th[data-sort].sort-asc::after {
    content: '\u25B2';
    opacity: 0.8;
    color: var(--primary);
}

.reservations-table th[data-sort].sort-desc::after {
    content: '\u25BC';
    opacity: 0.8;
    color: var(--primary);
}

.reservations-table th[data-sort].sort-asc,
.reservations-table th[data-sort].sort-desc {
    color: var(--primary);
}

.reservations-table td {
    padding: 0.625rem 0.75rem;
    font-size: 0.8rem;
    color: var(--gray-700);
    border-bottom: 1px solid var(--gray-100);
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.reservations-table tbody tr {
    cursor: pointer;
    transition: background 0.15s;
}

.reservations-table tbody tr:hover {
    background: var(--gray-50);
}

.reservations-table tbody tr:active {
    background: var(--gray-100);
}

.reservations-table tbody tr:nth-child(even) {
    background: rgba(241, 245, 249, 0.4);
}

.reservations-table tbody tr:nth-child(even):hover {
    background: var(--gray-50);
}

/* ========================
   LOADING & EMPTY STATES
   ======================== */

.loading {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    color: var(--gray-500);
}

.loading.active {
    display: flex;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 1rem;
}

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

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--gray-400);
    font-size: 0.95rem;
}

.empty-icon {
    margin-bottom: 1rem;
    color: var(--gray-300);
}

.empty-state p {
    color: var(--gray-500);
}

/* ========================
   MODAL
   ======================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

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

.modal {
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 560px;
    max-height: 85vh;
    overflow-y: auto;
    transform: translateY(0);
    transition: transform 0.2s ease;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--gray-100);
    position: sticky;
    top: 0;
    background: var(--white);
    z-index: 1;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.modal-header h3 {
    font-size: 1.1rem;
    color: var(--gray-900);
}

.modal-close {
    background: var(--gray-100);
    border: none;
    font-size: 1.25rem;
    color: var(--gray-500);
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
    transition: var(--transition);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--gray-200);
    color: var(--gray-700);
}

.modal-body {
    padding: 1.5rem;
}

/* Confirm modal */
.confirm-modal {
    max-width: 400px;
    overflow-y: visible;
}

.modal-card {
    max-width: 480px;
}

.color-input {
    width: 60px;
    height: 36px;
    border: none;
    cursor: pointer;
    border-radius: var(--radius);
    padding: 0;
}

.confirm-modal .modal-body {
    padding: 1.25rem 1.5rem 1.5rem;
}

#confirm-message {
    font-size: 0.9rem;
    color: var(--gray-700);
    line-height: 1.5;
}

.confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.btn-cancel {
    padding: 0.5rem 1.25rem;
    background: var(--white);
    color: var(--gray-700);
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius);
}

.btn-cancel:hover {
    background: var(--gray-100);
    border-color: var(--gray-400);
}

.btn-danger {
    padding: 0.5rem 1.25rem;
    background: var(--error);
    color: var(--white);
    border: none;
    border-radius: var(--radius);
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.btn-danger:active {
    transform: translateY(0);
}

.detail-row {
    display: flex;
    padding: 0.625rem 0;
    border-bottom: 1px solid var(--gray-100);
    gap: 1rem;
    align-items: baseline;
}

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

.detail-row-long {
    flex-direction: column;
    gap: 0.375rem;
}

.detail-label {
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    min-width: 90px;
    flex-shrink: 0;
}

.detail-value {
    font-size: 0.9rem;
    color: var(--gray-800);
    word-break: break-word;
}

.detail-value a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.detail-value a:hover {
    text-decoration: underline;
}

/* ========================
   BUSINESSES VIEW
   ======================== */

.businesses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}

.business-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    border: 1px solid var(--gray-200);
    transition: var(--transition);
    overflow: hidden;
    min-width: 0;
}

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

.business-card h3 {
    font-size: 1.1rem;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}

.business-card a {
    color: var(--primary);
    font-size: 0.85rem;
    text-decoration: none;
    display: block;
    margin-bottom: 0.375rem;
    word-break: break-all;
}

.business-card a:hover {
    text-decoration: underline;
}

.business-slug {
    font-size: 0.8rem;
    color: var(--gray-400);
    margin-bottom: 0.75rem;
}

.site-type-badge {
    margin-right: 6px;
}

.site-type-badge.site-type-internal {
    background: #fef3c7;
    color: #92400e;
}

.site-type-badge.site-type-client {
    background: #dbeafe;
    color: #1e40af;
}

[data-theme="dark"] .site-type-badge.site-type-internal {
    background: #1a1400;
    color: #ffcc00;
    border: 1px solid rgba(255, 204, 0, 0.3);
}

[data-theme="dark"] .site-type-badge.site-type-client {
    background: #001a1a;
    color: #00e5ff;
    border: 1px solid rgba(0, 229, 255, 0.3);
}

#business-type-chips {
    margin-bottom: 1rem;
}

/* ========================
   CATEGORIES MANAGEMENT
   ======================== */

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.25rem;
}

.category-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.25rem;
    border: 1px solid var(--gray-200);
    transition: var(--transition);
}

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

.category-card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.category-color-swatch {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
    border: 2px solid var(--gray-200);
}

.category-card-name {
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--gray-900);
}

.category-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-bottom: 0.75rem;
}

.category-card-meta strong {
    color: var(--gray-700);
}

.category-card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.78rem;
    border-radius: var(--radius);
    border: 1px solid var(--gray-300);
    background: var(--white);
    color: var(--gray-700);
    cursor: pointer;
    transition: var(--transition);
}

.btn-sm:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

.btn-sm.btn-danger {
    color: #dc2626;
    border-color: #fca5a5;
}

.btn-sm.btn-danger:hover {
    background: #fef2f2;
    border-color: #dc2626;
}

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

/* ========================
   SCROLLBAR (content area)
   ======================== */

.main-content::-webkit-scrollbar,
.modal::-webkit-scrollbar {
    width: 6px;
}

.main-content::-webkit-scrollbar-track,
.modal::-webkit-scrollbar-track {
    background: transparent;
}

.main-content::-webkit-scrollbar-thumb,
.modal::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 3px;
}

.main-content::-webkit-scrollbar-thumb:hover,
.modal::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* ========================
   SETTINGS VIEW
   ======================== */

.settings-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    padding: 1.75rem;
    margin-bottom: 1.25rem;
}

.settings-card-title {
    font-size: 1.1rem;
    color: var(--gray-900);
    margin-bottom: 0.25rem;
}

.settings-card-desc {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-bottom: 1.5rem;
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.settings-form-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.settings-form-group label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--gray-700);
}

.settings-form-group input:not([type="checkbox"]) {
    width: 100%;
    max-width: 420px;
    padding: 0.625rem 0.875rem;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: var(--gray-800);
    background: var(--gray-50);
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.settings-form-group input:not([type="checkbox"]):focus {
    outline: none;
    border-color: var(--primary);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(26, 95, 122, 0.12);
}

.settings-form-group input::placeholder {
    color: var(--gray-400);
}

.settings-form-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.5rem;
}

.settings-save {
    width: auto;
    padding: 0.625rem 1.5rem;
    font-size: 0.875rem;
}

.settings-msg {
    font-size: 0.85rem;
    font-weight: 500;
    min-height: 1.2em;
}

.settings-msg.success {
    color: var(--success);
}

.settings-msg.error {
    color: var(--error);
}

.settings-divider {
    border: none;
    border-top: 1px solid var(--gray-200);
    margin: 1.5rem 0;
}

/* Toggle switches */
.settings-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--gray-100);
}

.settings-toggle-row:last-of-type {
    border-bottom: none;
}

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

.settings-toggle-label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--gray-800);
}

.settings-toggle-desc {
    font-size: 0.8rem;
    color: var(--gray-500);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

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

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--gray-300);
    border-radius: 24px;
    transition: background 0.2s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: var(--white);
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

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

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

.toggle-switch input:focus-visible + .toggle-slider {
    box-shadow: 0 0 0 3px rgba(26, 95, 122, 0.2);
}

/* Login methods */
.settings-sub-title {
    font-size: 0.95rem;
    color: var(--gray-800);
    margin-bottom: 0.75rem;
}

.settings-methods-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.settings-method-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--gray-50);
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
}

.settings-method-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--gray-700);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.settings-method-status {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.2rem 0.625rem;
    border-radius: 9999px;
}

.settings-method-status.connected {
    background: #d1fae5;
    color: #065f46;
}

.settings-method-status.not-connected {
    background: var(--gray-100);
    color: var(--gray-500);
}

.settings-login-methods {
    margin-top: 0;
}

/* ========================
   PAGINATION
   ======================== */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1rem;
    padding: 0.75rem 0;
}

.pagination-btn {
    padding: 0.375rem 0.875rem;
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 600;
    background: var(--gray-50);
    color: var(--primary);
    border: 1.5px solid var(--gray-200);
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
}

.pagination-btn:hover:not(:disabled) {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
    transform: translateY(-1px);
}

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

.pagination-info {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--gray-600);
    min-width: 140px;
    text-align: center;
}

.pagination-per-page {
    padding: 0.375rem 2rem 0.375rem 0.75rem;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 0.8rem;
    color: var(--gray-700);
    background: var(--white);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2364748b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    transition: var(--transition);
}

.pagination-per-page:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 95, 122, 0.1);
}

/* ========================
   TOAST NOTIFICATIONS
   ======================== */

.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    display: flex;
    flex-direction: column-reverse;
    gap: 0.5rem;
    z-index: 2000;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 500;
    pointer-events: auto;
    animation: toast-slide-in 0.3s ease;
    max-width: 380px;
    min-width: 260px;
}

.toast-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.toast-info {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.toast-success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.toast-close {
    background: none;
    border: none;
    font-size: 1.125rem;
    line-height: 1;
    cursor: pointer;
    color: inherit;
    opacity: 0.5;
    padding: 0.125rem 0.25rem;
    border-radius: 4px;
    flex-shrink: 0;
    transition: opacity 0.15s;
}

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

.toast-fade-out {
    animation: toast-slide-out 0.25s ease forwards;
}

@keyframes toast-slide-in {
    from {
        opacity: 0;
        transform: translateX(1rem);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toast-slide-out {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(1rem);
    }
}

/* ========================
   HELP VIEW
   ======================== */

.help-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.help-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    padding: 1.5rem;
}

.help-card h3 {
    font-size: 1.05rem;
    color: var(--gray-900);
    margin-bottom: 0.75rem;
}

.help-card h4 {
    font-size: 0.9rem;
    color: var(--gray-800);
    margin: 1rem 0 0.5rem;
}

.help-card p {
    font-size: 0.875rem;
    color: var(--gray-700);
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

.help-card ul,
.help-card ol {
    font-size: 0.875rem;
    color: var(--gray-700);
    line-height: 1.8;
    padding-left: 1.25rem;
}

.help-card li {
    margin-bottom: 0.25rem;
}

.help-card strong {
    color: var(--gray-900);
}

/* ========================
   ACTIVITY FEED VIEW
   ======================== */

.activity-feed {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    padding: 1.5rem;
}

.activity-feed-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--gray-100);
}

.activity-feed-item:last-child {
    border-bottom: none;
}

.activity-feed-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.85rem;
}

.activity-feed-icon-status { background: #eff6ff; color: #3b82f6; }
.activity-feed-icon-note { background: #fef3c7; color: #f59e0b; }
.activity-feed-icon-user { background: #ede9fe; color: #8b5cf6; }

.activity-feed-body {
    flex: 1;
    min-width: 0;
}

.activity-feed-text {
    font-size: 0.875rem;
    color: var(--gray-700);
    line-height: 1.5;
}

.activity-feed-text strong {
    color: var(--gray-900);
    font-weight: 600;
}

.activity-feed-time {
    font-size: 0.75rem;
    color: var(--gray-400);
    margin-top: 0.125rem;
}

.activity-feed-empty {
    text-align: center;
    padding: 3rem;
    color: var(--gray-400);
    font-size: 0.9rem;
}

/* ========================
   ANALYTICS VIEW
   ======================== */

.analytics-summary {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.analytics-stat {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.25rem;
    border: 1px solid var(--gray-200);
    text-align: center;
}

.analytics-stat-value {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
}

.analytics-stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 0.25rem;
}

.analytics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

.analytics-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    padding: 1.5rem;
}

.analytics-card-title {
    font-size: 0.95rem;
    color: var(--gray-900);
    margin-bottom: 1.25rem;
}

.analytics-card-full {
    grid-column: 1 / -1;
}

/* Analytics sub-tabs */
.analytics-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1.25rem;
    border-bottom: 2px solid var(--gray-200);
}

.analytics-tab {
    padding: 0.625rem 1.25rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-500);
    cursor: pointer;
    transition: var(--transition);
}

.analytics-tab:hover {
    color: var(--gray-700);
}

.analytics-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Trend indicators */
.analytics-stat-trend {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 0.25rem;
}

.analytics-stat-trend.up {
    color: #22c55e;
}

.analytics-stat-trend.down {
    color: #ef4444;
}

.analytics-stat-trend.neutral {
    color: var(--gray-400);
}

.trend-arrow {
    font-size: 0.65rem;
}

/* Heatmap */
.heatmap-grid {
    display: grid;
    grid-template-columns: 50px repeat(24, 1fr);
    gap: 2px;
    font-size: 0.6rem;
}

.heatmap-row-label {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 6px;
    font-weight: 600;
    color: var(--gray-500);
    font-size: 0.65rem;
}

.heatmap-col-label {
    text-align: center;
    font-weight: 600;
    color: var(--gray-500);
    font-size: 0.6rem;
    padding-bottom: 2px;
}

.heatmap-cell {
    aspect-ratio: 1;
    border-radius: 3px;
    min-height: 16px;
    position: relative;
    cursor: default;
    transition: opacity 0.15s;
}

.heatmap-cell:hover {
    opacity: 0.8;
}

.heatmap-cell[title] {
    cursor: help;
}

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

/* Bar chart */
.chart-bars {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 180px;
    padding-top: 20px;
}

.chart-bar-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.chart-bar {
    width: 100%;
    max-width: 40px;
    border-radius: 4px 4px 0 0;
    transition: height 0.4s ease;
    position: relative;
    cursor: default;
}

.chart-bar:hover {
    opacity: 0.85;
}

.chart-bar-label {
    font-size: 0.6rem;
    color: var(--gray-500);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 60px;
}

.chart-bar-value {
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--gray-600);
    white-space: nowrap;
}

/* Horizontal bar chart */
.chart-hbars {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.chart-hbar-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chart-hbar-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--gray-700);
    min-width: 100px;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chart-hbar-track {
    flex: 1;
    height: 24px;
    background: var(--gray-100);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.chart-hbar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s ease;
    display: flex;
    align-items: center;
    padding-left: 8px;
    min-width: 0;
}

.chart-hbar-count {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--white);
    white-space: nowrap;
}

.chart-hbar-count-outside {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--gray-600);
    margin-left: 8px;
    white-space: nowrap;
}

/* Donut chart */
.chart-donut-wrapper {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.chart-donut {
    width: 140px;
    height: 140px;
    flex-shrink: 0;
}

.chart-donut-legend {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.chart-legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--gray-700);
}

.chart-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.chart-legend-count {
    font-weight: 700;
    margin-left: auto;
    color: var(--gray-900);
}

/* ========================
   RESPONSIVE
   ======================== */

/* Tablet */
@media (max-width: 1024px) {
    .main-content {
        padding: 1.25rem 1.25rem;
    }

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

@media (max-width: 768px) {
    .mobile-header {
        display: flex;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.5);
        backdrop-filter: blur(2px);
        z-index: 150;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s;
    }

    .sidebar-overlay.open {
        opacity: 1;
        pointer-events: auto;
    }

    .main-content {
        margin-left: 0;
        padding: 1rem;
        padding-top: calc(56px + 1rem);
        max-width: 100%;
    }

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

    /* Card layout for table on mobile */
    .quotes-table thead {
        display: none;
    }

    .quotes-table,
    .quotes-table tbody,
    .quotes-table tr,
    .quotes-table td {
        display: block;
        width: 100%;
    }

    .quotes-table tbody tr:nth-child(even) {
        background: var(--white);
    }

    .quotes-table tr {
        background: var(--white);
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-sm);
        margin-bottom: 0.75rem;
        padding: 1rem;
        border: 1px solid var(--gray-200);
    }

    .quotes-table tr:hover {
        box-shadow: var(--shadow-md);
    }

    .quotes-table td {
        padding: 0.375rem 0;
        border-bottom: none;
        max-width: none;
        white-space: normal;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .quotes-table td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 0.75rem;
        color: var(--gray-500);
        text-transform: uppercase;
        letter-spacing: 0.04em;
        margin-right: 1rem;
    }

    .table-container {
        background: transparent;
        box-shadow: none;
        border: none;
    }

    /* Reservations table mobile card layout */
    .reservations-table thead {
        display: none;
    }

    .reservations-table,
    .reservations-table tbody,
    .reservations-table tr,
    .reservations-table td {
        display: block;
        width: 100%;
    }

    .reservations-table tbody tr:nth-child(even) {
        background: var(--white);
    }

    .reservations-table tr {
        background: var(--white);
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-sm);
        margin-bottom: 0.75rem;
        padding: 1rem;
        border: 1px solid var(--gray-200);
    }

    .reservations-table tr:hover {
        box-shadow: var(--shadow-md);
    }

    .reservations-table td {
        padding: 0.375rem 0;
        border-bottom: none;
        max-width: none;
        white-space: normal;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .reservations-table td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 0.75rem;
        color: var(--gray-500);
        text-transform: uppercase;
        letter-spacing: 0.04em;
        margin-right: 1rem;
    }

    .modal {
        max-height: 90vh;
        margin: 0.5rem;
        max-width: min(560px, calc(100vw - 2rem));
    }

    .confirm-modal {
        max-width: calc(100vw - 2rem);
    }

    .modal-card {
        max-width: calc(100vw - 2rem);
    }

    /* Touch targets — 44px minimum */
    .menu-toggle {
        width: 44px;
        height: 44px;
        justify-content: center;
        padding: 12px 8px;
    }

    .modal-close {
        width: 44px;
        height: 44px;
        font-size: 1.5rem;
    }

    .btn-sm {
        min-height: 44px;
        padding: 0.5rem 1rem;
    }

    .chip {
        padding: 0.625rem 1rem;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .stat-card {
        padding: 1rem;
    }

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

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

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
        top: 56px;
    }

    .filter-chips {
        top: auto;
        position: static;
    }

    .search-wrapper {
        max-width: none;
        min-width: 0;
        width: 100%;
    }

    .select-filter {
        width: 100%;
    }

    .date-range {
        flex-wrap: wrap;
        width: 100%;
    }

    .date-input {
        flex: 1;
        min-width: 0;
    }

    .view-actions {
        width: 100%;
        display: flex;
        gap: 0.5rem;
    }

    .btn-export {
        flex: 1;
    }

    .settings-card {
        padding: 1.25rem;
    }

    .settings-form-group input:not([type="checkbox"]) {
        max-width: 100%;
    }

    .settings-form-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .settings-save {
        width: 100%;
    }

    .settings-msg {
        text-align: center;
    }

    .settings-toggle-row {
        gap: 1rem;
    }

    .pagination {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .pagination-info {
        min-width: auto;
    }

    .toast-container {
        right: 1rem;
        left: 1rem;
        bottom: 1rem;
    }

    .toast {
        max-width: none;
        min-width: 0;
    }

    /* Users table mobile card layout */
    .users-table thead {
        display: none;
    }

    .users-table,
    .users-table tbody,
    .users-table tr,
    .users-table td {
        display: block;
        width: 100%;
    }

    .users-table tbody tr:nth-child(even) {
        background: var(--white);
    }

    .users-table tr {
        background: var(--white);
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-sm);
        margin-bottom: 0.75rem;
        padding: 1rem;
        border: 1px solid var(--gray-200);
    }

    .users-table td {
        padding: 0.375rem 0;
        border-bottom: none;
        max-width: none;
        white-space: normal;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .users-table td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 0.75rem;
        color: var(--gray-500);
        text-transform: uppercase;
        letter-spacing: 0.04em;
        margin-right: 1rem;
    }

    #users-table-container {
        background: transparent;
        box-shadow: none;
        border: none;
    }

    .add-user-modal {
        max-width: 95%;
    }

    .add-user-form-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .add-user-submit {
        width: 100%;
    }

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

    .analytics-card-full {
        grid-column: 1;
    }

    .chart-donut-wrapper {
        flex-direction: column;
        align-items: flex-start;
    }

    .chart-hbar-label {
        min-width: 70px;
        font-size: 0.7rem;
    }

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

    .heatmap-grid {
        grid-template-columns: 36px repeat(24, 1fr);
        gap: 1px;
    }

    .heatmap-cell {
        min-height: 12px;
    }

    .heatmap-col-label,
    .heatmap-row-label {
        font-size: 0.6rem;
    }

    .date-input {
        font-size: 0.875rem;
    }

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

    .analytics-tab {
        flex-shrink: 0;
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }

    /* Detail rows in modal — reduce label width on mobile */
    .detail-row {
        gap: 0.5rem;
    }

    .detail-label {
        min-width: 70px;
    }

    .detail-value {
        word-break: break-word;
    }

    /* Larger touch targets for status selects */
    .status-select {
        padding: 0.4rem 0.625rem;
        font-size: 0.8rem;
        min-height: 36px;
    }

    /* Larger touch targets for notification toggles */
    .notif-toggle-label {
        padding: 0.25rem 0;
        min-height: 36px;
    }

    .notif-toggle-label input[type="checkbox"] {
        width: 36px;
        height: 20px;
    }

    .notif-toggle-label input[type="checkbox"]::after {
        width: 16px;
        height: 16px;
    }

    .notif-toggle-label input[type="checkbox"]:checked::after {
        transform: translateX(16px);
    }

    /* Businesses & categories grid — single column on narrow screens */
    .businesses-grid,
    .categories-grid {
        grid-template-columns: 1fr;
    }

    /* View actions wrap properly */
    .view-actions {
        flex-wrap: wrap;
    }

    .btn-clear-filters {
        width: 100%;
    }

    /* Date presets scroll on narrow screens */
    .date-presets {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0.25rem;
    }

    .date-preset-btn {
        flex-shrink: 0;
    }
}

/* ========================
   USERS TABLE & MANAGEMENT
   ======================== */

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

.users-table thead {
    background: var(--gray-50);
    border-bottom: 2px solid var(--gray-200);
}

.users-table th {
    padding: 0.625rem 0.75rem;
    text-align: left;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.7rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.users-table td {
    padding: 0.625rem 0.75rem;
    font-size: 0.8rem;
    color: var(--gray-700);
    border-bottom: 1px solid var(--gray-100);
    white-space: nowrap;
}

.users-table tbody tr {
    transition: background 0.15s;
}

.users-table tbody tr:hover {
    background: var(--gray-50);
}

.users-table tbody tr:nth-child(even) {
    background: rgba(241, 245, 249, 0.7);
}

.users-table tbody tr:nth-child(even):hover {
    background: var(--gray-100);
}

.user-role-select,
.user-business-select,
.user-category-select {
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    border: 1.5px solid var(--gray-200);
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    background: var(--white);
    transition: var(--transition);
}

.user-role-select:focus,
.user-business-select:focus,
.user-category-select:focus {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}

.role-badge {
    display: inline-block;
    padding: 0.2rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.role-badge-admin {
    background: #ede9fe;
    color: #5b21b6;
}

.role-badge-client {
    background: #dbeafe;
    color: #1e40af;
}

/* Notification toggles in users table */
.notif-toggles {
    display: flex;
    gap: 0.75rem;
}

.notif-toggle-label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-500);
    cursor: pointer;
    white-space: nowrap;
}

.notif-toggle-label input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    width: 28px;
    height: 16px;
    background: var(--gray-300);
    border-radius: 8px;
    position: relative;
    cursor: pointer;
    transition: background 0.15s ease;
    flex-shrink: 0;
}

.notif-toggle-label input[type="checkbox"]::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.15s ease;
}

.notif-toggle-label input[type="checkbox"]:checked {
    background: var(--primary);
}

.notif-toggle-label input[type="checkbox"]:checked::after {
    transform: translateX(12px);
}

.btn-delete-user {
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    padding: 0.375rem;
    border-radius: var(--radius);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-delete-user:hover {
    background: #fef2f2;
    color: var(--error);
}

.btn-reset-password {
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    padding: 0.375rem;
    border-radius: var(--radius);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-reset-password:hover {
    background: #eff6ff;
    color: var(--primary);
}

.btn-add-user {
    gap: 0.375rem;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: var(--radius);
    padding: 0.625rem 1.25rem;
}

.btn-add-user:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(26, 95, 122, 0.3);
}

.btn-add-user svg {
    flex-shrink: 0;
}

/* Invite User modal */
.add-user-modal {
    max-width: 480px;
}

.invite-hint {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-bottom: 1rem;
}

.add-user-modal .settings-form-group select {
    width: 100%;
    max-width: 420px;
}

.add-user-form-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.5rem;
}

.add-user-submit {
    width: auto;
    padding: 0.75rem 2rem;
    font-size: 0.9rem;
}

/* ========================
   SMALL PHONE (480px)
   ======================== */

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

    .main-content {
        padding: 0.75rem;
        padding-top: calc(56px + 0.75rem);
    }

    .view-header h2 {
        font-size: 1.25rem;
    }

    .analytics-summary {
        grid-template-columns: 1fr;
    }
}

/* ========================
   EXTRA SMALL SCREENS
   ======================== */

@media (max-width: 380px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .analytics-summary {
        grid-template-columns: 1fr;
    }

    .stat-card {
        flex-direction: row;
        align-items: center;
    }

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

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

    .pagination {
        justify-content: center;
    }

    .pagination-btn {
        flex: 1;
        text-align: center;
    }
}

/* ========================
   PROJECTS & SITES
   ======================== */

/* View header layout */
.view-header-left {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.view-header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.view-subtitle {
    margin: 0;
    font-size: 0.875rem;
    color: var(--gray-500);
}

/* Stats row */
.stats-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.stats-row .stat-card {
    flex: 1 1 120px;
    min-width: 100px;
    text-align: center;
    padding: 1rem;
}

/* Table controls */
.table-controls {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
    align-items: center;
}

.filter-select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    background: var(--white);
    color: var(--gray-700);
    font-size: 0.875rem;
    cursor: pointer;
    min-width: 140px;
}

[data-theme="dark"] .filter-select {
    border-color: #1a3d1e;
    background: #000000;
    color: #00ff41;
    border-radius: 0;
}

/* Table wrapper */
.table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

[data-theme="dark"] .table-wrapper {
    border-color: #0d1f0f;
}

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

.data-table th,
.data-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

[data-theme="dark"] .data-table th,
[data-theme="dark"] .data-table td {
    border-color: #0d1f0f;
    color: #00ff41;
}

.data-table th {
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gray-500);
    background: var(--gray-50);
}

[data-theme="dark"] .data-table th {
    background: #050f07;
    color: #00cc33;
    letter-spacing: 0.08em;
}

.data-table tbody tr:hover {
    background: var(--gray-50);
}

[data-theme="dark"] .data-table tbody tr:hover {
    background: rgba(0, 255, 65, 0.04);
}

.data-table a {
    color: var(--primary);
    text-decoration: none;
}

.data-table a:hover {
    text-decoration: underline;
}

/* Loading indicator */
.loading-indicator {
    padding: 2rem;
    text-align: center;
    color: var(--gray-500);
    font-size: 0.875rem;
}

/* Kanban board */
.kanban-board {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 1rem;
    align-items: flex-start;
}

.kanban-column {
    flex: 0 0 260px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    overflow: hidden;
}

[data-theme="dark"] .kanban-column {
    background: #050f07;
    border-color: #0d1f0f;
}

.kanban-column-header {
    padding: 0.75rem 1rem;
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gray-800);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--gray-200);
}

[data-theme="dark"] .kanban-column-header {
    border-color: #0d1f0f;
    color: #00cc33;
    letter-spacing: 0.08em;
}

.kanban-column-count {
    background: var(--gray-200);
    color: var(--gray-700);
    border-radius: 999px;
    padding: 1px 7px;
    font-size: 0.75rem;
    font-weight: 700;
}

[data-theme="dark"] .kanban-column-count {
    background: #0d1f0f;
    color: #00aa2a;
    border-radius: 0;
    border: 1px solid #1a3d1e;
}

.kanban-cards {
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-height: 80px;
}

.kanban-card {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: calc(var(--radius) - 2px);
    padding: 0.75rem;
    cursor: pointer;
    transition: box-shadow 0.15s, border-color 0.15s;
}

[data-theme="dark"] .kanban-card {
    background: #000000;
    border-color: #1a3d1e;
    border-radius: 0;
}
[data-theme="dark"] .kanban-card:hover {
    border-color: #00ff41;
    box-shadow: 0 0 8px rgba(0, 255, 65, 0.12);
}

.kanban-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-color: var(--primary);
}

.kanban-card-title {
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
    color: var(--gray-900);
}

[data-theme="dark"] .kanban-card-title {
    color: #00ff41;
}

.kanban-card-biz {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-bottom: 0.4rem;
}

.kanban-card-meta {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    font-size: 0.7rem;
    color: var(--gray-500);
}

.kanban-card-actions {
    display: flex;
    gap: 4px;
    margin-top: 8px;
    flex-wrap: wrap;
}

/* Phase badges — light mode */
.phase-discovery { background: #dbeafe; color: #1d4ed8; font-weight: 700; }
.phase-design { background: #f3e8ff; color: #7e22ce; font-weight: 700; }
.phase-development { background: #fff7ed; color: #c2410c; font-weight: 700; }
.phase-qa { background: #dcfce7; color: #15803d; font-weight: 700; }
.phase-live { background: #d1fae5; color: #065f46; font-weight: 700; }
.phase-on_hold { background: #f1f5f9; color: #475569; font-weight: 700; }
.phase-cancelled { background: #fee2e2; color: #b91c1c; font-weight: 700; }

/* Phase badges — dark mode (DOS style) */
[data-theme="dark"] .phase-discovery { background: #001a1a; color: #00e5ff; border: 1px solid rgba(0,229,255,0.3); }
[data-theme="dark"] .phase-design { background: #0a001a; color: #cc99ff; border: 1px solid rgba(204,153,255,0.3); }
[data-theme="dark"] .phase-development { background: #1a0800; color: #ff9933; border: 1px solid rgba(255,153,51,0.3); }
[data-theme="dark"] .phase-qa { background: #001a05; color: #00ff41; border: 1px solid rgba(0,255,65,0.3); }
[data-theme="dark"] .phase-live { background: #001a05; color: #33ff66; border: 1px solid rgba(51,255,102,0.4); }
[data-theme="dark"] .phase-on_hold { background: #0d1f0f; color: #008822; border: 1px solid rgba(0,136,34,0.3); }
[data-theme="dark"] .phase-cancelled { background: #1a0000; color: #ff3333; border: 1px solid rgba(255,51,51,0.3); }

/* SSL badges — light mode */
.ssl-active { background: #dcfce7; color: #15803d; font-weight: 700; }
.ssl-expiring_soon { background: #fef9c3; color: #a16207; font-weight: 700; }
.ssl-expired { background: #fee2e2; color: #b91c1c; font-weight: 700; }
.ssl-none { background: #f1f5f9; color: #475569; font-weight: 700; }

/* SSL badges — dark mode */
[data-theme="dark"] .ssl-active { background: #001a05; color: #00ff41; border: 1px solid rgba(0,255,65,0.3); }
[data-theme="dark"] .ssl-expiring_soon { background: #1a1400; color: #ffcc00; border: 1px solid rgba(255,204,0,0.3); }
[data-theme="dark"] .ssl-expired { background: #1a0000; color: #ff3333; border: 1px solid rgba(255,51,51,0.3); }
[data-theme="dark"] .ssl-none { background: #0d1f0f; color: #008822; border: 1px solid rgba(0,136,34,0.3); }

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

/* Modal panel (for proj/site modals) */
.modal-panel {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    max-width: 540px;
    width: 95%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
}

[data-theme="dark"] .modal-panel {
    background: #050f07;
    border: 1px solid #0d1f0f;
}

.modal-panel form {
    padding: 0 1.5rem 1.5rem;
    overflow-y: auto;
    flex: 1;
}

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

[data-theme="dark"] .modal-panel .modal-header {
    border-color: #0d1f0f;
    background: #030a04;
}

.modal-panel .modal-header h3 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
}

/* Modal large */
.modal-large {
    max-width: 700px;
    width: 95%;
}

/* Form groups in modal panel */
.modal-panel .form-group {
    margin-bottom: 1rem;
}

.modal-panel .form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

[data-theme="dark"] .modal-panel .form-group label {
    color: #00cc33;
}

.modal-panel .form-group input,
.modal-panel .form-group select,
.modal-panel .form-group textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    background: var(--white);
    color: var(--gray-900);
    font-size: 0.875rem;
    box-sizing: border-box;
    font-family: var(--font-body);
}

[data-theme="dark"] .modal-panel .form-group input,
[data-theme="dark"] .modal-panel .form-group select,
[data-theme="dark"] .modal-panel .form-group textarea {
    border-color: #1a3d1e;
    background: #000000;
    color: #00ff41;
    border-radius: 0;
}

.modal-panel .form-group input:focus,
.modal-panel .form-group select:focus,
.modal-panel .form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 95, 122, 0.15);
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    padding-top: 0.75rem;
    border-top: 1px solid var(--gray-200);
    margin-top: 0.5rem;
}

[data-theme="dark"] .modal-actions {
    border-color: #0d1f0f;
}

/* Error message */
.error-message {
    color: var(--error);
    font-size: 0.8rem;
    margin-bottom: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: #fef2f2;
    border-radius: var(--radius);
    border: 1px solid #fecaca;
}

/* Btn variants */
.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
}

.btn-ghost {
    background: transparent;
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

.btn-ghost:hover {
    background: var(--gray-100);
}

[data-theme="dark"] .btn-ghost {
    color: #00aa2a;
    border-color: #1a3d1e;
    border-radius: 0;
    background: #000000;
}

[data-theme="dark"] .btn-ghost:hover {
    background: rgba(0, 255, 65, 0.07);
    color: #00ff41;
    border-color: #00ff41;
}

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

.btn-danger:hover {
    background: #dc2626;
}

/* User action buttons */
.user-actions {
    display: flex;
    gap: 4px;
    white-space: nowrap;
}
.user-actions .btn-sm {
    min-width: 68px;
    text-align: center;
    font-size: 0.75rem;
    padding: 0.3rem 0.5rem;
}
.btn-danger-text {
    color: var(--error, #ef4444) !important;
    border-color: var(--error, #ef4444) !important;
}
.btn-danger-text:hover {
    background: var(--error, #ef4444) !important;
    color: #fff !important;
}
[data-theme="dark"] .btn-danger-text {
    color: #ff4444 !important;
    border-color: #551111 !important;
    background: #000 !important;
}
[data-theme="dark"] .btn-danger-text:hover {
    background: #ff4444 !important;
    color: #fff !important;
    border-color: #ff4444 !important;
}

/* Modal note items */
.modal-note-item {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: var(--gray-50);
}

[data-theme="dark"] .modal-note-item {
    border-color: #0d1f0f;
    background: #000000;
}

.modal-note-text {
    font-size: 0.875rem;
    color: var(--gray-800);
    margin-bottom: 0.25rem;
}

[data-theme="dark"] .modal-note-text {
    color: #00ee44;
}

.modal-note-meta {
    font-size: 0.75rem;
    color: var(--gray-500);
}

/* Stat label (used in modal detail grids) */
.stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gray-500);
    display: block;
    margin-bottom: 0.2rem;
}

@media (max-width: 640px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .kanban-board {
        gap: 0.75rem;
    }

    .kanban-column {
        flex: 0 0 220px;
    }

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

    .filter-select {
        min-width: unset;
        width: 100%;
    }
}

/* ── CRM Deal Picker ───────────────────────────────────────── */
.crm-picker { position: relative; }

.crm-picker-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.crm-picker-input-wrap input {
    width: 100%;
    padding: 0.75rem 2.25rem 0.75rem 1rem;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 0.95rem;
    color: var(--gray-800);
    background: var(--gray-50);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.crm-picker-input-wrap input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(26,95,122,0.12);
}

.crm-picker-clear {
    position: absolute;
    right: 0.625rem;
    background: none;
    border: none;
    font-size: 1.1rem;
    color: var(--gray-400);
    cursor: pointer;
    line-height: 1;
    padding: 0.2rem 0.3rem;
}
.crm-picker-clear:hover { color: var(--gray-700); }

.crm-picker-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0; right: 0;
    background: var(--white);
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    z-index: 200;
    max-height: 240px;
    overflow-y: auto;
}

.crm-picker-item {
    padding: 0.65rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--gray-100);
    transition: background 0.15s;
}
.crm-picker-item:last-child { border-bottom: none; }
.crm-picker-item:hover { background: var(--gray-50); }

.crm-picker-item-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--gray-800);
}
.crm-picker-item-meta {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 0.15rem;
}
.crm-picker-item-stage {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    background: var(--primary-light, #e8f4f8);
    color: var(--primary);
    margin-left: 0.4rem;
}
.crm-picker-empty {
    padding: 0.85rem 1rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-align: center;
}

.crm-deal-card {
    margin-top: 0.6rem;
    padding: 0.85rem 1rem;
    border: 1.5px solid var(--primary);
    border-radius: var(--radius);
    background: var(--primary-light, #e8f4f8);
    font-size: 0.875rem;
}
.crm-deal-card-title {
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.35rem;
}
.crm-deal-card-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    color: var(--gray-700);
}
.crm-deal-card-field { display: flex; flex-direction: column; }
.crm-deal-card-field span:first-child {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}
.crm-deal-card-field span:last-child { font-weight: 600; }

/* Project modal CRM panel */
.crm-panel {
    border: 1.5px solid var(--primary);
    border-radius: var(--radius);
    padding: 0.85rem 1rem;
    background: var(--primary-light, #e8f4f8);
    margin-bottom: 1rem;
    font-size: 0.875rem;
}
.crm-panel-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
}
.crm-panel-badge {
    font-size: 0.7rem;
    font-weight: 700;
    background: var(--primary);
    color: white;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    letter-spacing: 0.03em;
}
.crm-panel-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}
.crm-panel-field { display: flex; flex-direction: column; }
.crm-panel-field span:first-child {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}
.crm-panel-field span:last-child { font-weight: 600; color: var(--gray-800); }


/* Permission grid (Edit User modal) */
.perm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 6px 14px;
    padding: 8px 10px;
    background: var(--gray-50, #f8fafc);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 6px;
}
.perm-checkbox {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 6px;
    font-size: 13px;
    font-weight: 400 !important;
    cursor: pointer;
    user-select: none;
}
.perm-checkbox input[type="checkbox"] {
    width: auto !important;
    max-width: none !important;
    padding: 0 !important;
    margin: 0;
    cursor: pointer;
    flex-shrink: 0;
}
.perm-biz-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.perm-biz-section {
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 6px;
    padding: 8px;
    background: var(--card-bg, #fff);
}
.perm-biz-header {
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--gray-800, #1f2937);
}
.perm-biz-section .perm-grid {
    border: none;
    background: transparent;
    padding: 0;
}
.perm-hint {
    font-size: 12px;
    color: var(--text-secondary, #64748b);
    font-style: italic;
    padding: 8px;
    margin: 0;
}
[data-theme="dark"] .perm-grid,
[data-theme="dark"] .perm-biz-section {
    background: rgba(0, 255, 65, 0.04);
    border-color: rgba(0, 255, 65, 0.2);
}

/* Business checkbox selector (Edit User / Add User modals) */
.checkbox-list {
    max-height: 280px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px;
    background: var(--gray-50, #f8fafc);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 6px;
}
.biz-check-section {
    padding: 6px 8px;
    border-left: 3px solid var(--primary, #1a5f7a);
    background: var(--card-bg, #fff);
    border-radius: 4px;
}
.biz-check-header {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--primary, #1a5f7a);
    margin-bottom: 4px;
}
.biz-check-row {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 8px;
    padding: 3px 0;
    cursor: pointer;
}
.biz-check-input {
    -webkit-appearance: checkbox !important;
    appearance: checkbox !important;
    width: 15px !important;
    height: 15px !important;
    min-width: 15px !important;
    max-width: 15px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: initial !important;
    background: none !important;
    box-shadow: none !important;
    cursor: pointer;
    flex-shrink: 0;
    accent-color: var(--primary, #1a5f7a);
}
.biz-check-label {
    font-size: 13px;
    font-weight: 400;
    color: var(--gray-800, #1f2937);
    cursor: pointer;
    user-select: none;
}
[data-theme="dark"] .checkbox-list {
    background: rgba(0, 255, 65, 0.04);
    border-color: rgba(0, 255, 65, 0.2);
}
[data-theme="dark"] .biz-check-section {
    background: rgba(0, 255, 65, 0.06);
    border-left-color: #00ff41;
}
[data-theme="dark"] .biz-check-header {
    color: #00ff41;
}
[data-theme="dark"] .biz-check-label {
    color: #ccc;
}
[data-theme="dark"] .perm-biz-header {
    color: #00ff41;
}
