/* ================================================
   Vehicle Management System
   Professional sidebar layout
   ================================================ */

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

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --danger: #dc2626;
    --danger-light: #fef2f2;
    --success: #16a34a;
    --success-light: #f0fdf4;
    --warning: #d97706;
    --warning-light: #fffbeb;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --sidebar-width: 240px;
    --topbar-height: 56px;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.07), 0 4px 6px rgba(0,0,0,0.04);
    --transition: 0.2s ease;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: var(--gray-800);
    background: var(--gray-100);
    min-height: 100vh;
}

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

/* ================================================
   Sidebar
   ================================================ */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--gray-900);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 200;
    transition: transform var(--transition);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 1.15rem 1.25rem;
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: -0.01em;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo {
    width: 22px;
    height: 22px;
    color: var(--primary);
    flex-shrink: 0;
}

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

.nav-section-label {
    padding: 0.75rem 1.25rem 0.35rem;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--gray-500);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.55rem 1.25rem;
    margin: 1px 0.5rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    color: var(--gray-400);
    transition: all 0.15s;
    text-decoration: none;
}

.sidebar-link svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.7;
}

.sidebar-link:hover {
    background: rgba(255,255,255,0.07);
    color: #fff;
    text-decoration: none;
}

.sidebar-link:hover svg { opacity: 1; }

.sidebar-link.active {
    background: var(--primary);
    color: #fff;
    font-weight: 500;
}

.sidebar-link.active svg { opacity: 1; }

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

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.25rem;
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.user-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

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

.user-role {
    font-size: 0.7rem;
    color: var(--gray-500);
    text-transform: capitalize;
}

.logout-link { color: var(--gray-500); font-size: 0.8rem; }
.logout-link:hover { color: var(--danger); background: rgba(220,38,38,0.1); }

/* ================================================
   Main content wrapper
   ================================================ */
.main-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
}

.topbar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    color: var(--gray-600);
}

.sidebar-toggle svg { width: 22px; height: 22px; }

.topbar-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--gray-800);
}

.topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 1rem;
}

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

.main-content {
    flex: 1;
    padding: 1rem 1.25rem;
    max-width: 1400px;
    width: 100%;
    overflow-x: hidden;
}

.main-footer {
    text-align: center;
    padding: 1rem 1.5rem;
    font-size: 0.75rem;
    color: var(--gray-400);
    border-top: 1px solid var(--gray-200);
}

/* ================================================
   Auth pages (login / register) - no sidebar
   ================================================ */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    flex: 1;
}

.site-footer {
    text-align: center;
    padding: 1rem;
    font-size: 0.8rem;
    color: var(--gray-600);
    border-top: 1px solid var(--gray-200);
}

.auth-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
}

.auth-card {
    background: #fff;
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
}

.auth-card h1 {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    text-align: center;
    color: var(--gray-900);
}

.auth-link {
    text-align: center;
    margin-top: 1.25rem;
    font-size: 0.875rem;
    color: var(--gray-600);
}

/* ================================================
   Buttons
   ================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.5rem 1.15rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    background: #fff;
    color: var(--gray-700);
    transition: all 0.15s;
    text-decoration: none;
    line-height: 1.4;
}

.btn:hover { background: var(--gray-50); text-decoration: none; }

.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); text-decoration: none; }

.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; text-decoration: none; }

.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { background: #15803d; border-color: #15803d; text-decoration: none; }

.btn-warning { background: var(--warning); color: #fff; border-color: var(--warning); }
.btn-warning:hover { background: #b45309; text-decoration: none; }

.btn-ghost { border-color: transparent; background: transparent; color: var(--gray-600); }
.btn-ghost:hover { background: var(--gray-100); }

.btn-sm { padding: 0.3rem 0.75rem; font-size: 0.8rem; }
.btn-xs { padding: 0.2rem 0.5rem; font-size: 0.75rem; }
.btn-block { display: flex; width: 100%; }

/* ================================================
   Forms
   ================================================ */
.form-group { margin-bottom: 1rem; }

.form-group label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--gray-700);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.9rem;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
    color: var(--gray-800);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: var(--gray-500);
    font-size: 0.78rem;
}

