/* =============================================================================
   main.css — GAIN Consulting LLC platform stylesheet
   Applies to every page via base.html.
   Page-specific styles go in {% block extra_css %} inside the child template.

   2026-11 BRAND REFRESH (approved by Kelsea Ansfield, Nov 2026):
     "Brand chrome, calm work surface." The dark charcoal + GAIN blue carry
     the brand in the header, footer and sign-in pages. Forms, tables and
     reports sit on a soft grey surface in white cards.

   COLORS: every color lives in the :root tokens below. Templates use
   var(--token) instead of hex codes, so a future Admin > Branding screen
   (or a per-customer theme) only has to override these variables.
   All text/background pairs used here meet WCAG AA (4.5:1). Brand blue
   (#4F99D2) is 3.08:1 on white, so it is NEVER used for text on white —
   only as a fill (with charcoal text) or as text on charcoal.

   FONT: Montserrat, self-hosted from static/fonts/ (see @font-face below).
   Falls back to Arial until the font file is in place.
============================================================================= */

@font-face {
    font-family: "Montserrat";
    src: url("../fonts/Montserrat-VariableFont_wght.ttf") format("truetype");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

:root {
    /* Brand (from gain.consulting) */
    --gain-blue:            #4F99D2;   /* fills + text on charcoal only */
    --gain-blue-hover:      #6AAADB;
    --gain-charcoal:        #2D2727;   /* header, text, dark buttons */
    --gain-charcoal-hover:  #463E3E;
    --gain-logo-grey:       #6B6363;   /* logo half, dividers on dark */
    --gain-link:            #2B6A9E;   /* links, focus, section labels */
    --gain-link-hover:      #1F5A8A;

    /* Work surface */
    --surface:              #F2F4F7;   /* page background */
    --surface-alt:          #F7F9FB;   /* tiles, zebra, hover */
    --card:                 #FFFFFF;
    --border:               #DDE3EA;
    --border-subtle:        #EEF1F4;
    --border-strong:        #C7D0DA;   /* form field edges */
    --blue-50:              #E3EFF9;
    --blue-100:             #CFE3F4;

    /* Text (each adjustable in Admin > Branding) */
    --text:                 #2D2727;   /* body text, text on blue buttons */
    --on-dark:              #FFFFFF;   /* text on the header, footer and dark buttons */
    --text-secondary:       #3D4650;
    --text-muted:           #5A6470;   /* 5.5:1 on --surface, 6:1 on white */
    --text-on-dark:         #DCD6D6;
    --text-on-dark-muted:   #B5AEAE;

    /* Meaning */
    --attention:            #D9822B;   /* missing docs, View-As, alerts (charcoal text) */
    --attention-text:       #9A4A00;
    --success:              #1D6B3A;
    --success-bg:           #E2F3E8;
    --danger:               #B03A2E;
    --danger-text:          #9B2C22;
    --danger-bg:            #FBE5E3;
    --warn-text:            #7A4E00;
    --warn-bg:              #FDF1DC;

    --radius:               10px;
    --radius-sm:            8px;
    --radius-pill:          999px;
    --shadow-card:          0 2px 10px rgba(45,39,39,0.06);
    --focus-ring:           0 0 0 3px rgba(79,153,210,0.35);
    --font:                 "Montserrat", Arial, Helvetica, sans-serif;
}

/* ---------------------------------------------------------------------------
   Reset & base
--------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; }

body {
    font-family: var(--font);
    font-size: 0.9375rem;          /* 15px — Montserrat runs wider than the old system font */
    line-height: 1.6;
    color: var(--text);
    background: var(--surface);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

h1 { font-weight: 300; font-size: 1.85rem; line-height: 1.25; color: var(--text); }
h2, h3 { font-weight: 600; color: var(--text); }

table, .data-table { font-variant-numeric: tabular-nums; }

a { color: var(--gain-link); text-decoration: none; }
a:hover { color: var(--gain-link-hover); text-decoration: underline; }

input, select, textarea, button { font-family: inherit; }

:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* ---------------------------------------------------------------------------
   Header
--------------------------------------------------------------------------- */
.site-header {
    background: var(--gain-charcoal);
    color: var(--on-dark);
    border-bottom: 3px solid var(--gain-blue);
    padding: 0 1.5rem;
}

.header-inner {
    max-width: 1360px;
    margin: 0 auto;
    min-height: 64px;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

/* Logo / brand */
.brand-link { display: flex; align-items: center; gap: 0.65rem; color: var(--on-dark); }
.brand-link:hover { color: var(--on-dark); text-decoration: none; }

.brand-mark { width: 28px; height: 28px; flex: none; display: block; }

.header-logo { height: 40px; width: auto; display: block; }

.brand-wordmark { font-size: 0.95rem; letter-spacing: 0.06em; white-space: nowrap; }
.brand-wordmark strong { font-weight: 700; }
.brand-wordmark span   { font-weight: 300; }

.brand-divider { width: 1px; height: 22px; background: var(--gain-logo-grey); }

.brand-app {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    color: var(--gain-blue);       /* 4.77:1 on charcoal */
    white-space: nowrap;
}

/* Kept for templates that still reference it */
.logo-text { font-size: 1.1rem; font-weight: 700; color: var(--on-dark); letter-spacing: 0.04em; }

/* Navigation */
.header-nav {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
    margin-left: auto;
}

.nav-user {
    font-size: 0.82rem;
    color: var(--text-on-dark);
}

.nav-link,
.nav-dropdown-toggle {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-on-dark);
    padding: 0.5rem 0.9rem;
    border-radius: var(--radius-pill);
    transition: background 0.15s, color 0.15s;
}

.nav-link:hover,
.nav-dropdown-toggle:hover {
    background: rgba(79,153,210,0.22);
    color: var(--on-dark);
    text-decoration: none;
}

.nav-alert {
    background: var(--attention);
    color: var(--text) !important;
}
.nav-alert:hover { background: #E39446; }

.nav-logout {
    border: 1px solid var(--gain-logo-grey);
}

/* Nav dropdowns (Admin / Claims / Profile) */
.nav-dropdown { position: relative; display: inline-block; }

.nav-dropdown-toggle {
    background: none;
    border: none;
    cursor: pointer;
}

/* The user-name dropdown reads as a name, not a menu label */
.nav-dropdown-user .nav-dropdown-toggle {
    text-transform: none;
    letter-spacing: 0.02em;
    font-weight: 500;
    font-size: 0.82rem;
    border: 1px solid var(--gain-logo-grey);
}

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 24px rgba(45,39,39,0.16);
    min-width: 210px;
    z-index: 200;
    overflow: hidden;
}

.nav-dropdown-user .nav-dropdown-menu { left: auto; right: 0; }

.nav-dropdown-menu.open { display: block; }

.nav-dropdown-menu a {
    display: block;
    padding: 0.65rem 1rem;
    font-size: 0.85rem;
    color: var(--text);
    border-bottom: 1px solid var(--border-subtle);
}

.nav-dropdown-menu a:last-child { border-bottom: none; }
.nav-dropdown-menu a:hover { background: var(--blue-50); color: var(--text); text-decoration: none; }

/* Password rules reminder (hardening H8): shown on every page during the
   180-day grace period to people whose password doesn't meet the new rules. */
.password-banner {
    background: var(--attention);
    color: var(--text);
    font-size: 0.88rem;
    padding: 0.6rem 1.5rem;
}
.password-banner a { font-weight: 600; margin-left: 0.5rem; }

/* Sign-out warning (2026-11-13): shown 2 minutes before the 30-minute or
   8-hour limit, fixed to the bottom of the window so it's seen anywhere. */
.session-warning { position: fixed; left: 1rem; right: 1rem; bottom: 1rem; z-index: 2000; max-width: 760px; margin: 0 auto;
                   display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1rem;
                   background: var(--attention); color: var(--text); border-radius: var(--radius-sm);
                   box-shadow: 0 4px 18px rgba(0,0,0,0.18); padding: 0.85rem 1.1rem; font-size: 0.92rem; }
.session-warning[hidden] { display: none; }
.session-warning .sw-text { flex: 1 1 320px; }
.session-warning button { background: var(--gain-charcoal); color: var(--on-dark); border: none; border-radius: 999px;
                          padding: 0.5rem 1.1rem; font-weight: 600; cursor: pointer; }
.session-warning button:hover, .session-warning button:focus-visible { background: var(--gain-link); }

.form-hint { font-size: 0.82rem; color: var(--text-muted); margin: 0 0 1rem; }

/* Log Out is a form button (hardening H1) made to look like the menu links. */
.nav-menu-form { margin: 0; }
.nav-menu-button {
    display: block;
    width: 100%;
    padding: 0.65rem 1rem;
    font: inherit;
    font-size: 0.85rem;
    color: var(--text);
    text-align: left;
    background: none;
    border: none;
    border-radius: 0;
    cursor: pointer;
}
.nav-menu-button:hover, .nav-menu-button:focus-visible { background: var(--blue-50); }

/* ---------------------------------------------------------------------------
   "View As" banner — must be unmissable on every page while active.
--------------------------------------------------------------------------- */
.view-as-banner {
    background: var(--attention);
    color: var(--text);
    font-weight: 600;
    font-size: 0.88rem;
    padding: 0.6rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    text-align: center;
}

.view-as-exit-form { display: inline; margin: 0; }

/* ---------------------------------------------------------------------------
   Search-as-you-type picker (TMS customer / location fields)
--------------------------------------------------------------------------- */
.search-picker { position: relative; }

.search-picker-results {
    position: absolute; z-index: 50; top: 100%; left: 0; right: 0;
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm);
    box-shadow: 0 6px 16px rgba(45,39,39,0.10); max-height: 220px; overflow-y: auto;
    display: none;
}

