/* */
:root {
    /* Core Light Palette */
    --primary-color: #6c757d;
    /* Lighter neutral gray */
    --secondary-color: #6c757d;

    /* Status Colors */
    --success-color: #008000;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #202f55;

    /* Neutral Colors (light mode) */
    --light-color: #f8f9fa;
    /* surfaces */
    --dark-color: #212529;
    /* text on light */
    --muted-color: #6c757d;
    --white-color: #ffffff;

    /* Border Colors */
    --border-light: #dee2e6;
    --border-primary: var(--primary-color);

    /* Shadows */
    --shadow-light: rgba(0, 0, 0, 0.05);
    --shadow-medium: rgba(0, 0, 0, 0.1);
    --shadow-dark: rgba(0, 0, 0, 0.15);

    /* Text Colors */
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --text-success: var(--success-color);
    --text-danger: var(--danger-color);
    --text-warning: #856404;
    --text-info: var(--info-color);
    --text-muted: var(--muted-color);
    --text-dark: var(--dark-color);
    --text-white: var(--white-color);

    /* Background Colors */
    --bg-primary: #ffffff;
    /* page background */
    --bg-secondary: #ffffff;
    /* cards/surfaces */
    --bg-success: var(--success-color);
    --bg-danger: var(--danger-color);
    --bg-warning: var(--warning-color);
    --bg-info: var(--info-color);
    --bg-light: var(--light-color);
    --bg-dark: #343a40;
    --bg-white: var(--white-color);

    /* Shared */
    --font-family-base: 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --border-radius-sm: 0.375rem;
    --border-radius-md: 0.75rem;
    --transition-speed: 0.2s;
    --accent-primary: var(--primary-color);
    --accent-primary-hover: #5c636a;
    --accent-danger: #dc3545;
    --accent-danger-hover: #bb2d3b;
    --border-color: #dee2e6;
    --shadow-color: rgba(0, 0, 0, 0.08);
    --header-height: 3rem;
    /* Responsive Bottom Nav (Pill + FABs) */
    --fab-size: clamp(3.5rem, 3rem + 1.5vw, 4.5rem);
    /* floating circular fabs */
    --fab-icon-size: clamp(1.35rem, 1.1rem + 0.7vw, 1.85rem);
    --fab-center-icon-scale: 1.09375;
    /* center floating icon larger than button */
    --fab-pill-gap: clamp(0.375rem, 0.25rem + 0.8vw, 0.75rem);
    --fab-pill-padding-y: clamp(0.5rem, 0.6rem + 0.4vw, 0.875rem);
    --fab-pill-padding-x: clamp(0.5rem, 0.4rem + 1vw, 1rem);
    --fab-item-height: clamp(3.25rem, 3.75rem + 1vw, 4.25rem);
    /* buttons inside pill */
    --fab-item-min-width: var(--fab-item-height);
    --fab-pill-border-width: 0.0625rem;
    --fab-pill-offset: clamp(1rem, 0.5rem + 1vw, 1.5rem);
    --fab-text-size: clamp(1rem, 3rem + 0.5vw, 1.25rem);
    /* Total height used for page padding and layout calculations */
    --bottom-pill-height: calc((var(--fab-pill-padding-y) * 2) + var(--fab-item-height) + env(safe-area-inset-bottom, 0px));
}

/* Global Bold Override to Montserrat 600 */
b,
strong,
.fw-bold {
    font-weight: 600 !important;
}

/* Typography utility classes using Plus Jakarta Sans */
.font-logo {
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 20px;
    line-height: 1.1;
    letter-spacing: -0.015em;
    color: #1c1c1e;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.font-headline {
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 22px;
    line-height: 1.2;
    color: #000000;
}

.font-subheadline {
    font-family: 'Montserrat', sans-serif;
    font-weight: 500;
    font-size: 16px;
    color: #6d6d72;
}

.font-plan-title {
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 18px;
    color: #1c1c1e;
}

.font-description {
    font-family: 'Montserrat', sans-serif;
    font-weight: 400;
    font-size: 14px;
    color: #8a8a8e;
}

.font-price {
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 20px;
    color: #1c1c1e;
}

.font-price-strikethrough {
    font-family: 'Montserrat', sans-serif;
    font-weight: 400;
    font-size: 16px;
    color: #ff453a;
    text-decoration: line-through;
}

.font-button {
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 16px;
    color: #ffffff;
}

.font-caption {
    font-family: 'Montserrat', sans-serif;
    font-weight: 500;
    font-size: 12px;
    color: #8a8a8e;
}