.form-card {
    background: #fff;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    max-width: 700px;
}

.form-card h2, .form-card h3 {
    margin-bottom: 1.25rem;
    font-size: 1.1rem;
    color: var(--gray-800);
}

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

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

.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.25rem;
    align-items: center;
}

.form-hint {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-bottom: 0.5rem;
}

/* ================================================
   Alerts
   ================================================ */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.alert-error {
    background: var(--danger-light);
    color: var(--danger);
    border: 1px solid #fecaca;
}

.alert-success {
    background: var(--success-light);
    color: var(--success);
    border: 1px solid #bbf7d0;
}

/* ================================================
   Page Headers
   ================================================ */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.page-header h1 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

/* ================================================
   Dashboard
   ================================================ */

/* Stats config row */
.stats-config-row {
    display: flex;
    margin-bottom: 0.5rem;
    position: relative;
}

.stats-config-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 0.5rem 0;
    z-index: 50;
    min-width: 200px;
}

.stats-config-dropdown label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.75rem;
    font-size: 0.82rem;
    color: var(--gray-700);
    cursor: pointer;
    transition: background 0.1s;
}

.stats-config-dropdown label:hover {
    background: var(--gray-50);
}

.stats-config-dropdown input[type="checkbox"] {
    accent-color: var(--primary);
    width: 15px;
    height: 15px;
}

/* Stats row - horizontal strip */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: box-shadow var(--transition);
}

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

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

.stat-icon svg { width: 18px; height: 18px; }

.stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-icon.green { background: #dcfce7; color: var(--success); }
.stat-icon.orange { background: var(--warning-light); color: var(--warning); }
.stat-icon.purple { background: #f3e8ff; color: #7c3aed; }

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

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

.stat-number {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1.2;
}

.stat-link {
    display: inline-block;
    font-size: 0.72rem;
    color: var(--primary);
}

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

/* Dashboard filter bar */
.dash-filter-bar {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    flex-wrap: wrap;
}

.dash-filter-select {
    padding: 0.25rem 0.45rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.75rem;
    background: #fff;
    color: var(--gray-600);
    cursor: pointer;
    max-width: 140px;
}

.dash-filter-select:focus {
    outline: none;
    border-color: var(--primary);
}

.dash-filter-info {
    margin-left: auto;
    font-size: 0.72rem;
    color: var(--gray-500);
    white-space: nowrap;
}

/* ================================================
   Dashboard Section Titles
   ================================================ */
.section-title {
    margin-bottom: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-subtitle {
    font-weight: 400;
    font-size: 0.8rem;
    color: var(--gray-500);
}

/* ================================================
   Recent Bookings Panel (dashboard)
   ================================================ */
.bookings-panel {
    overflow: hidden;
}

.bookings-panel-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--gray-100);
}

.time-range-selector {
    display: flex;
    gap: 0.25rem;
    background: var(--gray-100);
    border-radius: var(--radius);
    padding: 0.2rem;
}

.time-btn {
    padding: 0.3rem 0.65rem;
    border: none;
    background: transparent;
    color: var(--gray-600);
    font-size: 0.78rem;
    font-weight: 500;
    border-radius: calc(var(--radius) - 2px);
    cursor: pointer;
    transition: all 0.15s;
}

.time-btn:hover {
    color: var(--gray-800);
    background: rgba(255,255,255,0.6);
}

.time-btn.active {
    background: #fff;
    color: var(--primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    font-weight: 600;
}

.bookings-panel .table-responsive {
    max-height: 320px;
    overflow-y: auto;
}

.bookings-panel .data-table {
    margin: 0;
    border-radius: 0;
    box-shadow: none;
}

.bookings-panel .data-table thead th {
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 2;
}

/* ================================================
   Dashboard Two-Column Layout
   ================================================ */
.dash-bookings-full { margin-top: 0.5rem; }
.dash-bookings-full .bookings-panel { margin-bottom: 0; }

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

/* Horizontal compact area cards */
.area-cards-horizontal {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.area-card-compact {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    cursor: pointer;
    transition: box-shadow 0.15s, transform 0.15s;
}

.area-card-compact:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.area-card-compact-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--gray-100);
}

.area-card-compact-header h3 {
    font-size: 0.82rem;
    font-weight: 600;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.area-card-compact-canvas-wrap {
    display: flex;
    justify-content: center;
    padding: 0.5rem;
    background: var(--gray-50);
    max-height: 160px;
    overflow: hidden;
}

.area-card-compact-canvas-wrap .area-mini-canvas {
    border-radius: 3px;
    background: #fff;
    box-shadow: inset 0 0 0 1px var(--gray-200);
    max-width: 100%;
    height: auto;
    max-height: 150px;
}

.area-card-compact-footer {
    padding: 0.5rem 0.75rem;
    border-top: 1px solid var(--gray-100);
}

.area-card-compact-bar {
    height: 4px;
    background: var(--gray-100);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0.35rem;
}

.area-card-bar-fill {
    height: 100%;
    background: var(--danger);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.area-card-compact-footer .area-map-legend {
    font-size: 0.68rem;
}

.area-cards-stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ================================================
   Area Map Cards (dashboard)
   ================================================ */
.area-maps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
}

.area-map-card {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: box-shadow var(--transition);
}

.area-map-clickable { cursor: pointer; }
.area-map-clickable:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); transition: all 0.15s; }

