/* AbbyManager app theme — warm, rounded look layered on top of Bootstrap 5. */


:root {
    /* Brand palette — shared across the logo, this app, and the Oakling site */
    --bs-primary: #4a148c;
    --bs-primary-rgb: 74, 20, 140;
    --brand-purple-dark: #2f1c54;
    --brand-purple-soft: #efe6f7;
    --brand-blue: #71badb;
    --brand-blue-soft: #d8ecf8;
    --brand-gold: #f0da8e;
    --brand-gold-soft: #f6e7c8;
    --brand-green: #47a275;
    --brand-green-soft: #dcf0e2;
    --bg-cream: #fbf7f0;
    --card-border: #efe6f5;
    --ink: #2a1f3d;
    --ink-soft: #4d4262;
    --ink-muted: #7a6c90;
    --ink-faint: #9a8fae;

    /* Semantic colours. The light values are the original literals, so light
       mode is unchanged; [data-bs-theme="dark"] below swaps them. */
    --surface: #ffffff;
    --text-grey: #6c757d;
    --disabled-text: #c9c2d6;
    --surface-alt: #f8f4fc;
    --title: var(--brand-purple-dark);
    --accent: var(--bs-primary);
    --nav-bg: var(--bs-primary);
    --primary-hover: var(--brand-purple-dark);
    --input-bg: #fdfbf7;
    --input-border: #e6dcca;
    --track: #ece4d6;
    --ring-track: #efe6f7;
    --ring-arc: #432878;
    --gold-bg: #fff7e6;
    --on-gold: #5c3d05;
    --on-gold-strong: #3d2a05;
    --on-gold-icon: #8a5a00;
    --red-bg: #fdecea;
    --red-border: #f3c6c0;
    --red-soft: #fbe3e0;
    --red-icon: #b0332a;
    --on-red: #6b1d17;
    --on-red-soft: #8a453d;
    --on-red-icon: #8a2a1f;
    --on-blue: #1d4a66;
    --on-green: #1f5c34;
}

body {
    font-family: 'Nunito', 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-cream) !important;
}

.material-symbols-rounded {
    font-family: 'Material Symbols Rounded';
    font-weight: normal;
    font-style: normal;
    line-height: 1;
    vertical-align: middle;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6, .navbar-brand {
    font-weight: 800;
}

.bg-primary { background-color: var(--bs-primary) !important; }
.text-primary { color: var(--accent) !important; }
.border-primary { border-color: var(--bs-primary) !important; }

.btn-primary {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
}
.btn-primary:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
}
.btn-outline-primary {
    color: var(--accent);
    border-color: var(--bs-primary);
}
.btn-outline-primary:hover {
    background-color: var(--bs-primary);
    color: #fff;
}
.btn-check:checked + .btn-outline-primary,
.btn-outline-primary:active,
.btn-outline-primary.active {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
    color: #fff;
}
.btn-check:focus-visible + .btn-outline-primary,
.btn-outline-primary:focus-visible {
    box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.35);
}
.btn {
    border-radius: 0.75rem;
    font-weight: 600;
}
.btn-sm {
    border-radius: 0.6rem;
}

/* Softer, cosier cards */
.card {
    border: 1px solid var(--card-border);
    border-radius: 1rem;
}
.card-header {
    border-radius: 1rem 1rem 0 0 !important;
}
.shadow-sm {
    box-shadow: 0 2px 10px rgba(74, 20, 140, 0.06) !important;
}

.list-group-item.active {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
}

