/* ============================================================================
   Seven Hills Driving Academy — Shared Stylesheet
   Mobile-first. Navy + amber "driving school" palette. Poppins + Material
   Symbols. Designed to feel like a native app on phones/tablets.
   ============================================================================ */

:root {
    --shda-navy: #0f1f3d;
    --shda-navy-dark: #0a1529;
    --shda-navy-light: #1c2f57;
    --shda-amber: #f5a623;
    --shda-amber-dark: #d68c0f;
    --shda-amber-soft: #fef3e2;
    --shda-bg: #f4f6fb;
    --shda-card-bg: #ffffff;
    --shda-border: #e5e8f0;
    --shda-input-border: #adb5c4;
    --shda-text: #1c2333;
    --shda-text-muted: #6b7280;
    --shda-danger: #d64545;
    --shda-danger-soft: #fdecec;
    --shda-success: #1f9d55;
    --shda-success-soft: #e9f8ef;
    --shda-info: #2f7fd6;
    --shda-info-soft: #eaf3fd;

    --shda-header-navy: #0e2862;
    --shda-btn-primary: #ff6a20;
    --shda-btn-primary-dark: #cc551a;

    --shda-radius-sm: 0.5rem;
    --shda-control-radius: 5px;
    --shda-radius: 0.9rem;
    --shda-radius-lg: 1.25rem;

    --shda-shadow-sm: 0 1px 2px rgba(15, 31, 61, 0.05), 0 1px 3px rgba(15, 31, 61, 0.06);
    --shda-shadow: 0 4px 10px rgba(15, 31, 61, 0.06), 0 2px 4px rgba(15, 31, 61, 0.05);
    --shda-shadow-lg: 0 12px 32px rgba(15, 31, 61, 0.14);

    --shda-transition: 160ms cubic-bezier(0.4, 0, 0.2, 1);
    --shda-bottom-tabbar-height: 64px;
}

* {
    -webkit-tap-highlight-color: transparent;
}

html, body {
    height: 100%;
}

html {
    /* Defensive safety net: nothing in this app should legitimately need
       to scroll sideways, so a stray over-wide element on a narrow phone
       gets clipped instead of quietly widening the page. Deliberately set
       on <html>, not <body> — forcing overflow-x on body computes its
       overflow-y to auto too (an unrelated corner of the CSS overflow
       spec), turning body into its own nested scroll container, which is
       a known way to break this app's sticky top navbar (position: sticky
       tracks the nearest scrolling ancestor) — worst of all in Safari.
       <html> doesn't have that problem since it's already the root
       scroller. */
    overflow-x: hidden;
}

body {
    max-width: 100%;
}

img, svg, video {
    max-width: 100%;
    height: auto;
}

body {
    background-color: var(--shda-bg);
    color: var(--shda-text);
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.95rem;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 600;
}

body.has-bottom-tabbar {
    padding-bottom: calc(var(--shda-bottom-tabbar-height) + env(safe-area-inset-bottom));
}

a {
    color: var(--shda-navy);
    transition: color var(--shda-transition);
}

::selection {
    background-color: var(--shda-amber);
    color: var(--shda-navy-dark);
}

/* One consistent keyboard-focus ring reused on every interactive element
   (buttons, links, chips, tabs, sortable headers) instead of whatever
   color each Bootstrap component defaults to on its own — layers on top
   of a component's own focus style rather than replacing it, so nothing
   that already has a focus treatment loses it. Only shows for keyboard
   focus (:focus-visible), never on a mouse/touch click. */
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
.shda-tab:focus-visible,
.shda-filter-chip:focus-visible,
.shda-admin-subnav-link:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--shda-btn-primary);
    outline-offset: 2px;
    border-radius: var(--shda-control-radius);
}

/* ----------------------------------------------------------------------
   Material Symbols — consistent, evenly-weighted outline icons everywhere
   ---------------------------------------------------------------------- */

.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    font-size: 1.2em;
    line-height: 1;
    vertical-align: -0.2em;
    display: inline-block;
    user-select: none;
}

/* ----------------------------------------------------------------------
   Top navbar
   ---------------------------------------------------------------------- */

.shda-navbar {
    background-color: var(--shda-navy);
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
    box-shadow: 0 2px 8px rgba(15, 31, 61, 0.25);
}

.shda-navbar .navbar-brand {
    display: flex;
    align-items: center;
    padding-top: 0;
    padding-bottom: 0;
}

.shda-brand-chip {
    display: inline-flex;
    align-items: center;
    background-color: #ffffff;
    border-radius: var(--shda-radius-sm);
    padding: 0.3rem 0.6rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.shda-brand-chip img {
    height: 28px;
    width: auto;
    display: block;
}

.shda-navbar .nav-link {
    color: rgba(255, 255, 255, 0.82);
    font-weight: 500;
    padding-left: 0.85rem;
    padding-right: 0.85rem;
    border-radius: var(--shda-radius-sm);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: background-color var(--shda-transition), color var(--shda-transition);
}

.shda-navbar .nav-link:hover,
.shda-navbar .nav-link:focus {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.08);
}

.shda-navbar .nav-link.active {
    color: #ffffff;
    background-color: var(--shda-navy-light);
}

.shda-navbar .navbar-toggler {
    color: #ffffff;
    border: none;
    font-size: 1.5rem;
    padding: 0.15rem 0.4rem;
    line-height: 1;
}