.area-map-click-hint {
    font-size: 0.72rem;
    color: var(--gray-400);
    font-style: italic;
}

.area-map-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--gray-100);
}

.area-map-header h3 { font-size: 0.95rem; margin: 0; font-weight: 600; }

.area-map-canvas-wrap {
    display: flex;
    justify-content: center;
    padding: 0.75rem;
    background: var(--gray-50);
}

.area-mini-canvas {
    border-radius: 4px;
    background: #fff;
    box-shadow: inset 0 0 0 1px var(--gray-200);
    max-width: 100%;
    height: auto;
}

.area-map-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 1rem;
    border-top: 1px solid var(--gray-100);
}

.area-map-legend { display: flex; gap: 1rem; font-size: 0.72rem; color: var(--gray-500); }
.legend-item { display: flex; align-items: center; gap: 0.3rem; }
.legend-dot { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.legend-green { background: rgba(22, 163, 74, 0.5); border: 1px solid #16a34a; }
.legend-red { background: rgba(220, 38, 38, 0.5); border: 1px solid #dc2626; }

/* ================================================
   Area Modal (full-size plan overlay)
   ================================================ */
.area-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 500;
    justify-content: center;
    align-items: center;
    padding: 1.5rem;
}

.area-modal-overlay.open {
    display: flex;
}

.area-modal {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    width: 100%;
    max-width: 1100px;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.area-modal-header h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.area-modal-close {
    font-size: 1.4rem;
    line-height: 1;
    padding: 0.25rem 0.5rem;
    min-width: auto;
}

.area-modal-body {
    flex: 1;
    overflow: auto;
    position: relative;
    background: var(--gray-50);
}

.area-modal-plan {
    position: relative;
    display: flex;
    justify-content: center;
    padding: 1rem;
}

.area-modal-plan canvas {
    max-width: 100%;
    height: auto;
}

#modalSpaceCanvas {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: auto;
    cursor: default;
}

.area-modal-tooltip {
    position: absolute;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    z-index: 10;
    pointer-events: none;
    min-width: 140px;
    max-width: 220px;
    line-height: 1.4;
}

.area-modal-legend-bar {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 0.6rem 1.25rem;
    border-top: 1px solid var(--gray-100);
    font-size: 0.78rem;
    color: var(--gray-600);
}

/* ================================================
   Data Tables
   ================================================ */
.table-responsive { overflow-x: auto; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.data-table th,
.data-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.875rem;
}

.data-table thead th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-600);
    border-bottom: 1px solid var(--gray-200);
    white-space: nowrap;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.data-table tbody tr { border-bottom: 1px solid var(--gray-100); }
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: var(--gray-50); }
.data-table .actions { white-space: nowrap; }

.inline-form { display: inline; }