.badge.bg-warning { background-color: var(--brand-gold) !important; color: #6b5310; }
.badge.bg-info { background-color: var(--brand-blue) !important; color: #073a4c; }
.badge.bg-success { background-color: var(--brand-green) !important; }

/* ---------- Top navigation ---------- */
.navbar {
    background-color: var(--nav-bg) !important;
    border-radius: 0;
    border-bottom: 3px solid var(--brand-gold);
    box-shadow: 0 6px 20px rgba(42, 31, 61, 0.22);
    padding-top: 0.85rem;
    padding-bottom: 0.85rem;
}

.navbar-brand-logo {
    height: 60px;
    width: auto;
    display: block;
}

.nav-tiles {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.nav-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    min-width: 4.6rem;
    padding: 0.65rem 0.65rem;
    border-radius: 0.75rem;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    text-align: center;
    position: relative;
    border: none;
    background: transparent;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.nav-tile i {
    font-size: 1.6rem;
    line-height: 1;
    transition: color 0.2s ease;
}

.nav-tile span {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: none;
    white-space: nowrap;
}

.nav-tile:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--brand-gold);
    transform: translateY(-1px);
}

.nav-tile.active {
    background: linear-gradient(135deg, rgba(240, 218, 142, 0.22), rgba(113, 186, 219, 0.14));
    box-shadow: inset 0 0 0 1px rgba(240, 218, 142, 0.45);
    color: var(--brand-gold);
}

.nav-tile.active i,
.nav-tile.active span {
    color: var(--brand-gold) !important;
}

/* Account menu: a tile (it's a <button>) that opens a dropdown. */
.nav-account .nav-tile {
    cursor: pointer;
    font-family: inherit;
}
.nav-account .nav-tile[aria-expanded="true"] {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--brand-gold);
}
.nav-account .dropdown-menu {
    border: 1px solid var(--card-border);
    border-radius: 0.9rem;
    box-shadow: 0 14px 34px -14px rgba(42, 31, 61, 0.45);
    padding: 0.4rem;
    min-width: 13rem;
    margin-top: 0.6rem;
}
.nav-account .dropdown-item {
    border-radius: 0.6rem;
    color: var(--ink);
    font-weight: 600;
    padding: 0.5rem 0.75rem;
}
.nav-account .dropdown-item i {
    width: 1.4rem;
    margin-right: 0.35rem;
    color: var(--accent);
}
.nav-account .dropdown-item:hover,
.nav-account .dropdown-item:focus {
    background-color: var(--brand-purple-soft);
    color: var(--ink);
}
.nav-account .dropdown-item.active,
.nav-account .dropdown-item:active {
    background-color: var(--bs-primary);
    color: #fff;
}
.nav-account .dropdown-item.active i,
.nav-account .dropdown-item:active i {
    color: var(--brand-gold);
}

.nav-tile.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 55%;
    height: 2px;
    border-radius: 2px;
    background: var(--brand-gold);
    box-shadow: 0 0 8px rgba(240, 218, 142, 0.6);
}

/* ---------- Standalone login page ---------- */
.login-body {
    min-height: 100vh;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background: linear-gradient(135deg, var(--bs-primary) 0%, var(--brand-purple-dark) 100%);
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border-radius: 1.25rem;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
    padding: 2.5rem 2.25rem;
}

.login-logo {
    height: 125px;
    width: auto;
}
/* The colour logo's dark purple vanishes on a dark card, so dark mode swaps in
   the white version (logo_w.svg). Done in CSS so there's no flash. */
.logo-for-dark { display: none; }
[data-bs-theme="dark"] .logo-for-light { display: none; }
[data-bs-theme="dark"] .logo-for-dark { display: inline; }

.login-brand-title {
    font-size: 1.7rem;
    font-weight: 800;
    color: var(--accent);
    line-height: 1;
    margin-top: 0.25rem;
}

.login-brand-subtitle {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: var(--text-grey);
}

.login-heading {
    text-align: center;
    font-weight: 800;
    color: var(--accent);
    font-size: 1.15rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--card-border);
}

/* ---------- List + detail section shell (Clients, Sessions, etc.) ---------- */
.ld-shell {
    display: flex;
    align-items: stretch;
    min-height: calc(100vh - 220px);
    background: var(--surface);
    border: 1px solid var(--card-border);
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(74, 20, 140, 0.06);
}

.ld-sidebar {
    width: 340px;
    flex: 0 0 340px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--card-border);
    background: var(--bg-cream);
}

.ld-sidebar-header {
    padding: 1.1rem 1.1rem 0.9rem;
    border-bottom: 1px solid var(--card-border);
}

.ld-sidebar-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.ld-filter-form {
    flex: 1 1 auto;
    min-width: 0;
}

.ld-sort-select {
    width: 100%;
    border: none;
    background: var(--surface);
    color: var(--accent);
    font-size: 0.88rem;
    font-weight: 700;
    border-radius: 0.6rem;
    padding: 0.5rem 0.65rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    cursor: pointer;
}

.ld-search-toggle {
    border: none;
    background: transparent;
    color: var(--accent);
    font-size: 1.05rem;
    padding: 0.3rem 0.45rem;
    border-radius: 0.5rem;
    line-height: 1;
    flex: 0 0 auto;
}
.ld-search-toggle:hover {
    background: var(--brand-purple-soft);
}

.ld-search-box {
    margin-top: 0.75rem;
    position: relative;
}
.ld-search-box .input-group {
    border-radius: 0.7rem;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}
.ld-search-box .input-group-text {
    background: var(--surface);
    border: none;
    color: var(--accent);
    cursor: pointer;
}
.ld-search-box .input-group-text:hover {
    background: var(--brand-purple-soft);
}
.ld-search-box .form-control {
    border: none;
    box-shadow: none;
}

