/* ============================================================
   Shared styles - canonical rules for qFIT2, PacklistPRO, MeetUp.
   ONE rule per element type. SINGLE SOURCE OF TRUTH for every
   design token (colors, spacing, typography, shadows, etc.).
   Per-site Content/styles.css should NOT redefine these variables.
   Sizes use rem so the html.font-* preference scales everything.
   ============================================================ */

/* ── CSS Variables - Light Mode (canonical values, used by all 3 sites) ── */
:root {
    /* Brand / accent */
    --color-accent:        #00B0F0;
    --color-accent-dark:   #0090C8;
    --color-accent-deeper: #005a80;
    --color-accent-light:  #e0f6fe;
    --color-primary:       var(--color-accent);
    --color-primary-dark:  var(--color-accent-dark);
    --color-primary-light: #e0f6fe;

    /* Semantic */
    --color-success:          #2e7d32;
    --color-success-bg:       #e8f5e9;
    --color-success-border:   #a5d6a7;
    --color-save-btn:         #32cd32;
    --color-save-btn-hover:   #28a828;
    --color-danger:           #c62828;
    --color-danger-bg:        #ffebee;
    --color-danger-border:    #ef9a9a;
    --color-delete-btn:       #d32f2f;
    --color-delete-btn-hover: #b71c1c;
    --color-warning:          #e65100;
    --color-warning-bg:       #fff3e0;
    --color-warning-border:   #ffcc80;
    --color-info:             #0277bd;
    --color-info-bg:          #e1f5fe;
    --color-info-border:      #81d4fa;

    /* Text */
    --color-text:       #1a1f2e;
    --color-text-muted: #6c757d;
    --color-text-light: #9aa0a8;
    --color-link:       var(--color-accent);
    --color-link-hover: var(--color-accent-dark);

    /* Backgrounds */
    --color-bg:       #f5f7fa;
    --color-bg-card:  #ffffff;
    --color-bg-input: #ffffff;
    --color-bg-nav:   #1a1a2e;

    /* Borders */
    --color-border:       #e0e0e0;
    --color-border-focus: var(--color-accent);

    /* Radii */
    --border-radius:    10px;
    --border-radius-sm: 6px;
    --border-radius-lg: 14px;

    /* Shadows (layered for modern depth) */
    --shadow-sm:          0 1px 2px rgba(15, 23, 42, 0.08), 0 1px 3px rgba(15, 23, 42, 0.10);
    --shadow-md:          0 4px 6px -2px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.10);
    --shadow-lg:          0 12px 24px -8px rgba(15, 23, 42, 0.15), 0 4px 10px -4px rgba(15, 23, 42, 0.12);
    --shadow-xl:          0 20px 40px -12px rgba(15, 23, 42, 0.25);
    --shadow-focus:       0 0 0 3px rgba(0, 176, 240, 0.22);
    --shadow-focus-ring:  0 0 0 3px rgba(0, 176, 240, 0.35);
    --shadow-btn:         0 1px 2px rgba(15, 23, 42, 0.15), 0 1px 3px rgba(15, 23, 42, 0.10);
    --shadow-btn-hover:   0 4px 8px -2px rgba(15, 23, 42, 0.18), 0 2px 4px -2px rgba(15, 23, 42, 0.12);
    --shadow-btn-active:  inset 0 2px 4px rgba(0, 0, 0, 0.10);
    --shadow-card-hover:  0 8px 16px -6px rgba(15, 23, 42, 0.14), 0 4px 8px -4px rgba(15, 23, 42, 0.10);
    --text-shadow-heading: 0 1px 1px rgba(0,0,0,0.10);

    /* Spacing */
    --card-padding:    1rem;
    --card-padding-lg: 1.5rem;
    --section-gap:     1.5rem;

    /* Typography */
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-size-xs:   0.75rem;
    --font-size-sm:   0.875rem;
    --font-size-base: 1.125rem;
    --font-size-lg:   1.125rem;
    --font-size-xl:   1.375rem;
    --font-size-xxl:  1.75rem;
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-bold:   600;
    --line-height: 1.5;

    /* Input sizing */
    --input-height:  2.5rem;
    --input-padding: 0.5rem 0.75rem;

    /* Buttons */
    --btn-padding:     0.5rem 1.25rem;
    --btn-padding-sm:  0.375rem 0.875rem;
    --btn-font-size:   0.9375rem;
    --btn-font-weight: 500;
    --btn-radius:      6px;
    --btn-transition:  background-color 0.15s ease, opacity 0.15s ease, box-shadow 0.15s ease;

    /* Nav structural (nav COLORS still per-site — see note below) */
    --nav-height: 56px;
    --nav-z:      1000;

    /* Transitions / easing */
    --ease-out-quint:  cubic-bezier(0.22, 1, 0.36, 1);
    --ease-out-back:   cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-in-out:     cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: 0.15s var(--ease-out-quint);
    --transition-mid:  0.25s var(--ease-out-quint);
    --transition-slow: 0.4s  var(--ease-out-quint);

    /* Text selection (brand-tinted) */
    --selection-bg:    rgba(0, 176, 240, 0.22);
    --selection-color: var(--color-text);
}