/* ================================================
   Badges
   ================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.55rem;
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 600;
    background: var(--gray-100);
    color: var(--gray-600);
}

.badge-success { background: #dcfce7; color: var(--success); }
.badge-danger { background: #fef2f2; color: var(--danger); }
.badge-warning { background: #fef3c7; color: var(--warning); }
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-neutral { background: #f3f4f6; color: #6b7280; }

/* ================================================
   Cards
   ================================================ */
.card {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 1.25rem;
    transition: box-shadow var(--transition);
}

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

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

/* Area cards */
.area-card {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    transition: box-shadow var(--transition);
}

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

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

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

.area-meta { font-size: 0.78rem; color: var(--gray-500); margin-bottom: 1rem; }

.area-card-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ================================================
   Plan Source Tabs & Template Picker
   ================================================ */
.plan-source-tabs {
    display: flex;
    gap: 0;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    overflow: hidden;
    width: fit-content;
}

.plan-source-tab {
    padding: 0.5rem 1rem;
    font-size: 0.82rem;
    font-weight: 500;
    background: #fff;
    color: var(--gray-600);
    border: none;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.plan-source-tab:not(:last-child) {
    border-right: 1px solid var(--gray-200);
}

.plan-source-tab.active {
    background: var(--primary);
    color: #fff;
}

.plan-source-tab:hover:not(.active) {
    background: var(--gray-50);
}

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

.template-card {
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 0.5rem;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
    position: relative;
    background: #fff;
}

.template-card:hover {
    border-color: var(--gray-400);
    box-shadow: var(--shadow);
}

.template-card.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.template-card-preview {
    background: var(--gray-50);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100px;
    max-height: 160px;
}

.template-mini-canvas {
    width: 100%;
    height: auto;
    display: block;
}

.template-card-info {
    padding: 0.5rem 0.25rem 0.25rem;
}

.template-card-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--gray-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.template-card-meta {
    font-size: 0.72rem;
    color: var(--gray-500);
    margin-top: 0.15rem;
}

.template-card-check {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: none;
    align-items: center;
    justify-content: center;
}

.template-card-check svg {
    width: 14px;
    height: 14px;
}

.template-card.selected .template-card-check {
    display: flex;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.88rem;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    accent-color: var(--primary);
    width: 16px;
    height: 16px;
}

/* ================================================
   Area Detail / Space Editor
   ================================================ */
.area-detail-full {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 1.5rem;
}

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

.plan-toolbar h2 { margin: 0; font-size: 1.1rem; font-weight: 600; }
.toolbar-actions { display: flex; gap: 0.5rem; }

.plan-canvas-wrapper {
    position: relative;
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

#pdfCanvas {
    display: block;
    width: 100%;
    height: auto;
}

.space-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.space-overlay.editable { pointer-events: auto; cursor: default; }

.plan-hint {
    font-size: 0.78rem;
    color: var(--gray-500);
    margin-top: 0.5rem;
}

.area-spaces-panel { max-height: 650px; overflow-y: auto; }

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

.spaces-header h2 { margin-bottom: 0; font-size: 1.1rem; font-weight: 600; }

.spaces-list { display: flex; flex-direction: column; gap: 0.4rem; }

.space-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    padding: 0.7rem 1rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border-left: 3px solid var(--success);
    cursor: pointer;
    transition: all 0.15s;
}

.space-item:hover { background: var(--gray-50); }
.space-item.space-occupied { border-left-color: var(--danger); }
.space-item.space-non-parking { border-left-color: #9ca3af; background: #f9fafb; }

.space-item.space-selected {
    border-left-color: var(--primary);
    background: var(--primary-light);
    box-shadow: var(--shadow-md);
}

.space-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
}

.space-pos { font-size: 0.72rem; color: var(--gray-500); }

.space-form-container { margin-bottom: 1rem; }
.space-actions { display: flex; gap: 0.5rem; }

/* Calibration steps */
.cal-steps { display: flex; flex-direction: column; gap: 0.5rem; }