.ld-autocomplete-results {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    background: var(--surface);
    border-radius: 0.7rem;
    box-shadow: 0 10px 28px rgba(47, 28, 84, 0.18);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1050;
    padding: 0.35rem;
}
.ld-autocomplete-results.show {
    display: block;
}
.ld-autocomplete-item {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    padding: 0.55rem 0.7rem;
    border-radius: 0.5rem;
    text-decoration: none;
    color: inherit;
}
.ld-autocomplete-item:hover,
.ld-autocomplete-item.active {
    background: var(--brand-purple-soft);
}
.ld-autocomplete-label {
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--title);
}
.ld-autocomplete-sub {
    font-size: 0.78rem;
    color: var(--text-grey);
}
.ld-autocomplete-empty {
    padding: 0.6rem 0.7rem;
    font-size: 0.85rem;
    color: var(--ink-faint);
}

.ld-items {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 0.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.ld-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 0.65rem 0.85rem;
    border-radius: 0.75rem;
    background: var(--surface);
    border: 1px solid var(--card-border);
    text-decoration: none;
    color: inherit;
    transition: background-color 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}
.ld-item:hover {
    background-color: var(--brand-purple-soft);
    border-color: var(--brand-purple-soft);
    transform: translateX(3px);
    color: inherit;
}
.ld-item.selected {
    background-color: var(--brand-purple-soft);
    border-color: var(--bs-primary);
    box-shadow: inset 3px 0 0 var(--bs-primary);
}
.ld-item-title {
    font-weight: 700;
    color: var(--title);
    font-size: 0.93rem;
    margin-bottom: 0.15rem;
}
.ld-item-sub {
    font-size: 0.78rem;
    color: var(--text-grey);
}
.ld-item-chevron {
    color: var(--brand-gold);
    font-size: 1rem;
    flex: 0 0 auto;
}

.ld-empty-list {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--ink-faint);
    font-size: 0.88rem;
}

.ld-pager {
    padding: 0.65rem;
    border-top: 1px solid var(--card-border);
    display: flex;
    justify-content: center;
}
.ld-pager .pagination { margin-bottom: 0; }
.ld-pager .page-link { color: var(--accent); }
.ld-pager .page-item.active .page-link {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
}
.ld-pager .page-item.disabled .page-link {
    color: var(--disabled-text);
}

.ld-panel {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 1.75rem;
	background: var(--bg-cream);
}

.ld-panel-empty {
    height: 100%;
    min-height: 320px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--ink-faint);
    text-align: center;
    gap: 0.5rem;
}
.ld-panel-empty i { font-size: 2.75rem; color: var(--card-border); }

.ld-back-link {
    display: none;
}

/* On narrow / collapsed nav, go back to a compact icon+label row, pin the bar
   to the top of the viewport so it stays reachable while scrolling, and drop
   the list/detail shell (Clients, Sessions, etc.) to a single stacked column. */
@media (max-width: 991.98px) {
    :root {
        --mobile-navbar-height: 5rem;
    }

    body {
        padding-top: var(--mobile-navbar-height);
    }

    .navbar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1030;
        border-radius: 0;
        margin-bottom: 0 !important;
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }

    #navbarNav.show {
        max-height: calc(100vh - var(--mobile-navbar-height));
        overflow-y: auto;
    }

    .nav-tiles {
        flex-direction: column;
        align-items: stretch;
        gap: 0.15rem;
    }
    .nav-tile {
        flex-direction: row;
        justify-content: flex-start;
        gap: 0.6rem;
        min-width: 0;
    }
    .nav-tile i {
        font-size: 1.15rem;
        width: 1.5rem;
        text-align: center;
    }
    .nav-tile span {
        font-size: 0.8rem;
        text-transform: none;
        letter-spacing: normal;
    }

    /* Account items sit inline in the vertical list instead of in a dropdown. */
    .nav-account > .nav-tile {
        display: none;
    }
    .nav-account .dropdown-menu {
        display: block;
        position: static;
        transform: none;
        background: transparent;
        border: 0;
        box-shadow: none;
        margin: 0;
        padding: 0;
        min-width: 0;
    }
        .nav-account .dropdown-item {
        color: rgba(255, 255, 255, 0.85);
        font-size: 0.8rem;
        padding: 0.65rem;
    }
    .nav-account .dropdown-item i {
        color: inherit;
        font-size: 1.15rem;
        width: 1.5rem;
        text-align: center;
        margin-right: 0.6rem;
    }
    .nav-account .dropdown-item:hover,
    .nav-account .dropdown-item:focus {
        background-color: rgba(255, 255, 255, 0.1);
        color: var(--brand-gold);
    }
    .nav-account .dropdown-item.active {
        background: linear-gradient(135deg, rgba(240, 218, 142, 0.22), rgba(113, 186, 219, 0.14));
        color: var(--brand-gold);
    }
    .nav-account .dropdown-item.active i {
        color: var(--brand-gold);
    }
    .nav-account .dropdown-divider {
        border-color: rgba(255, 255, 255, 0.15);
    }

    .ld-shell {
        flex-direction: column;
        min-height: 0;
    }
    .ld-sidebar {
        width: 100%;
        flex: 1 1 auto;
        border-right: none;
        border-bottom: 1px solid var(--card-border);
    }
    .ld-shell.has-selection .ld-sidebar {
        display: none;
    }
    .ld-shell.has-selection .ld-panel {
        display: block;
    }
    .ld-back-link {
        display: inline-flex;
        align-items: center;
        gap: 0.35rem;
        margin-bottom: 1rem;
        color: var(--accent);
        font-weight: 700;
        text-decoration: none;
    }
}

