/* =========================================================================
   Village Tech Hub — Design System
   One accent (Village Tech red), neutral slate system. Light and dark themes;
   dark follows the device setting (see "Dark theme" below).
   Components are namespaced `vt-*` so unconverted legacy pages are unaffected.
   Load this LAST in base.html so tokens + components take precedence where used.
   ========================================================================= */

/* ---- Palette (raw scales; themes map these into semantic tokens) --------- */
:root {
    --red-50:  #fef2f2;
    --red-100: #fee2e2;
    --red-200: #fecaca;
    --red-400: #f87171;
    --red-500: #ef4444;
    --red-600: #d32f2f;   /* Village Tech primary */
    --red-700: #b71c1c;
    --red-800: #991b1b;

    --slate-50:  #f8fafc;
    --slate-100: #f1f5f9;
    --slate-200: #e2e8f0;
    --slate-300: #cbd5e1;
    --slate-400: #94a3b8;
    --slate-500: #64748b;
    --slate-600: #475569;
    --slate-700: #334155;
    --slate-800: #1e293b;
    --slate-900: #0f172a;
    --slate-950: #020617;

    /* Shape + motion (theme-independent) */
    --vt-r-sm: 8px;
    --vt-r-md: 12px;
    --vt-r-lg: 16px;
    --vt-r-pill: 999px;
    --vt-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
    --vt-nav-height: 56px;
}

/* ---- Light theme (default) ---------------------------------------------- */
:root {
    /* The page has its own light AND dark design, so browsers render native
       controls to match and never apply their own forced darkening (Samsung
       Internet, Chrome auto-darken) on top. */
    color-scheme: light dark;

    --vt-bg: #f5f6f8;
    --vt-surface: #ffffff;
    --vt-surface-2: #f6f8fb;
    --vt-surface-3: #eef2f7;
    --vt-border: rgba(15, 23, 42, 0.12);
    --vt-border-strong: rgba(15, 23, 42, 0.22);

    --vt-text: #0f172a;
    --vt-text-muted: #475569;
    --vt-text-subtle: #64748b;
    --vt-text-faint: #94a3b8;
    --vt-text-invert: #ffffff;

    --vt-accent: var(--red-600);
    --vt-accent-hover: var(--red-700);
    --vt-accent-contrast: #ffffff;
    --vt-accent-text: var(--vt-accent);   /* red text/icons; lighter in dark */
    --vt-accent-soft: var(--red-50);
    --vt-accent-soft-border: rgba(211, 47, 47, 0.22);
    --vt-accent-ring: rgba(211, 47, 47, 0.18);

    /* Tones: fill (with white text) / soft chip ground / text on soft or
       surface / pale panel ground / border. */
    --vt-success: #16a34a;  --vt-success-soft: #dcfce7;  --vt-success-text: #166534;
    --vt-warning: #d97706;  --vt-warning-soft: #fef3c7;  --vt-warning-text: #92400e;
    --vt-danger:  #dc2626;  --vt-danger-soft:  #fee2e2;  --vt-danger-text:  #b91c1c;
    --vt-info:    #2563eb;  --vt-info-soft:    #dbeafe;  --vt-info-text:    #1d4ed8;
    --vt-violet:  #8b5cf6;  --vt-violet-soft:  #ede9fe;  --vt-violet-text:  #6d28d9;
    --vt-success-pale: #f0fdf4;  --vt-success-border: #bbf7d0;
    --vt-warning-pale: #fffbeb;  --vt-warning-border: #fde68a;
    --vt-danger-pale:  #fff1f2;  --vt-danger-border:  #fecaca;
    --vt-info-pale:    #f0f9ff;  --vt-info-border:    #bfdbfe;
    --vt-violet-pale:  #faf5ff;  --vt-violet-border:  #ddd6fe;

    --vt-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.08);
    --vt-shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08), 0 2px 4px rgba(15, 23, 42, 0.05);
    --vt-shadow-lg: 0 12px 30px rgba(15, 23, 42, 0.12);

    --vt-watermark-opacity: 0.5;
}

/* ---- Dark theme (follows the device) ------------------------------------
   Same token names, dark values. Fills keep the brand red and the vivid tone
   colours so white-on-colour buttons keep their contrast; text on dark uses the
   lighter *-text tokens. */