/* Dashboard */
.dashboard-page .create-visit-btn {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Make the plus icon larger on the Dashboard's New Visit button */
.dashboard-page .btn.btn-lg .bi-plus {
    font-size: 1rem;
    line-height: 1;

}

/* Keep large sizing but apply card header look to New Visit button */
.dashboard-page .new-visit-btn {
    background-color: var(--bg-white) !important;
    border: var(--bs-border-width, var(--fab-pill-border-width)) solid var(--bs-card-border-color, var(--border-color)) !important;
    color: var(--text-primary) !important;
    border-radius: var(--bs-card-border-radius, var(--border-radius-sm)) !important;
}

.dashboard-page .new-visit-btn:focus,
.dashboard-page .new-visit-btn:hover,
.dashboard-page .new-visit-btn:active {
    background-color: var(--bg-white) !important;
    border-color: var(--bs-card-border-color, var(--border-color)) !important;
    color: var(--text-primary) !important;
}

/* Floating Bottom Console */
/* Floating individual fabs (split mode) */
.fab-fab {
    position: fixed;
    bottom: calc(var(--fab-pill-offset) + var(--bottom-pill-height) + var(--fab-pill-gap));
    width: var(--fab-size);
    height: var(--fab-size);
    border-radius: 50%;
    background-color: #e9ecef;
    border: 0;
    color: #212529;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    z-index: 1050;
}

.fab-fab i {
    font-size: var(--fab-icon-size);
    line-height: 1;
}

.fab-fab:focus {
    box-shadow: none;
}

.fab-fab--left {
    left: calc(50% - (var(--fab-size) * 1.75));
}

.fab-fab--right {
    right: calc(50% - (var(--fab-size) * 1.75));
}

.fab-fab--center {
    left: 50%;
    transform: translateX(-50%)
}

.fab-fab--center i {
    font-size: calc(var(--fab-size) * var(--fab-center-icon-scale));
}

/* Remove old console/fab-btn styles (now split) */

/* Left/Right plain icons */
.fab-icon {
    color: #000000;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.fab-icon:hover,
.fab-icon:active,
.fab-icon:focus {
    color: #000000 !important;
}

.fab-icon i {
    font-size: var(--fab-icon-size);
    line-height: 1;
    color: #000000 !important;
}

.fab-icon:focus {
    box-shadow: none;
}

/* Bottom nav band */
.fab-pill {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    transform: none;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    background: #ffffff;
    border-radius: 0;
    z-index: 1049;
    height: var(--header-height);
    padding: 0 0.5rem env(safe-area-inset-bottom, 0px);
}

.fab-pill {
    padding-top: 0 !important;
}

.fab-pill .fab-left {
    height: 100%;
}

.fab-pill .fab-left .fab-icon {
    width: var(--header-height);
    height: var(--header-height);
}

.fab-pill .fab-icon {
    color: #000000 !important;
}

.fab-pill .fab-icon i,
.fab-pill .fab-icon .bi {
    color: #000000 !important;
}

.fab-pill .fab-icon.is-active {
    color: #000000 !important;
}

.fab-pill .fab-icon.is-active i,
.fab-pill .fab-icon.is-active .bi {
    color: #000000 !important;
}

/* Nudge bottom nav icons up slightly and add a clear active underline */
.fab-pill .fab-left .fab-icon i,
.fab-pill .fab-right .fab-icon i {
    transform: translateY(0);
}

.fab-pill .fab-left .fab-icon,
.fab-pill .fab-right .fab-icon {
    position: relative;
}

.fab-pill .fab-left .fab-icon.is-active::after,
.fab-pill .fab-right .fab-icon.is-active::after {
    content: "";
    position: absolute;
    left: 28%;
    right: 28%;
    bottom: 0.50rem;
    height: 0.0625rem;
    /* 1px */
    background-color: currentColor;
    border-radius: 0.0625rem;
}

/* Subtle outward nudge without breaking centering */
.fab-pill .fab-left .fab-icon {
    transform: translateX(-12px);
}

.fab-pill .fab-right .fab-icon {
    transform: translateX(12px);
}

/* Bottom nav left/right layout adjustments */
.fab-pill {
    justify-content: space-between;
}

.fab-pill .fab-left,
.fab-pill .fab-right {
    flex: 1 1 0;
    display: flex;
    align-items: center;
}

.fab-pill .fab-left {
    justify-content: center;
    padding-left: 0;
}

.fab-pill .fab-right {
    justify-content: center;
    padding-right: 0;
}

/* Ensure right-side icon gets same target size */
.fab-pill .fab-right .fab-icon {
    width: var(--header-height);
    height: var(--header-height);
}

.fab-pill .fab-right .fab-icon i,
.fab-pill .fab-right .fab-icon .bi {
    color: #000000 !important;
}

/* FAB content styling for icon + text layout */
.fab-content {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.fab-pill .fab-text {
    display: inline;
}

.fab-content {
    gap: 0.5rem;
}

.fab-text {
    font-size: var(--fab-text-size);
    font-weight: 300;
    color: inherit;
    margin: 0;
    white-space: nowrap;
}

/* No labels in bottom nav */
.fab-pill .fab-content,
.fab-pill .fab-text {
    display: none !important;
}

/* Center FAB overlapping top border of nav */
.fab-fab--center {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    --fab-center-icon-size: calc(var(--header-height) * 0.6);
    bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px));
    background: #e9ecef;
    z-index: 1050;
    border-radius: 0.625rem;
    width: auto;
    height: calc(var(--header-height) - 0.75rem);
    min-width: 3rem;
    padding: 0 1.5rem;
    box-shadow: 0 2px 0 0 #ced4da;
    border: none;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.fab-fab--center:active {
    transform: translateX(-50%) translateY(1px);
    box-shadow: 0 1px 0 0 #ced4da;
}

.fab-fab--center::before {
    content: none;
}

.fab-fab--center i {
    position: relative;
    z-index: 1;
}

.fab-fab--center i.bi-plus {
    font-size: calc(var(--fab-center-icon-size) * 0.8);
    color: #000 !important;
    filter: none;
    font-weight: 200;
    -webkit-text-stroke: 0;
}

.fab-fab--center:hover i.bi-plus,
.fab-fab--center:active i.bi-plus,
.fab-fab--center.is-active i.bi-plus {
    color: #000 !important;
}

/* Lucide icon styling */
.fab-fab--center i[data-lucide="plus"],
.fab-fab--center i[data-lucide="plus"] svg,
.fab-fab--center svg.lucide {
    width: 18px !important;
    height: 18px !important;
    display: inline-block !important;
    stroke: #000 !important;
    stroke-width: 2.5 !important;
}

/* Dropup menu should open upward from bottom bar */
.fab-pill .dropup .dropdown-menu {
    inset: auto auto var(--fab-item-height) 0 !important;
    box-shadow: none !important;
}

/* Login Page Styles */
.login-page main {
    padding: 0 !important;
    /* Remove default main padding for full height centering */
    height: auto !important;
    min-height: calc(100vh - var(--header-height)) !important;
    /* fallback */
    min-height: calc(100svh - var(--header-height)) !important;
    /* iOS small viewport height */
    min-height: calc(100dvh - var(--header-height)) !important;
    /* dynamic viewport height */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    /* Center along main axis as well */
}

.login-page .main-container {
    height: 100% !important;
    max-width: none !important;
    /* Remove max-width constraint for proper centering */
    width: 100% !important;
}

.login-page .login-content-wrapper {
    height: 100%;
    width: 100%;
}

/* Show header on login page */
.login-page .site-header {
    display: block !important;
}

/* Keep global header offset on login page */
.login-page .page-wrap {
    padding-top: var(--header-height) !important;
}

/* Hide bottom pill nav on login pages */
.login-page .fab-pill {
    display: none !important;
}

.login-page .fab-fab--center {
    display: none !important;
}

/* Hide bottom nav on capture-then-tag draft visit details */
.hide-bottom-nav .fab-pill {
    display: none !important;
}

.hide-bottom-nav .fab-fab--center {
    display: none !important;
}

/* Login form - ensure inputs are under labels on all screen sizes */
.login-page .form-control {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
    display: block !important;
    /* Force block display to ensure inputs go under labels */
}

.login-page .mb-3 {
    display: flex !important;
    flex-direction: column !important;
    /* Stack label above input */
}

@media (max-width: 48rem) {
    .container {
        padding-left: 0.9375rem;
        padding-right: 0.9375rem;
    }

    .btn-lg {
        padding: 0.5rem 1rem;
        font-size: 1rem;
    }

    /* Login */
    .login-page .row,
    .login-page .card,
    .login-page form {
        max-width: 100%;
        width: 100%;
    }

    .login-page .col-md-6,
    .login-page .col-lg-4 {
        width: 100%;
        flex: 0 0 100%;
        max-width: 100%;
        padding: 0 1rem;
    }

    .login-page .card {
        margin: 0;
        width: 100%;
    }

    /* Ensure mobile login centering works accounting for header */
    .login-page main {
        height: auto !important;
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
        min-height: calc(100svh - var(--header-height)) !important;
        min-height: calc(100dvh - var(--header-height)) !important;
    }
}

/* Bootstrap Override Classes */

/* Text Color Overrides */
.text-primary {
    color: var(--text-primary) !important;
}

.text-secondary {
    color: var(--text-secondary) !important;
}

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

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

.text-warning {
    color: var(--text-warning) !important;
}

.text-info {
    color: var(--text-info) !important;
}

.text-muted {
    color: var(--text-muted) !important;
}

.text-dark {
    color: var(--text-dark) !important;
}

.text-white {
    color: var(--text-white) !important;
}

/* Background Color Overrides */
.bg-primary {
    background-color: var(--bg-primary) !important;
}

.bg-secondary {
    background-color: var(--bg-secondary) !important;
}

.bg-success {
    background-color: var(--bg-success) !important;
}

.bg-danger {
    background-color: var(--bg-danger) !important;
}

.bg-warning {
    background-color: var(--bg-warning) !important;
}

.bg-info {
    background-color: var(--bg-info) !important;
}

.bg-light {
    background-color: var(--bg-light) !important;
}

.bg-dark {
    background-color: var(--bg-dark) !important;
}

.bg-white {
    background-color: var(--bg-white) !important;
}

.btn-primary,
.btn-inverted {
    /* keep alias consistent */
    background-color: #e9ecef !important;
    /* light neutral */
    border-color: #ced4da !important;
    /* subtle border */
    color: #212529 !important;
    /* dark text */
}

/* Removed .btn-secondary custom styles as all buttons use primary styling */

.btn-success {
    background-color: var(--bg-success) !important;
    border-color: var(--bg-success) !important;
    color: var(--text-white) !important;
}

.btn-danger {
    background-color: var(--bg-danger) !important;
    border-color: var(--bg-danger) !important;
    color: var(--text-white) !important;
}

/* Unified delete button and X icon styling */
.btn-delete {
    background-color: #e9ecef !important;
    border-color: #ced4da !important;
    color: #212529 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 1.75rem;
    /* match selected circle size */
    height: 1.75rem;
    padding: 0 !important;
    /* remove extra padding that can offset centering */
}

.btn-delete .bi {
    color: #212529 !important;
    display: inline-block;
    line-height: 1;
    vertical-align: middle;
}

/* X icon sizing/weight */
.icon-x {
    font-size: 1.2em;
    /* slightly smaller icon */
    font-weight: 600;
    /* match chevron weight */
    -webkit-text-stroke: 0;
    /* no stroke like chevron */
    line-height: 1;
    display: inline-block;
}

/* Inverted button */
.btn-inverted,
.btn-inverted:visited {
    background-color: #e9ecef !important;
    border-color: #ced4da !important;
    color: #212529 !important;
}

.btn-inverted:disabled,
.btn-inverted.disabled,
.btn-primary:disabled,
.btn-primary.disabled {
    background-color: #e9ecef !important;
    border-color: #ced4da !important;
    color: #adb5bd !important;
    opacity: 0.65;
}

.btn-inverted .bi,
.btn-primary .bi {
    color: #212529 !important;
}

/* Toggleable choice buttons */
.btn-choice {
    background-color: transparent !important;
    border: 0.0625rem solid #ced4da !important;
    color: var(--text-primary) !important;
}

.btn-check:checked+.btn-choice,
.btn-choice.active {
    background-color: var(--bg-light) !important;
    /* keep light surface when selected */
    border-color: var(--accent-primary) !important;
    /* highlight selection */
    color: var(--text-primary) !important;
    /* keep dark text for readability */
}

/* Ensure muted subtext is still visible on selected state */
.btn-check:checked+.btn-choice .text-muted,
.btn-choice.active .text-muted {
    color: var(--muted-color) !important;
}

/* Ensure navbar dropdown overlays content without expanding header */
.site-header {
    overflow: visible !important;
}

.site-header .dropdown-menu {
    position: absolute !important;
    z-index: 2000 !important;
}

/* Stat Cards */
.stat-card {
    --stat-bg: linear-gradient(135deg, #202f55 0%, #3a3a3a 100%);
    position: relative;
    overflow: hidden;
    border: 0 !important;
    background: var(--stat-bg) !important;
    color: #ffffff !important;
}

.stat-card .card-body {
    background: transparent !important;
}

.stat-card small {
    color: rgba(255, 255, 255, 0.85) !important;
}

.stat-card .stat-icon {
    color: rgba(255, 255, 255, 0.95) !important;
    text-shadow: 0 0.375rem 1.5rem rgba(0, 0, 0, 0.25);
}

.stat-card::after {
    content: none;
}

/* Keep stat card text colors consistent when clickable */
a.stat-card,
a.stat-card:hover,
a.stat-card:active,
a.stat-card:focus,
a.stat-card:visited {
    color: #ffffff !important;
}

a.stat-card small,
a.stat-card:hover small,
a.stat-card:active small,
a.stat-card:focus small,
a.stat-card:visited small {
    color: rgba(255, 255, 255, 0.85) !important;
}

.stat-card--primary {
    /* Total Visits */
    --stat-bg: #202f55;
}

.stat-card--warning {
    /* Draft Visits */
    --stat-bg: #5f5f5fd3;
}

.stat-card--success {
    /* Recent Submitted */
    --stat-bg: #008000;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
}

.badge.bg-primary {
    background-color: var(--bg-primary) !important;
}

.badge.bg-secondary {
    background-color: var(--bg-secondary) !important;
}

.badge.bg-success {
    background-color: var(--bg-success) !important;
}

.badge.bg-danger {
    background-color: var(--bg-danger) !important;
}

.badge.bg-warning {
    background-color: var(--bg-warning) !important;
    color: var(--text-dark) !important;
}

.badge.bg-info {
    background-color: var(--bg-info) !important;
    color: var(--text-dark) !important;
}

/* Allow forcing white text on info badges when used with Bootstrap's text-white utility */
.badge.bg-info.text-white {
    color: var(--text-white) !important;
}

/* Alerts */
.alert-success {
    background-color: color-mix(in srgb, var(--success-color) 10%, white) !important;
    border-color: color-mix(in srgb, var(--success-color) 20%, white) !important;
    color: var(--text-success) !important;
}

.alert-warning {
    background-color: color-mix(in srgb, var(--warning-color) 10%, white) !important;
    border-color: color-mix(in srgb, var(--warning-color) 20%, white) !important;
    color: var(--text-warning) !important;
}

.alert-danger {
    background-color: color-mix(in srgb, var(--danger-color) 10%, white) !important;
    border-color: color-mix(in srgb, var(--danger-color) 20%, white) !important;
    color: var(--text-danger) !important;
}

/* Info alerts: dark blue background with white text */
.alert-info {
    background-color: #202f55 !important;
    border-color: #202f55 !important;
    color: #ffffff !important;
    /* Override Bootstrap alert CSS variables to ensure consistent styling */
    --bs-alert-color: #ffffff;
    --bs-alert-bg: #202f55;
    --bs-alert-border-color: #202f55;
    --bs-alert-link-color: #ffffff;
}

.alert-info a {
    color: #ffffff !important;
    text-decoration: underline;
}

.alert-info .btn-close {
    filter: invert(1);
}

.alert-info .fa-circle-exclamation {
    font-size: 1.1rem;
}

/* Borders */

/* Image Dump selection styles */
.staged-thumb {
    transition: box-shadow 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
    aspect-ratio: 1 / 1;
    /* keep square aspect ratio */
    width: 100%;
    position: relative;
    /* already set inline, ensure here as well */
    overflow: hidden;
}

.staged-thumb>img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100% !important;
    /* override inline fixed heights */
    object-fit: cover;
}

@supports not (aspect-ratio: 1 / 1) {
    .staged-thumb {
        height: 0;
        padding-top: 100%;
    }
}

.staged-thumb .selected-badge {
    display: none;
    /* only show when selected */
    width: 1.75rem;
    height: 1.75rem;
    background-color: #fff;
    /* inverted: white fill */
    border: 0.125rem solid #000;
    /* inverted: black circle border */
    border-radius: 62.4375rem;
    padding: 0;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0.0625rem 0.125rem rgba(0, 0, 0, 0.25);
}

.staged-thumb .selected-badge .bi {
    font-size: 1rem;
    /* inverted: black check mark */
    color: #000;
    line-height: 1;
}

.staged-thumb.selected .selected-badge {
    display: inline-flex;
}

/* Image Dump delete button */
.staged-delete {
    /* match primary button look */
    background-color: #e9ecef !important;
    border-color: #ced4da !important;
    color: #212529 !important;
    opacity: 0.95;
}

.staged-delete .bi {
    color: #212529 !important;
}

/* Smooth Collapse Animations */
.smooth-collapse {
    will-change: height;
    backface-visibility: hidden;
}

.smooth-collapse.collapsing {
    transition: height 280ms ease-in-out;
}

@media (prefers-reduced-motion: reduce) {
    .smooth-collapse.collapsing {
        transition: none;
    }
}

/* Tabs */
.nav-tabs .nav-link:not(.active) {
    color: var(--muted-color) !important;
}

/* Visits list: make active tab match page bg; inactive tabs white */
.nav-tabs {
    border-bottom: 0.0625rem solid var(--border-color) !important;
}

.nav-tabs .nav-link {
    background-color: var(--bg-white);
    border: 0.0625rem solid var(--border-color);
    border-top-left-radius: var(--border-radius-sm);
    border-top-right-radius: var(--border-radius-sm);
    margin-bottom: -0.0625rem;
}

.nav-tabs .nav-link.active {
    background-color: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    /* Blend active tab with page background */
    border-color: var(--border-color) var(--border-color) var(--bg-secondary) !important;
}

.nav-tabs .nav-link:focus,
.nav-tabs .nav-link:focus-visible,
.nav-tabs .nav-link:active {
    outline: none !important;
    box-shadow: none !important;
    border-color: var(--border-color) !important;
}

.nav-tabs .nav-link.active:focus,
.nav-tabs .nav-link.active:focus-visible,
.nav-tabs .nav-link.active:active {
    border-color: var(--border-color) var(--border-color) var(--bg-secondary) !important;
}

/* Inactive tabs: remove top and side borders */
.nav-tabs .nav-link:not(.active) {
    border-top: 0 !important;
    border-left: 0 !important;
    border-right: 0 !important;
    border-bottom: 0 !important;
    background-color: transparent !important;
    margin-bottom: 0 !important;
}


/* Modal */
.modal-header,
.modal-footer {
    border: 0 !important;
}

/* Standardize small modal widths across the app */
.sv-modal-dialog.modal-dialog {
    --bs-modal-width: 23.75rem;
    max-width: 90vw;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Reduce modal widths for notes/delete popups across the app */
#stagedNotesModal .modal-dialog,
#deleteModal .modal-dialog {
    --bs-modal-width: 23.75rem;
    max-width: 90vw;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Dark mode only; theme wrapper removed */

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-family-base);
    transition: background-color var(--transition-speed) ease-in-out, color var(--transition-speed) ease-in-out;
}

/* Ensure pages can scroll; scrollbars remain hidden by rules below */
html,
body {
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

main {
    background-color: var(--bg-secondary);
}

/* Ensure content clears the fixed bottom band by default */
.page-wrap main {
    padding-bottom: var(--bottom-pill-height);
}

/* Extra bottom padding on visit detail pages so content clears bottom UI comfortably */
.visit-detail-page main {
    padding-top: 0.5rem !important;
    /* reduce space above title */
    padding-bottom: calc(var(--bottom-pill-height) + 1.5rem) !important;
}

/* Extra bottom padding on account page */
.profile-page main {
    padding-top: 0.5rem !important;
    /* reduce space above title */
    padding-bottom: calc(var(--bottom-pill-height) + 1.5rem) !important;
}

/* Extra bottom padding on visits list page */
.visits-list-page main {
    padding-top: 0.5rem !important;
    /* reduce space above title */
    padding-bottom: calc(var(--bottom-pill-height) + 1.5rem) !important;
}

/* Vertically center content on item form page while allowing scrolling */
.item-form-page {
    overflow-x: hidden;
}

.item-form-page main {
    padding: .5rem .75rem calc(7rem + env(safe-area-inset-bottom)) !important;
    /* a bit more bottom padding */
    height: calc(100dvh - var(--header-height));
    display: flex;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
}

.item-form-page main>.container.main-container {
    flex: 1 1 auto;
    display: flex;
}

/* Allow nested flex containers to shrink so page can scroll */
.item-form-page main>.container.main-container {
    min-height: 0;
}

.item-form-page .viewport-center {
    height: 100%;
    display: flex;
    align-items: stretch;
    justify-content: flex-start;
    padding: 0;
    width: 100%;
    max-width: 90rem;
    /* widen the working area */
    margin-left: auto;
    /* center the viewport horizontally */
    margin-right: auto;
    /* center the viewport horizontally */
}

/* Removed delayed :has() stretch to prevent layout jump on load */

/* Add bottom padding when there are many images to prevent overlap with bottom nav */
.item-form-page .viewport-center:has(.col-6:nth-child(3)) {
    padding-bottom: 0;
    align-items: flex-start;
}

.item-form-page .viewport-center>.row {
    flex: 1 1 auto;
}

.item-form-page .viewport-center>.row>[class^="col-"],
.item-form-page .viewport-center>.row>[class*=" col-"] {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.item-form-page .action-row {
    margin-top: auto;
    padding-bottom: env(safe-area-inset-bottom);
}

.item-form-page .action-row-fixed {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-white);
    padding: .5rem .75rem calc(.5rem + env(safe-area-inset-bottom));
    z-index: 1020;
}

/* Camera flash overlay */
.camera-flash {
    position: absolute;
    inset: 0;
    background: white;
    opacity: 0;
    pointer-events: none;
}

.camera-flash.flash {
    animation: sv-camera-flash 220ms ease-in-out;
}

@keyframes sv-camera-flash {
    0% {
        opacity: 0;
    }

    10% {
        opacity: 0.9;
    }

    100% {
        opacity: 0;
    }
}

/* Fixed camera port size on Add/Edit Issue (item form) */
.item-form-page #cameraBlock {
    flex: 0 0 auto !important;
}

.item-form-page #previewWrap {
    width: 100% !important;
    max-width: 100% !important;
    /* Fixed height that won't change with mobile browser chrome */
    height: 60vh !important;
    /* fallback */
    min-height: 60vh !important;
    /* fallback */
    max-height: 60vh !important;
    /* fallback */
    height: 60svh !important;
    min-height: 60svh !important;
    max-height: 60svh !important;
    flex: 0 0 60vh !important;
    /* fallback */
    flex-basis: 60svh !important;
    /* preferred */
}

