/* =============================================================================
   RV Park — Design System
   -----------------------------------------------------------------------------
   This file is the single source of truth for design tokens and every shared UI
   primitive (buttons, forms, cards, tables, badges, alerts, modals).

   Page-level `.razor.css` files must NOT redefine these primitives. Blazor scoped
   CSS adds a [b-xxx] attribute, so a page-level copy silently outranks the global
   rule and the same component ends up looking different on every screen. Add
   shared primitives here; keep page files to genuinely page-specific layout, and
   reference the tokens below rather than raw hex.
   ============================================================================= */

:root {
    /* ---- Brand ---------------------------------------------------------- */
    --brand-navy:        #003087;
    --brand-navy-dark:   #002266;
    --brand-navy-light:  #e8f0fb;
    --brand-navy-border: #c5d4ee;
    --brand-gold:        #E8C97A;
    --brand-gold-dark:   #C9A84C;
    /* rgba helpers — use these inside box-shadow / rgba() */
    --brand-navy-rgb:    0, 48, 135;
    --brand-gold-rgb:    232, 201, 122;

    /* ---- Neutral ramp ---------------------------------------------------
       A cool grey ramp that sits under the navy without muddying it. `canvas`
       is the app background; `surface` is every card/table/modal face. */
    --canvas:            #eef1f6;
    --surface:           #ffffff;
    --surface-sunken:    #f7f9fc;
    --border:            #dfe4ec;
    --border-strong:     #c8d0dd;
    --text:              #1f2733;
    --text-muted:        #5b6675;
    --text-subtle:       #7c8798;

    /* ---- Semantic -------------------------------------------------------
       Muted, print-safe status colours. These match the badge palette so a
       status reads the same as a badge, a border, or a bar. */
    --success:           #1f8a5b;
    --success-soft:      #e6f4ed;
    --warning:           #b8791f;
    --warning-soft:      #fbf1e1;
    --danger:            #c0344f;
    --danger-soft:       #fbe9ec;
    --info:              #2b6ca3;
    --info-soft:         #e7f0f8;

    /* ---- Shape & depth --------------------------------------------------- */
    --radius-sm:         4px;
    --radius:            6px;
    --radius-lg:         10px;

    --shadow-sm:         0 1px 2px rgba(16, 26, 45, 0.06);
    --shadow:            0 1px 2px rgba(16, 26, 45, 0.06), 0 2px 6px rgba(16, 26, 45, 0.05);
    --shadow-md:         0 2px 4px rgba(16, 26, 45, 0.07), 0 8px 20px rgba(16, 26, 45, 0.08);
    --shadow-lg:         0 8px 32px rgba(16, 26, 45, 0.16);

    /* ---- Type ------------------------------------------------------------
       System UI stack: matches the host OS, needs no webfont download, and
       renders crisply at the small sizes an operations screen relies on. */
    --font-ui: system-ui, -apple-system, "Segoe UI Variable Text", "Segoe UI",
               Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Consolas,
                 "Liberation Mono", monospace;
}

/* =============================================================================
   Base
   ============================================================================= */

html {
    font-size: 16px;
}

html, body {
    font-family: var(--font-ui);
    background-color: var(--canvas);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Numbers in an operations system are read in columns — money against money,
   meter reading against meter reading. Lining tabular figures keep those
   columns aligned no matter which digits appear. */
table, .table, .stat-value, .stat-number, input[type="number"],
input[type="date"], input[type="time"], input[type="datetime-local"],
.tabular {
    font-variant-numeric: tabular-nums lining-nums;
    font-feature-settings: "tnum" 1, "lnum" 1;
}

a, .btn-link {
    color: #0b5ed7;
    text-decoration: none;
}

a:hover, .btn-link:hover {
    color: var(--brand-navy);
    text-decoration: underline;
}

.content {
    padding-top: 1.1rem;
}

h1:focus {
    outline: none;
}

/* A single visible focus treatment for everything keyboard-reachable. */
:focus-visible {
    outline: 2px solid var(--brand-gold-dark);
    outline-offset: 2px;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus,
.form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.2rem rgba(var(--brand-navy-rgb), 0.18);
}

/* Thin, unobtrusive scrollbars so the internal scroll areas of the app shell
   don't read as browser chrome bolted onto the page. */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background-color: var(--border-strong);
    border-radius: 8px;
    border: 2px solid transparent;
    background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background-color: var(--text-subtle); }