@media (prefers-color-scheme: dark) {
    :root {
        --vt-bg: #0b1120;
        --vt-surface: #131c2e;
        --vt-surface-2: #172135;
        --vt-surface-3: #1e293d;
        --vt-border: rgba(148, 163, 184, 0.16);
        --vt-border-strong: rgba(148, 163, 184, 0.3);

        --vt-text: #e5e9f0;
        --vt-text-muted: #a3afc2;
        --vt-text-subtle: #8a96aa;
        --vt-text-faint: #6b7a90;
        --vt-text-invert: #0f172a;

        --vt-accent-text: #f87171;
        --vt-accent-soft: rgba(239, 68, 68, 0.14);
        --vt-accent-soft-border: rgba(248, 113, 113, 0.32);
        --vt-accent-ring: rgba(248, 113, 113, 0.3);

        --vt-success-soft: rgba(34, 197, 94, 0.14);  --vt-success-text: #4ade80;
        --vt-warning-soft: rgba(245, 158, 11, 0.14); --vt-warning-text: #fbbf24;
        --vt-danger-soft:  rgba(239, 68, 68, 0.14);  --vt-danger-text:  #f87171;
        --vt-info-soft:    rgba(59, 130, 246, 0.16); --vt-info-text:    #60a5fa;
        --vt-violet-soft:  rgba(139, 92, 246, 0.16); --vt-violet-text:  #a78bfa;
        --vt-success-pale: rgba(34, 197, 94, 0.07);  --vt-success-border: rgba(74, 222, 128, 0.3);
        --vt-warning-pale: rgba(245, 158, 11, 0.07); --vt-warning-border: rgba(251, 191, 36, 0.3);
        --vt-danger-pale:  rgba(239, 68, 68, 0.07);  --vt-danger-border:  rgba(248, 113, 113, 0.3);
        --vt-info-pale:    rgba(59, 130, 246, 0.08); --vt-info-border:    rgba(96, 165, 250, 0.3);
        --vt-violet-pale:  rgba(139, 92, 246, 0.08); --vt-violet-border:  rgba(167, 139, 250, 0.3);

        --vt-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35), 0 1px 3px rgba(0, 0, 0, 0.25);
        --vt-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4), 0 2px 4px rgba(0, 0, 0, 0.25);
        --vt-shadow-lg: 0 12px 30px rgba(0, 0, 0, 0.5);

        --vt-watermark-opacity: 0;

        /* Legacy stylesheets (style.css, villagetech-theme.css) read these. */
        --text-color: var(--vt-text);
        --text-secondary: var(--vt-text-muted);
        --card-bg: var(--vt-surface);
        --card-border: var(--vt-border);
        --shadow: rgba(0, 0, 0, 0.4);
        --surface: var(--vt-surface);
        --surface-muted: var(--vt-surface-2);
        --field-bg: var(--vt-surface);
        --field-border: var(--vt-border-strong);
        --focus-ring: var(--vt-accent-ring);
    }

    /* The logo artwork has a solid white ground; give it a white tile. */
    .vt-auth__logo { background: #fff; border-radius: 14px; padding: 6px; }

    /* Legacy rules with hard-coded light colours. */
    .btn-outline { border-color: var(--vt-border-strong); }
    .btn-outline:hover { background: var(--vt-surface-3); border-color: var(--vt-border-strong); }
    .back-button:hover { background: var(--vt-surface-3); }

    /* Flash messages (styled with !important in villagetech-theme.css). */
    main.vt-container .vt-alert {
        background: linear-gradient(var(--_tint, transparent), var(--_tint, transparent)), var(--vt-surface) !important;
        border-color: var(--vt-border-strong) !important;
        box-shadow: var(--vt-shadow-lg) !important;
    }
    main.vt-container .vt-alert--success { --_tint: var(--vt-success-soft); color: var(--vt-success-text) !important; }
    main.vt-container .vt-alert--error   { --_tint: var(--vt-danger-soft);  color: var(--vt-danger-text) !important; }
    main.vt-container .vt-alert--warning { --_tint: var(--vt-warning-soft); color: var(--vt-warning-text) !important; }
    main.vt-container .vt-alert--info    { --_tint: var(--vt-info-soft);    color: var(--vt-info-text) !important; }
    main.vt-container .vt-alert__icon { background: rgba(255, 255, 255, 0.06) !important; color: inherit !important; }
    main.vt-container .vt-alert__message { color: var(--vt-text-muted) !important; }
    main.vt-container .vt-alert__close { color: inherit; }
    main.vt-container .vt-alert__close:hover { background: rgba(255, 255, 255, 0.08) !important; }
}