/* Clickable toggle pill — e.g. the "filter by user" row on the audit log.
   Distinct from .dash-chip, which is a static read-only label. */
.filter-pill {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.3rem 0.8rem;
    border-radius: 999px;
    border: 1.5px solid var(--brand-purple-soft);
    color: var(--accent);
    background: var(--surface);
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.filter-pill:hover {
    background: var(--brand-purple-soft);
    color: var(--accent);
}

/* Practice Files landing page: one clickable "folder" tile per category. */
.folder-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}
.folder-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    padding: 1.5rem 1rem;
    text-align: center;
    text-decoration: none;
    color: var(--ink);
    background: var(--surface);
    border-radius: 1.25rem;
    box-shadow: 0 2px 14px -6px rgba(42, 31, 61, 0.14);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.folder-tile:hover {
    color: var(--ink);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px -8px rgba(42, 31, 61, 0.22);
}
.folder-tile .material-symbols-rounded {
    font-size: 2.75rem;
    color: var(--brand-gold);
}
.folder-tile.folder-tile-all .material-symbols-rounded {
    color: var(--accent);
}
.folder-tile-name {
    font-weight: 700;
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}
.folder-tile-count {
    font-size: 0.78rem;
    color: var(--ink-muted);
    font-weight: 600;
}
.filter-pill.active {
    background: var(--bs-primary);
    border-color: var(--bs-primary);
    color: #fff;
}

/* Small inline tip/info box — e.g. the "changes save automatically" note
   under an autosave form. Reuses the same blue used for .dash-chip-blue /
   .dash-icon-blue elsewhere for consistency. */
.tip-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--brand-blue-soft);
    color: var(--on-blue);
    border-radius: 0.75rem;
    padding: 0.65rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
}
.tip-box .bi, .tip-box .material-symbols-rounded {
    font-size: 1.1rem;
    flex: 0 0 auto;
}

/* Styled confirm()/alert() replacement — see confirm-modal.js. */
.app-confirm-modal {
    border: none;
    border-radius: 1.25rem;
    box-shadow: 0 10px 40px -10px rgba(42, 31, 61, 0.3);
}
.app-confirm-icon .material-symbols-rounded {
    font-size: 2.75rem;
}
.app-confirm-icon.variant-danger .material-symbols-rounded { color: var(--bs-danger); }
.app-confirm-icon.variant-primary .material-symbols-rounded { color: var(--accent); }
.app-confirm-message {
    font-size: 1rem;
    color: var(--ink);
    white-space: pre-line;
}
.app-confirm-modal .btn-danger {
    background-color: var(--bs-danger);
    border-color: var(--bs-danger);
}

/* Small shared utilities replacing repeated inline styles. */
.ms-18 { font-size: 18px; }
.ms-20 { font-size: 20px; }
.text-ink-muted { color: var(--ink-muted); }

/* Inactivity-logout warning: must sit above the navbar (1030), the modal
   backdrop/modals (1050-1055) and toasts (1090), or it's easy to miss. */
.idle-warning {
    z-index: 2000;
    width: max-content;
    max-width: calc(100vw - 2rem);
}

/* Small status pills: session attendance, and enquiries in contact lists. */
.status-pill {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1.5;
    padding: 0.05rem 0.55rem;
    border-radius: 999px;
    vertical-align: middle;
    white-space: nowrap;
}
.status-pill-warn    { background: var(--brand-gold-soft); color: var(--on-gold); }
.status-pill-muted   { background: var(--brand-purple-soft); color: var(--ink-soft); }
.status-pill-enquiry { background: var(--brand-blue-soft); color: var(--on-blue); }
.status-pill-locked   { background: var(--brand-green-soft); color: var(--on-green); }
.status-pill-unlocked { background: var(--brand-gold-soft); color: var(--on-gold); }
.status-pill .bi { font-size: 0.68rem; }