.shda-navbar .navbar-toggler:focus {
    /* Drop Bootstrap's default box-shadow ring (too heavy against the navy
       bar) but keep a real, visible focus indicator for keyboard users —
       removing it outright with nothing in its place fails "proper focus
       states" the moment someone tabs to this button. */
    box-shadow: none;
    outline: 2px solid rgba(255, 255, 255, 0.7);
    outline-offset: 2px;
    border-radius: var(--shda-radius-sm);
}

.shda-role-badge {
    background-color: var(--shda-amber);
    color: var(--shda-navy-dark);
    font-weight: 600;
    font-size: 0.65rem;
    vertical-align: middle;
    border-radius: 999px;
    padding: 0.25em 0.6em;
}

.shda-notif-badge {
    position: absolute;
    top: 0.15rem;
    right: 0.1rem;
    background-color: var(--shda-danger);
    color: #ffffff;
    font-weight: 600;
    font-size: 0.6rem;
    line-height: 1;
    border-radius: 999px;
    padding: 0.25em 0.45em;
}

.shda-notif-badge-inline {
    position: static;
    margin-left: 0.4rem;
}

.shda-notif-dropdown {
    width: 340px;
    max-width: calc(100vw - 2rem);
    padding: 0;
}

.shda-notif-item {
    white-space: normal;
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--shda-border);
}

.shda-notif-item:last-of-type {
    border-bottom: none;
}

.shda-notif-unread {
    background-color: var(--shda-bg);
    position: relative;
}

.shda-notif-unread::before {
    content: '';
    position: absolute;
    left: 0.35rem;
    top: 1rem;
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background-color: var(--shda-danger);
}

.shda-notif-card-unread {
    border-left: 3px solid var(--shda-danger);
}

/* ----------------------------------------------------------------------
   Toasts — client-side success/error notifications for actions that don't
   round-trip through the server (so can't use the flash_set() banner),
   e.g. the admin Clear Cache action.
   ---------------------------------------------------------------------- */
.shda-toast {
    color: #ffffff;
    border: none;
    border-radius: var(--shda-radius-sm);
    box-shadow: var(--shda-shadow-lg);
}

.shda-toast-success { background-color: var(--shda-success); }
.shda-toast-error { background-color: var(--shda-danger); }
.shda-toast-info { background-color: var(--shda-info); }

/* ----------------------------------------------------------------------
   Offcanvas menu
   ---------------------------------------------------------------------- */

.offcanvas {
    border: none;
    box-shadow: var(--shda-shadow-lg);
}

.offcanvas-header {
    background-color: var(--shda-navy);
    color: #ffffff;
}

.offcanvas-header .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

.offcanvas-body .nav-link {
    color: var(--shda-text);
    border-radius: var(--shda-radius-sm);
    padding: 0.7rem 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    transition: background-color var(--shda-transition);
}

.offcanvas-body .nav-link:hover {
    background-color: var(--shda-bg);
}

.offcanvas-body .nav-link .material-symbols-outlined {
    color: var(--shda-navy);
    width: 1.4rem;
    text-align: center;
    font-size: 1.3rem;
}

.offcanvas-body .nav-pills .nav-link.active {
    background-color: var(--shda-navy);
    color: #ffffff;
}

.offcanvas-body .nav-pills .nav-link.active .material-symbols-outlined {
    color: var(--shda-amber);
}

/* ----------------------------------------------------------------------
   Main content area
   ---------------------------------------------------------------------- */

.shda-main {
    min-height: calc(100vh - 64px);
    /* iOS Safari's address/toolbar chrome shrinks the visual viewport
       without resizing 100vh, which is pinned to the larger layout
       viewport — dvh tracks the actual visible area instead. Older
       browsers without dvh support simply ignore this line and keep the
       100vh value above. */
    min-height: calc(100dvh - 64px);
    /* 90% keeps comfortable side margins at typical desktop widths, but on
       a large/ultra-wide monitor that alone would let tables and forms
       stretch to 2000px+ — capping the absolute width too keeps line
       lengths and table columns readable no matter how wide the display. */
    max-width: min(90%, 1600px) !important;
    display: flex;
    flex-direction: column;
}

.shda-page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.shda-page-header h1 {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.01em;
}

/* ----------------------------------------------------------------------
   Cards, buttons, forms — shared app-like polish
   ---------------------------------------------------------------------- */

.card {
    border: 1px solid var(--shda-border);
    border-radius: var(--shda-radius);
    box-shadow: var(--shda-shadow-sm);
}

.card-header {
    background-color: var(--shda-header-navy);
    color: #ffffff;
    border-bottom: 1px solid var(--shda-border);
    border-top-left-radius: var(--shda-radius) !important;
    border-top-right-radius: var(--shda-radius) !important;
    padding: 0.9rem 1.1rem;
}

.card-header .btn-outline-secondary {
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.6);
    background-color: transparent;
}

.card-header .btn-outline-secondary:hover,
.card-header .btn-outline-secondary:focus {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: #ffffff;
    color: #ffffff;
}

/* A toggle button group in a card-header (e.g. the dashboard chart's date
   range filter) needs its selected button to stay visibly different from
   the rest — the extra .active class here outweighs the plain
   ".card-header .btn-outline-secondary" rule above on specificity, so it
   wins regardless of stylesheet order. */