/* Bootstrap's own dark mode (data-bs-theme, set from the device theme by the
   head script in base.html), mapped onto our palette so Bootstrap components
   match the vt-* ones. */
:root[data-bs-theme="dark"] {
    --bs-body-bg: var(--vt-surface);
    --bs-body-bg-rgb: 19, 28, 46;
    --bs-body-color: var(--vt-text);
    --bs-body-color-rgb: 229, 233, 240;
    --bs-emphasis-color: #fff;
    --bs-secondary-color: var(--vt-text-muted);
    --bs-secondary-bg: var(--vt-surface-2);
    --bs-tertiary-bg: var(--vt-surface-3);
    --bs-border-color: var(--vt-border-strong);
    --bs-heading-color: inherit;
}
:root[data-bs-theme="dark"] .btn-outline-dark {
    --bs-btn-color: var(--vt-text);
    --bs-btn-border-color: var(--vt-border-strong);
    --bs-btn-hover-color: var(--vt-text);
    --bs-btn-hover-bg: var(--vt-surface-3);
    --bs-btn-hover-border-color: var(--vt-border-strong);
}

/* =========================================================================
   Page shell (light ground + watermark fade), applied app-wide.
   ========================================================================= */
html { background: var(--vt-bg); }
body {
    background: var(--vt-bg);
    color: var(--vt-text);
    transition: background-color 0.2s var(--vt-ease), color 0.2s var(--vt-ease);
}
body::before { opacity: var(--vt-watermark-opacity); }

/* Keyboard users: visible skip link injected in base.html */
.vt-skip-link {
    position: fixed;
    left: 12px;
    top: -60px;
    z-index: 100000;
    background: var(--vt-accent);
    color: var(--vt-accent-contrast);
    padding: 10px 16px;
    border-radius: var(--vt-r-md);
    font-weight: 700;
    text-decoration: none;
    transition: top 0.15s var(--vt-ease);
}
.vt-skip-link:focus { top: 12px; outline: 2px solid #fff; outline-offset: 2px; }

:where(.vt-scope) :focus-visible,
.vt-focusable:focus-visible {
    outline: 2px solid var(--vt-accent);
    outline-offset: 2px;
}

/* =========================================================================
   Layout
   ========================================================================= */
.vt-scope { color: var(--vt-text); }

.vt-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 1rem 3rem;
    position: relative;
    z-index: 1;
}
.vt-page--narrow { max-width: 820px; }
.vt-page--wide { max-width: 1320px; }

.vt-stack > * + * { margin-top: 1rem; }
.vt-stack-lg > * + * { margin-top: 1.5rem; }

/* ---- Page header --------------------------------------------------------- */
.vt-page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}
.vt-page-head__titles { min-width: 0; }
.vt-page-head__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--vt-accent-text);
    margin-bottom: 0.35rem;
}
.vt-page-head h1 {
    font-size: clamp(1.5rem, 1rem + 1.8vw, 2rem);
    line-height: 1.2;
    letter-spacing: -0.01em;
    color: var(--vt-text);
    margin: 0;
}
.vt-page-head p {
    margin: 0.35rem 0 0;
    color: var(--vt-text-muted);
    font-size: 0.95rem;
}
.vt-page-head__actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* =========================================================================
   Buttons
   ========================================================================= */
.vt-btn {
    --_bg: var(--vt-surface);
    --_fg: var(--vt-text);
    --_bd: var(--vt-border-strong);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0.62rem 1.15rem;
    min-height: 42px;
    border: 1px solid var(--_bd);
    border-radius: var(--vt-r-md);
    background: var(--_bg);
    color: var(--_fg);
    font: 600 0.92rem/1 'Poppins', system-ui, sans-serif;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    transition: transform 0.12s var(--vt-ease), box-shadow 0.15s var(--vt-ease),
                background-color 0.15s var(--vt-ease), border-color 0.15s var(--vt-ease);
}
.vt-btn:hover { transform: translateY(-1px); box-shadow: var(--vt-shadow-sm); }
.vt-btn:active { transform: translateY(0); }
.vt-btn:disabled, .vt-btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }
.vt-btn i { font-size: 0.95em; }