/* ---------- Locked session notes + amendments ---------- */
.locked-notes {
    padding: 0.75rem 1rem;
    border: 1px solid var(--card-border);
    border-radius: 0.75rem;
    background: var(--surface-alt);
    color: var(--ink);
    white-space: normal;
    overflow-wrap: anywhere;
}
.note-lock-banner {
    margin-top: 0.6rem;
    padding: 0.6rem 0.9rem;
    border-radius: 0.75rem;
    background: var(--brand-green-soft);
    color: var(--on-green);
    font-size: 0.85rem;
}
.note-lock-banner.is-mismatch {
    background: var(--red-bg);
    color: var(--on-red);
    border: 1px solid var(--red-border);
}
.note-lock-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.8rem;
}
.note-verify {
    font-weight: 700;
    font-size: 0.8rem;
}
.note-verify-bad { color: var(--on-red); }
.note-lock-details {
    margin-top: 0.35rem;
    font-size: 0.78rem;
}
.note-lock-details summary { cursor: pointer; font-weight: 700; }
.note-lock-details code {
    display: block;
    margin: 0.35rem 0;
    padding: 0.35rem 0.5rem;
    border-radius: 0.4rem;
    background: rgba(0, 0, 0, 0.06);
    color: inherit;
    overflow-wrap: anywhere;
}
.amendments { margin-top: 1.25rem; }
.amendments-title { font-weight: 800; color: var(--title); }
.amendment {
    margin-bottom: 0.6rem;
    padding: 0.65rem 0.9rem;
    border-left: 4px solid var(--accent);
    border-radius: 0 0.6rem 0.6rem 0;
    background: var(--surface-alt);
}
.amendment-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.8rem;
    margin-bottom: 0.25rem;
    font-size: 0.8rem;
    color: var(--ink-muted);
}
.amendment-text { color: var(--ink); overflow-wrap: anywhere; }
.amendment-form { margin-top: 0.9rem; }
.amendment-form label { font-weight: 700; margin-bottom: 0.25rem; }
.ld-filter-chip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.7rem;
    padding: 0.35rem 0.65rem;
    border-radius: 0.6rem;
    background: var(--brand-gold-soft);
    color: var(--on-gold);
    font-size: 0.78rem;
    font-weight: 700;
}
.ld-filter-chip a { margin-left: auto; color: inherit; }


/* ======================================================================
   Dark theme. Switched by <html data-bs-theme="dark"> (see theme-init.js /
   theme-toggle.js; light is the default). Bootstrap's own components follow
   the --bs-* variables below; the app's colours follow the tokens above.
   ====================================================================== */
[data-bs-theme="dark"] {
    --bs-primary: #6b33c4;
    --bs-primary-rgb: 107, 51, 196;
    --bg-cream: #14101f;
    --surface: #1f1730;
    --text-grey: #a99dc0;
    --disabled-text: #5b4f73;
    --surface-alt: #19132a;
    --card-border: #352a4d;
    --ink: #ece6f7;
    --ink-soft: #cdc2e0;
    --ink-muted: #a99dc0;
    --ink-faint: #8a7ea4;
    --title: #e9defb;
    --accent: #c4a5f5;
    --nav-bg: #2f1060;
    --primary-hover: #8452d8;
    --brand-purple-soft: #2e2347;
    --brand-blue-soft: #1c3547;
    --brand-gold-soft: #3e3214;
    --brand-green-soft: #1b3a2b;
    --input-bg: #17112a;
    --input-border: #43355f;
    --track: #3a2f55;
    --ring-track: #3a2d55;
    --ring-arc: #b794f4;
    --gold-bg: #3a2f12;
    --on-gold: #f3e2b0;
    --on-gold-strong: #fff1cf;
    --on-gold-icon: #f0c862;
    --red-bg: #3b1d20;
    --red-border: #6a3036;
    --red-soft: #4a2327;
    --red-icon: #ff9a8f;
    --on-red: #f6c8c3;
    --on-red-soft: #e3a39b;
    --on-red-icon: #ffb4aa;
    --on-blue: #9fd3ef;
    --on-green: #8fd6a8;

    /* Bootstrap components */
    --bs-body-bg: #14101f;
    --bs-body-bg-rgb: 20, 16, 31;
    --bs-body-color: #ece6f7;
    --bs-body-color-rgb: 236, 230, 247;
    --bs-emphasis-color: #ffffff;
    --bs-secondary-color: #a99dc0;
    --bs-tertiary-color: #8a7ea4;
    --bs-secondary-bg: #19132a;
    --bs-tertiary-bg: #19132a;
    --bs-border-color: #352a4d;
    --bs-link-color: #c4a5f5;
    --bs-link-hover-color: #ddc9fa;
    --bs-link-color-rgb: 196, 165, 245;
    --bs-link-hover-color-rgb: 221, 201, 250;
}

[data-bs-theme="dark"] .card,
[data-bs-theme="dark"] .modal-content,
[data-bs-theme="dark"] .dropdown-menu,
[data-bs-theme="dark"] .list-group-item,
[data-bs-theme="dark"] .popover {
    --bs-card-bg: var(--surface);
    --bs-modal-bg: var(--surface);
    --bs-dropdown-bg: var(--surface);
    --bs-dropdown-link-color: var(--ink);
    --bs-list-group-bg: var(--surface);
}