.search-picker-result-item {
    padding: 0.5rem 0.75rem; font-size: 0.88rem; cursor: pointer;
    border-bottom: 1px solid var(--border-subtle);
}
.search-picker-result-item:last-child { border-bottom: none; }
.search-picker-result-item:hover { background: var(--blue-50); }

.search-picker-status-ok   { color: var(--success); }
.search-picker-status-warn { color: var(--warn-text); }

/* ---------------------------------------------------------------------------
   Chip list — removable tags for a multi-select search picker
--------------------------------------------------------------------------- */
.chip-list {
    display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.6rem;
}

.chip {
    display: inline-flex; align-items: center; gap: 0.35rem;
    background: var(--blue-50); color: var(--gain-link-hover); border-radius: var(--radius-pill);
    padding: 0.25rem 0.4rem 0.25rem 0.8rem; font-size: 0.8rem; font-weight: 600;
}

.chip-remove {
    background: none; border: none; color: var(--gain-link-hover); cursor: pointer;
    font-size: 1rem; line-height: 1; padding: 0 0.35rem; font-weight: 700;
}
.chip-remove:hover { color: var(--danger); }

/* ---------------------------------------------------------------------------
   Main content area — the calm work surface
--------------------------------------------------------------------------- */
.site-main {
    flex: 1;                    /* pushes footer to bottom on short pages */
    padding: 2rem 1.5rem 2.5rem;
}