.vt-btn--primary {
    --_bg: var(--vt-accent);
    --_fg: var(--vt-accent-contrast);
    --_bd: transparent;
    box-shadow: 0 4px 12px var(--vt-accent-ring);
}
.vt-btn--primary:hover { --_bg: var(--vt-accent-hover); box-shadow: 0 8px 20px var(--vt-accent-ring); }

.vt-btn--ghost { --_bg: transparent; --_bd: transparent; --_fg: var(--vt-text-muted); }
.vt-btn--ghost:hover { --_bg: var(--vt-surface-3); box-shadow: none; }

.vt-btn--outline { --_bg: transparent; }
.vt-btn--outline:hover { --_bg: var(--vt-surface-2); }

.vt-btn--danger { --_bg: var(--vt-danger); --_fg: #fff; --_bd: transparent; }
.vt-btn--danger:hover { filter: brightness(0.95); }

.vt-btn--sm { min-height: 34px; padding: 0.4rem 0.8rem; font-size: 0.82rem; border-radius: var(--vt-r-sm); }
.vt-btn--lg { min-height: 50px; padding: 0.9rem 1.8rem; font-size: 1.05rem; }
.vt-btn--block { width: 100%; }

/* Single-dash aliases: some pages use `.vt-btn .vt-btn-primary` etc. Map them
   to the same look as the `--` modifiers so every page's buttons match. */
.vt-btn-primary { --_bg: var(--vt-accent); --_fg: var(--vt-accent-contrast); --_bd: transparent; background: var(--vt-accent); color: var(--vt-accent-contrast); border-color: transparent; box-shadow: 0 4px 12px var(--vt-accent-ring); }
.vt-btn-primary:hover { background: var(--vt-accent-hover); }
.vt-btn-outline { background: transparent; }
.vt-btn-outline:hover { background: var(--vt-surface-2); }
.vt-btn-ghost { background: transparent; border-color: transparent; color: var(--vt-text-muted); }
.vt-btn-ghost:hover { background: var(--vt-surface-3); }
.vt-btn-danger { background: var(--vt-danger); color: #fff; border-color: transparent; }
.vt-btn-danger:hover { filter: brightness(0.95); }
.vt-btn-success { background: var(--vt-success); color: #fff; border-color: transparent; }
.vt-btn-sm { min-height: 34px; padding: 0.4rem 0.8rem; font-size: 0.82rem; border-radius: var(--vt-r-sm); }
.vt-btn-lg { min-height: 50px; padding: 0.9rem 1.8rem; font-size: 1.05rem; }
.vt-btn-block { width: 100%; justify-content: center; }

/* =========================================================================
   Card / panel
   ========================================================================= */
.vt-card {
    background: var(--vt-surface);
    border: 1px solid var(--vt-border);
    border-radius: var(--vt-r-lg);
    box-shadow: var(--vt-shadow-sm);
    overflow: hidden;
}
.vt-card--pad { padding: 1.25rem; }
.vt-card--accent-top { position: relative; }
.vt-card--accent-top::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 3px;
    background: linear-gradient(90deg, var(--vt-accent), var(--vt-accent-hover));
}
.vt-card__head {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--vt-border);
}
.vt-card__head h2, .vt-card__head h3 { margin: 0; font-size: 1.02rem; color: var(--vt-text); }
.vt-card__head i { color: var(--vt-accent-text); }
.vt-card__body { padding: 1.25rem; }

/* =========================================================================
   Stat tiles
   ========================================================================= */
.vt-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 1rem;
}
.vt-stat {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 1.1rem 1.2rem;
    background: var(--vt-surface);
    border: 1px solid var(--vt-border);
    border-radius: var(--vt-r-lg);
    box-shadow: var(--vt-shadow-sm);
}
.vt-stat__icon {
    flex: 0 0 auto;
    width: 46px;
    height: 46px;
    border-radius: var(--vt-r-md);
    display: grid;
    place-items: center;
    font-size: 1.25rem;
    background: var(--vt-accent-soft);
    color: var(--vt-accent-text);
    border: 1px solid var(--vt-accent-soft-border);
}
.vt-stat__icon--success { background: var(--vt-success-soft); color: var(--vt-success-text); border-color: transparent; }
.vt-stat__icon--warning { background: var(--vt-warning-soft); color: var(--vt-warning-text); border-color: transparent; }
.vt-stat__icon--info { background: var(--vt-info-soft); color: var(--vt-info-text); border-color: transparent; }
.vt-stat__value { font-size: 1.6rem; font-weight: 800; line-height: 1; color: var(--vt-text); }
.vt-stat__label { font-size: 0.82rem; color: var(--vt-text-muted); margin-top: 0.2rem; }