.card-header .btn-outline-secondary.active {
    background-color: #ffffff;
    border-color: #ffffff;
    color: var(--shda-header-navy);
}

.btn {
    border-radius: var(--shda-control-radius);
    font-weight: 500;
    transition: transform var(--shda-transition), box-shadow var(--shda-transition), background-color var(--shda-transition), border-color var(--shda-transition);
}

.btn:active {
    transform: scale(0.97);
}

.btn .material-symbols-outlined {
    font-size: 1.15em;
}

.btn-shda-primary {
    background-color: var(--shda-btn-primary);
    border: none;
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(255, 106, 32, 0.35);
}

.btn-shda-primary:hover,
.btn-shda-primary:focus {
    background-color: var(--shda-btn-primary-dark);
    color: #ffffff;
}

.form-control, .form-select {
    border-radius: var(--shda-control-radius);
    border-color: var(--shda-input-border);
    padding-top: 0.55rem;
    padding-bottom: 0.55rem;
    font-size: 14px;
    transition: border-color var(--shda-transition), box-shadow var(--shda-transition);
}

.form-control:focus, .form-select:focus {
    border-color: var(--shda-amber);
    box-shadow: 0 0 0 0.2rem rgba(245, 166, 35, 0.2);
}

.form-control::placeholder {
    color: #6B7280;
    opacity: 1;
}

.form-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--shda-text);
    margin-bottom: 0.35rem;
}

.badge {
    font-weight: 600;
    letter-spacing: 0.01em;
}

.list-group-item {
    border-color: var(--shda-border);
}

.list-group-item-action:hover {
    background-color: var(--shda-bg);
}

.list-group-item.list-group-item-action.active {
    background-color: var(--shda-header-navy);
    border-color: var(--shda-header-navy);
    color: #ffffff;
}

.alert {
    border: none;
    border-radius: var(--shda-radius);
    box-shadow: var(--shda-shadow-sm);
}

/* ----------------------------------------------------------------------
   Admin section sub-nav
   ---------------------------------------------------------------------- */

.shda-admin-subnav {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
    -webkit-overflow-scrolling: touch;
}

.shda-admin-subnav-link {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    background-color: var(--shda-card-bg);
    border: 1px solid var(--shda-border);
    color: var(--shda-text);
    font-weight: 500;
    font-size: 0.85rem;
    text-decoration: none;
    transition: background-color var(--shda-transition), color var(--shda-transition), border-color var(--shda-transition);
}

.shda-admin-subnav-link:hover {
    background-color: var(--shda-bg);
    color: var(--shda-text);
}

.shda-admin-subnav-link.active {
    background-color: var(--shda-navy);
    border-color: var(--shda-navy);
    color: #ffffff;
}

.shda-admin-subnav-link .material-symbols-outlined {
    font-size: 1.1rem;
}

/* ----------------------------------------------------------------------
   Permission matrix (Roles & Permissions)
   ---------------------------------------------------------------------- */

.shda-permission-matrix th,
.shda-permission-matrix td {
    text-align: center;
    vertical-align: middle;
}

.shda-permission-matrix th:first-child,
.shda-permission-matrix td:first-child {
    text-align: left;
}

.shda-permission-matrix .form-check {
    display: flex;
    justify-content: center;
    margin: 0;
}

.shda-permission-matrix .form-check-input {
    width: 1.2em;
    height: 1.2em;
    cursor: pointer;
}

.shda-permission-matrix .form-check-input:disabled {
    opacity: 0.25;
    cursor: not-allowed;
}

.shda-permission-matrix tbody tr:hover {
    background-color: var(--shda-bg);
}

/* ----------------------------------------------------------------------
   KPI stat cards
   ---------------------------------------------------------------------- */

.shda-stat-card {
    background: linear-gradient(155deg, var(--shda-card-bg) 60%, var(--shda-amber-soft) 160%);
    border: 1px solid var(--shda-border);
    border-radius: var(--shda-radius);
    padding: 1.1rem 1.2rem;
    height: 100%;
    box-shadow: var(--shda-shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    transition: transform var(--shda-transition), box-shadow var(--shda-transition);
}

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

.shda-stat-card .shda-stat-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
}

.shda-stat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.6rem;
    height: 2.6rem;
    border-radius: var(--shda-radius-sm);
    background-color: var(--shda-amber-soft);
    color: var(--shda-amber-dark);
    flex-shrink: 0;
}

.shda-stat-icon .material-symbols-outlined {
    font-size: 1.4rem;
    vertical-align: middle;
}

.shda-stat-icon.is-navy { background-color: rgba(15, 31, 61, 0.08); color: var(--shda-navy); }
.shda-stat-icon.is-success { background-color: var(--shda-success-soft); color: var(--shda-success); }
.shda-stat-icon.is-danger { background-color: var(--shda-danger-soft); color: var(--shda-danger); }
.shda-stat-icon.is-info { background-color: var(--shda-info-soft); color: var(--shda-info); }

.shda-stat-card .shda-stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--shda-text-muted);
}

.shda-stat-card .shda-stat-value {
    font-size: 1.55rem;
    font-weight: 700;
    color: var(--shda-navy);
    line-height: 1.15;
}

.shda-stat-card .shda-stat-sub {
    font-size: 0.8rem;
    color: var(--shda-text-muted);
}

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