.content-wrapper {
    max-width: 1360px;
    margin: 0 auto;
}

/* ---------------------------------------------------------------------------
   Footer
--------------------------------------------------------------------------- */
.site-footer {
    background: var(--gain-charcoal);
    color: var(--text-on-dark);
    border-top: 3px solid var(--gain-blue);
    padding: 1rem 1.5rem;
    margin-top: auto;
}

.footer-inner {
    max-width: 1360px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1rem 1.5rem;
    flex-wrap: wrap;
}

.footer-logo { display: flex; align-items: center; gap: 0.5rem; }

.footer-logo-img { height: 28px; width: auto; }

.footer-logo-text { font-size: 0.85rem; letter-spacing: 0.06em; color: var(--on-dark); }

.footer-contact { font-size: 0.78rem; color: var(--text-on-dark); }
.footer-contact a { color: var(--text-on-dark); }
.footer-contact a:hover { color: var(--on-dark); }

.footer-copy {
    font-size: 0.78rem;
    color: var(--text-on-dark-muted);
    margin-left: auto;
}

/* ---------------------------------------------------------------------------
   Cards and forms (change password, 2FA, admin forms)
--------------------------------------------------------------------------- */
.form-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow-card);
    padding: 2rem 2.5rem;
    max-width: 440px;
    margin: 2rem auto;
}