.cal-step {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.5rem 0.75rem;
    background: var(--gray-50);
    border-radius: var(--radius);
    font-size: 0.85rem;
    color: var(--gray-600);
    border: 1px solid var(--gray-200);
    transition: all 0.2s;
}

.cal-step-num {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--gray-200);
    color: var(--gray-600);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    flex-shrink: 0;
}

.cal-step-done {
    background: var(--success-light);
    border-color: #bbf7d0;
    color: var(--success);
}

.cal-step-done .cal-step-num {
    background: var(--success);
    color: #fff;
}

/* ================================================
   User Management Table
   ================================================ */
.user-role-badge {
    display: inline-flex;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: capitalize;
}

.role-admin { background: #fef3c7; color: #92400e; }
.role-manager { background: var(--primary-light); color: var(--primary-dark); }
.role-viewer { background: var(--gray-100); color: var(--gray-600); }

/* ================================================
   Permissions Matrix
   ================================================ */
.permissions-grid {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

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

.perm-table th,
.perm-table td {
    padding: 0.75rem 1rem;
    text-align: center;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--gray-100);
}

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

.perm-table td:first-child,
.perm-table th:first-child { text-align: left; font-weight: 600; }

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

.perm-check {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

.perm-role-header {
    font-size: 1rem;
    font-weight: 600;
    padding: 1rem 1.25rem 0.5rem;
    color: var(--gray-800);
    border-bottom: 2px solid var(--gray-200);
}

/* ================================================
   Vehicle Template Selector
   ================================================ */
/* ================================================
   Vehicle Toggle (booking form)
   ================================================ */
.vehicle-toggle {
    display: flex;
    gap: 0;
    background: var(--gray-100);
    border-radius: var(--radius);
    padding: 0.2rem;
    width: fit-content;
}

.toggle-btn {
    padding: 0.45rem 1rem;
    border: none;
    background: transparent;
    color: var(--gray-600);
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: calc(var(--radius) - 2px);
    cursor: pointer;
    transition: all 0.15s;
}

.toggle-btn:hover {
    color: var(--gray-800);
}

.toggle-btn.active {
    background: #fff;
    color: var(--primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    font-weight: 600;
}

.inline-vehicle-form {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 1rem;
    margin-top: 0.5rem;
}

/* ================================================
   Auto-Allocate Controls
   ================================================ */
.space-selector-row {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
}

.space-selector-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

.btn-auto {
    background: var(--success);
    color: #fff;
    border-color: var(--success);
    white-space: nowrap;
    height: fit-content;
    padding: 0.55rem 1rem;
}

.btn-auto:hover {
    background: #15803d;
    border-color: #15803d;
    text-decoration: none;
}

.auto-result {
    font-size: 0.8rem;
    margin-top: 0.35rem;
    color: var(--gray-500);
}

.auto-result.success { color: var(--success); }
.auto-result.error { color: var(--danger); }

/* Bulk auto-allocate bar */
.bulk-allocate-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: #fff;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.bulk-allocate-bar label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--gray-700);
    white-space: nowrap;
}

.bulk-allocate-bar input[type="date"] {
    padding: 0.4rem 0.65rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.85rem;
}

.bulk-allocate-result {
    font-size: 0.85rem;
    color: var(--gray-600);
    margin-left: auto;
}

/* Reassign modal */
.reassign-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 500;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.reassign-overlay.open { display: flex; }

.reassign-modal {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    width: 100%;
    max-width: 480px;
    padding: 1.5rem;
}

.reassign-modal h3 {
    margin-bottom: 1rem;
    font-size: 1.05rem;
    font-weight: 600;
}

.reassign-modal .form-actions {
    margin-top: 1rem;
}

#vehicle_template {
    background-color: var(--gray-50);
    border: 1px dashed var(--gray-300);
    transition: border-color 0.15s, background-color 0.15s;
}

#vehicle_template:focus {
    border-style: solid;
    border-color: var(--primary);
    background-color: #fff;
}

#vehicle_template optgroup {
    font-weight: 600;
    color: var(--gray-700);
}

/* ================================================
   Empty State
   ================================================ */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--gray-500);
    font-size: 0.95rem;
}