.item-form-page #camVideo {
    position: absolute !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    transform: none !important;
    -webkit-transform: none !important;
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    object-fit: cover !important;
    /* fill viewport width/height, crop as needed */
    object-position: center center !important;
    display: block;
}

.item-form-page #captureLayout {
    padding-bottom: calc(2rem + env(safe-area-inset-bottom, 0px)) !important;
    height: auto !important;
    /* prevent full-height container blocking page scroll */
    min-height: 0 !important;
}

/* Extra bottom padding on Add Issue (create) for capture-and-go */
.item-form-create #captureLayout {
    padding-bottom: calc(3.5rem + env(safe-area-inset-bottom, 0px)) !important;
}

/* Hide bottom navbar on add new issue page */
.item-form-page .fab-pill {
    display: none !important;
}

.item-form-page .fab-fab--center {
    display: none !important;
}

.visit-create-page main {
    padding: 2rem .75rem 2rem !important;
    /* balanced padding with room to scroll */
}

.visit-create-page .viewport-center {
    align-items: flex-start !important;
    /* allow scrolling for tall content */
    justify-content: center !important;
    /* horizontal centering on desktop */
}

.item-form-edit .viewport-center {
    align-items: flex-start !important;
    /* allow scrolling for tall content */
}

.visit-create-page .viewport-center>.row {
    flex: 0 1 auto !important;
    /* let content define height so scrolling works */
}