/* ----------------------------------------------------------------------
   Responsive tables: on screens under 768px, a table wrapped in
   .card-on-mobile stops looking like a squeezed table and instead renders
   each row as a stacked card.
   ---------------------------------------------------------------------- */

.shda-table-wrap {
    background-color: var(--shda-card-bg);
    border: 1px solid var(--shda-border);
    border-radius: var(--shda-radius);
    box-shadow: var(--shda-shadow-sm);
    overflow: hidden;
}

.shda-table-wrap table {
    margin-bottom: 0;
}

.shda-table-wrap thead th {
    background-color: var(--shda-header-navy);
    color: #ffffff;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    padding-top: 0.9rem;
    padding-bottom: 0.9rem;
    border-bottom: 1px solid var(--shda-border);
}

/* Tables that aren't wrapped in .shda-table-wrap (dashboard mini-tables,
   permission matrix, invoice line editor, student profile sub-tables) get
   the same treatment for a consistent look app-wide. */
thead th {
    background-color: var(--shda-header-navy);
    color: #ffffff;
    padding-top: 0.9rem;
    padding-bottom: 0.9rem;
}

/* The printable invoice sheet stays plain black-on-white — a colored
   header wastes ink and doesn't match standard invoice conventions. */
.shda-invoice-sheet thead th {
    background-color: transparent;
    color: inherit;
}

@media (min-width: 768px) {
    .shda-details-col + .shda-details-col {
        border-left: 1px solid var(--shda-border);
    }
}

.shda-table-wrap tbody tr {
    transition: background-color var(--shda-transition);
}

.shda-table-wrap tbody tr:hover {
    background-color: var(--shda-bg);
}

@media (max-width: 767.98px) {
    .card-on-mobile,
    .card-on-mobile tbody,
    .card-on-mobile tr,
    .card-on-mobile td {
        display: block;
        width: 100%;
    }

    .card-on-mobile thead {
        display: none;
    }

    .card-on-mobile tr {
        border-bottom: 1px solid var(--shda-border);
        padding: 0.85rem 1.1rem;
    }

    .card-on-mobile tr:last-child {
        border-bottom: none;
    }

    .card-on-mobile td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        padding: 0.3rem 0;
        border: none;
        text-align: right;
    }

    .card-on-mobile td[data-label]::before {
        content: attr(data-label);
        font-size: 0.72rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.03em;
        color: var(--shda-text-muted);
        text-align: left;
        margin-right: auto;
        padding-right: 0.75rem;
    }

    .card-on-mobile td:empty {
        display: none;
    }

    /* App-like touches on small screens */
    .shda-page-header h1 {
        font-size: 1.2rem;
    }

    .card-header {
        padding: 0.8rem 1rem;
    }

    .btn {
        min-height: 42px;
    }
}

/* ----------------------------------------------------------------------
   Bottom tab bar (mobile only) — native-app style tab bar
   ---------------------------------------------------------------------- */

.shda-bottom-tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1030;
    display: flex;
    background-color: rgba(255, 255, 255, 0.96);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-top: 1px solid var(--shda-border);
    box-shadow: 0 -2px 16px rgba(15, 31, 61, 0.1);
    height: var(--shda-bottom-tabbar-height);
    padding-bottom: env(safe-area-inset-bottom);
}

.shda-tab {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    color: var(--shda-text-muted);
    text-decoration: none;
    font-size: 0.66rem;
    font-weight: 600;
    background: none;
    border: none;
    transition: color var(--shda-transition);
}

.shda-tab .material-symbols-outlined {
    font-size: 1.45rem;
    line-height: 1;
    transition: transform var(--shda-transition);
}

.shda-tab:active .material-symbols-outlined {
    transform: scale(0.88);
}

.shda-tab.active {
    color: var(--shda-navy);
}

.shda-tab.active .material-symbols-outlined {
    color: var(--shda-navy);
    font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* ----------------------------------------------------------------------
   Avatars
   ---------------------------------------------------------------------- */

.shda-avatar-lg {
    width: 4rem;
    height: 4rem;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--shda-border);
}

.shda-avatar-placeholder {
    font-size: 4rem;
    color: var(--shda-text-muted);
    line-height: 1;
}

.shda-avatar-xl {
    width: 4.5rem;
    height: 4.5rem;
}

