/* ============================================================
   Coach Booking System V2 — Main Stylesheet
   ============================================================ */

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

:root {
    --primary:       #667eea;
    --primary-dark:  #5568d3;
    --secondary:     #764ba2;
    --success:       #10b981;
    --warning:       #f59e0b;
    --danger:        #ef4444;
    --info:          #3b82f6;

    --bg:            #f1f5f9;
    --surface:       #ffffff;
    --surface-2:     #f8fafc;
    --border:        #e2e8f0;
    --border-2:      #cbd5e1;

    --text:          #1e293b;
    --text-2:        #475569;
    --text-3:        #94a3b8;

    --nav-bg:        #ffffff;
    --nav-height:    64px;

    --radius:        10px;
    --radius-sm:     6px;
    --radius-lg:     14px;

    --shadow-sm:     0 1px 3px rgba(0,0,0,0.08);
    --shadow:        0 2px 8px rgba(0,0,0,0.10);
    --shadow-lg:     0 8px 30px rgba(0,0,0,0.12);

    --transition:    0.2s ease;
}

/* ── Dark Mode Variables ────────────────────────────────────── */
[data-theme="dark"] {
    --bg:        #0f172a;
    --surface:   #1e293b;
    --surface-2: #162032;
    --border:    #334155;
    --border-2:  #475569;

    --text:      #f1f5f9;
    --text-2:    #cbd5e1;
    --text-3:    #64748b;

    --nav-bg:    #1e293b;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow:    0 2px 8px rgba(0,0,0,0.35);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.4);
}

/* ── Base ───────────────────────────────────────────────────── */
html { font-size: 15px; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

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

/* ── Navbar ─────────────────────────────────────────────────── */
.navbar {
    background: var(--nav-bg);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 200;
    height: var(--nav-height);
}

.nav-container {
    max-width: 1500px;
    margin: 0 auto;
    padding: 0 20px;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-brand {
    font-size: 17px;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
    margin-right: 12px;
    text-decoration: none;
}

.nav-brand:hover { color: var(--primary-dark); }

/* Nav menu wrapper */
.nav-menu {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
}

/* Plain nav link */
.nav-link {
    padding: 7px 12px;
    color: var(--text-2);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 500;
    white-space: nowrap;
    transition: background var(--transition), color var(--transition);
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
    line-height: 1.4;
}

.nav-link:hover, .nav-link.active {
    background: rgba(102,126,234,0.1);
    color: var(--primary);
}

/* ── Dropdown ───────────────────────────────────────────────── */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 5px;
}

.nav-arrow {
    font-size: 10px;
    transition: transform var(--transition);
    display: inline-block;
}

.nav-dropdown.open .nav-arrow { transform: rotate(180deg); }

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 170px;
    padding: 6px;
    z-index: 300;
    animation: dropIn 0.15s ease;
}

@keyframes dropIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.nav-dropdown.open .nav-dropdown-menu { display: block; }

.nav-dropdown-item {
    display: block;
    padding: 8px 12px;
    color: var(--text-2);
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    transition: background var(--transition), color var(--transition);
}

.nav-dropdown-item:hover,
.nav-dropdown-item.active {
    background: rgba(102,126,234,0.1);
    color: var(--primary);
}

/* ── Nav User Area ──────────────────────────────────────────── */
.nav-user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    padding-left: 12px;
    border-left: 1px solid var(--border);
    white-space: nowrap;
}

.nav-username {
    font-size: 13px;
    color: var(--text-2);
    font-weight: 500;
}

.btn-logout {
    padding: 6px 14px;
    background: var(--danger);
    color: white;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    transition: background var(--transition);
}

.btn-logout:hover { background: #dc2626; color: white; }

/* Theme toggle */
.theme-toggle {
    background: none;
    border: 1px solid var(--border-2);
    border-radius: 20px;
    padding: 4px 10px;
    cursor: pointer;
    font-size: 15px;
    color: var(--text-2);
    transition: border-color var(--transition), color var(--transition);
    line-height: 1;
}

.theme-toggle:hover { border-color: var(--primary); color: var(--primary); }

/* ── Hamburger (mobile) ─────────────────────────────────────── */
.nav-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    margin-left: auto;
}