/* Utilities that Bootstrap leaves light in dark mode (.text-dark is left alone:
   it is used on light badges, where it must stay dark) */
[data-bs-theme="dark"] .bg-light { background-color: var(--surface-alt) !important; }
[data-bs-theme="dark"] .badge.bg-light.text-dark { color: var(--ink) !important; }
[data-bs-theme="dark"] .table-light {
    --bs-table-bg: var(--surface-alt);
    --bs-table-color: var(--ink);
    --bs-table-border-color: var(--card-border);
}
[data-bs-theme="dark"] .btn-light {
    --bs-btn-color: var(--ink);
    --bs-btn-bg: var(--surface-alt);
    --bs-btn-border-color: var(--card-border);
    --bs-btn-hover-color: var(--ink);
    --bs-btn-hover-bg: var(--brand-purple-soft);
    --bs-btn-hover-border-color: var(--card-border);
}
[data-bs-theme="dark"] .btn-outline-secondary {
    --bs-btn-color: var(--ink-soft);
    --bs-btn-border-color: var(--ink-faint);
    --bs-btn-hover-color: var(--ink);
    --bs-btn-hover-bg: var(--brand-purple-soft);
    --bs-btn-hover-border-color: var(--ink-faint);
    --bs-btn-active-color: var(--ink);
    --bs-btn-active-bg: var(--brand-purple-soft);
    --bs-btn-active-border-color: var(--ink-faint);
}
[data-bs-theme="dark"] .alert-light {
    background-color: var(--surface-alt);
    border-color: var(--card-border);
    color: var(--ink);
}
[data-bs-theme="dark"] .shadow-sm { box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35) !important; }


/* "Dictate Notes" dialog */
.dictation-steps { padding-left: 1.25rem; margin-bottom: 1rem; }
.dictation-steps li { margin-bottom: 0.4rem; }

/* Tabs / pills use the brand purple, not Bootstrap's default blue. */
.nav-pills .nav-link { color: var(--accent); font-weight: 600; }
.nav-pills .nav-link.active,
.nav-pills .show > .nav-link {
    background-color: var(--bs-primary);
    color: #fff;
}

/* Push-to-talk dictation control */
.dictate-control {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
}
.dictate-control .btn.is-recording {
    border-color: #dc3545;
    color: #dc3545;
}
.dictate-control .btn.is-recording i {
    animation: dictate-pulse 1.1s ease-in-out infinite;
}
@keyframes dictate-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}
@media (prefers-reduced-motion: reduce) {
    .dictate-control .btn.is-recording i { animation: none; }
}

/* Reports landing page: two large tiles. The logo sits on its own white panel
   in both themes, as it is a white-background image. */
.report-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}
.report-tile {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
    padding: 1.5rem;
    text-decoration: none;
    color: var(--ink);
    background: var(--surface);
    border-radius: 1.25rem;
    box-shadow: 0 2px 14px -6px rgba(42, 31, 61, 0.14);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.report-tile:hover {
    color: var(--ink);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px -8px rgba(42, 31, 61, 0.22);
}
.report-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: #fff;
    border-radius: 1rem;
    border: 1px solid var(--input-border);
}
.report-logo img {
    width: auto;
    max-height: 80px;
}
.report-tile-title {
    font-size: 1.35rem;
    font-weight: 800;
    text-align: center;
}
.report-legal {
    font-size: 0.78rem;
    color: var(--ink-muted);
    text-align: center;
    margin: 0.5rem auto 1rem;
    max-width: 720px;
}

/* ---------- Tamper-evident audit log ---------- */
.audit-seal {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-left: 0.6rem;
    padding: 0.2rem 0.65rem;
    font-size: 0.78rem;
    font-weight: 700;
    border-radius: 999px;
    vertical-align: middle;
    cursor: help;
}
.audit-seal-ok   { background: var(--brand-green-soft); color: var(--on-green); }
.audit-seal-bad  { background: var(--red-soft); color: var(--on-red); }
.audit-seal-none { background: var(--brand-purple-soft); color: var(--ink-soft); }
.audit-seal-icon.audit-seal-ok  { background: none; color: var(--on-green); }
.audit-seal-icon.audit-seal-bad { background: none; color: var(--on-red); }
.audit-chain-status {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.85rem 1.1rem;
    margin-bottom: 1rem;
    border-radius: 0.9rem;
    font-size: 0.92rem;
}
.audit-chain-status .bi { font-size: 1.3rem; line-height: 1.2; }
.audit-chain-ok  { background: var(--brand-green-soft); color: var(--on-green); }
.audit-chain-bad { background: var(--red-soft); color: var(--on-red); }