.page-wrap {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    padding-top: var(--header-height);
}

.main-container {
    max-width: 75rem;
}

/* Wider center column allowance on item form page */
.item-form-page .main-container {
    max-width: 90rem;
}

.site-header {
    background-color: var(--bg-white);
    border-bottom: none;
    transition: background-color var(--transition-speed) ease-in-out;
    box-shadow: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1020;
}

.navbar-brand {
    font-weight: 700;
    letter-spacing: -0.0125rem;
    color: var(--text-primary) !important;
}

.navbar .nav-link {
    color: var(--text-secondary);
    font-weight: 500;
    transition: color var(--transition-speed) ease;
}

.navbar .nav-link.active {
    color: var(--accent-primary);
}

.navbar .nav-link[data-bs-toggle="dropdown"],
.navbar .nav-link[data-bs-toggle="dropdown"]:focus {
    color: var(--text-secondary) !important;
    background-color: transparent !important;
}

.navbar .nav-link.dropdown-toggle:focus {
    color: var(--text-secondary);
}

.navbar .dropdown-item:focus {
    color: var(--text-primary);
}


/* Dropdowns */

.dropdown-menu {
    background-color: var(--bg-white);
    border: 0.0625rem solid var(--border-color);
    box-shadow: 0 0.5rem 1rem var(--shadow-color);
    border-radius: var(--border-radius-md);
    padding: .5rem;
}