/* =========================================================================
   Badges / chips (semantic)
   ========================================================================= */
.vt-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0.28rem 0.6rem;
    border-radius: var(--vt-r-pill);
    font-size: 0.74rem;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    background: var(--vt-surface-3);
    color: var(--vt-text-muted);
}
.vt-chip--accent  { background: var(--vt-accent-soft);  color: var(--vt-accent-text); }
.vt-chip--success { background: var(--vt-success-soft); color: var(--vt-success-text); }
.vt-chip--warning { background: var(--vt-warning-soft); color: var(--vt-warning-text); }
.vt-chip--danger  { background: var(--vt-danger-soft);  color: var(--vt-danger-text); }
.vt-chip--info    { background: var(--vt-info-soft);    color: var(--vt-info-text); }

/* Text tinted from a colour picked server-side (e.g. repair status):
   class="vt-tone" style="--tone: #16a34a". In dark mode it is lifted toward
   white so dark shades stay readable on dark grounds. */
.vt-tone { color: var(--tone); }
@media (prefers-color-scheme: dark) {
    .vt-tone { color: color-mix(in srgb, var(--tone) 55%, #fff); }
}

/* Unmissable banner shown on every page when the app is bound to a test
   database (APP_ENV=test), so test data is never mistaken for the live system. */
.vt-testbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 11000;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0.35rem 1rem;
    background: repeating-linear-gradient(45deg, #b45309, #b45309 14px, #92400e 14px, #92400e 28px);
    color: #fff;
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    text-align: center;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.18);
}

/* Small inline "Former" tag shown beside a departed employee's name in history
   (results, Hall of Fame, …). The real name is kept; this only flags them. */
.vt-former-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 6px;
    padding: 0.1rem 0.45rem;
    border-radius: var(--vt-r-pill);
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    background: var(--vt-surface-3);
    color: var(--vt-text-muted);
    border: 1px solid var(--vt-border);
    vertical-align: middle;
    white-space: nowrap;
}

/* =========================================================================
   Toolbar / filter bar
   ========================================================================= */
.vt-toolbar {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 1rem;
}
.vt-toolbar form { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; margin: 0; }
.vt-segmented {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    background: var(--vt-surface-2);
    border: 1px solid var(--vt-border);
    border-radius: var(--vt-r-pill);
}
.vt-segmented a {
    padding: 0.4rem 0.9rem;
    border-radius: var(--vt-r-pill);
    font-size: 0.82rem;
    font-weight: 700;
    text-decoration: none;
    color: var(--vt-text-muted);
}
.vt-segmented a.is-active { background: var(--vt-accent); color: var(--vt-accent-contrast); }

/* =========================================================================
   Form fields
   ========================================================================= */
.vt-field { display: flex; flex-direction: column; gap: 0.4rem; }
.vt-field > label, .vt-field__label {
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--vt-text);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.vt-field .req { color: var(--vt-danger); }
.vt-field input,
.vt-field select,
.vt-field textarea,
.vt-input {
    width: 100%;
    min-height: 46px;
    padding: 0.6rem 0.85rem;
    font-size: 16px; /* prevents iOS zoom */
    font-family: 'Poppins', system-ui, sans-serif;
    color: var(--vt-text);
    background: var(--vt-surface);
    border: 1px solid var(--vt-border-strong);
    border-radius: var(--vt-r-md);
    transition: border-color 0.15s var(--vt-ease), box-shadow 0.15s var(--vt-ease);
}
.vt-field textarea, textarea.vt-input { min-height: 110px; padding-top: 0.7rem; }
.vt-field input::placeholder, .vt-field textarea::placeholder { color: var(--vt-text-subtle); }
.vt-field input:focus,
.vt-field select:focus,
.vt-field textarea:focus,
.vt-input:focus {
    outline: none;
    border-color: var(--vt-accent);
    box-shadow: 0 0 0 3px var(--vt-accent-ring);
}
.vt-field__hint { font-size: 0.8rem; color: var(--vt-text-subtle); }

