/* =====================================================================
   WealthGenie Ops — design system
   One family (Plus Jakarta Sans), one accent (emerald) for the live /
   active / primary state, navy for the sidebar and headings, colour
   otherwise only for status. Surfaces are bordered, not shadowed;
   shadows belong to floating layers (drawers, menus, dialogs).
   Existing page class names (.page-header, .card-wg, .table-wg,
   .badge-*, .total-records, .empty-state, .login-*) keep working.
   ===================================================================== */

:root {
    /* Navy ink + emerald accent */
    --wg-primary: #0f172a;
    --wg-primary-light: #1e293b;
    --wg-secondary: #334155;
    --wg-accent: #10b981;
    --wg-accent-hover: #059669;
    --wg-accent-ink: #047857;
    --wg-accent-light: rgba(16, 185, 129, 0.10);

    /* Surfaces */
    --wg-bg: #f5f7fa;
    --wg-bg-card: #ffffff;
    --wg-bg-sunken: #eef1f5;
    --wg-bg-hover: #f8fafc;
    --wg-border: #e3e8ef;
    --wg-border-light: #eef1f5;
    --wg-border-strong: #cbd3de;

    /* Text */
    --wg-text-primary: #0f172a;
    --wg-text-secondary: #475569;
    --wg-text-muted: #64748b;
    --wg-text-light: #cbd5e1;

    /* Status: ink / tint pairs */
    --wg-success: #10b981;
    --wg-ok-ink: #047857;      --wg-ok-tint: #ecfdf5;    --wg-ok-line: #a7f3d0;
    --wg-warning: #f59e0b;
    --wg-warn-ink: #b45309;    --wg-warn-tint: #fffbeb;  --wg-warn-line: #fde68a;
    --wg-danger: #ef4444;
    --wg-bad-ink: #b91c1c;     --wg-bad-tint: #fef2f2;   --wg-bad-line: #fecaca;
    --wg-info: #3b82f6;
    --wg-info-ink: #1d4ed8;    --wg-info-tint: #eff6ff;  --wg-info-line: #bfdbfe;
    --wg-neutral-ink: #475569; --wg-neutral-tint: #f1f5f9;

    /* Shape, elevation, motion */
    --wg-radius: 6px;
    --wg-radius-lg: 10px;
    --wg-radius-xl: 14px;
    --wg-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
    --wg-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    --wg-shadow-md: 0 8px 24px -12px rgba(15, 23, 42, 0.25);
    --wg-shadow-lg: 0 24px 48px -16px rgba(15, 23, 42, 0.30);
    --wg-transition: all 0.12s ease;
    --wg-focus: 0 0 0 3px rgba(16, 185, 129, 0.28);

    /* Shell */
    --wg-side-w: 240px;
    --wg-side-rail-w: 60px;
    --wg-topbar-h: 52px;
    --wg-content-pad: 24px;

    /* Type scale */
    --wg-font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --wg-fs-xs: 12px;
    --wg-fs-sm: 13px;
    --wg-fs-md: 14px;
    --wg-fs-lg: 16px;
    --wg-fs-xl: 20px;
    --wg-fs-2xl: 24px;

    /* Bootstrap bridge: pages built on Bootstrap classes inherit the system */
    --bs-body-font-family: var(--wg-font);
    --bs-body-font-size: var(--wg-fs-md);
    --bs-body-line-height: 1.5;
    --bs-body-color: var(--wg-text-primary);
    --bs-body-bg: var(--wg-bg);
    --bs-secondary-color: var(--wg-text-secondary);
    --bs-tertiary-color: var(--wg-text-muted);
    --bs-border-color: var(--wg-border);
    --bs-border-radius: var(--wg-radius);
    --bs-border-radius-sm: 4px;
    --bs-border-radius-lg: var(--wg-radius-lg);
    --bs-primary: var(--wg-accent);
    --bs-primary-rgb: 16, 185, 129;
    --bs-link-color: var(--wg-accent-ink);
    --bs-link-color-rgb: 4, 120, 87;
    --bs-link-hover-color: var(--wg-accent-hover);
    --bs-link-hover-color-rgb: 5, 150, 105;
    --bs-emphasis-color: var(--wg-text-primary);
}

/* =====================================================================
   Base
   ===================================================================== */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--wg-font);
    font-size: var(--wg-fs-md);
    background: var(--wg-bg);
    color: var(--wg-text-primary);
    min-height: 100vh;
    margin: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 { font-weight: 600; letter-spacing: -0.01em; }   /* colour inherits: pages with dark bands keep white text */
h4 { font-size: var(--wg-fs-xl); }
h5 { font-size: var(--wg-fs-lg); }

a { color: var(--wg-accent-ink); text-decoration: none; }
a:hover { color: var(--wg-accent-hover); text-decoration: underline; }
.btn:hover, .page-link:hover, .nav-link:hover, .dropdown-item:hover, .wg-side-link:hover, .filter-chip:hover { text-decoration: none; }