.dropdown-item {
    color: var(--text-primary);
    font-weight: 500;
    border-radius: var(--border-radius-sm);
}

.dropdown-item i {
    color: var(--text-secondary);
}

.dropdown-item.text-danger {
    color: var(--accent-danger) !important;
}

.btn {
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    transition: all var(--transition-speed) ease;
}

/* Round top corners of table headers to match button border radius */
.table thead.table-light tr:first-child th:first-child {
    border-top-left-radius: var(--border-radius-sm);
}

.table thead.table-light tr:first-child th:last-child {
    border-top-right-radius: var(--border-radius-sm);
}

/* Remove bold from table headers */
.table thead th {
    font-weight: normal;
}

/* Reduce spacing above table section labels on visits list page */
.visits-list-page .table-responsive+.form-label,
.visits-list-page .form-label {
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.btn-primary:active,
.btn-primary.active,
.show>.btn-primary.dropdown-toggle,
.btn-inverted:active,
.btn-inverted.active {
    background-color: #d3d9df !important;
    border-color: #c0c7cd !important;
    color: #212529 !important;
}

.btn-primary:focus,
.btn-inverted:focus {
    box-shadow: 0 0 0 .2rem rgba(108, 117, 125, .15) !important;
}

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



.card-header {
    display: flex;
    align-items: center;
}

.card-header>h1,
.card-header>h2,
.card-header>h3,
.card-header>h4,
.card-header>h5,
.card-header>h6 {
    margin: 0;
}

/* Make card-header titles that previously used font-plan-title match the Images header style */
.card-header .font-plan-title {
    font-family: var(--font-family-base);
    font-weight: 500;
    font-size: 1.25rem;
    line-height: 1.2;
    color: inherit;
}

.card-header.text-center {
    justify-content: center;
}

/* When a subtitle exists, stack vertically and control alignment */
.card-header:has(> .text-muted) {
    flex-direction: column;
    align-items: flex-start;
}

.card-header.text-center:has(> .text-muted) {
    align-items: center;
}

.card-header:has(> .text-muted)>.text-muted {
    margin-top: .25rem;
}

.sv-ribbon {
    transition: transform .35s ease;
    will-change: transform;
    transform: translateY(0);
}

.sv-ribbon.pre-enter {
    transform: translateY(100%);
}

.sv-ribbon.slide-out {
    transform: translateY(100%);
}

@media (prefers-reduced-motion: reduce) {
    .sv-ribbon {
        transition: none;
    }
}

/* Keep pointer cursor on clickable elements */
a[href],
button,
.btn,
[role="button"],
input[type="button"],
input[type="submit"],
.dropdown-item {
    cursor: pointer;
}

.dropdown-item:focus,
.dropdown-item.active,
.dropdown-item:active {
    background-color: transparent !important;
    color: inherit !important;
}

/* Buttons: remove motion/shadow on focus/active only */
.btn:focus,
.btn:active {
    box-shadow: none !important;
    transform: none !important;
}

/* Links: keep color and remove underline on focus */
a:focus {
    color: inherit !important;
    text-decoration: none !important;
}

/* Feedback dropdown button: make icon black */
#feedbackDropdownButton,
#feedbackDropdownButton:hover,
#feedbackDropdownButton:focus,
#feedbackDropdownButton:active,
.show>#feedbackDropdownButton {
    color: #000000 !important;
}