/* =============================================================================
   Typography
   ============================================================================= */

h1, h2, h3, h4, h5, h6 {
    color: var(--brand-navy);
    letter-spacing: -0.01em;
}

h1 { font-size: 1.6rem;  font-weight: 700; }
h2 { font-size: 1.4rem;  font-weight: 700; }
h3 { font-size: 1.25rem; font-weight: 650; }
h4 { font-size: 1.1rem;  font-weight: 600; }
h5 { font-size: 1rem;    font-weight: 600; }
h6 { font-size: 0.9rem;  font-weight: 600; color: var(--brand-navy-dark); }

h5.modal-title { color: inherit; }

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

small, .small { font-size: 0.8125rem; }

/* Eyebrow / section label — small, uppercase, tracked out. */
.section-label {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-subtle);
}

.primary-color {
    color: var(--brand-navy);
}

.secondary-color {
    color: var(--brand-gold);
}

/* =============================================================================
   Page header
   -----------------------------------------------------------------------------
   Every screen opens the same way: title on the left, actions on the right,
   separated from the content by a hairline. Use `.page-header` on the wrapper,
   `.page-title` on the heading, `.page-subtitle` for the optional description
   and `.page-actions` for the button cluster.
   ============================================================================= */

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

/* Standalone, not scoped to `.page-header`: the Reservations screen needs the
   title typography without the bordered header block, because the park layout
   grid below it is sized in fixed px and cannot absorb extra vertical chrome. */
.page-title {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin: 0;
    font-size: 1.3rem;
    font-weight: 650;
    color: var(--brand-navy);
    line-height: 1.25;
}

.page-title .bi {
    color: var(--brand-gold-dark);
    font-size: 1.1rem;
}

.page-subtitle {
    margin: 0.2rem 0 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.page-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Compact variant for the dense, full-height screens that scroll internally. */
.page-header.page-header-tight {
    padding-bottom: 0.5rem;
    margin-bottom: 0.625rem;
}

/* =============================================================================
   Cards
   ============================================================================= */

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

/* No !important here on purpose: pages layer Bootstrap `bg-*` utilities on a
   card header to tint it by severity (warning / danger alerts on the dashboard),
   and those utilities need to win. */
.card-header {
    background-color: var(--surface-sunken);
    border-bottom: 1px solid var(--border);
    padding: 0.625rem 1rem;
    border-radius: var(--radius) var(--radius) 0 0;
}

.card-header h5,
.card-header h6 {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0;
    color: var(--brand-navy);
    font-weight: 600;
}

.card-header h5 { font-size: 0.95rem; }
.card-header h6 { font-size: 0.875rem; }

.card-header .bi { color: var(--brand-gold-dark); }

.card-body { padding: 1rem; }

.card-footer {
    background-color: var(--surface-sunken);
    border-top: 1px solid var(--border);
}

/* Accent rules. A 2px top rule reads as a deliberate section marker; the 3–4px
   slabs used previously made every card shout at the same volume. */
.border-top-primary {
    border-top: 2px solid var(--brand-navy) !important;
}

.card-accent-primary { border-left: 3px solid var(--brand-navy); }
.card-accent-warning { border-left: 3px solid var(--warning); }
.card-accent-danger  { border-left: 3px solid var(--danger); }
.card-accent-success { border-left: 3px solid var(--success); }

.bg-primary-subtle {
    background-color: var(--brand-navy-light) !important;
}

/* =============================================================================
   Buttons
   ============================================================================= */

.btn {
    --bs-btn-border-radius: var(--radius);
    font-weight: 500;
    letter-spacing: 0.005em;
    transition: background-color 0.15s ease, border-color 0.15s ease,
                color 0.15s ease, box-shadow 0.15s ease;
}

.btn .bi { vertical-align: -0.08em; }

.btn-sm { font-size: 0.8125rem; }

.btn-primary {
    color: var(--brand-gold);
    background-color: var(--brand-navy);
    border-color: var(--brand-navy);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--brand-navy-dark);
    border-color: var(--brand-navy-dark);
    color: var(--brand-gold);
}

.btn-primary:focus {
    box-shadow: 0 0 0 0.2rem rgba(var(--brand-navy-rgb), 0.25);
}