.vt-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.vt-form-section {
    background: var(--vt-surface);
    border: 1px solid var(--vt-border);
    border-radius: var(--vt-r-lg);
    box-shadow: var(--vt-shadow-sm);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}
.vt-form-section__title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--vt-text);
    margin: 0 0 1rem;
}
.vt-form-section__num {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: var(--vt-r-pill);
    background: var(--vt-accent);
    color: var(--vt-accent-contrast);
    font-size: 0.82rem;
    font-weight: 800;
}
.vt-radio-group { display: grid; gap: 0.5rem; }
.vt-radio {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--vt-border-strong);
    border-radius: var(--vt-r-md);
    background: var(--vt-surface);
    cursor: pointer;
    font-size: 0.9rem;
}
.vt-radio:has(input:checked) { border-color: var(--vt-accent); background: var(--vt-accent-soft); }
.vt-radio input { accent-color: var(--vt-accent); width: 18px; height: 18px; }
.vt-radio small { color: var(--vt-text-subtle); }
.vt-form-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; justify-content: flex-end; margin-top: 0.5rem; }

/* Optional/secondary form section (e.g. back-office-only fields) */
.vt-form-section--muted { border-style: dashed; background: var(--vt-surface-2); }
.vt-note {
    display: flex;
    gap: 6px;
    align-items: flex-start;
    color: var(--vt-text-subtle);
    font-size: 0.8rem;
    font-style: italic;
    margin: 0 0 0.75rem;
}
.vt-conditional[hidden] { display: none; }
.vt-conditional { margin-top: 0.6rem; }

/* =========================================================================
   Data table (+ responsive mobile card grid)
   Add class `vt-table--cards` and give each <td> a data-label to collapse to
   stacked cards on narrow screens.
   ========================================================================= */
.vt-table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--vt-border);
    border-radius: var(--vt-r-lg);
    background: var(--vt-surface);
}
.vt-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.vt-table thead th {
    text-align: left;
    padding: 0.8rem 1rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--vt-text-subtle);
    background: var(--vt-surface-2);
    border-bottom: 1px solid var(--vt-border);
    white-space: nowrap;
}
.vt-table tbody td {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--vt-border);
    color: var(--vt-text);
    vertical-align: middle;
}
.vt-table tbody tr:last-child td { border-bottom: none; }
.vt-table tbody tr.is-clickable { cursor: pointer; transition: background-color 0.12s var(--vt-ease); }
.vt-table tbody tr:hover { background: var(--vt-surface-2); }
.vt-table td strong { color: var(--vt-text); }

@media (max-width: 760px) {
    .vt-table--cards thead { display: none; }
    .vt-table--cards,
    .vt-table--cards tbody { display: grid; gap: 0.75rem; }
    .vt-table--cards tr {
        display: grid;
        gap: 0.35rem;
        background: var(--vt-surface);
        border: 1px solid var(--vt-border);
        border-radius: var(--vt-r-md);
        padding: 0.85rem;
        box-shadow: var(--vt-shadow-sm);
    }
    .vt-table--cards td { display: grid; grid-template-columns: 40% 1fr; gap: 0.5rem; padding: 0.25rem 0; border: none; }
    .vt-table--cards td::before {
        content: attr(data-label);
        font-size: 0.72rem;
        font-weight: 700;
        letter-spacing: 0.02em;
        text-transform: uppercase;
        color: var(--vt-text-subtle);
    }
    .vt-table-wrap { border: none; background: transparent; overflow: visible; }

    /* Two-column form rows stack on phones so fields aren't cramped. */
    .vt-form-row { grid-template-columns: 1fr; }
    /* Page headers: action buttons drop under the title and go full-width-ish. */
    .vt-page-head { align-items: stretch; }
    .vt-page-head__actions { width: 100%; }
    .vt-page-head__actions .vt-btn { flex: 1; }
}