/* ================================================
   PDF viewer (legacy)
   ================================================ */

/* ================================================
   Sidebar overlay (mobile)
   ================================================ */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 150;
}

/* ================================================
   Responsive
   ================================================ */
@media (max-width: 1024px) {
    .stats-row { grid-template-columns: repeat(2, 1fr); }
    .area-cards-horizontal { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

    .sidebar-overlay.open { display: block; }

    .sidebar-toggle { display: block; }

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

    .main-content { padding: 0.75rem; }

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

    .stat-card { padding: 0.5rem 0.6rem; gap: 0.5rem; }
    .stat-icon { width: 28px; height: 28px; }
    .stat-icon svg { width: 14px; height: 14px; }
    .stat-number { font-size: 1.05rem; }
    .stat-label { font-size: 0.62rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .stat-link { display: none; }

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

    .area-detail-full { grid-template-columns: 1fr; }

    .plan-canvas-wrapper { min-height: auto; }

    .card-grid,
    .area-maps-grid { grid-template-columns: 1fr; }

    .external-booking-wrapper { margin: 0.5rem; padding: 1rem; }

    /* Compact dashboard table for mobile */
    .data-table th, .data-table td { padding: 0.4rem 0.5rem; font-size: 0.75rem; }

    /* Hide Event and Size columns on mobile */
    .data-table .col-event { display: none; }
    .data-table .col-vehicle-size { display: none; }

    .dash-filter-bar { gap: 0.3rem; }
    .dash-filter-select { font-size: 0.72rem; padding: 0.2rem 0.35rem; flex: 1; min-width: 0; }
    .dash-filter-info { font-size: 0.68rem; }

    .section-title { font-size: 0.9rem; margin-bottom: 0.5rem; }

    .bookings-panel .table-responsive { max-height: 300px; overflow-x: auto; -webkit-overflow-scrolling: touch; }

    .area-map-card { font-size: 0.82rem; }
    .area-map-header { padding: 0.6rem 0.75rem; }
    .area-map-header h3 { font-size: 0.85rem; }
    .area-map-canvas-wrap { padding: 0.5rem; }
    .area-map-footer { padding: 0.5rem 0.75rem; }

    .area-cards-horizontal { grid-template-columns: 1fr 1fr; }
    .area-card-compact-canvas-wrap { max-height: 120px; }
    .area-card-compact-canvas-wrap .area-mini-canvas { max-height: 110px; }
}

@media (max-width: 480px) {
    .stat-icon { display: none; }
    .stat-card { padding: 0.45rem 0.55rem; }
    .stat-number { font-size: 0.95rem; }

    /* Hide Company and Area columns on very small screens */
    .data-table .col-company { display: none; }
}

/* ================================================
   Badge variations
   ================================================ */
.badge-muted { background: var(--gray-100); color: var(--gray-500); }

/* ================================================
   Status indicator in actions
   ================================================ */
.btn-success {
    background: var(--success);
    color: #fff;
    border-color: var(--success);
}

.btn-success:hover {
    background: #15803d;
    border-color: #15803d;
}

/* ================================================
   External Booking Page
   ================================================ */
.external-booking-body {
    background: var(--gray-100);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 2rem 1rem;
}

.external-booking-wrapper {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
    max-width: 640px;
    width: 100%;
    padding: 2rem;
}

.external-booking-header {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--gray-200);
}

.external-booking-header h1 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--gray-800);
}

.external-booking-header p {
    font-size: 0.85rem;
    color: var(--gray-500);
}

.external-booking-form fieldset {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1rem;
}

.external-booking-form legend {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--gray-700);
    padding: 0 0.5rem;
}

/* ================================================
   External link section in area view
   ================================================ */
.external-link-section {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 1rem;
    margin-top: 1rem;
}

.external-link-url {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #fff;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    padding: 0.5rem 0.75rem;
    margin: 0.5rem 0;
    font-size: 0.82rem;
    word-break: break-all;
}

.external-link-url code {
    flex: 1;
    color: var(--primary);
}

.copy-btn {
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
    cursor: pointer;
    background: var(--gray-100);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    white-space: nowrap;
}