.btn-secondary {
    background-color: var(--brand-gold);
    border-color: var(--brand-gold-dark);
    color: #3d2f0c;
}

.btn-secondary:hover,
.btn-secondary:focus {
    background-color: var(--brand-gold-dark);
    border-color: var(--brand-gold-dark);
    color: #2c2208;
}

.btn-secondary:focus {
    box-shadow: 0 0 0 0.2rem rgba(var(--brand-gold-rgb), 0.35);
}

.btn-outline-primary,
.btn-outline-secondary {
    color: var(--brand-navy);
    border-color: var(--border-strong);
    background-color: var(--surface);
}

.btn-outline-primary:hover,
.btn-outline-secondary:hover {
    background-color: var(--brand-navy);
    border-color: var(--brand-navy);
    color: var(--brand-gold);
}

.btn-outline-primary:focus,
.btn-outline-secondary:focus {
    color: var(--brand-navy);
    border-color: var(--brand-navy);
    box-shadow: 0 0 0 0.2rem rgba(var(--brand-navy-rgb), 0.2);
}

.btn-outline-danger {
    color: var(--danger);
    border-color: var(--danger);
}

.btn-outline-danger:hover {
    background-color: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

.btn-danger {
    background-color: var(--danger);
    border-color: var(--danger);
}

.btn-danger:hover, .btn-danger:focus {
    background-color: #a52a42;
    border-color: #a52a42;
}

.btn-success {
    background-color: var(--success);
    border-color: var(--success);
}

.btn-success:hover, .btn-success:focus {
    background-color: #186f49;
    border-color: #186f49;
}

/* Standardized Cancel Button */
.btn-cancel {
    border: 1px solid var(--border-strong);
    color: var(--text-muted);
    background-color: var(--surface);
    font-weight: 500;
    border-radius: var(--radius);
    transition: all 0.15s ease;
}

.btn-cancel:hover {
    background-color: var(--surface-sunken);
    border-color: var(--text-subtle);
    color: var(--text);
}

.btn-cancel:focus {
    box-shadow: 0 0 0 0.2rem rgba(var(--brand-navy-rgb), 0.15);
    border-color: var(--border-strong);
}

.btn-cancel:active {
    background-color: #e9edf3;
    border-color: var(--text-subtle);
    color: var(--text);
}

/* =============================================================================
   Forms
   ============================================================================= */

.form-control,
.form-select {
    border-color: var(--border-strong);
    border-radius: var(--radius);
    color: var(--text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

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

.form-control:hover:not(:focus):not(:disabled),
.form-select:hover:not(:focus):not(:disabled) {
    border-color: var(--text-subtle);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--brand-navy);
    box-shadow: 0 0 0 0.2rem rgba(var(--brand-navy-rgb), 0.15);
}

.form-control:disabled,
.form-control[readonly],
.form-select:disabled {
    background-color: var(--surface-sunken);
    color: var(--text-muted);
}

.form-label {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.8125rem;
    margin-bottom: 0.3rem;
}

.form-check-input {
    border-color: var(--border-strong);
}

.form-check-input:checked {
    background-color: var(--brand-navy);
    border-color: var(--brand-navy);
}

.form-check-input:focus {
    border-color: var(--brand-navy);
    box-shadow: 0 0 0 0.2rem rgba(var(--brand-navy-rgb), 0.15);
}

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.input-group-text {
    background-color: var(--surface-sunken);
    border-color: var(--border-strong);
    color: var(--text-muted);
}

.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* Date / time inputs */
input[type="date"],
input[type="time"],
input[type="datetime-local"] {
    font-weight: 500;
}

input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.55;
}

input[type="date"]:hover::-webkit-calendar-picker-indicator {
    opacity: 0.9;
}

/* Validation */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid var(--success);
}

.invalid {
    outline: 1px solid var(--danger);
}

.validation-message {
    color: var(--danger);
    font-size: 0.8125rem;
}

/* =============================================================================
   Tables
   -----------------------------------------------------------------------------
   Operations screens are read as data grids: quiet header, hairline rows, a
   clear hover target, and no heavy internal gridlines competing with content.
   ============================================================================= */

.table {
    --bs-table-border-color: var(--border);
    color: var(--text);
    margin-bottom: 0;
}