/* =========================================================================
   Dropdown menu
   ========================================================================= */
.vt-menu { position: relative; display: inline-block; }
.vt-menu__panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 230px;
    background: var(--vt-surface);
    border: 1px solid var(--vt-border);
    border-radius: var(--vt-r-md);
    box-shadow: var(--vt-shadow-lg);
    padding: 6px;
    z-index: 2200;
    display: none;
}
.vt-menu__panel.is-open { display: block; }
.vt-menu__panel a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0.6rem 0.7rem;
    border-radius: var(--vt-r-sm);
    text-decoration: none;
    color: var(--vt-text);
    font-size: 0.9rem;
    font-weight: 600;
}
.vt-menu__panel a:hover { background: var(--vt-surface-2); }

/* =========================================================================
   Empty state
   ========================================================================= */
.vt-empty { text-align: center; padding: 3rem 1.5rem; color: var(--vt-text-muted); }
.vt-empty > i { font-size: 2.6rem; color: var(--vt-accent-text); opacity: 0.5; margin-bottom: 0.6rem; }
.vt-empty h3 { margin: 0 0 0.35rem; color: var(--vt-text); font-size: 1.1rem; }
.vt-empty p { margin: 0; font-size: 0.92rem; }

/* =========================================================================
   Auth pages (login / admin login)
   ========================================================================= */
.vt-auth {
    min-height: calc(100vh - var(--vt-nav-height) - 24px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}
.vt-auth__card {
    width: min(440px, 100%);
    background: var(--vt-surface);
    border: 1px solid var(--vt-border);
    border-radius: var(--vt-r-lg);
    box-shadow: var(--vt-shadow-lg);
    padding: 2rem;
}
.vt-auth__logo { display: block; width: 72px; height: auto; margin: 0 auto 1rem; }
.vt-auth__title { text-align: center; margin: 0 0 0.25rem; font-size: 1.4rem; color: var(--vt-text); }
.vt-auth__sub { text-align: center; margin: 0 0 1.5rem; color: var(--vt-text-muted); font-size: 0.9rem; }
.vt-auth__footer { text-align: center; margin-top: 1.25rem; font-size: 0.88rem; color: var(--vt-text-muted); }
.vt-auth__footer a { color: var(--vt-accent-text); font-weight: 700; text-decoration: none; }

/* Input with a trailing control (e.g. password show/hide) */
.vt-input-affix { position: relative; display: flex; align-items: center; }
.vt-input-affix .vt-input { padding-right: 46px; }
.vt-input-affix__btn {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    background: none; border: none; cursor: pointer;
    color: var(--vt-text-subtle); padding: 8px; border-radius: var(--vt-r-sm);
}
.vt-input-affix__btn:hover { color: var(--vt-text); }

/* =========================================================================
   Modal (JS toggles inline display:flex/none) + icon button
   ========================================================================= */
.vt-modal { position: fixed; inset: 0; background: rgba(2, 6, 23, 0.55); z-index: 10050; display: none; align-items: center; justify-content: center; padding: 1rem; }
.vt-modal__card { width: min(500px, 100%); max-height: 90vh; overflow: auto; background: var(--vt-surface); border: 1px solid var(--vt-border); border-radius: var(--vt-r-lg); box-shadow: var(--vt-shadow-lg); padding: 1.5rem; }
.vt-modal__head { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; border-bottom: 1px solid var(--vt-border); padding-bottom: 0.6rem; margin-bottom: 1rem; }
.vt-modal__head h2, .vt-modal__head h3 { margin: 0; font-size: 1.1rem; color: var(--vt-text); }
.vt-modal__actions { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 1rem; }
.vt-icon-btn { width: 34px; height: 34px; padding: 0; border-radius: var(--vt-r-sm); display: inline-flex; align-items: center; justify-content: center; }

/* Inline form row (label+field groups laid out horizontally, wraps on mobile) */
.vt-inline-form { display: flex; gap: 1rem; flex-wrap: wrap; align-items: flex-end; }
.vt-inline-form .vt-field { flex: 1; min-width: 180px; }

/* =========================================================================
   Motion preferences
   ========================================================================= */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}