.shda-upload-preview-wrap {
    flex-shrink: 0;
    width: 4.5rem;
    height: 4.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.shda-licence-preview-wrap {
    width: 100%;
    max-width: 240px;
    min-height: 100px;
    border: 1px dashed var(--shda-input-border);
    border-radius: var(--shda-control-radius);
    background-color: #fdfdfe;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
}

.shda-licence-preview {
    max-width: 100%;
    max-height: 140px;
    object-fit: contain;
    border-radius: var(--shda-control-radius);
}

.shda-licence-modal-img {
    max-height: 70vh;
    border-radius: var(--shda-control-radius);
}

.shda-avatar-sm {
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    object-fit: cover;
    vertical-align: -0.4em;
}

/* ----------------------------------------------------------------------
   Access Denied
   ---------------------------------------------------------------------- */

.shda-access-denied-icon {
    font-size: 4.5rem;
    color: var(--shda-danger);
    background-color: var(--shda-danger-soft);
    border-radius: 50%;
    width: 6rem;
    height: 6rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ----------------------------------------------------------------------
   Password strength meter
   ---------------------------------------------------------------------- */

.shda-strength-track {
    height: 6px;
    border-radius: 999px;
    background-color: var(--shda-border);
    overflow: hidden;
    margin-top: 0.4rem;
}

.shda-strength-bar {
    height: 100%;
    width: 0;
    border-radius: 999px;
    transition: width var(--shda-transition), background-color var(--shda-transition);
}

.shda-strength-text {
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 0.25rem;
    display: inline-block;
}

/* ----------------------------------------------------------------------
   Login page
   ---------------------------------------------------------------------- */

.shda-login-body {
    background: linear-gradient(160deg, var(--shda-navy) 0%, var(--shda-navy-dark) 100%);
    min-height: 100vh;
    min-height: 100dvh;
}

.shda-login-wrap {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 1rem;
}

.shda-login-card {
    background-color: var(--shda-card-bg);
    border-radius: var(--shda-radius-lg);
    box-shadow: var(--shda-shadow-lg);
    padding: 2.25rem 1.85rem;
    width: 100%;
    max-width: 420px;
}

/* Wider variant for the public student self-registration form, which has
   far more fields than the login/reset-password cards. */
.shda-register-card {
    max-width: 700px;
    text-align: left;
}

.shda-token-chip {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.82rem;
    color: var(--shda-text-muted);
}

.shda-login-brand {
    font-size: 2.5rem;
    color: var(--shda-amber);
    margin-bottom: 0.5rem;
}

.shda-login-brand .material-symbols-outlined {
    font-size: inherit;
}

.shda-login-logo {
    height: 44px;
    width: auto;
}

.shda-login-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--shda-navy);
    margin-bottom: 0.25rem;
}

.shda-login-hint {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--shda-border);
    font-size: 0.8rem;
    color: var(--shda-text-muted);
    text-align: center;
}

.shda-login-hint .material-symbols-outlined {
    color: var(--shda-amber);
}

/* ----------------------------------------------------------------------
   Invoice sheet
   ---------------------------------------------------------------------- */

.shda-invoice-brand {
    color: var(--shda-navy);
    font-weight: 700;
}

/* ----------------------------------------------------------------------
   Powered-by footer line
   ---------------------------------------------------------------------- */

.shda-powered-by {
    text-align: center;
    font-size: 0.78rem;
    color: var(--shda-text-muted);
    padding: 1.5rem 0 1rem;
    margin-top: auto;
    width: 100%;
}

.shda-powered-by a {
    color: var(--shda-text-muted);
    font-weight: 600;
    text-decoration: underline;
}

.shda-powered-by a:hover {
    color: var(--shda-navy);
}

.shda-login-wrap .shda-powered-by {
    padding-top: 1rem;
}

/* ----------------------------------------------------------------------
   Session calendar (FullCalendar theming to match the app)
   ---------------------------------------------------------------------- */

.shda-legend-dot {
    display: inline-block;
    width: 0.65rem;
    height: 0.65rem;
    border-radius: 50%;
}

#sessionCalendar {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.85rem;
    --fc-border-color: var(--shda-border);
    --fc-neutral-bg-color: var(--shda-bg);
    --fc-page-bg-color: transparent;
    --fc-list-event-hover-bg-color: var(--shda-bg);
}

/* --- Header toolbar: Prev/Next as circular icon buttons, Today as a
   distinct accent-outlined pill, a bold title, and a segmented view
   switcher — the "modern SaaS dashboard" header called for in the redesign. --- */
#sessionCalendar .fc-header-toolbar {
    margin-bottom: 1.5rem !important;
    flex-wrap: wrap;
    gap: 0.75rem;
}

#sessionCalendar .fc-toolbar-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--shda-navy);
    letter-spacing: -0.01em;
}

#sessionCalendar .fc-button {
    background-color: var(--shda-card-bg);
    border: 1px solid var(--shda-border);
    color: var(--shda-text);
    box-shadow: none !important;
    text-transform: capitalize;
    font-weight: 500;
    border-radius: var(--shda-control-radius) !important;
    padding: 0.4rem 0.9rem;
    transition: background-color var(--shda-transition), border-color var(--shda-transition), transform 120ms ease;
}

#sessionCalendar .fc-button:hover {
    background-color: var(--shda-bg);
    border-color: var(--shda-input-border);
}

#sessionCalendar .fc-button:active,
#sessionCalendar .fc-button:focus {
    box-shadow: none !important;
}

#sessionCalendar .fc-button:active {
    transform: scale(0.96);
}

#sessionCalendar .fc-today-button {
    font-weight: 600;
    color: var(--shda-btn-primary);
    border-color: var(--shda-btn-primary);
}

#sessionCalendar .fc-today-button:hover:not(:disabled) {
    background-color: var(--shda-amber-soft);
}

#sessionCalendar .fc-today-button:disabled {
    opacity: 0.45;
}

#sessionCalendar .fc-prevYear-button,
#sessionCalendar .fc-prev-button,
#sessionCalendar .fc-next-button,
#sessionCalendar .fc-nextYear-button {
    border-radius: 50% !important;
    width: 2.2rem;
    height: 2.2rem;
    padding: 0 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#sessionCalendar .fc-button-primary:not(:disabled).fc-button-active,
#sessionCalendar .fc-button-primary:not(:disabled):active {
    background-color: var(--shda-navy);
    border-color: var(--shda-navy);
    color: #ffffff;
}