.table > :not(caption) > * > * {
    padding: 0.5rem 0.75rem;
    vertical-align: middle;
}

.table thead th,
.table thead.table-light th {
    background-color: var(--surface-sunken);
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    border-bottom: 1px solid var(--border-strong);
    border-top: none;
}

.table tbody tr {
    border-bottom: 1px solid var(--border);
}

.table-hover > tbody > tr:hover > * {
    background-color: var(--brand-navy-light);
    --bs-table-accent-bg: var(--brand-navy-light);
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
    --bs-table-accent-bg: var(--surface-sunken);
    background-color: var(--surface-sunken);
}

.table-sm > :not(caption) > * > * {
    padding: 0.35rem 0.6rem;
}

/* Header stays put while the body scrolls inside a bounded container. */
.table-sticky thead th {
    position: sticky;
    top: 0;
    z-index: 2;
}

/* =============================================================================
   Badges
   -----------------------------------------------------------------------------
   Reservation-status colours are load-bearing: the same status must read the
   same everywhere. Solid fills, white text, consistent weight.
   ============================================================================= */

.badge {
    padding: 0.32em 0.6em;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    border-radius: var(--radius-sm);
}

.badge-pending,
.badge.bg-warning {
    background-color: #d4a76a !important;
    color: #fff !important;
    font-weight: 600;
}

.badge-confirmed,
.badge.bg-info {
    background-color: #5ba3d0 !important;
    color: #fff !important;
    font-weight: 600;
}

.badge-checked-in,
.badge.bg-success {
    background-color: #52b788 !important;
    color: #fff !important;
    font-weight: 600;
}

.badge-checked-out,
.badge.bg-secondary {
    background-color: #8b7355 !important;
    color: #fff !important;
    font-weight: 600;
}

.badge-cancelled,
.badge.bg-danger {
    background-color: #d04a6f !important;
    color: #fff !important;
    font-weight: 600;
}

/* Neutral "chip" for identifiers (unit numbers, codes) — an identifier is not
   a status, so it should not borrow a status colour. */
.badge-id {
    background-color: var(--brand-navy-light) !important;
    color: var(--brand-navy) !important;
    border: 1px solid var(--brand-navy-border);
    font-variant-numeric: tabular-nums;
}

/* =============================================================================
   Alerts
   ============================================================================= */

.alert {
    border-radius: var(--radius);
    border-width: 1px;
    border-left-width: 3px;
    font-size: 0.9rem;
}

.alert-success {
    background-color: var(--success-soft);
    border-color: #b7ddc9;
    border-left-color: var(--success);
    color: #14603e;
}

.alert-danger {
    background-color: var(--danger-soft);
    border-color: #efc2cb;
    border-left-color: var(--danger);
    color: #8c2438;
}

.alert-info {
    background-color: var(--info-soft);
    border-color: #bcd6ea;
    border-left-color: var(--info);
    color: #1e4e75;
}

.alert-warning {
    background-color: var(--warning-soft);
    border-color: #e8d3ac;
    border-left-color: var(--warning);
    color: #855511;
}

/* =============================================================================
   Modals
   ============================================================================= */

.modal-content {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    background-color: var(--brand-navy);
    color: #fff;
    border-bottom: none;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 0.75rem 1.25rem;
}

.modal-header .modal-title {
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-header .modal-title .bi { color: var(--brand-gold); }

.modal-header .btn-close {
    filter: invert(1) grayscale(100%) brightness(1.8);
    opacity: 0.8;
}

.modal-header .btn-close:hover { opacity: 1; }

.modal-footer {
    background-color: var(--surface-sunken);
    border-top: 1px solid var(--border);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    padding: 0.75rem 1.25rem;
}

/* =============================================================================
   Progress
   ============================================================================= */

.progress {
    background-color: #e3e8f0;
    border-radius: var(--radius-sm);
}

.progress-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 0.75rem;
    transition: width 0.3s ease;
}

/* =============================================================================
   Misc
   ============================================================================= */

.spinner-border {
    color: var(--brand-navy);
}

.blazor-error-boundary {
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Y5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
    border-radius: var(--radius);
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

/* Print: Electric Reading Sheet — markup lives on the Units page but is only
   ever rendered into the popup print window (see js/print.js). */
#electric-print-sheet { display: none; }