.nav-hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-2);
    border-radius: 2px;
    transition: all 0.3s;
}

/* ── Flash / Alerts ─────────────────────────────────────────── */
.flash-wrap {
    max-width: 1500px;
    margin: 16px auto 0;
    padding: 0 20px;
}

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 16px;
}

.alert-success { background: #d1fae5; color: #065f46; border-left: 4px solid var(--success); }
.alert-error   { background: #fee2e2; color: #991b1b; border-left: 4px solid var(--danger); }
.alert-warning { background: #fef3c7; color: #92400e; border-left: 4px solid var(--warning); }
.alert-info    { background: #dbeafe; color: #1e40af; border-left: 4px solid var(--info); }

[data-theme="dark"] .alert-success { background: #064e3b; color: #6ee7b7; }
[data-theme="dark"] .alert-error   { background: #450a0a; color: #fca5a5; }
[data-theme="dark"] .alert-warning { background: #451a03; color: #fcd34d; }
[data-theme="dark"] .alert-info    { background: #1e3a5f; color: #93c5fd; }

/* ── Main Content ───────────────────────────────────────────── */
.main-content {
    max-width: 1500px;
    margin: 28px auto;
    padding: 0 20px;
}

/* ── Page Header ────────────────────────────────────────────── */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header h1 {
    font-size: 26px;
    font-weight: 700;
    color: var(--text);
}

.page-header-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ── Cards ──────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

/* ── Stats Grid ─────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 22px 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stat-card-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-3);
}

.stat-card-value {
    font-size: 34px;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
}

.stat-card-sub {
    font-size: 12px;
    color: var(--text-3);
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 20px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 600;
    text-decoration: none;
    transition: all var(--transition);
    font-family: inherit;
    white-space: nowrap;
    line-height: 1.4;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(102,126,234,0.4);
    color: white;
}

.btn-success  { background: var(--success); color: white; }
.btn-success:hover  { background: #059669; color: white; transform: translateY(-1px); }

.btn-danger   { background: var(--danger); color: white; }
.btn-danger:hover   { background: #dc2626; color: white; transform: translateY(-1px); }

.btn-warning  { background: var(--warning); color: white; }
.btn-warning:hover  { background: #d97706; color: white; }

.btn-info     { background: var(--info); color: white; }
.btn-info:hover     { background: #2563eb; color: white; }

.btn-secondary {
    background: var(--surface-2);
    color: var(--text-2);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border); color: var(--text); }

.btn-sm { padding: 6px 14px; font-size: 12.5px; }
.btn-lg { padding: 12px 28px; font-size: 15px; }

[data-theme="dark"] .btn-secondary { background: #334155; color: var(--text-2); border-color: var(--border); }
[data-theme="dark"] .btn-secondary:hover { background: #475569; }

/* ── Filter Bar ─────────────────────────────────────────────── */
.filter-bar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 18px;
    margin-bottom: 18px;
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    box-shadow: var(--shadow-sm);
}

.filter-search-wrap {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.filter-search-icon {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-3);
    font-size: 15px;
    pointer-events: none;
}

.filter-search-input {
    width: 100%;
    padding: 9px 12px 9px 36px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    background: var(--bg);
    color: var(--text);
    transition: border-color var(--transition);
    font-family: inherit;
}

.filter-search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102,126,234,0.15);
}

.filter-select {
    padding: 9px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    background: var(--bg);
    color: var(--text);
    cursor: pointer;
    font-family: inherit;
    transition: border-color var(--transition);
}

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

.filter-btn {
    padding: 9px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-2);
    font-size: 13.5px;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition);
    font-family: inherit;
}

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

.result-count { font-size: 13px; color: var(--text-3); white-space: nowrap; }

/* ── Table ──────────────────────────────────────────────────── */
.table-container {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

thead { background: linear-gradient(135deg, var(--primary), var(--secondary)); }

th {
    padding: 13px 16px;
    text-align: left;
    color: white;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .4px;
    white-space: nowrap;
}

td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }

[data-theme="dark"] tbody tr:hover { background: #263348; }

.td-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── Forms ──────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-2);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102,126,234,0.15);
}

.form-control::placeholder { color: var(--text-3); }

textarea.form-control { min-height: 90px; resize: vertical; }

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

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

.form-hint { font-size: 12px; color: var(--text-3); margin-top: 4px; }

[data-theme="dark"] .form-control {
    background: var(--surface-2);
    border-color: var(--border);
    color: var(--text);
}

/* ── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 1000;
    overflow-y: auto;
    padding: 20px;
}

.modal-overlay.open {
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.modal {
    background: var(--surface);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 820px;
    margin-top: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.25s ease;
    overflow: hidden;
}

.modal-sm { max-width: 460px; }
.modal-lg { max-width: 1000px; }

@keyframes modalIn {
    from { opacity: 0; transform: translateY(-20px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, var(--primary), var(--secondary));
}

.modal-title {
    font-size: 17px;
    font-weight: 700;
    color: white;
}

.modal-close {
    background: rgba(255,255,255,0.2);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    font-size: 18px;
    transition: background var(--transition);
    line-height: 1;
}

.modal-close:hover { background: rgba(255,255,255,0.35); }

.modal-body { padding: 24px; }
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: var(--surface-2);
}

/* ── Modal Tabs ─────────────────────────────────────────────── */
.modal-tabs {
    display: flex;
    gap: 2px;
    border-bottom: 2px solid var(--border);
    margin-bottom: 20px;
    overflow-x: auto;
}

.modal-tab {
    padding: 9px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-3);
    border: none;
    background: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    font-family: inherit;
    transition: color var(--transition), border-color var(--transition);
}

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