.form-card h2 {
    margin-bottom: 1.5rem;
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text);
}

/* Wider variant for the tile-based user forms */
.form-card-wide { max-width: 1100px; }

.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    align-items: start;
}

.tile {
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
}

.tile h3 {
    margin: 0 0 1rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--gain-link);
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}

.tile.tile-hidden { display: none; }

.form-group {
    margin-bottom: 1.1rem;
}

.form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
    color: var(--text);
}

.form-group input {
    width: 100%;
    height: 46px;
    padding: 0 0.9rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    color: var(--text);
    background: var(--card);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group input:focus,
.field input:focus,
.field select:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--gain-link);
    box-shadow: var(--focus-ring);
}

/* Primary button: GAIN blue pill with charcoal text (4.77:1). White text
   on this blue would fail contrast, so it is never used. */
.btn-primary {
    display: block;
    width: 100%;
    padding: 0.75rem 1.4rem;
    background: var(--gain-blue);
    color: var(--text);
    border: none;
    border-radius: var(--radius-pill);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: center;
    cursor: pointer;
    margin-top: 1.25rem;
    transition: background 0.15s, box-shadow 0.15s, transform 0.15s;
}

/* A link-style primary button sits in a toolbar row, not under a form,
   so it must not carry the form spacing (it pushed it out of line). */
a.btn-primary { margin-top: 0; }

/* HOVER STATES (2026-11-11, per Paul): every clickable button FLIPS its
   full color on hover/keyboard focus so it is unmistakable which one the
   pointer is on:
     blue pill      -> charcoal with white text
     white pill     -> charcoal with white text
     charcoal pill  -> GAIN blue with charcoal text (4.77:1)
   plus a light-blue ring. Brand blue never carries white text (fails
   contrast), which is the only color rule these flips have to respect. */
.btn-primary:hover,
.btn-primary:focus-visible {
    background: var(--gain-charcoal);       /* full color flip: blue -> charcoal */
    color: var(--on-dark);
    text-decoration: none;
    box-shadow: 0 0 0 3px var(--blue-100), 0 4px 12px rgba(45,39,39,0.25);
    transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); box-shadow: none; }

.btn-primary:disabled {
    background: #C9D3DC;
    color: var(--text-muted);
    cursor: not-allowed;
}
.btn-primary:disabled:hover { background: #C9D3DC; }

/* ---------------------------------------------------------------------------
   Alert / error messages
--------------------------------------------------------------------------- */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: 0.88rem;
}

.alert-error {
    background: var(--danger-bg);
    border: 1px solid #F1C3BE;
    color: var(--danger-text);
}

.alert-info {
    background: var(--blue-50);
    border: 1px solid var(--blue-100);
    color: var(--gain-link-hover);
}

/* ---------------------------------------------------------------------------
   QR code block (2FA setup)
--------------------------------------------------------------------------- */
.qr-block {
    text-align: center;
    margin: 1.5rem 0;
}

.qr-block img {
    border: 6px solid #FFFFFF;
    box-shadow: 0 2px 10px rgba(45,39,39,0.12);
    border-radius: var(--radius-sm);
    max-width: 200px;
}

.qr-block p {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* ---------------------------------------------------------------------------
   Admin — form field layout (used by admin/create_user, edit_user, reset_password)
--------------------------------------------------------------------------- */
.field {
    margin-bottom: 1.2rem;
}

.field label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
    color: var(--text);
}