/* ================================================
   Filter Bar
   ================================================ */
.filter-bar {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 1rem;
    margin-bottom: 1rem;
}

.filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
    flex: 1 1 140px;
}

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

.filter-group input,
.filter-group select {
    padding: 0.45rem 0.65rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.85rem;
    background: #fff;
    color: var(--gray-800);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

.filter-actions {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
    padding-bottom: 1px;
}

.filter-result-count {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-bottom: 0.75rem;
}

/* ================================================
   Pagination Controls
   ================================================ */
.pagination-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--gray-100);
}

.pagination-info {
    font-size: 0.78rem;
    color: var(--gray-500);
    padding: 0.5rem 1rem;
    text-align: center;
}

.pagination-controls .page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 0.5rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    background: #fff;
    color: var(--gray-600);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s;
}

.pagination-controls .page-btn:hover {
    background: var(--gray-50);
    border-color: var(--gray-300);
}

.pagination-controls .page-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    font-weight: 600;
}

.pagination-controls .page-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

/* ================================================
   Dashboard Filter Dropdowns
   ================================================ */
.bookings-filter-bar {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.bookings-filter-bar select {
    padding: 0.3rem 0.55rem;
    border: 1px solid var(--gray-200);
    border-radius: calc(var(--radius) - 2px);
    font-size: 0.78rem;
    background: #fff;
    color: var(--gray-600);
    cursor: pointer;
}

.bookings-filter-bar select:focus {
    outline: none;
    border-color: var(--primary);
}

/* ================================================
   Settings Page
   ================================================ */
.current-logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
}

.current-logo img {
    max-height: 48px;
    width: auto;
    border-radius: 4px;
}

/* ================================================
   Analytics Page
   ================================================ */
.analytics-filters {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
    flex-wrap: wrap;
    background: #fff;
    padding: 1rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
}

.analytics-filters .filter-group {
    flex: 0 1 auto;
    min-width: 140px;
}

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

.kpi-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1rem;
    text-align: center;
}

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

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

.analytics-charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.chart-card {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 1.25rem;
}

.chart-card h3 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--gray-800);
}

.chart-canvas-wrap {
    position: relative;
    width: 100%;
}

.chart-canvas-wrap canvas {
    width: 100% !important;
    height: auto !important;
}

.chart-bar-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
    font-size: 0.82rem;
}

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

.chart-bar-track {
    flex: 1;
    background: var(--gray-100);
    border-radius: 4px;
    height: 20px;
    overflow: hidden;
}

.chart-bar-fill {
    height: 100%;
    border-radius: 4px;
    background: var(--primary);
    transition: width 0.3s;
    min-width: 2px;
}

.chart-bar-value {
    min-width: 40px;
    font-size: 0.78rem;
    color: var(--gray-500);
    font-weight: 600;
}

@media (max-width: 1024px) {
    .analytics-charts-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .analytics-kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .analytics-filters { flex-direction: column; }
    .analytics-filters .filter-group { flex: 1 1 100%; }
}

@media (max-width: 768px) {
    .filter-form { flex-direction: column; }
    .filter-group { flex: 1 1 100%; }
    .pagination-controls { flex-wrap: wrap; }
    .page-header { margin-bottom: 0.75rem; }
    .page-header h1 { font-size: 1.1rem; }
}

/* ================================================
   Area checkbox list (event form)
   ================================================ */
.area-checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    max-height: 360px;
    overflow-y: auto;
}

.area-checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
    background: #fff;
}

.area-checkbox-item:hover {
    border-color: var(--primary);
    background: var(--gray-50);
}

.area-checkbox-item.checked {
    border-color: var(--primary);
    background: var(--primary-light);
}

.area-checkbox-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    flex-shrink: 0;
}

/* ================================================
   Help page
   ================================================ */
.help-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.help-card {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 1.5rem;
}

.help-card-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.85rem;
}

.help-card-icon svg {
    width: 22px;
    height: 22px;
}