:focus-visible { outline: 2px solid var(--wg-accent); outline-offset: 2px; }
.form-control:focus-visible, .form-select:focus-visible { outline: none; }

.text-muted { color: var(--wg-text-muted) !important; }
.small, small { font-size: var(--wg-fs-sm); }

.wg-icon { width: 18px; height: 18px; flex: 0 0 auto; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.wg-icon-sm { width: 14px; height: 14px; }
.wg-num { font-variant-numeric: tabular-nums; }
.wg-prose { max-width: 72ch; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* =====================================================================
   Shell: sidebar + main
   ===================================================================== */
.wg-app { display: flex; min-height: 100vh; }

.wg-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.wg-content { flex: 1 0 auto; padding: var(--wg-content-pad) 28px 40px; width: 100%; }
.wg-main--auth .wg-content { padding: 0; }
.wg-main--auth .alert { margin: 16px 16px 0; }

.wg-side {
    position: sticky; top: 0; height: 100vh;
    width: var(--wg-side-w); flex: 0 0 var(--wg-side-w);
    background: var(--wg-primary); color: var(--wg-text-light);
    display: flex; flex-direction: column;
    transition: width 0.16s ease, flex-basis 0.16s ease;
    z-index: 1020;
}

.wg-side-brand {
    display: flex; align-items: center; gap: 8px;
    height: 56px; padding: 0 16px 0 18px; flex: 0 0 auto;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.wg-side-logo { display: inline-flex; align-items: center; min-width: 0; }
.wg-side-logo .wg-side-wordmark { height: 30px; width: auto; filter: brightness(0) invert(1); opacity: 0.95; }
.wg-side-logo .wg-side-mark { height: 28px; width: 28px; border-radius: 6px; }
.wg-side-close { margin-left: auto; }

.wg-side-nav { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; padding: 8px 0 12px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.15) transparent; }

.wg-side-group + .wg-side-group { margin-top: 6px; }
.wg-side-group-label {
    padding: 10px 22px 3px; font-size: 11.5px; font-weight: 600;
    color: rgba(203, 213, 225, 0.68); white-space: nowrap; overflow: hidden;
}

.wg-side-link {
    display: flex; align-items: center; gap: 10px;
    margin: 1px 10px; padding: 6px 12px;
    border-radius: var(--wg-radius);
    color: var(--wg-text-light); font-size: 13.5px; font-weight: 500; line-height: 1.3;
    text-decoration: none; white-space: nowrap; position: relative;
    background: transparent; border: 0; width: calc(100% - 20px); text-align: left; cursor: pointer;
    font-family: inherit; transition: background-color 0.12s ease, color 0.12s ease;
}
.wg-side-link:hover { color: #fff; background: rgba(255, 255, 255, 0.07); text-decoration: none; }
.wg-side-link:focus-visible { outline-offset: -2px; }
.wg-side-link.is-active { color: #fff; background: rgba(16, 185, 129, 0.16); box-shadow: inset 3px 0 0 var(--wg-accent); }
.wg-side-link .wg-icon { color: rgba(203, 213, 225, 0.85); }
.wg-side-link.is-active .wg-icon, .wg-side-link:hover .wg-icon { color: #fff; }
.wg-side-label { overflow: hidden; text-overflow: ellipsis; }

.wg-nav-count {
    margin-left: auto; background: var(--wg-danger); color: #fff;
    font-size: 11px; font-weight: 600; line-height: 1; padding: 3px 7px; border-radius: 999px;
    font-variant-numeric: tabular-nums;
}

.wg-side-foot { flex: 0 0 auto; padding: 6px 0 8px; border-top: 1px solid rgba(255, 255, 255, 0.07); }
.wg-side-user { display: flex; align-items: center; gap: 10px; margin: 0 10px; padding: 5px 12px; font-size: 13px; color: #fff; font-weight: 600; white-space: nowrap; }
.wg-side-user .wg-icon { color: var(--wg-accent); }
.wg-side-logout { color: rgba(252, 165, 165, 0.9); }
.wg-side-logout:hover { background: rgba(239, 68, 68, 0.18); color: #fff; }
.wg-side-collapse { color: rgba(203, 213, 225, 0.7); font-size: 12.5px; }
.wg-side-collapse .wg-icon { transition: transform 0.16s ease; }

.wg-icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: var(--wg-radius);
    background: transparent; border: 0; color: inherit; cursor: pointer; padding: 0;
}
.wg-icon-btn:hover { background: rgba(255, 255, 255, 0.1); }

/* Icon rail (desktop only; the preference is kept in localStorage) */
@media (min-width: 992px) {
    html[data-wg-side="rail"] .wg-side { width: var(--wg-side-rail-w); flex-basis: var(--wg-side-rail-w); }
    html[data-wg-side="rail"] .wg-side-label,
    html[data-wg-side="rail"] .wg-side-group-label { display: none; }
    html[data-wg-side="rail"] .wg-side-brand { padding: 0; justify-content: center; }
    html[data-wg-side="rail"] .wg-side-wordmark { display: none; }
    html[data-wg-side="rail"] .wg-side-mark[hidden] { display: block; }
    html[data-wg-side="rail"] .wg-side-group + .wg-side-group { margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(255, 255, 255, 0.07); }
    html[data-wg-side="rail"] .wg-side-link,
    html[data-wg-side="rail"] .wg-side-user { justify-content: center; padding: 9px 0; margin: 1px 10px; width: calc(100% - 20px); }
    html[data-wg-side="rail"] .wg-nav-count { position: absolute; top: 3px; right: 6px; margin: 0; padding: 2px 5px; font-size: 10px; }
    html[data-wg-side="rail"] .wg-side-collapse .wg-icon { transform: rotate(180deg); }
}

/* Top bar: only below the desktop breakpoint, where the sidebar slides in */
.wg-topbar {
    display: none; position: sticky; top: 0; z-index: 1010;
    height: var(--wg-topbar-h); align-items: center; gap: 10px; padding: 0 12px;
    background: var(--wg-primary); color: #fff;
}
.wg-topbar img { height: 22px; filter: brightness(0) invert(1); }
.wg-side-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.55); z-index: 1029; }
.wg-side-backdrop[hidden] { display: none; }

@media (max-width: 991.98px) {
    .wg-topbar { display: flex; }
    .wg-side {
        position: fixed; left: 0; top: 0; height: 100vh; height: 100dvh;
        width: min(var(--wg-side-w), 86vw); flex-basis: auto;
        transform: translateX(-102%); transition: transform 0.18s ease; z-index: 1030;
        box-shadow: var(--wg-shadow-lg);
    }
    body.wg-side-open .wg-side { transform: none; }
    body.wg-side-open { overflow: hidden; }
    .wg-side-collapse { display: none !important; }
    .wg-content { padding: 16px 16px 32px; }
}

/* =====================================================================
   Page header (used by every page)
   ===================================================================== */
.page-header { margin-bottom: 20px; }
.page-title {
    font-size: var(--wg-fs-xl); font-weight: 600; letter-spacing: -0.01em;
    color: var(--wg-text-primary); margin: 0;
    display: flex; align-items: center; gap: 10px; line-height: 1.25;
}
.page-title-icon {
    width: 32px; height: 32px; flex: 0 0 auto;
    background: var(--wg-accent-light); color: var(--wg-accent-ink);
    border-radius: var(--wg-radius); display: inline-flex; align-items: center; justify-content: center;
}
.page-title-icon svg { width: 17px; height: 17px; }
.page-subtitle { color: var(--wg-text-secondary); font-size: var(--wg-fs-sm); margin: 4px 0 0; max-width: 72ch; }
.page-header-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* =====================================================================
   Surfaces
   ===================================================================== */
.card-wg, .card {
    background: var(--wg-bg-card);
    border: 1px solid var(--wg-border);
    border-radius: var(--wg-radius-lg);
    box-shadow: none;
}
.card-wg { overflow: hidden; }
.card > .table-responsive, .card-wg > .table-responsive { border-radius: inherit; }
.card { --bs-card-border-color: var(--wg-border); --bs-card-border-radius: var(--wg-radius-lg); --bs-card-cap-bg: var(--wg-bg-card); --bs-card-spacer-y: 14px; --bs-card-spacer-x: 16px; }
.card-wg-header { padding: 12px 16px; border-bottom: 1px solid var(--wg-border); background: var(--wg-bg-card); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.card-wg-title { font-size: var(--wg-fs-md); font-weight: 600; color: var(--wg-text-primary); margin: 0; }
.card-wg-body { padding: 16px; }

/* Toolbar: filters and actions above a list */
.wg-toolbar {
    display: flex; flex-wrap: wrap; align-items: end; gap: 8px 12px;
    padding: 12px 14px; margin-bottom: 14px;
    background: var(--wg-bg-card); border: 1px solid var(--wg-border); border-radius: var(--wg-radius-lg);
}
.wg-toolbar .form-label { margin-bottom: 3px; font-size: var(--wg-fs-xs); color: var(--wg-text-secondary); font-weight: 500; }

.filter-section {
    background: var(--wg-bg-card); border: 1px solid var(--wg-border);
    border-radius: var(--wg-radius-lg); padding: 14px 16px; margin-bottom: 14px;
}
.filter-section .form-label { font-size: var(--wg-fs-xs); color: var(--wg-text-secondary); }

.filter-chip {
    border: 1px solid var(--wg-border); background: var(--wg-bg-card); color: var(--wg-text-secondary);
    border-radius: 999px; padding: 4px 12px; font-size: var(--wg-fs-sm); font-weight: 500;
    cursor: pointer; white-space: nowrap; line-height: 1.4; transition: var(--wg-transition);
}
.filter-chip:hover { border-color: var(--wg-border-strong); color: var(--wg-text-primary); }
.filter-chip.active { background: var(--wg-primary); color: #fff; border-color: var(--wg-primary); }
.filter-chip .count { opacity: 0.7; margin-left: 5px; font-variant-numeric: tabular-nums; }

/* Result line: "Showing 12" — quiet text, not a block */
.total-records {
    display: inline-flex; align-items: center; gap: 5px;
    color: var(--wg-text-secondary); font-size: var(--wg-fs-sm); font-weight: 500; margin-bottom: 0;
}
.total-records strong { color: var(--wg-text-primary); font-variant-numeric: tabular-nums; }

/* =====================================================================
   Forms
   ===================================================================== */
.form-label { font-weight: 500; color: var(--wg-text-primary); font-size: var(--wg-fs-sm); margin-bottom: 4px; }
.form-control, .form-select {
    border: 1px solid var(--wg-border-strong); border-radius: var(--wg-radius);
    padding: 6px 10px; font-size: var(--wg-fs-md); line-height: 1.45;
    background-color: var(--wg-bg-card); color: var(--wg-text-primary); transition: var(--wg-transition);
}
.form-control-sm, .form-select-sm { padding: 4px 8px; font-size: var(--wg-fs-sm); }
.form-control:focus, .form-select:focus { border-color: var(--wg-accent); box-shadow: var(--wg-focus); outline: none; }
.form-control::placeholder { color: var(--wg-text-muted); }
.input-group-text { background: var(--wg-bg-sunken); border-color: var(--wg-border-strong); color: var(--wg-text-muted); }
.form-check-input:checked { background-color: var(--wg-accent); border-color: var(--wg-accent); }
.form-check-input:focus { box-shadow: var(--wg-focus); border-color: var(--wg-accent); }
.form-switch .form-check-input:focus { --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%2310b981'/%3e%3c/svg%3e"); }

/* =====================================================================
   Buttons
   ===================================================================== */
.btn {
    --bs-btn-font-weight: 600;
    --bs-btn-font-size: var(--wg-fs-sm);
    --bs-btn-padding-y: 6px;
    --bs-btn-padding-x: 12px;
    --bs-btn-border-radius: var(--wg-radius);
    --bs-btn-focus-box-shadow: var(--wg-focus);
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    line-height: 1.45; transition: var(--wg-transition);
}
.btn-sm { --bs-btn-padding-y: 4px; --bs-btn-padding-x: 9px; --bs-btn-font-size: var(--wg-fs-xs); }
.btn-lg { --bs-btn-padding-y: 9px; --bs-btn-padding-x: 16px; --bs-btn-font-size: var(--wg-fs-md); }

.btn-primary {
    --bs-btn-bg: var(--wg-accent); --bs-btn-border-color: var(--wg-accent); --bs-btn-color: #fff;
    --bs-btn-hover-bg: var(--wg-accent-hover); --bs-btn-hover-border-color: var(--wg-accent-hover); --bs-btn-hover-color: #fff;
    --bs-btn-active-bg: #047857; --bs-btn-active-border-color: #047857; --bs-btn-active-color: #fff;
    --bs-btn-disabled-bg: var(--wg-accent); --bs-btn-disabled-border-color: var(--wg-accent); --bs-btn-disabled-color: #fff;
}
.btn-outline-primary {
    --bs-btn-color: var(--wg-accent-ink); --bs-btn-border-color: var(--wg-border-strong);
    --bs-btn-hover-bg: var(--wg-accent-light); --bs-btn-hover-color: var(--wg-accent-ink); --bs-btn-hover-border-color: var(--wg-accent);
    --bs-btn-active-bg: var(--wg-accent); --bs-btn-active-color: #fff; --bs-btn-active-border-color: var(--wg-accent);
}
.btn-secondary {
    --bs-btn-bg: var(--wg-secondary); --bs-btn-border-color: var(--wg-secondary); --bs-btn-color: #fff;
    --bs-btn-hover-bg: var(--wg-primary-light); --bs-btn-hover-border-color: var(--wg-primary-light); --bs-btn-hover-color: #fff;
    --bs-btn-active-bg: var(--wg-primary); --bs-btn-active-border-color: var(--wg-primary);
}
.btn-outline-secondary, .btn-outline {
    --bs-btn-color: var(--wg-text-secondary); --bs-btn-border-color: var(--wg-border-strong); --bs-btn-bg: var(--wg-bg-card);
    --bs-btn-hover-bg: var(--wg-bg-sunken); --bs-btn-hover-color: var(--wg-text-primary); --bs-btn-hover-border-color: var(--wg-border-strong);
    --bs-btn-active-bg: var(--wg-bg-sunken); --bs-btn-active-color: var(--wg-text-primary); --bs-btn-active-border-color: var(--wg-border-strong);
    background: var(--wg-bg-card); border: 1px solid var(--wg-border-strong); color: var(--wg-text-secondary);
}
.btn-outline:hover { background: var(--wg-bg-sunken); color: var(--wg-text-primary); border-color: var(--wg-border-strong); }
.btn-warning {
    --bs-btn-bg: var(--wg-warning); --bs-btn-border-color: var(--wg-warning); --bs-btn-color: #fff;
    --bs-btn-hover-bg: #d97706; --bs-btn-hover-border-color: #d97706; --bs-btn-hover-color: #fff;
}
.btn-danger { --bs-btn-bg: #dc2626; --bs-btn-border-color: #dc2626; --bs-btn-hover-bg: #b91c1c; --bs-btn-hover-border-color: #b91c1c; }
.btn-outline-danger { --bs-btn-color: var(--wg-bad-ink); --bs-btn-border-color: var(--wg-bad-line); --bs-btn-hover-bg: var(--wg-bad-tint); --bs-btn-hover-color: var(--wg-bad-ink); --bs-btn-hover-border-color: var(--wg-bad-ink); }
.btn-link { --bs-btn-color: var(--wg-accent-ink); --bs-btn-hover-color: var(--wg-accent-hover); --bs-btn-font-weight: 500; text-decoration: none; }
.btn-link:hover { text-decoration: underline; }
.btn-group-sm > .btn { --bs-btn-padding-y: 4px; --bs-btn-padding-x: 10px; --bs-btn-font-size: var(--wg-fs-xs); }

/* =====================================================================
   Tables (compact)
   ===================================================================== */
.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--wg-text-primary);
    --bs-table-border-color: var(--wg-border-light);
    --bs-table-hover-bg: var(--wg-bg-hover);
    --bs-table-striped-bg: var(--wg-bg);
    font-size: var(--wg-fs-sm); margin-bottom: 0;
}
.table > :not(caption) > * > * { padding: 8px 12px; vertical-align: middle; }
.table-sm > :not(caption) > * > * { padding: 5px 10px; }
.table thead th, .table > thead > tr > th {
    font-size: 12.5px; font-weight: 600; color: var(--wg-text-secondary);
    background: var(--wg-bg-card); border-bottom: 1px solid var(--wg-border); white-space: nowrap;
}
.table tbody tr:last-child > * { border-bottom: 0; }
.table td { font-variant-numeric: tabular-nums; }

.table-wg { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--wg-fs-sm); }
.table-wg th {
    background: var(--wg-bg-card); color: var(--wg-text-secondary);
    font-weight: 600; font-size: 12.5px; text-transform: none; letter-spacing: 0;
    padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--wg-border); white-space: nowrap;
}
.table-wg td { padding: 8px 12px; border-bottom: 1px solid var(--wg-border-light); color: var(--wg-text-primary); vertical-align: middle; font-variant-numeric: tabular-nums; }
.table-wg tbody tr { transition: background-color 0.12s ease; }
.table-wg tbody tr:hover { background: var(--wg-bg-hover); }
.table-wg tbody tr:last-child td { border-bottom: none; }
.table-responsive { border-radius: inherit; }

/* =====================================================================
   Status
   ===================================================================== */
.badge-status, .status-pill, .pkg-pill {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 2px 8px; border-radius: 999px;
    font-size: 11.5px; font-weight: 600; line-height: 1.5; white-space: nowrap;
    text-transform: none; letter-spacing: 0;
}
.badge-success { background: var(--wg-ok-tint); color: var(--wg-ok-ink); }
.badge-warning { background: var(--wg-warn-tint); color: var(--wg-warn-ink); }
.badge-danger { background: var(--wg-bad-tint); color: var(--wg-bad-ink); }
.badge-info { background: var(--wg-info-tint); color: var(--wg-info-ink); }
.badge-secondary { background: var(--wg-neutral-tint); color: var(--wg-neutral-ink); }

/* Application / firm states (shared by the Applications page and its drawer) */
.status-pill.st-under_review { background: #ede9fe; color: #5b21b6; }
.status-pill.st-phone_verified { background: var(--wg-info-tint); color: var(--wg-info-ink); }
.status-pill.st-changes_requested { background: var(--wg-warn-tint); color: var(--wg-warn-ink); }
.status-pill.st-approved, .status-pill.st-provisioning { background: var(--wg-info-tint); color: var(--wg-info-ink); }
.status-pill.st-provisioned, .status-pill.st-active, .status-pill.st-trial { background: var(--wg-ok-tint); color: var(--wg-ok-ink); }
.status-pill.st-grace { background: var(--wg-warn-tint); color: var(--wg-warn-ink); }
.status-pill.st-failed, .status-pill.st-past_due, .status-pill.st-suspended { background: var(--wg-bad-tint); color: var(--wg-bad-ink); }
.status-pill.st-rejected, .status-pill.st-expired, .status-pill.st-closed { background: var(--wg-neutral-tint); color: var(--wg-neutral-ink); }

.badge { --bs-badge-font-weight: 600; --bs-badge-font-size: 11.5px; --bs-badge-padding-y: 3px; --bs-badge-padding-x: 8px; }

/* Status dot before a word */
.wg-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--wg-text-light); vertical-align: middle; margin-right: 6px; }
.wg-dot.ok { background: var(--wg-accent); }
.wg-dot.warn { background: var(--wg-warning); }
.wg-dot.bad { background: var(--wg-danger); }
.wg-dot.info { background: var(--wg-info); }

/* Notice: an inline message with a left rule */
.wg-notice {
    padding: 10px 14px; border-radius: var(--wg-radius); font-size: var(--wg-fs-sm);
    border: 1px solid var(--wg-border); border-left-width: 3px; background: var(--wg-bg-card); color: var(--wg-text-primary);
}
.wg-notice.ok { background: var(--wg-ok-tint); border-color: var(--wg-ok-line); border-left-color: var(--wg-accent); color: #14532d; }
.wg-notice.warn { background: var(--wg-warn-tint); border-color: var(--wg-warn-line); border-left-color: var(--wg-warning); color: #78350f; }
.wg-notice.bad { background: var(--wg-bad-tint); border-color: var(--wg-bad-line); border-left-color: var(--wg-danger); color: #7f1d1d; }
.wg-notice.info { background: var(--wg-info-tint); border-color: var(--wg-info-line); border-left-color: var(--wg-info); color: #1e3a5f; }
.warn-box { background: var(--wg-warn-tint); border-left: 3px solid var(--wg-warning); padding: 8px 12px; font-size: var(--wg-fs-sm); color: #78350f; border-radius: 4px; margin-bottom: 10px; }
.checklist-box { background: var(--wg-info-tint); border-left: 3px solid var(--wg-info); padding: 8px 12px; font-size: var(--wg-fs-sm); color: #1e3a5f; border-radius: 4px; margin-bottom: 12px; }
.checklist-box.ok { background: var(--wg-ok-tint); border-left-color: var(--wg-accent); color: #14532d; }
.checklist-box ul { margin: 4px 0 0 18px; padding: 0; }

/* Key / value lists in drawers */
.kv { font-size: var(--wg-fs-sm); }
.kv dt { color: var(--wg-text-muted); font-weight: 500; font-size: var(--wg-fs-xs); }
.kv dd { margin-bottom: 8px; }

/* =====================================================================
   Alerts (flash messages and page errors)
   ===================================================================== */
.alert {
    --bs-alert-border-radius: var(--wg-radius);
    --bs-alert-padding-y: 10px; --bs-alert-padding-x: 14px;
    border: 1px solid transparent; border-left-width: 3px; font-size: var(--wg-fs-sm);
}
.alert-success { background: var(--wg-ok-tint); color: #14532d; border-color: var(--wg-ok-line); border-left-color: var(--wg-accent); }
.alert-danger { background: var(--wg-bad-tint); color: #7f1d1d; border-color: var(--wg-bad-line); border-left-color: var(--wg-danger); }
.alert-warning { background: var(--wg-warn-tint); color: #78350f; border-color: var(--wg-warn-line); border-left-color: var(--wg-warning); }
.alert-info { background: var(--wg-info-tint); color: #1e3a5f; border-color: var(--wg-info-line); border-left-color: var(--wg-info); }
.alert-dismissible .btn-close { padding: 13px 14px; }

/* =====================================================================
   Tabs, pagination, dropdowns
   ===================================================================== */
.nav-tabs {
    --bs-nav-tabs-border-color: var(--wg-border);
    --bs-nav-tabs-link-active-color: var(--wg-text-primary);
    --bs-nav-tabs-link-active-bg: transparent;
    --bs-nav-tabs-link-active-border-color: transparent transparent var(--wg-accent);
    --bs-nav-tabs-link-hover-border-color: transparent transparent var(--wg-border-strong);
    --bs-nav-link-color: var(--wg-text-secondary);
    --bs-nav-link-hover-color: var(--wg-text-primary);
    --bs-nav-link-font-size: var(--wg-fs-sm);
    --bs-nav-link-font-weight: 500;
    --bs-nav-link-padding-y: 8px; --bs-nav-link-padding-x: 12px;
    gap: 4px;
}
.nav-tabs .nav-link { border-width: 0 0 2px; margin-bottom: -1px; border-radius: 0; }
.nav-tabs .nav-link.active { font-weight: 600; }

.pagination { --bs-pagination-font-size: var(--wg-fs-sm); gap: 4px; margin: 0; }
.page-link {
    border: 1px solid var(--wg-border); border-radius: var(--wg-radius) !important;
    padding: 4px 10px; font-weight: 500; color: var(--wg-text-secondary); background: var(--wg-bg-card);
}
.page-link:hover { background: var(--wg-bg-sunken); border-color: var(--wg-border-strong); color: var(--wg-text-primary); }
.page-item.active .page-link { background: var(--wg-primary); border-color: var(--wg-primary); color: #fff; }
.page-item.disabled .page-link { background: var(--wg-bg); color: var(--wg-text-muted); }

.dropdown-menu { --bs-dropdown-border-color: var(--wg-border); --bs-dropdown-border-radius: var(--wg-radius-lg); --bs-dropdown-font-size: var(--wg-fs-sm); --bs-dropdown-link-active-bg: var(--wg-accent-light); --bs-dropdown-link-active-color: var(--wg-text-primary); box-shadow: var(--wg-shadow-md); }

/* =====================================================================
   Floating layers: drawers and dialogs
   ===================================================================== */
.offcanvas { --bs-offcanvas-border-color: var(--wg-border); box-shadow: var(--wg-shadow-lg); }
.offcanvas-end { border-left: 1px solid var(--wg-border); }
.offcanvas-header { background: var(--wg-bg-card); color: var(--wg-text-primary); padding: 14px 20px; border-bottom: 1px solid var(--wg-border); }
.offcanvas-title { font-weight: 600; font-size: var(--wg-fs-lg); }
.offcanvas-body { padding: 20px; }

.modal { --bs-modal-border-color: var(--wg-border); --bs-modal-border-radius: var(--wg-radius-xl); --bs-modal-header-padding: 14px 20px; --bs-modal-padding: 20px; --bs-modal-footer-gap: 8px; }
.modal-content { box-shadow: var(--wg-shadow-lg); }
.modal-header { border-bottom: 1px solid var(--wg-border); }
.modal-title { font-size: var(--wg-fs-lg); font-weight: 600; }
.modal-footer { border-top: 1px solid var(--wg-border); padding: 12px 20px; }

/* =====================================================================
   Empty, loading, footer
   ===================================================================== */
.empty-state, .empty { text-align: center; padding: 40px 24px; color: var(--wg-text-muted); font-size: var(--wg-fs-sm); }
.empty-state-icon {
    width: 48px; height: 48px; margin: 0 auto 12px;
    background: var(--wg-bg-sunken); border-radius: 50%;
    display: flex; align-items: center; justify-content: center; color: var(--wg-text-muted);
}
.empty-state-title { font-size: var(--wg-fs-md); font-weight: 600; color: var(--wg-text-secondary); margin-bottom: 4px; }

.wg-skeleton { display: block; height: 12px; border-radius: 4px; background: linear-gradient(90deg, var(--wg-bg-sunken) 25%, var(--wg-bg) 50%, var(--wg-bg-sunken) 75%); background-size: 200% 100%; animation: wg-shimmer 1.2s linear infinite; }
@keyframes wg-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.footer-wg { padding: 16px 0 0; text-align: right; }
.footer-wg p { margin: 0; color: var(--wg-text-muted); font-size: var(--wg-fs-xs); }

/* =====================================================================
   Sign-in (no sidebar)
   ===================================================================== */
.login-container { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 32px 16px; }
.login-card { width: 100%; max-width: 400px; }
.login-brand { display: flex; justify-content: center; align-items: center; gap: 10px; margin-bottom: 22px; }
.login-brand img { height: 56px; width: auto; }
.login-header { text-align: center; margin-bottom: 22px; }
.login-title { font-size: var(--wg-fs-xl); font-weight: 600; color: var(--wg-text-primary); margin: 0 0 4px; }
.login-subtitle { color: var(--wg-text-secondary); font-size: var(--wg-fs-sm); margin: 0; }

/* =====================================================================
   Home page
   ===================================================================== */
.wg-home { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.wg-tile { grid-column: span 3; background: var(--wg-bg-card); border: 1px solid var(--wg-border); border-radius: var(--wg-radius-lg); padding: 16px 18px; display: flex; flex-direction: column; min-height: 160px; min-width: 0; }
.wg-tile--wide { grid-column: span 8; }
.wg-tile--third { grid-column: span 4; }
.wg-tile-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.wg-tile-title { font-size: var(--wg-fs-md); font-weight: 600; margin: 0; color: var(--wg-text-primary); }
.wg-tile-link { font-size: var(--wg-fs-xs); font-weight: 600; white-space: nowrap; }
.wg-tile-body { flex: 1 1 auto; font-size: var(--wg-fs-sm); color: var(--wg-text-secondary); }
.wg-tile-foot { margin-top: 10px; font-size: var(--wg-fs-xs); color: var(--wg-text-muted); }
.wg-tile.is-error .wg-tile-body { color: var(--wg-bad-ink); }
.wg-tile-lead { font-size: var(--wg-fs-md); color: var(--wg-text-primary); margin: 0 0 6px; }
.wg-tile ul { margin: 6px 0 0; padding-left: 18px; }
.wg-tile li + li { margin-top: 3px; }

.wg-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 8px; }
.wg-stat { padding: 8px 10px; border-radius: var(--wg-radius); background: var(--wg-bg); min-width: 0; }
.wg-stat-value { font-size: var(--wg-fs-2xl); font-weight: 600; line-height: 1.1; color: var(--wg-text-primary); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.wg-stat-label { font-size: var(--wg-fs-xs); color: var(--wg-text-secondary); margin-top: 3px; line-height: 1.3; }
.wg-stat.bad .wg-stat-value { color: var(--wg-bad-ink); }
.wg-stat.warn .wg-stat-value { color: var(--wg-warn-ink); }
.wg-stat.ok .wg-stat-value { color: var(--wg-ok-ink); }
.wg-stat.quiet .wg-stat-value { color: var(--wg-text-muted); }

/* The day's three fetch cycles, drawn as one track */
.wg-cycles { display: flex; align-items: flex-start; margin: 6px 0 16px; position: relative; }
.wg-cycles::before { content: ""; position: absolute; left: 12px; right: 12px; top: 9px; height: 2px; background: var(--wg-border); }
.wg-cycle { flex: 1 1 0; position: relative; text-align: center; min-width: 0; }
.wg-cycle-dot { width: 20px; height: 20px; border-radius: 50%; margin: 0 auto; background: var(--wg-bg-card); border: 2px solid var(--wg-border-strong); position: relative; display: flex; align-items: center; justify-content: center; }
.wg-cycle-dot svg { width: 11px; height: 11px; stroke-width: 3; }
.wg-cycle.done .wg-cycle-dot { background: var(--wg-accent); border-color: var(--wg-accent); color: #fff; }
.wg-cycle.running .wg-cycle-dot { border-color: var(--wg-accent); box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.18); animation: wg-pulse 1.6s ease-in-out infinite; }
.wg-cycle.running .wg-cycle-dot::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--wg-accent); }
.wg-cycle.failed .wg-cycle-dot { background: var(--wg-danger); border-color: var(--wg-danger); color: #fff; }
.wg-cycle.stalled .wg-cycle-dot { background: var(--wg-warning); border-color: var(--wg-warning); color: #fff; }
.wg-cycle-time { font-size: var(--wg-fs-sm); font-weight: 600; margin-top: 6px; color: var(--wg-text-primary); font-variant-numeric: tabular-nums; }
.wg-cycle-note { font-size: var(--wg-fs-xs); color: var(--wg-text-muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wg-cycle.upcoming .wg-cycle-time { color: var(--wg-text-muted); font-weight: 500; }
@keyframes wg-pulse { 0%, 100% { box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.18); } 50% { box-shadow: 0 0 0 7px rgba(16, 185, 129, 0.08); } }

.wg-home-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.wg-home-date { font-size: var(--wg-fs-sm); color: var(--wg-text-secondary); font-variant-numeric: tabular-nums; }

@media (max-width: 1279.98px) {
    .wg-tile { grid-column: span 6; }
    .wg-tile--wide { grid-column: span 12; }
    .wg-tile--third { grid-column: span 12; }
}
@media (max-width: 767.98px) {
    .wg-tile, .wg-tile--wide, .wg-tile--third { grid-column: span 12; }
    .page-title { font-size: 18px; }
    .card-wg-body { padding: 14px; }
}

/* =====================================================================
   Utilities
   ===================================================================== */
.text-truncate-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.min-w-0 { min-width: 0; }
.spinner-border { --bs-spinner-border-width: 2px; color: var(--wg-accent); }

/* Home page: the row of small tiles fits whatever this user may see */
.wg-home-row { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.wg-home-row .wg-tile { grid-column: auto; }
.wg-rows { list-style: none; margin: 0; padding: 0; }
.wg-rows li { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-top: 1px solid var(--wg-border-light); font-size: var(--wg-fs-sm); color: var(--wg-text-primary); }
.wg-rows li:first-child { border-top: 0; padding-top: 0; }
.wg-rows li > span:last-child { color: var(--wg-text-secondary); }
.wg-notes { list-style: none; margin: 10px 0 0; padding: 0; font-size: var(--wg-fs-sm); color: var(--wg-text-primary); }
.wg-notes li { padding: 3px 0; }
.wg-notes li + li { border-top: 1px solid var(--wg-border-light); }
.wg-stages { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.wg-stages li { display: inline-flex; align-items: center; gap: 4px; font-size: var(--wg-fs-xs); padding: 3px 8px; border-radius: 999px; background: var(--wg-bg-sunken); color: var(--wg-text-secondary); }
.wg-stages li.done { background: var(--wg-ok-tint); color: var(--wg-ok-ink); }
.wg-stages li.done .wg-icon { width: 12px; height: 12px; stroke-width: 3; }
.wg-stages li.current { background: var(--wg-accent-light); color: var(--wg-accent-ink); font-weight: 600; }
.wg-tile.is-loading .wg-skeleton + .wg-skeleton { margin-top: 8px; }