.field select,
.field input[type="text"],
.field input[type="email"],
.field input[type="password"] {
    width: 100%;
    height: 44px;
    padding: 0 0.8rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    color: var(--text);
    background: var(--card);
    box-sizing: border-box;
}

.field-hint {
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

/* ✓/✗ indicator for the live email-exists / password-match checks on the
   Create User forms — a dedicated column to the LEFT of the input, not
   overlaid inside it (see git history for the full reasoning). */
.field-status-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.field-status-icon-slot {
    flex: 0 0 1.3rem;
    text-align: center;
    font-weight: 900;
    font-size: 1.2rem;
    line-height: 1;
}
.field-status-icon-slot.field-status-ok  { color: var(--success); }
.field-status-icon-slot.field-status-bad { color: var(--danger); }

.field-status-row input { flex: 1 1 auto; }

.form-note {
    color: var(--text-muted);
    font-size: 0.88rem;
    margin-bottom: 1.25rem;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.form-actions .btn-primary {
    display: inline-block;
    width: auto;
    padding: 0.7rem 1.6rem;
    margin-top: 0;
}

.btn-secondary {
    display: inline-block;
    padding: 0.7rem 1.4rem;
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-pill);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.btn-secondary:hover,
.btn-secondary:focus-visible {
    background: var(--gain-charcoal);       /* full color flip: white -> charcoal */
    border-color: var(--gain-charcoal);
    color: var(--on-dark);
    text-decoration: none;
    box-shadow: 0 0 0 3px var(--blue-100), 0 4px 12px rgba(45,39,39,0.25);
    transform: translateY(-1px);
}
.btn-secondary:active { transform: translateY(0); box-shadow: none; }

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.checkbox-label {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    font-size: 0.88rem;
    cursor: pointer;
}

.role-desc { color: var(--text-muted); }

.section-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1.75rem 0;
}

/* ---------------------------------------------------------------------------
   Admin — list pages and tables
--------------------------------------------------------------------------- */
.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.admin-header h1 { margin: 0; }

.admin-header .btn-primary {
    display: inline-block;
    width: auto;
    padding: 0.65rem 1.4rem;
    margin-top: 0;
    text-decoration: none;
}

.table-wrap {
    /* No scroll box of its own (Paul, 2026-11-13): the whole page scrolls, so
       the title and filters above a table scroll away, and the column
       headings below stay glued to the top of the window. (A scroll box here
       would make the headings stick inside the box instead.) A table wider
       than the window makes the page scroll sideways. */
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.table-wrap thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--surface);
    box-shadow: inset 0 -1px 0 var(--border);
}
/* Keep the box's rounded top corners now that it no longer clips. */
.table-wrap thead tr:first-child th:first-child { border-top-left-radius: var(--radius); }
.table-wrap thead tr:first-child th:last-child  { border-top-right-radius: var(--radius); }

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    background: var(--card);
}

/* Header row: quiet grey band with small caps, not a dark bar */
.data-table th {
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.7rem 0.75rem;
    text-align: left;
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--surface-alt); }

.sort-link { color: inherit; text-decoration: none; }
.sort-link:hover { color: var(--gain-link); text-decoration: underline; }

.row-inactive td { color: #8A929B; }

.action-cell {
    white-space: nowrap;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}

/* Small buttons: dark pill by default */
.btn-sm {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-pill);
    border: none;
    cursor: pointer;
    text-decoration: none;
    background: var(--gain-charcoal);
    color: var(--on-dark);
    transition: background 0.15s, box-shadow 0.15s;
}

/* Dark pills (View / Edit / Manage Values …) flip to GAIN blue with
   charcoal text on hover (4.77:1), plus a ring. */
.btn-sm:hover,
.btn-sm:focus-visible { background: var(--gain-blue); color: var(--text); text-decoration: none; box-shadow: 0 0 0 3px var(--blue-100); }
/* .btn-sm-outline is defined locally in some templates; its hover lives here
   so it never inherits a dark background with dark text. */