/* ---------- Note templates dialog ---------- */
.template-card {
    padding: 1rem 1.1rem;
    margin-bottom: 0.9rem;
    border: 1px solid var(--card-border);
    border-radius: 0.9rem;
    background: var(--surface-alt);
}
.template-guide dt { font-weight: 700; margin-top: 0.4rem; }
.template-guide dd { margin: 0 0 0.2rem; color: var(--ink-soft); }
.template-example {
    padding: 0.75rem 1rem;
    border: 1px dashed var(--card-border);
    border-radius: 0.75rem;
    background: var(--surface-alt);
    color: var(--ink);
    font-size: 0.92rem;
}
.template-example p { margin: 0 0 0.5rem; }
.template-example p:last-child { margin-bottom: 0; }

.report-group {
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ink-muted);
    margin: 0.5rem 0 0.75rem;
}
.report-icon {
    font-size: 5rem;
    color: var(--brand-green, #3f9d6b);
    line-height: 1;
}
.report-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}
.report-stat {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 1rem 1.15rem;
    border-radius: 1rem;
    background: var(--surface-alt);
    border: 1px solid var(--card-border);
}
.report-stat > span { font-size: 0.8rem; font-weight: 700; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.report-stat strong { font-size: 1.6rem; font-weight: 800; color: var(--ink); }
.report-stat small { color: var(--ink-soft); }
.report-stat-ok   { background: var(--brand-green-soft); border-color: transparent; }
.report-stat-ok strong, .report-stat-ok > span { color: var(--on-green); }
.report-stat-warn { background: var(--brand-gold-soft); border-color: transparent; }
.report-stat-warn strong, .report-stat-warn > span { color: var(--on-gold); }
.report-icon-gold   { color: var(--on-gold-icon, #b07d12); }
.report-icon-blue   { color: var(--on-blue, #1d4f73); }
.report-icon-purple { color: var(--accent); }

/* ---------- Calendar ---------- */
.cal-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}
.cal-nav { display: flex; gap: 0.35rem; }
.cal-title { margin: 0; font-size: 1.25rem; font-weight: 800; flex: 1 1 auto; text-align: center; }
.cal-switch { display: flex; }
.cal-switch .btn:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.cal-switch .btn:last-child  { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: -1px; }
.cal-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.25rem; margin-bottom: 0.9rem; font-size: 0.85rem; }
.cal-legend-item { display: inline-flex; align-items: center; gap: 0.4rem; margin: 0; font-weight: 700; cursor: pointer; }
.cal-legend-note { color: var(--ink-muted); }
.cal-dot { width: 0.7rem; height: 0.7rem; border-radius: 50%; display: inline-block; }
.cal-dot-session { background: var(--on-blue); }
.cal-dot-supervision { background: var(--on-gold-icon, var(--on-gold)); }
.cal-dot-given { background: var(--on-green, #2e7d5b); }

.cal-event {
    display: block;
    padding: 0.1rem 0.4rem;
    margin-top: 0.15rem;
    border-radius: 0.4rem;
    font-size: 0.74rem;
    line-height: 1.35;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cal-event-session     { background: var(--brand-blue-soft); color: var(--on-blue); }
.cal-event-supervision { background: var(--brand-gold-soft); color: var(--on-gold); }
.cal-event-given { background: var(--brand-green-soft, #e3f4ec); color: var(--on-green, #1f6b4a); }
.cal-event:hover, .cal-block:hover { filter: brightness(0.95); text-decoration: none; }
.cal-event.is-missed, .cal-block.is-missed { opacity: 0.6; text-decoration: line-through; }
.cal-time { font-weight: 700; }
.cal-flag { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.03em; text-decoration: none; display: inline-block; }

/* month */
.cal-head, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-head > div { padding: 0.35rem 0.5rem; font-size: 0.75rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-muted); }
.cal-grid { border-top: 1px solid var(--card-border); border-left: 1px solid var(--card-border); }
.cal-day { min-height: 6.5rem; padding: 0.25rem 0.3rem; border-right: 1px solid var(--card-border); border-bottom: 1px solid var(--card-border); min-width: 0; }
.cal-day.is-other { background: var(--surface-alt); }
.cal-day.is-other .cal-daynum { color: var(--ink-muted); }
.cal-day.is-today { background: var(--brand-purple-soft); }
.cal-daynum { border: 0; background: none; padding: 0 0.3rem; font-size: 0.8rem; font-weight: 800; color: var(--ink); border-radius: 0.4rem; cursor: pointer; }
.cal-day.is-today .cal-daynum { background: var(--bs-primary); color: #fff; }
.cal-daynum:hover { background: var(--brand-purple-soft); }
.cal-day.is-today .cal-daynum:hover { background: var(--primary-hover, var(--bs-primary)); }
.cal-more { border: 0; background: none; padding: 0.1rem 0.4rem; font-size: 0.72rem; font-weight: 700; color: var(--accent); cursor: pointer; }

/* week */
.cal-weekwrap { overflow-x: auto; }
.cal-week { min-width: 720px; }
.cal-week-head, .cal-week-untimed, .cal-week-body { display: grid; grid-template-columns: 3.5rem repeat(7, minmax(0, 1fr)); }
.cal-gutter { font-size: 0.7rem; color: var(--ink-muted); font-weight: 700; padding: 0.3rem 0.35rem; }
.cal-week-daylabel { border: 0; background: none; padding: 0.4rem 0.3rem; text-align: center; font-size: 0.8rem; color: var(--ink-soft); border-radius: 0.5rem; cursor: pointer; }
.cal-week-daylabel strong { font-size: 1.05rem; color: var(--ink); }
.cal-week-daylabel.is-today strong { background: var(--bs-primary); color: #fff; border-radius: 999px; padding: 0.05rem 0.5rem; }
.cal-week-daylabel:hover { background: var(--brand-purple-soft); }
.cal-week-untimed { border-top: 1px solid var(--card-border); border-bottom: 1px solid var(--card-border); background: var(--surface-alt); min-height: 2rem; }
.cal-week-cell { padding: 0.15rem 0.2rem 0.3rem; border-left: 1px solid var(--card-border); min-width: 0; }
.cal-hours { padding: 0; }
.cal-hours > div { position: relative; border-top: 1px solid var(--card-border); }
.cal-hours > div:first-child { border-top: 0; }
.cal-hours span { position: absolute; top: -0.5rem; right: 0.35rem; background: var(--surface); padding: 0 0.15rem; font-size: 0.68rem; }
.cal-hours > div:first-child span { top: 0; }
.cal-week-col {
    position: relative;
    border-left: 1px solid var(--card-border);
    background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 47px, var(--card-border) 47px, var(--card-border) 48px);
}
.cal-week-col.is-today { background-color: var(--brand-purple-soft); }
.cal-block {
    position: absolute;
    display: block;
    padding: 0.15rem 0.35rem;
    border-radius: 0.45rem;
    font-size: 0.72rem;
    line-height: 1.3;
    overflow: hidden;
    text-decoration: none;
    border-left: 3px solid currentColor;
}
.cal-block-sub { display: block; opacity: 0.85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 767.98px) {
    .cal-day { min-height: 4.5rem; padding: 0.15rem; }
    .cal-event { font-size: 0.65rem; padding: 0 0.2rem; }
    .cal-event .cal-time { display: none; }
    .cal-title { order: -1; flex-basis: 100%; }
    .cal-legend-note { flex-basis: 100%; }
}

/* ---------- Client retention (deletion date) panel ---------- */
.retention-panel {
    padding: 0.9rem 1.1rem;
    border-radius: 0.9rem;
    border: 1px solid transparent;
    font-size: 0.92rem;
}
.retention-panel.is-ask     { background: var(--brand-gold-soft);   color: var(--on-gold); }
.retention-panel.is-ok      { background: var(--brand-blue-soft);   color: var(--on-blue); }
.retention-panel.is-overdue,
.retention-panel.is-invalid { background: var(--red-soft);         color: var(--on-red); }
.retention-summary { display: flex; gap: 0.6rem; align-items: flex-start; }
.retention-summary .bi { font-size: 1.15rem; line-height: 1.3; }
.retention-assumed { margin: 0.6rem 0 0; display: flex; gap: 0.5rem; }
.retention-how { margin-top: 0.6rem; }
.retention-how summary { cursor: pointer; font-weight: 700; }
.retention-how-body { margin-top: 0.5rem; }
.retention-how-body ul { margin-bottom: 0.6rem; padding-left: 1.2rem; }
.form-control.needs-attention, .form-select.needs-attention {
    border-color: var(--on-gold-icon, #b07d12) !important;
    box-shadow: 0 0 0 0.2rem rgba(214, 160, 40, 0.3);
}

/* "Date of Birth [ ] ignore": the label and a small tickbox on one line. */
.dob-label-row {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    column-gap: 0.75rem;
    margin-bottom: 0.4375rem;
}
.oform-card .dob-label-row > label { margin: 0; } /* beats the form-wide label margin: the row supplies its own */
.dob-ignore { margin: 0; min-height: 0; display: inline-flex; align-items: center; gap: 0.2rem; padding-left: 0; white-space: nowrap; font-size: 0.875rem; font-weight: 700; color: var(--ink-soft); }
.dob-ignore .form-check-input { margin: 0; float: none; }
.oform-card .dob-ignore label {
    display: inline;
    margin: 0;
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
}