/* ── CSS Variables - Dark Mode Overrides ──────────────────── */
[data-theme="dark"] {
    --color-text:       #e8eaed;
    --color-text-muted: #b1b5bb;
    --color-text-light: #7c8088;

    --color-bg:       #121418;
    --color-bg-card:  #1c1f24;
    --color-bg-input: #25292f;
    --color-bg-nav:   #0d0d0f;

    --color-border:        #3c3c3c;
    --color-primary-light: #082a3d;

    --color-success-bg:     #1b3a1e;
    --color-success-border: #2e7d32;
    --color-danger-bg:      #3b1212;
    --color-danger-border:  #c62828;
    --color-warning-bg:     #3a2a10;
    --color-warning-border: #e65100;
    --color-info-bg:        #082a3d;
    --color-info-border:    #0277bd;

    --shadow-sm:         0 1px 2px rgba(0, 0, 0, 0.35), 0 1px 3px rgba(0, 0, 0, 0.30);
    --shadow-md:         0 4px 8px -2px rgba(0, 0, 0, 0.45), 0 2px 4px -2px rgba(0, 0, 0, 0.30);
    --shadow-lg:         0 12px 24px -8px rgba(0, 0, 0, 0.55), 0 4px 10px -4px rgba(0, 0, 0, 0.40);
    --shadow-xl:         0 20px 40px -12px rgba(0, 0, 0, 0.65);
    --shadow-focus:      0 0 0 3px rgba(0, 176, 240, 0.35);
    --shadow-focus-ring: 0 0 0 3px rgba(0, 176, 240, 0.45);
    --shadow-btn:        0 1px 2px rgba(0, 0, 0, 0.50);
    --shadow-btn-hover:  0 4px 8px -2px rgba(0, 0, 0, 0.55);
    --shadow-card-hover: 0 8px 16px -6px rgba(0, 0, 0, 0.55);

    --selection-bg: rgba(0, 176, 240, 0.45);
}

::selection      { background: var(--selection-bg); color: var(--selection-color); }
::-moz-selection { background: var(--selection-bg); color: var(--selection-color); }

/* ── 1. User font-size preference (scales all rem-based sizes) ── */
html              { font-size: 16px; }   /* default: 1rem = 16px */
html.font-small   { font-size: 14px; }
html.font-medium  { font-size: 16px; }
html.font-large   { font-size: 18px; }