.btn-sm-outline { background: transparent; border: 1.5px solid var(--gain-charcoal); color: var(--text); }
.btn-sm-outline:hover,
.btn-sm-outline:focus-visible { background: var(--gain-blue); border-color: var(--gain-blue); color: var(--text); box-shadow: 0 0 0 3px var(--blue-100); }
.btn-warn            { background: var(--attention); color: var(--text); }
.btn-warn:hover      { background: #E39446; color: var(--text); }
.btn-danger          { background: var(--danger); color: #FFFFFF; }
.btn-danger:hover,
.btn-danger:focus-visible { background: #7E2219; color: #FFFFFF; box-shadow: 0 0 0 3px #F1C3BE; }
.btn-success         { background: var(--success); color: #FFFFFF; }
.btn-success:hover,
.btn-success:focus-visible { background: #10401F; color: #FFFFFF; box-shadow: 0 0 0 3px #C7E8D2; }

.badge {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: var(--radius-pill);
    font-size: 0.72rem;
    font-weight: 700;
    margin-right: 0.2rem;
}

.badge-active   { background: var(--success-bg); color: var(--success); }
.badge-inactive { background: #E9ECEF; color: var(--text-secondary); }
.badge-warn     { background: var(--warn-bg); color: var(--warn-text); }

/* ---------------------------------------------------------------------------
   Sign-in pages (login, 2FA, forced 2FA setup) — split layout:
   brand panel on the left, sign-in card on the right. Stacks on phones.
--------------------------------------------------------------------------- */
.auth-page .site-main { padding: 0; display: flex; }
.auth-page .content-wrapper { max-width: none; width: 100%; display: flex; }

.auth-split {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    min-height: 100vh;
}

.auth-brand {
    flex: 1 1 520px;
    min-height: 360px;
    background-color: var(--gain-charcoal);
    background-image: radial-gradient(rgba(79,153,210,0.22) 1px, transparent 1.4px);
    background-size: 22px 22px;
    color: var(--on-dark);
    padding: 3.5rem 4rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 2.5rem;
}

.auth-brand .brand-mark { width: 36px; height: 36px; }
.auth-brand-logo { display: flex; align-items: center; gap: 0.75rem; }
.auth-brand-logo .brand-wordmark { font-size: 1.1rem; }
.auth-brand-tagline { display: block; font-size: 0.62rem; letter-spacing: 0.28em; color: #C9C3C3; margin-top: 2px; }

.auth-kicker {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.22em;
    color: var(--gain-blue);
}

.auth-headline {
    font-size: clamp(2.4rem, 5vw, 4rem);
    line-height: 1.05;
    font-weight: 200;
    color: var(--on-dark);
    margin: 1.25rem 0;
}
.auth-headline strong { font-weight: 700; }

.auth-sub { font-size: 1rem; line-height: 1.6; color: var(--text-on-dark); max-width: 460px; }

.auth-fine { font-size: 0.75rem; color: var(--text-on-dark-muted); }

.auth-panel {
    flex: 1 1 460px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    background: var(--surface);
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 8px 28px rgba(45,39,39,0.08);
    padding: 2.5rem 2.5rem 2rem;
}

.auth-card h2 { font-size: 1.6rem; font-weight: 600; margin-bottom: 0.35rem; }
.auth-card .auth-lead { font-size: 0.88rem; color: var(--text-muted); margin-bottom: 1.5rem; }
.auth-card .btn-primary { height: 48px; }
.auth-card .qr-block img { max-width: 180px; }

.auth-card-foot {
    border-top: 1px solid var(--border-subtle);
    margin-top: 1.5rem;
    padding-top: 1rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

@media (max-width: 640px) {
    .auth-brand { padding: 2rem 1.5rem; min-height: 0; }
    .auth-card  { padding: 2rem 1.5rem 1.5rem; }
    .form-card  { padding: 1.5rem; }
    .site-main  { padding: 1.25rem 1rem 2rem; }
}