#feedbackDropdownButton i,
#feedbackDropdownButton:hover i,
#feedbackDropdownButton:focus i,
#feedbackDropdownButton:active i {
    color: #000000 !important;
}

/* Override Bootstrap btn-link default color */
.btn.btn-link#feedbackDropdownButton {
    color: #000000 !important;
}

/* Feedback dropdown: make radio selector black when checked */
#feedbackForm .form-check-input:checked {
    background-color: #000 !important;
    border-color: #000 !important;
}

#feedbackForm .form-check-input:focus {
    border-color: #000 !important;
    box-shadow: 0 0 0 .2rem rgba(0, 0, 0, .15) !important;
}

/* Hide scrollbars */
* {
    -ms-overflow-style: none !important;
    /* IE and old Edge */
    scrollbar-width: none !important;
    /* Firefox */
}

*::-webkit-scrollbar {
    width: 0 !important;
    height: 0 !important;
    display: none !important;
    /* Chrome, Safari, newer Edge */
}

/* Dashboard */
.dashboard-page .card .card-header+.card-body {
    padding-top: 0 !important;
}

.dashboard-page .card .card-header+.card-body> :first-child {
    margin-top: 0 !important;
}

.dashboard-page main {
    padding-top: 0.5rem !important;
    /* reduce space above greeting */
    padding-bottom: calc(1rem + var(--bottom-pill-height)) !important;
    /* ensure content clears bottom nav */
}