/* --- Grid chrome: rounded card, muted uppercase weekday headers, subtle
   row/column hover, a refined "today" treatment (accent ring on the date
   number rather than a flat background wash). --- */
#sessionCalendar .fc-scrollgrid {
    border-radius: var(--shda-radius-sm);
    overflow: hidden;
}

#sessionCalendar .fc-col-header-cell {
    background-color: var(--shda-bg);
    padding: 0.55rem 0;
}

#sessionCalendar .fc-col-header-cell-cushion {
    text-transform: uppercase;
    font-size: 0.68rem;
    letter-spacing: 0.06em;
    color: var(--shda-text-muted);
    font-weight: 600;
}

#sessionCalendar .fc-daygrid-day:hover,
#sessionCalendar .fc-timegrid-col:hover {
    background-color: rgba(15, 31, 61, 0.025);
}

#sessionCalendar .fc-daygrid-day.fc-day-today,
#sessionCalendar .fc-timegrid-col.fc-day-today {
    background-color: var(--shda-amber-soft);
}

#sessionCalendar .fc-daygrid-day-number {
    font-weight: 500;
    padding: 0.35rem 0.5rem;
}

#sessionCalendar .fc-day-today .fc-daygrid-day-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.6rem;
    height: 1.6rem;
    background: var(--shda-btn-primary);
    color: #ffffff;
    border-radius: 50%;
    font-weight: 700;
    margin: 0.2rem;
    padding: 0 0.35rem;
}

#sessionCalendar .fc-highlight {
    background: rgba(255, 106, 32, 0.15);
}

/* --- Events: soft-tint cards with a status-colored accent border (set
   per-event from calendar_events.php), a gentle lift + shadow on hover,
   and a compact status dot + label built in eventContent (calendar.php). --- */
#sessionCalendar a {
    color: inherit;
}

#sessionCalendar .fc-event {
    border-left-width: 3px;
    border-radius: 0.5rem;
    padding: 2px 6px;
    cursor: pointer;
    transition: transform 140ms ease, box-shadow 140ms ease;
}

#sessionCalendar .fc-event:hover {
    transform: translateY(-1px);
    box-shadow: var(--shda-shadow);
    z-index: 5;
}

#sessionCalendar .fc-daygrid-event {
    margin-top: 2px;
}

#sessionCalendar .fc-event-main {
    padding: 1px 2px;
}

.shda-event-card {
    line-height: 1.3;
}

.shda-event-title-row {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.shda-event-dot {
    width: 6px;
    height: 6px;
    min-width: 6px;
    border-radius: 50%;
    display: inline-block;
}

.shda-event-title {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.shda-event-sub {
    font-size: 0.72em;
    opacity: 0.85;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

#sessionCalendar .fc-list-event-title .shda-event-sub {
    display: block;
    opacity: 0.75;
}

#sessionCalendar .fc-list-event:hover td {
    background-color: var(--shda-bg);
}

/* Status badges (used in the legend, filters, and details modal — never
   rely on color alone) */
.shda-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    white-space: nowrap;
}