.modal-tab-panel { display: none; }
.modal-tab-panel.active { display: block; }

/* ── Confirm Modal ──────────────────────────────────────────── */
.confirm-modal {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 32px 28px;
    max-width: 420px;
    width: 100%;
    text-align: center;
    animation: popIn 0.2s ease;
    box-shadow: var(--shadow-lg);
}

@keyframes popIn {
    from { opacity: 0; transform: scale(0.88); }
    to   { opacity: 1; transform: scale(1); }
}

.confirm-modal-icon { font-size: 48px; margin-bottom: 14px; line-height: 1; }
.confirm-modal h3   { font-size: 19px; margin-bottom: 8px; color: var(--text); }
.confirm-modal p    { font-size: 14px; color: var(--text-2); line-height: 1.6; }

.confirm-modal-ref {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 13px;
    margin: 10px 0;
    background: #fee2e2;
    color: #991b1b;
}

.confirm-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
}

.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-info    { background: #dbeafe; color: #1e40af; }
.badge-grey    { background: #e2e8f0; color: #475569; }

[data-theme="dark"] .badge-success { background: #064e3b; color: #6ee7b7; }
[data-theme="dark"] .badge-warning { background: #451a03; color: #fcd34d; }
[data-theme="dark"] .badge-danger  { background: #450a0a; color: #fca5a5; }
[data-theme="dark"] .badge-info    { background: #1e3a5f; color: #93c5fd; }
[data-theme="dark"] .badge-grey    { background: #334155; color: #94a3b8; }

/* ── Expiry Indicators ──────────────────────────────────────── */
.expiry-ok      { color: var(--success); font-weight: 600; }
.expiry-warn    { color: var(--warning); font-weight: 600; }
.expiry-expired { color: var(--danger);  font-weight: 600; }

/* ── Utility ────────────────────────────────────────────────── */
.text-muted  { color: var(--text-3); font-size: 13px; }
.text-small  { font-size: 12.5px; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.fw-600      { font-weight: 600; }
.fw-700      { font-weight: 700; }
.mt-4        { margin-top: 4px; }
.mt-8        { margin-top: 8px; }
.mt-16       { margin-top: 16px; }
.mt-24       { margin-top: 24px; }
.mb-16       { margin-bottom: 16px; }
.mb-24       { margin-bottom: 24px; }
.flex        { display: flex; }
.flex-wrap   { flex-wrap: wrap; }
.gap-8       { gap: 8px; }
.gap-12      { gap: 12px; }
.align-center { align-items: center; }

/* ── Empty State ────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-3);
}

.empty-state-icon { font-size: 48px; margin-bottom: 14px; opacity: .5; }
.empty-state h3   { font-size: 17px; color: var(--text-2); margin-bottom: 8px; }
.empty-state p    { font-size: 14px; }

/* ── Calendar (from V2) ─────────────────────────────────────── */
.cal-header {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 18px 22px;
    border-radius: var(--radius);
    margin-bottom: 14px;
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
}

.cal-nav { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.cal-nav-btn {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    font-size: 13.5px;
    transition: all var(--transition);
    text-decoration: none;
    display: inline-block;
}

.cal-nav-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(102,126,234,0.4); color: white; }

.cal-nav-btn.today {
    background: var(--surface);
    color: var(--primary);
    border: 1.5px solid var(--primary);
}
.cal-nav-btn.today:hover { background: var(--primary); color: white; }

.cal-date { font-size: 20px; font-weight: 700; color: var(--text); }
.cal-stats { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.cal-count { background: var(--surface-2); border: 1px solid var(--border); padding: 7px 14px; border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.cal-count.has-bookings { background: linear-gradient(135deg, var(--primary), var(--secondary)); color: white; border-color: transparent; }

.date-input {
    padding: 8px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font-family: inherit;
}
.date-input:focus { outline: none; border-color: var(--primary); }

.cal-legend { display: flex; gap: 18px; margin-bottom: 14px; flex-wrap: wrap; }
.legend-item { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-2); }
.legend-dot  { width: 14px; height: 14px; border-radius: 3px; flex-shrink: 0; }

.cal-grid { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; box-shadow: var(--shadow-sm); }
.cal-row  { display: flex; border-bottom: 1px solid var(--border); min-height: 44px; }
.cal-row:last-child { border-bottom: none; }
.cal-row:hover { background: var(--surface-2); }

.cal-time {
    width: 82px;
    min-width: 82px;
    padding: 12px 8px;
    background: var(--surface-2);
    border-right: 2px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 13px;
}

.cal-time .t-hour  { font-size: 14px; font-weight: 700; color: var(--text-2); line-height: 1; }
.cal-time .t-ampm  { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.cal-time.active-hour { background: rgba(102,126,234,0.08); border-right-color: var(--primary); }
.cal-time.active-hour .t-hour { color: var(--primary); }

.cal-events { flex: 1; padding: 6px 10px; display: flex; flex-direction: column; gap: 5px; justify-content: center; }
.cal-empty  { color: var(--border-2); font-size: 12px; font-style: italic; }

.cal-booking {
    border-radius: var(--radius-sm);
    padding: 6px 10px 0 10px;
    cursor: pointer;
    transition: background var(--transition), box-shadow var(--transition);
    border-left: 4px solid var(--primary);
    background: rgba(102,126,234,0.08);
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.cal-booking:hover {
    background: rgba(102,126,234,0.16);
    box-shadow: inset 0 0 0 1px rgba(102,126,234,0.3);
}

.bk-top    { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.bk-ref    { font-weight: 700; font-size: 13px; color: var(--text-3); }
.bk-client { font-weight: 700; font-size: 15px; color: var(--text); }
.bk-meta   { display: flex; gap: 10px; flex-wrap: wrap; font-size: 13.5px; color: var(--text-2); }
.bk-route  { font-size: 13.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.bk-actions { display: flex; gap: 5px; flex-wrap: wrap; padding-bottom: 6px; }
.bk-btn { padding: 4px 11px; border-radius: 5px; font-size: 12px; font-weight: 600; cursor: pointer; border: none; text-decoration: none; display: inline-flex; align-items: center; gap: 3px; transition: filter var(--transition); white-space: nowrap; }
.bk-btn:hover { filter: brightness(0.88); }
.bk-btn-edit     { background: var(--primary); color: white; }
.bk-btn-copy     { background: #7c3aed; color: white; }
.bk-btn-return   { background: #0891b2; color: white; }
.bk-btn-email    { background: #ea580c; color: white; }
.bk-btn-sms      { background: var(--success); color: white; }
.bk-btn-delete   { background: var(--danger); color: white; }
.bk-btn-secondary { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }

.multi-badge { font-size: 11px; background: var(--primary); color: white; padding: 1px 7px; border-radius: 10px; font-weight: 700; margin-left: 5px; }

/* ── Settings ───────────────────────────────────────────────── */
.settings-container { max-width: 860px; margin: 0 auto; }
.settings-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}
.settings-section h2 {
    font-size: 17px;
    margin-bottom: 20px;
    color: var(--text);
    border-bottom: 2px solid var(--border);
    padding-bottom: 10px;
}

/* ── Users ──────────────────────────────────────────────────── */
.role-badge { padding: 3px 11px; border-radius: 20px; font-size: 11.5px; font-weight: 600; text-transform: uppercase; }
.role-admin   { background: #fee2e2; color: #991b1b; }
.role-manager { background: #dbeafe; color: #1e40af; }
.role-user    { background: #e0e7ff; color: #3730a3; }

[data-theme="dark"] .role-admin   { background: #450a0a; color: #fca5a5; }
[data-theme="dark"] .role-manager { background: #1e3a5f; color: #93c5fd; }
[data-theme="dark"] .role-user    { background: #1e1b4b; color: #a5b4fc; }

.admin-warning {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border-left: 4px solid var(--warning);
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #92400e;
}

[data-theme="dark"] .admin-warning {
    background: #1e3a5f;
    color: #93c5fd;
    border-left-color: var(--info);
}

/* ── Animations ─────────────────────────────────────────────── */
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .nav-container { gap: 2px; }
    .nav-link      { padding: 7px 9px; font-size: 13px; }
}

@media (max-width: 768px) {
    body { overflow-x: hidden; }

    .nav-hamburger { display: flex; }

    .nav-menu {
        display: none;
        position: fixed;
        top: var(--nav-height);
        left: 0;
        right: 0;
        bottom: 0;
        background: var(--nav-bg);
        flex-direction: column;
        align-items: stretch;
        padding: 16px;
        overflow-y: auto;
        border-top: 1px solid var(--border);
        box-shadow: var(--shadow-lg);
        gap: 4px;
        z-index: 199;
    }

    .nav-menu.open { display: flex; }

    .nav-link { padding: 12px 14px; font-size: 14px; border-radius: var(--radius-sm); }

    /* Dropdowns go full width on mobile */
    .nav-dropdown-menu {
        position: static;
        box-shadow: none;
        border: none;
        border-left: 3px solid var(--primary);
        border-radius: 0;
        background: transparent;
        padding: 4px 0 4px 12px;
        margin-top: 2px;
        animation: none;
    }

    .nav-dropdown-btn { width: 100%; justify-content: space-between; }

    .nav-user {
        margin-left: 0;
        padding-left: 0;
        border-left: none;
        border-top: 1px solid var(--border);
        padding-top: 14px;
        margin-top: 10px;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .btn-logout { text-align: center; width: 100%; justify-content: center; }

    .page-header h1 { font-size: 22px; }
    .stats-grid     { grid-template-columns: repeat(2, 1fr); }
    .form-grid-3,
    .form-grid-4    { grid-template-columns: repeat(2, 1fr); }
    .form-grid-2    { grid-template-columns: 1fr; }

    .table-container { overflow-x: auto; }
    table { min-width: 650px; font-size: 13px; }
    th, td { padding: 10px 12px; }

    .cal-date { font-size: 16px; }
    .cal-time { width: 64px; min-width: 64px; }
    .cal-time .t-hour { font-size: 12px; }
    .cal-header { flex-direction: column; align-items: stretch; }
    .cal-nav { justify-content: space-between; }
    .bk-route { display: none; }
}

@media (max-width: 480px) {
    .main-content { padding: 0 12px; margin-top: 20px; }
    .card, .settings-section { padding: 18px 14px; }
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .form-grid-2,
    .form-grid-3,
    .form-grid-4 { grid-template-columns: 1fr; }
    .modal { margin-top: 0; border-radius: var(--radius) var(--radius) 0 0; }
    .modal-overlay { padding: 0; align-items: flex-end; }
    .cal-time { width: 50px; min-width: 50px; }
    .cal-time .t-ampm { display: none; }
}

/* ── Icon Buttons ───────────────────────────────────────────── */
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border);
    background: var(--surface);
    cursor: pointer;
    font-size: 15px;
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1;
    padding: 0;
}

.icon-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.icon-btn-edit { border-color: var(--primary); background: rgba(102,126,234,0.08); }
.icon-btn-edit:hover { background: var(--primary); }

.icon-btn-delete { border-color: var(--danger); background: rgba(239,68,68,0.08); }
.icon-btn-delete:hover { background: var(--danger); }

/* Invoice icon — grey when not invoiced, green when invoiced */
.icon-btn-uninvoiced {
    border-color: var(--border-2);
    background: var(--surface-2);
    opacity: 0.6;
}
.icon-btn-uninvoiced:hover {
    border-color: var(--success);
    background: rgba(16,185,129,0.1);
    opacity: 1;
}

.icon-btn-invoiced {
    border-color: var(--success);
    background: rgba(16,185,129,0.12);
    cursor: default;
}
.icon-btn-invoiced:hover {
    background: var(--success);
}

[data-theme="dark"] .icon-btn { background: var(--surface-2); border-color: var(--border); }
[data-theme="dark"] .icon-btn-edit { background: rgba(102,126,234,0.15); }
[data-theme="dark"] .icon-btn-delete { background: rgba(239,68,68,0.15); }
[data-theme="dark"] .icon-btn-invoiced { background: rgba(16,185,129,0.15); }

/* ── Pill Buttons (booking table actions) ───────────────────── */
.pill-btn {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    font-family: inherit;
    transition: all var(--transition);
    white-space: nowrap;
    line-height: 1.4;
    text-decoration: none;
}

.pill-btn-edit {
    background: rgba(102,126,234,0.12);
    color: var(--primary);
    border: 1px solid var(--primary);
}
.pill-btn-edit:hover {
    background: var(--primary);
    color: white;
}

.pill-btn-uninvoiced {
    background: var(--surface-2);
    color: var(--text-3);
    border: 1px solid var(--border-2);
    width: 70px;
    text-align: center;
}
.pill-btn-uninvoiced:hover {
    background: rgba(16,185,129,0.12);
    color: var(--success);
    border-color: var(--success);
}

.pill-btn-invoiced {
    background: rgba(16,185,129,0.12);
    color: var(--success);
    border: 1px solid var(--success);
    cursor: default;
    width: 70px;
    text-align: center;
}

.pill-btn-delete {
    background: rgba(239,68,68,0.08);
    color: var(--danger);
    border: 1px solid var(--danger);
}
.pill-btn-delete:hover {
    background: var(--danger);
    color: white;
}

[data-theme="dark"] .pill-btn-edit { background: rgba(102,126,234,0.15); }
[data-theme="dark"] .pill-btn-uninvoiced { background: var(--surface-2); border-color: var(--border); }
[data-theme="dark"] .pill-btn-invoiced { background: rgba(16,185,129,0.15); }
[data-theme="dark"] .pill-btn-delete { background: rgba(239,68,68,0.12); }

/* ── Loading Modal ──────────────────────────────────────────── */
.loading-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 20px;
}

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

.loading-box {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 36px 48px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    min-width: 240px;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

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

.loading-text {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.loading-sub {
    font-size: 13px;
    color: var(--text-3);
}