.help-card-icon.blue { background: var(--primary-light); color: var(--primary); }
.help-card-icon.green { background: var(--success-light); color: var(--success); }
.help-card-icon.orange { background: var(--warning-light); color: var(--warning); }
.help-card-icon.red { background: var(--danger-light); color: var(--danger); }

.help-card h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 0.5rem;
}

.help-card p {
    font-size: 0.88rem;
    color: var(--gray-600);
    line-height: 1.6;
}

.help-card ol,
.help-card ul {
    font-size: 0.85rem;
    color: var(--gray-600);
    line-height: 1.7;
    padding-left: 1.25rem;
    margin-top: 0.4rem;
}

.help-section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--gray-200);
}

.help-workflow {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.help-workflow-step {
    display: flex;
    gap: 1rem;
    position: relative;
}

.help-workflow-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.help-workflow-step:not(:last-child) .help-workflow-number::after {
    content: '';
    position: absolute;
    top: 32px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: calc(100% + 8px);
    background: var(--gray-200);
}

.help-workflow-content {
    flex: 1;
    padding-bottom: 1.25rem;
}

.help-workflow-content h4 {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 0.2rem;
}

.help-workflow-content p {
    font-size: 0.85rem;
    color: var(--gray-500);
    line-height: 1.5;
}

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

/* ================================================
   View toggle (list / calendar)
   ================================================ */
.view-toggle {
    display: inline-flex;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    overflow: hidden;
}

.view-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem 0.65rem;
    background: #fff;
    color: var(--gray-500);
    text-decoration: none;
    transition: all 0.15s;
    border-right: 1px solid var(--gray-200);
}

.view-toggle-btn:last-child { border-right: none; }

.view-toggle-btn:hover {
    background: var(--gray-50);
    color: var(--gray-700);
    text-decoration: none;
}

.view-toggle-btn.active {
    background: var(--primary);
    color: #fff;
}

/* ================================================
   Calendar
   ================================================ */
.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--gray-200);
}

.calendar-month-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gray-800);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.calendar-dow {
    padding: 0.5rem;
    text-align: center;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gray-500);
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

.calendar-cell {
    min-height: 90px;
    padding: 0.35rem;
    border-right: 1px solid var(--gray-100);
    border-bottom: 1px solid var(--gray-100);
    background: #fff;
    vertical-align: top;
}

.calendar-cell:nth-child(7n) { border-right: none; }

.calendar-cell-empty {
    background: var(--gray-50);
}

.calendar-cell-today {
    background: #eff6ff;
}

.calendar-cell-today .calendar-day-number {
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.calendar-day-number {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.2rem;
    display: block;
}

.calendar-event {
    display: block;
    padding: 1px 4px;
    margin-bottom: 2px;
    border-radius: 3px;
    font-size: 0.68rem;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.5;
}

.calendar-event:hover { text-decoration: none; opacity: 0.85; }

.calendar-event-active {
    background: #dcfce7;
    color: var(--success);
}

.calendar-event-pending {
    background: #fef3c7;
    color: var(--warning);
}

.calendar-event-completed {
    background: var(--gray-100);
    color: var(--gray-500);
}

.calendar-more {
    font-size: 0.68rem;
    color: var(--gray-400);
    padding: 0 4px;
}

@media (max-width: 768px) {
    .calendar-cell { min-height: 60px; }
    .calendar-event { font-size: 0.6rem; }
    .calendar-dow { font-size: 0.6rem; padding: 0.3rem; }
}

/* ================================================
   Event meta in cards
   ================================================ */
.event-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.event-meta-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.82rem;
    color: var(--gray-600);
}

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

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

/* ================================================
   Dashboard event cards
   ================================================ */
.dash-events-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.dash-event-card {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 0.85rem 1rem;
    border-left: 3px solid var(--gray-300);
    transition: box-shadow var(--transition);
}

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

.dash-event-active { border-left-color: var(--success); }
.dash-event-pending { border-left-color: var(--warning); }
.dash-event-completed { border-left-color: var(--gray-400); }

.dash-event-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dash-event-dates {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    color: var(--gray-500);
}

.dash-event-spaces {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    color: var(--success);
}

.dash-event-spaces-full {
    color: var(--danger);
}

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