.shda-status-Scheduled { background: #0f1f3d; color: #fff; }
.shda-status-Confirmed { background: #1f9d55; color: #fff; }
.shda-status-Completed { background: #6b7280; color: #fff; }
.shda-status-Cancelled { background: #fdecec; color: #d64545; }
.shda-status-NoShow { background: #f5a623; color: #0a1529; }
.shda-status-InProgress { background: #2f7fd6; color: #fff; }

/* Student self-registration: link statuses (Active/Expired/Revoked/Used)
   and request statuses (Pending/Approved/Rejected) */
.shda-status-Active { background: #1f9d55; color: #fff; }
.shda-status-Expired { background: #6b7280; color: #fff; }
.shda-status-Revoked { background: #fdecec; color: #d64545; }
.shda-status-Used { background: #0e2862; color: #fff; }
.shda-status-Pending { background: #f5a623; color: #0a1529; }
.shda-status-Approved { background: #1f9d55; color: #fff; }
.shda-status-Rejected { background: #fdecec; color: #d64545; }

/* "In Progress" session's End Session button — a subtle, continuous green
   pulse that communicates "this session is live right now" at a glance,
   without being distracting. Only ever applied to a session whose actual
   status (from the database) is In Progress — see sessions/list.php and
   the calendar's details modal, never applied speculatively. */
@keyframes shda-pulse-running {
    0%   { box-shadow: 0 0 0 0 rgba(31, 157, 85, 0.5); }
    70%  { box-shadow: 0 0 0 9px rgba(31, 157, 85, 0); }
    100% { box-shadow: 0 0 0 0 rgba(31, 157, 85, 0); }
}

.shda-session-running {
    background-color: var(--shda-success);
    border-color: var(--shda-success);
    color: #fff;
    animation: shda-pulse-running 2.2s ease-out infinite;
}

.shda-session-running:hover,
.shda-session-running:focus {
    background-color: var(--shda-success);
    border-color: var(--shda-success);
    color: #fff;
    filter: brightness(1.08);
}

@media (prefers-reduced-motion: reduce) {
    .shda-session-running {
        animation: none;
    }
}

/* ----------------------------------------------------------------------
   Table toolbar — search + Advanced Filters toggle + Clear Filters, shared
   by every list page (students, sessions, payments, invoices, expenses,
   enquiries, notifications, admin users/roles). Stacks on narrow screens.
   ---------------------------------------------------------------------- */
.shda-table-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.shda-table-toolbar .shda-toolbar-search {
    flex: 1 1 220px;
    min-width: 0;
}

.shda-table-toolbar .shda-toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.shda-advanced-filters {
    background-color: var(--shda-bg);
    border: 1px solid var(--shda-border);
    border-radius: var(--shda-radius-sm);
    padding: 1rem;
    margin-bottom: 0.75rem;
}

/* Active-filter chips (a badge per applied filter, each removable) */
.shda-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background-color: var(--shda-info-soft);
    color: var(--shda-info);
    font-weight: 500;
    font-size: 0.78rem;
    padding: 0.3rem 0.6rem;
    border-radius: 999px;
    transition: background-color var(--shda-transition);
}

.shda-filter-chip:hover {
    background-color: var(--shda-info);
    color: #fff;
}

.shda-filter-chip .material-symbols-outlined {
    font-size: 0.9em;
}

/* Sortable column header links: keep the header's own white/uppercase
   look (no blue link color, no underline) and shrink the arrow icon to
   match the header's small font-size instead of the default 1.2em. */
.shda-table-wrap thead th a,
thead th a {
    color: inherit;
}

.shda-table-wrap thead th a .material-symbols-outlined,
thead th a .material-symbols-outlined {
    font-size: 1em;
    vertical-align: -0.15em;
}

/* Calendar toolbar: filters + Today's Sessions panel */
.shda-calendar-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-end;
    margin-bottom: 1rem;
    padding: 0.85rem 1rem;
    background-color: var(--shda-bg);
    border: 1px solid var(--shda-border);
    border-radius: var(--shda-radius-sm);
}

.shda-calendar-toolbar .form-label {
    font-size: 0.72rem;
    margin-bottom: 0.2rem;
    color: var(--shda-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}

.shda-calendar-toolbar select {
    min-width: 160px;
}

.shda-calendar-toolbar select:hover {
    border-color: var(--shda-input-border);
}

.shda-today-panel {
    max-height: 420px;
    overflow-y: auto;
}

.shda-today-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--shda-border);
}

.shda-today-item:last-child {
    border-bottom: none;
}

.shda-today-time {
    font-weight: 700;
    color: var(--shda-navy);
    min-width: 4.5rem;
    font-size: 0.82rem;
}

.shda-today-item .shda-today-student {
    font-weight: 600;
}

.shda-today-item .shda-today-meta {
    font-size: 0.78rem;
    color: var(--shda-text-muted);
}

/* Searchable select combobox (student/instructor/vehicle pickers) */
.shda-searchable-select {
    position: relative;
}

.shda-searchable-native {
    position: absolute !important;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.shda-searchable-options {
    position: absolute;
    z-index: 1065;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 0.15rem;
    max-height: 220px;
    overflow-y: auto;
    background: var(--shda-card-bg);
    border: 1px solid var(--shda-border);
    border-radius: var(--shda-radius-sm);
    box-shadow: var(--shda-shadow);
}

.shda-searchable-option {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.5rem 0.75rem;
    border: none;
    background: none;
    font-size: 0.85rem;
}

.shda-searchable-option:hover {
    background-color: var(--shda-bg);
}

.shda-searchable-empty {
    padding: 0.5rem 0.75rem;
    color: var(--shda-text-muted);
    font-size: 0.82rem;
}

/* Loading / empty / error states over the calendar grid */
.shda-calendar-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 3rem 1rem;
    color: var(--shda-text-muted);
    text-align: center;
}

.shda-calendar-state .material-symbols-outlined {
    font-size: 2rem;
}

.shda-calendar-loading .spinner-border {
    width: 2rem;
    height: 2rem;
    color: var(--shda-amber);
}

@media (max-width: 767.98px) {
    #sessionCalendar .fc-toolbar {
        flex-direction: column;
        gap: 0.6rem;
    }

    #sessionCalendar .fc-toolbar-title {
        font-size: 1.1rem;
    }

    #sessionCalendar .fc-toolbar-chunk {
        display: flex;
        justify-content: center;
        width: 100%;
    }

    #sessionCalendar .fc-button {
        padding: 0.35rem 0.7rem;
        font-size: 0.82rem;
    }

    .shda-calendar-toolbar {
        padding: 0.75rem;
    }

    .shda-calendar-toolbar select {
        min-width: 0;
        width: 100%;
    }

    #sessionCalendar,
    .card:has(#sessionCalendar) {
        overflow-x: hidden;
    }
}

/* ----------------------------------------------------------------------
   Voice-to-text dictation button
   ---------------------------------------------------------------------- */

.shda-voice-status {
    margin-top: 0.3rem;
}

/* Wraps a <textarea> so the mic trigger can float inside its bottom-right
   corner, like a chat message composer. */
.shda-notes-wrap {
    position: relative;
}

.shda-notes-wrap textarea {
    padding-right: 2.75rem;
    padding-bottom: 2.75rem;
}

.shda-voice-btn-floating {
    position: absolute;
    right: 0.6rem;
    bottom: 0.6rem;
    width: 2.15rem;
    height: 2.15rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid var(--shda-border);
    background-color: var(--shda-card-bg);
    color: var(--shda-text-muted);
    box-shadow: var(--shda-shadow-sm);
    transition: background-color var(--shda-transition), color var(--shda-transition);
}

.shda-voice-btn-floating:hover {
    background-color: var(--shda-bg);
    color: var(--shda-text);
}

.shda-voice-btn-floating .material-symbols-outlined {
    font-size: 1.25rem;
}

/* When recording, the pill takes over the full width of the notes field
   instead of sitting as a small corner control. */
.shda-notes-wrap .shda-voice-recorder {
    position: absolute;
    left: 0.5rem;
    right: 0.5rem;
    bottom: 0.5rem;
}

/* Recording pill: cancel (X) — animated waveform — stop — confirm (send) */
.shda-voice-recorder {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--shda-card-bg);
    border: 1px solid var(--shda-border);
    border-radius: 999px;
    padding: 0.3rem 0.4rem;
    box-shadow: var(--shda-shadow-sm);
}

.shda-voice-recorder-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 1.9rem;
    height: 1.9rem;
    border-radius: 50%;
    border: none;
    padding: 0;
    transition: background-color var(--shda-transition), transform var(--shda-transition);
}

.shda-voice-recorder-btn:active {
    transform: scale(0.92);
}

.shda-voice-recorder-btn .material-symbols-outlined {
    font-size: 1.1rem;
    vertical-align: middle;
}

.shda-voice-recorder-cancel {
    background-color: transparent;
    color: var(--shda-text-muted);
}

.shda-voice-recorder-cancel:hover {
    background-color: var(--shda-bg);
    color: var(--shda-text);
}

.shda-voice-recorder-stop {
    background-color: var(--shda-bg);
    color: var(--shda-text);
}

.shda-voice-recorder-stop:hover {
    background-color: var(--shda-border);
}

.shda-voice-recorder-confirm {
    background-color: var(--shda-success);
    color: #ffffff;
}

.shda-voice-recorder-confirm:hover {
    background-color: #187a42;
}

.shda-voice-waveform {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    gap: 3px;
    height: 1.6rem;
    min-width: 0;
    overflow: hidden;
}

.shda-voice-waveform span {
    flex: 0 0 3px;
    width: 3px;
    border-radius: 999px;
    background-color: var(--shda-amber);
    animation: shda-waveform-bounce 1s ease-in-out infinite;
}

@keyframes shda-waveform-bounce {
    0%, 100% { opacity: 0.45; transform: scaleY(0.55); }
    50% { opacity: 1; transform: scaleY(1); }
}

/* ----------------------------------------------------------------------
   Loaders — top navigation progress bar + in-button loading state
   ---------------------------------------------------------------------- */

.shda-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 3px;
    background-color: var(--shda-amber);
    box-shadow: 0 0 8px rgba(245, 166, 35, 0.6);
    z-index: 2000;
    opacity: 0;
    transition: width 0ms;
    pointer-events: none;
}

.shda-progress-bar.is-active {
    opacity: 1;
    width: 80%;
    transition: width 1.2s cubic-bezier(0.1, 0.7, 0.3, 1), opacity 150ms;
}

.btn.is-loading {
    cursor: wait;
}

.btn.is-loading .spinner-border {
    vertical-align: -0.15em;
    margin-right: 0.3rem;
}

/* ----------------------------------------------------------------------
   Print (invoice view)
   ---------------------------------------------------------------------- */

@media print {
    .no-print {
        display: none !important;
    }

    body {
        background-color: #ffffff;
        padding-bottom: 0 !important;
    }

    .shda-invoice-sheet {
        border: none !important;
        box-shadow: none !important;
    }

    .shda-consent-sheet {
        border: none !important;
        box-shadow: none !important;
    }
}

/* ----------------------------------------------------------------------
   Student Consent & Release (DTC205)
   ---------------------------------------------------------------------- */

.shda-consent-version-badge {
    background-color: var(--shda-bg);
    color: var(--shda-text-muted);
    border: 1px solid var(--shda-border);
    font-weight: 500;
    border-radius: 999px;
    padding: 0.25em 0.7em;
    font-size: 0.75rem;
}

.shda-consent-statement {
    margin: 1rem 0 0.75rem;
}

.shda-consent-list {
    margin-bottom: 1.25rem;
}

.shda-consent-subheader {
    margin: 1.5rem -1rem 1rem;
    background-color: var(--shda-bg);
}

.shda-consent-statements {
    padding-left: 1.25rem;
}

.shda-consent-statements li {
    margin-bottom: 0.85rem;
}

.shda-consent-ack {
    background-color: var(--shda-bg);
    border: 1px solid var(--shda-border);
    border-radius: var(--shda-radius-sm);
    padding: 1rem 1.1rem;
    margin-bottom: 1rem;
}

.shda-signature-pad-frame {
    border: 1px dashed var(--shda-input-border);
    border-radius: var(--shda-control-radius);
    background-color: #fdfdfe;
}

.shda-signature-canvas {
    width: 100%;
    height: 180px;
    display: block;
    touch-action: none;
}

.shda-signature-img {
    max-width: 280px;
    max-height: 120px;
    border: 1px solid var(--shda-border);
    border-radius: var(--shda-control-radius);
    background-color: #ffffff;
    display: block;
}

.shda-signature-readonly {
    margin-bottom: 0.5rem;
}

@media (max-width: 575.98px) {
    .shda-signature-canvas {
        height: 220px;
    }
}