/* ── 2. Document base ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    /* Anchor-link offset so the sticky nav (56px tall) doesn't obscure jump-targets */
    scroll-padding-top: calc(var(--nav-height, 56px) + 0.5rem);
}
body {
    margin: 0;
    padding: 0;
    font-family: var(--font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);
    font-size: var(--font-size-base, 1rem);
    color: var(--color-text, #1a1f2e);
    background-color: var(--color-bg, #f5f7fa);
    line-height: var(--line-height, 1.5);
    -webkit-font-smoothing: antialiased;
    overflow-wrap: break-word;
}

/* Responsive media defaults */
img, svg { max-width: 100%; height: auto; }

/* ── 3. Page title ─────────────────────────────────────────── */
.page-title {
    font-size: var(--font-size-xxl, 1.75rem);
    font-weight: var(--font-weight-bold, 600);
    color: var(--color-text, #1a1f2e);
    margin: 0 0 0.5rem 0;
    line-height: 1.2;
    letter-spacing: -0.01em;
}
.page-title-flush { margin-bottom: 0; }

/* ── 4. Typography ─────────────────────────────────────────── */
.normal-text-bold { font-weight: var(--font-weight-bold, 600); }

.small-dim-text {
    font-size: var(--font-size-sm, 0.875rem);
    color: var(--color-text-muted, #6c757d);
}

/* Same color as normal body text, just smaller. Use for fine-print, captions,
   metadata, etc. where the content is still primary, not a side-note. */
.small-text {
    font-size: var(--font-size-sm, 0.875rem);
    color: var(--color-text, #1a1f2e);
}

.inline-tip {
    display: inline-block;
    font-size: var(--font-size-sm, 0.875rem);
    color: var(--color-info, #0277bd);
    background-color: var(--color-info-bg, #e1f5fe);
    border-left: 3px solid var(--color-info-border, #81d4fa);
    padding: 0.4rem 0.7rem;
    border-radius: var(--border-radius-sm, 4px);
    margin: 0.4rem 0;
}

.note {
    font-size: var(--font-size-sm, 0.875rem);
    color: var(--color-text-muted, #6c757d);
    font-style: italic;
    margin: 0.25rem 0;
}

.input-label {
    display: inline-block;
    font-weight: var(--font-weight-medium, 500);
    color: var(--color-text, #1a1f2e);
    margin-bottom: 0.25rem;
}

.link,
a.link {
    color: var(--color-link, var(--color-primary, #0090C8));
    text-decoration: none;
    font-weight: var(--font-weight-bold, 600);
    cursor: pointer;
    transition: color var(--transition-fast, 0.15s ease);
}
.link:hover,
a.link:hover {
    color: var(--color-link-hover, var(--color-primary-dark, #005a80));
    text-decoration: underline;
}

/* ── 5. Lists - accent-colored bullets/numbers by default ──
   Applies to every <ul> and <ol> on the site. The named classes
   .bullet-list and .numbered-list are optional explicit aliases. */
ul li::marker { color: var(--color-primary, #0090C8); }
ol li::marker { color: var(--color-primary, #0090C8); font-weight: var(--font-weight-bold, 600); }
.bullet-list   { list-style-type: disc; }
.numbered-list { list-style-type: decimal; }

/* ── 6. Cards ──────────────────────────────────────────────── */
.main-card {
    background-color: var(--color-bg-card, #ffffff);
    border: 1px solid var(--color-border, #e0e0e0);
    border-radius: var(--border-radius, 8px);
    padding: var(--card-padding, 1rem);
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm, 0 1px 2px rgba(0,0,0,0.08));
}

.tip-card {
    background-color: var(--color-info-bg, #e1f5fe);
    border: 1px solid var(--color-info-border, #81d4fa);
    border-radius: var(--border-radius, 8px);
    padding: var(--card-padding, 1rem);
    margin-bottom: 1rem;
    position: relative;
    /* Hidden by default so the card doesn't flash on pages where the user
       previously closed it. initTips() adds .tip-visible to show it. */
    display: none;
}
.tip-card.tip-visible { display: block; }

.tip-card-heading {
    font-size: var(--font-size-lg, 1.125rem);
    font-weight: var(--font-weight-bold, 600);
    color: var(--color-text, #1a1f2e);
    margin: 0 1.5rem 0.5rem 0;
    line-height: 1.3;
}

.tip-card-text {
    font-size: var(--font-size-sm, 0.875rem);
    color: var(--color-text, #1a1f2e);
    margin: 0;
    line-height: 1.5;
}

/* ── 7. Form inputs ────────────────────────────────────────── */
.textbox,
.textarea,
.dropdown,
.date-picker,
.file-picker {
    width: 100%;
    max-width: 100%;
    height: var(--input-height, 2.5rem);
    padding: var(--input-padding, 0.5rem 0.75rem);
    font-family: inherit;
    font-size: max(16px, var(--font-size-base, 1rem));  /* 16px floor prevents iOS auto-zoom */
    color: var(--color-text, #1a1f2e);
    background-color: var(--color-bg-input, #ffffff);
    border: 1px solid var(--color-border, #e0e0e0);
    border-radius: var(--border-radius-sm, 6px);
    transition: border-color var(--transition-fast, 0.15s ease),
                box-shadow var(--transition-fast, 0.15s ease);
}
.textarea {
    height: auto;
    min-height: calc(var(--input-height, 2.5rem) * 2.5);
    resize: vertical;
    line-height: 1.5;
}
.textbox:focus,
.textarea:focus,
.dropdown:focus,
.date-picker:focus,
.file-picker:focus {
    outline: none;
    border-color: var(--color-border-focus, var(--color-primary, #0090C8));
    box-shadow: var(--shadow-focus, 0 0 0 3px rgba(0, 176, 240, 0.22));
}

/* Native placeholder text inside textbox/textarea.
   Matches the normal-text size of the host input (inherit, not the lighter
   --font-size-sm default some inputs use) so placeholders read as the same
   weight/size as typed text. Color is mid-gray #808080 per design req. */
input::placeholder,
textarea::placeholder,
.textbox::placeholder,
.textarea::placeholder {
    color: #808080;
    font-size: inherit;
    opacity: 1;  /* Firefox lowers it by default */
}

/* Single source of truth for checkbox styling across all 3 sites.
   appearance:none lets us control the look in both light and dark modes
   (native checkboxes track the OS color-scheme and can render dark even
   when the page is in light mode). White interior with the accent-color
   border, blue fill + white check when checked. */
.checkbox {
    -webkit-appearance: none;
    appearance: none;
    width: 1.125rem;
    height: 1.125rem;
    min-width: 1.125rem;
    border-radius: 3px;
    border: 2px solid var(--color-primary, #0090C8);
    background-color: #fff;
    cursor: pointer;
    vertical-align: middle;
    flex-shrink: 0;
    margin: 0 0.375rem 0 0;
    color-scheme: light;
    background-repeat: no-repeat;
    background-position: center;
    transition: background-color 0.1s;
    box-sizing: border-box;
}
.checkbox:checked {
    background-color: var(--color-primary, #0090C8);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2 6l3 3 5-5' stroke='%23fff' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.checkbox:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.radio-button {
    width: 1.1rem;
    height: 1.1rem;
    vertical-align: middle;
    accent-color: var(--color-primary, #0090C8);
    cursor: pointer;
    margin: 0 0.25rem 0 0;
}

/* ── 8. Buttons ────────────────────────────────────────────── */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    gap: 0.375rem;
    padding: var(--btn-padding, 0.5rem 1.25rem);
    font-family: inherit;
    font-size: var(--btn-font-size, 0.9375rem);
    font-weight: var(--btn-font-weight, 500);
    line-height: 1;
    text-align: center;
    text-decoration: none;
    color: #ffffff;
    background-color: var(--color-primary, #0090C8);
    border: none;
    border-radius: var(--btn-radius, 6px);
    cursor: pointer;
    transition: background-color var(--transition-fast, 0.15s ease),
                color var(--transition-fast, 0.15s ease),
                box-shadow var(--transition-fast, 0.15s ease),
                opacity var(--transition-fast, 0.15s ease);
    white-space: nowrap;
    box-shadow: var(--shadow-btn, 0 1px 2px rgba(0,0,0,0.15));
    min-height: 44px;             /* iOS touch-target accessibility */
    min-width: 44px;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}
.button:hover {
    background-color: var(--color-primary-dark, #005a80);
    color: #ffffff;
    text-decoration: none;
}
.button:focus-visible {
    outline: none;
    box-shadow: var(--shadow-btn, 0 1px 2px rgba(0,0,0,0.15)),
                var(--shadow-focus-ring, 0 0 0 3px rgba(0, 176, 240, 0.35));
}
.button:active {
    opacity: 0.92;
    box-shadow: var(--shadow-btn-active, inset 0 2px 4px rgba(0, 0, 0, 0.10));
}
.button:disabled,
.button[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
}

/* Save (lime green) - .button.save */
.button.save {
    background-color: var(--color-save-btn, #32cd32);
    border-color: var(--color-save-btn, #32cd32);
    color: #ffffff;
}
.button.save:hover {
    background-color: var(--color-save-btn-hover, #28a828);
    border-color: var(--color-save-btn-hover, #28a828);
}

/* Danger (red) - .button.danger - Delete, Clear, Cancel */
.button.danger {
    background-color: var(--color-delete-btn, #d32f2f);
    border-color: var(--color-delete-btn, #d32f2f);
    color: #ffffff;
}
.button.danger:hover {
    background-color: var(--color-delete-btn-hover, #b71c1c);
    border-color: var(--color-delete-btn-hover, #b71c1c);
}

/* Transparent (outline only) - .button.transparent */
.button.transparent {
    background-color: transparent;
    color: var(--color-primary, #0090C8);
    border: 1px solid var(--color-primary, #0090C8);
    box-shadow: none;
}
.button.transparent:hover {
    background-color: var(--color-primary-light, #e0f6fe);
    color: var(--color-primary-dark, #005a80);
    border-color: var(--color-primary-dark, #005a80);
}

/* Warning (orange) - .button.warning - Caution/alert action */
.button.warning {
    background-color: var(--color-warning, #e65100);
    border-color: var(--color-warning, #e65100);
    color: #ffffff;
}
.button.warning:hover {
    background-color: #d97706;
    border-color: #d97706;
}

/* Small modifier - .button.small */
.button.small {
    padding: var(--btn-padding-sm, 0.375rem 0.875rem);
    font-size: 0.875rem;
}

/* Icon-only button (e.g. the ⓘ Tips trigger). */
.tip-icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--color-text-muted, #6c757d);
    padding: 0.3rem 0.45rem;
    line-height: 1;
    border-radius: 999px;
    transition: color var(--transition-fast, 0.15s ease),
                background-color var(--transition-fast, 0.15s ease),
                border-color var(--transition-fast, 0.15s ease);
}
.tip-icon-button:hover {
    color: var(--color-primary, #0090C8);
    background-color: var(--color-primary-light, #e0f6fe);
}
.tip-icon-button:focus-visible {
    outline: none;
    box-shadow: var(--shadow-focus, 0 0 0 3px rgba(0, 176, 240, 0.35));
}
/* Make the (i) glyph itself bold — the U+24D8 ⓘ default weight reads as a
   thin outline at this font-size and gets visually lost in the header row.
   Scoped to [aria-expanded] so only the tip-opener triggers go bold; other
   uses of .tip-icon-button (× close, × file-remove) never set aria-expanded
   and keep their original weight. */
.tip-icon-button[aria-expanded] {
    font-weight: bold;
}

/* The trigger is the way to OPEN the Tips card. Once the card is open the
   trigger is redundant (and the card has its own × close button), so hide
   it; it reappears when the user closes the card and aria-expanded flips
   back to "false". Tips-toggle JS is the only thing that sets aria-expanded
   on .tip-icon-button, so other tip-icon-button uses (file-remove buttons,
   inline closers) which never get aria-expanded are unaffected. */
.tip-icon-button[aria-expanded="true"] {
    display: none;
}

/* ── 9. Pills ──────────────────────────────────────────────── */
.pill {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.85rem;
    font-size: var(--font-size-sm, 0.875rem);
    font-weight: var(--font-weight-medium, 500);
    color: var(--color-text, #1a1f2e);
    background-color: var(--color-bg-card, #ffffff);
    border: 1px solid var(--color-border, #e0e0e0);
    border-radius: 999px;
    cursor: pointer;
    user-select: none;
    text-decoration: none;
    transition: background-color var(--transition-fast, 0.15s ease),
                border-color var(--transition-fast, 0.15s ease),
                color var(--transition-fast, 0.15s ease);
}
.pill:hover, .pill:focus { text-decoration: none; }
.pill:hover { border-color: var(--color-primary, #0090C8); }
.pill.active,
.pill[aria-pressed="true"] {
    background-color: var(--color-primary, #0090C8);
    color: #ffffff;
    border-color: var(--color-primary, #0090C8);
}
.pill.small {
    padding: 0.15rem 0.55rem;
    font-size: var(--font-size-xs, 0.75rem);
}

/* ── 10. Alert / inline message panels ─────────────────────── */
.alert-panel {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.75rem 1rem 0.75rem 0.85rem;
    margin: 0.5rem 0 1rem;
    border: 1px solid transparent;
    border-left-width: 4px;          /* solid accent stripe on the left */
    border-radius: var(--border-radius, 10px);
    font-size: var(--font-size-sm, 0.875rem);
    line-height: 1.45;
}
.alert-panel a {
    color: inherit;
    font-weight: var(--font-weight-medium, 500);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.alert-panel a:hover { text-decoration-thickness: 2px; }
.alert-panel[data-icon]::before {
    content: attr(data-icon);
    flex-shrink: 0;
    font-size: 1.05em;
    line-height: 1.4;
}
.alert-panel.success {
    color: var(--color-success, #2e7d32);
    background-color: var(--color-success-bg, #e8f5e9);
    border-color: var(--color-success-border, #a5d6a7);
    border-left-color: var(--color-success, #2e7d32);
}
.alert-panel.error {
    color: var(--color-danger, #c62828);
    background-color: var(--color-danger-bg, #ffebee);
    border-color: var(--color-danger-border, #ef9a9a);
    border-left-color: var(--color-danger, #c62828);
}
.alert-panel.warning {
    color: var(--color-warning, #e65100);
    background-color: var(--color-warning-bg, #fff3e0);
    border-color: var(--color-warning-border, #ffcc80);
    border-left-color: var(--color-warning, #e65100);
}
.alert-panel.info {
    color: var(--color-info, #0277bd);
    background-color: var(--color-info-bg, #e1f5fe);
    border-color: var(--color-info-border, #81d4fa);
    border-left-color: var(--color-info, #0277bd);
}

/* ── 11. Section headings ─────────────────────────────────── */
.largeheading {
    font-size: var(--font-size-xl, 1.375rem);
    font-weight: 700;
    color: var(--color-text);
    margin: 0 0 0.5rem 0;
    line-height: 1.25;
    letter-spacing: -0.005em;
}
.heading {
    font-size: var(--font-size-lg, 1.125rem);
    font-weight: var(--font-weight-bold, 600);
    color: var(--color-text);
    margin: 0 0 0.4rem 0;
    line-height: 1.3;
}

/* ── 12. Horizontal rule ──────────────────────────────────── */
.hr,
hr.hr {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: var(--section-gap, 1.5rem) 0;
}

/* ── 13. Required-field indicator ─────────────────────────── */
.required-star {
    color: var(--color-danger);
    margin-left: 0.1em;
}

/* ── 14. Loading spinner ──────────────────────────────────── */
.spinner {
    display: inline-block;
    width: 1em;
    height: 1em;
    border: 2px solid rgba(255, 255, 255, 0.28);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.65s linear infinite;
    vertical-align: middle;
    will-change: transform;
}
.spinner-dark {
    border-color: rgba(0, 0, 0, 0.2);
    border-top-color: var(--color-primary);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── 15. Back button ──────────────────────────────────────── */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    text-decoration: none;
    padding: 0.375rem 0.55rem;
    margin-left: -0.55rem;
    min-height: 44px;
    border-radius: var(--border-radius-sm);
    transition: color var(--transition-fast),
                background-color var(--transition-fast);
}
.back-btn:hover {
    color: var(--color-text);
    text-decoration: none;
    background-color: var(--color-primary-light);
}
.back-btn:focus-visible {
    outline: none;
    box-shadow: var(--shadow-focus);
    color: var(--color-text);
}

/* ── 16. Utility classes ──────────────────────────────────── */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}
.text-muted   { color: var(--color-text-muted); }
.text-danger  { color: var(--color-danger); }
.text-success { color: var(--color-success); }
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.text-left    { text-align: left; }
.d-none       { display: none !important; }
.d-flex       { display: flex; }
.d-block      { display: block; }
.flex-wrap    { flex-wrap: wrap; }
.gap-1        { gap: 0.25rem; }
.gap-2        { gap: 0.5rem; }
.gap-3        { gap: 0.75rem; }
.gap-4        { gap: 1rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.w-100 { width: 100%; }
.cursor-pointer { cursor: pointer; }

/* ── 17. Focus visible (accessibility) ────────────────────── */
:focus-visible {
    outline: 3px solid var(--color-border-focus);
    outline-offset: 2px;
}

/* ── 18. Modals ───────────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    -webkit-backdrop-filter: blur(4px) saturate(140%);
    backdrop-filter:         blur(4px) saturate(140%);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: modalFade 0.18s var(--ease-out-quint);
}
.modal-overlay.open { display: flex; }

.modal-box {
    background-color: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-xl);
    max-width: 480px;
    width: 100%;
    padding: 1.5rem;
    position: relative;
    animation: modalPop 0.22s var(--ease-out-back);
}
@keyframes modalFade {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes modalPop {
    from { opacity: 0; transform: translateY(8px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)   scale(1); }
}

.modal-title {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
    margin: 0 0 0.75rem 0;
}

.modal-footer {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.25rem;
    justify-content: flex-end;
    flex-wrap: wrap;
}

/* ── 19. Breadcrumbs ──────────────────────────────────────── */
.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    align-items: center;
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    list-style: none;
    padding: 0;
    margin: 0 0 0.75rem 0;
}
.breadcrumb-item + .breadcrumb-item::before {
    content: "›";
    margin-right: 0.3rem;
    color: var(--color-text-light);
    font-size: 1.05em;
    line-height: 1;
}
.breadcrumb-item a { color: var(--color-link); text-decoration: none; }
.breadcrumb-item a:hover { text-decoration: underline; text-underline-offset: 2px; }
.breadcrumb-item.active { color: var(--color-text); font-weight: var(--font-weight-medium); }

/* ── 20. Tip-card structural helpers ──────────────────────── */
/* Used alongside .tip-card to position the × close button, hold the ⓘ trigger,
   and clear the float. The .tip-card itself is position:relative so .tips-close
   can be absolutely positioned inside. */
.tips-close {
    position: absolute;
    top: 0.5rem;
    right: 0.75rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
    color: var(--color-text-muted);
    line-height: 1;
}
.tips-close:hover { color: var(--color-text); }

/* TipsPanel.ascx renders the Ⓘ trigger BEFORE the page header on most pages.
   A plain float:right left the icon on its own line above the title. Anchor
   the trigger absolutely to the upper-right of <main class="page-wrapper">
   so it always sits in the upper-right corner of the title row. */
main.page-wrapper { position: relative; }
.tips-trigger-wrap {
    float: none;
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 5;
    margin: 0;
}
@media (min-width: 768px) {
    .tips-trigger-wrap { top: 1.5rem; right: 1.5rem; }
}
@media (min-width: 1200px) {
    .tips-trigger-wrap { top: 2rem; right: 1.5rem; }
}
.tips-clear { display: none; }

/* Reserve right-side space so a long page title can't visually overlap the
   absolutely-positioned Ⓘ trigger. Applies to .page-title (single-element
   title) as well as the .page-header pattern used elsewhere. */
.tips-trigger-wrap ~ .page-title,
.tips-trigger-wrap ~ .page-header,
.tips-trigger-wrap ~ * .page-title,
.tips-trigger-wrap ~ * .page-header {
    padding-right: 3rem;
}

/* ── 21. Form layout helpers ──────────────────────────────── */
.form-group {
    margin-bottom: 1rem;
}
.form-group-flush { margin-bottom: 0; }
.form-group .input-label,
.form-group .label { margin-bottom: 0.25rem; }
.form-group .textbox { width: 100%; }
@media (min-width: 768px) {
    .form-group .textbox { max-width: 480px; }
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    column-gap: 1rem;
    row-gap: 0.5rem;
    margin-bottom: 1rem;
}
.form-row .form-group {
    flex: 1 1 100%;
    margin-bottom: 0;
}
@media (min-width: 640px) {
    .form-row .form-group { flex: 1 1 calc(50% - 0.5rem); }
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.25rem;
    align-items: center;
}
.form-actions-centered { justify-content: center; }

/* ── 22. Responsive table wrapper ─────────────────────────── */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ── 23. Banners (full-width strip below the nav) ─────────── */
.banner-demo {
    background-color: var(--color-warning-bg);
    border-bottom: 1px solid var(--color-warning-border);
    color: var(--color-warning);
    padding: 0.55rem 1rem;
    font-size: var(--font-size-sm);
    text-align: center;
    font-weight: var(--font-weight-medium);
}
.banner-demo a {
    font-weight: var(--font-weight-bold);
    text-decoration: underline;
    text-underline-offset: 2px;
}
/* Optional leading icon kept smaller than text so it acts as a quiet marker. */
.banner-demo-icon {
    font-size: 1.05em;
    margin-right: 0.15rem;
    vertical-align: -1px;
}

.banner-offline {
    background-color: var(--color-danger-bg);
    border-bottom: 1px solid var(--color-danger-border);
    color: var(--color-danger);
    padding: 0.55rem 1rem;
    font-size: var(--font-size-sm);
    text-align: center;
    font-weight: var(--font-weight-medium);
    display: none;
    animation: bannerSlideIn 0.22s var(--ease-out-quint);
}
body.offline .banner-offline { display: block; }
@keyframes bannerSlideIn {
    from { transform: translateY(-100%); }
    to   { transform: translateY(0); }
}

/* ── 24. ASP.NET validator / inline field error ───────────── */
/* A small red "!" bullet precedes the message so it reads as an error even on
   calm pages. inline-flex keeps the bullet aligned with the wrapped message. */
.field-validation-error,
.error-message {
    color: var(--color-danger);
    font-size: var(--font-size-sm);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.2rem;
}
.field-validation-error::before,
.error-message::before {
    content: "!";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.05em;
    height: 1.05em;
    flex-shrink: 0;
    background: var(--color-danger);
    color: #ffffff;
    border-radius: 50%;
    font-size: 0.7em;
    font-weight: 700;
    line-height: 1;
}

/* ── Print: page numbering ─────────────────────────────────────────
   Adds "Page X of Y" to the bottom-right of every printed page so a
   multi-page packlist / event detail / fitness report can be reassembled
   if pages get separated. counter(page) and counter(pages) are CSS
   built-ins kept by the print engine. Browsers that don't yet support
   @page margin boxes (older Safari, older Firefox) will silently ignore
   this; the rest of the print layout is unaffected. Users on those
   browsers can still enable the built-in "Headers and footers" option
   in the browser's print dialog as a fallback.

   @top-* boxes are intentionally left empty so the layout doesn't
   conflict with whatever the user has set as the browser's print header.
   Margins are also left untouched here — each site's @media print block
   handles per-page chrome (hiding nav, footer, etc.). */
@page {
    @bottom-right {
        content: "Page " counter(page) " of " counter(pages);
        font-size: 9pt;
        color: #666;
        font-family: var(--font-family, sans-serif);
    }
}
