/* ============================================================
   Aysha Dashboard — design tokens
   Palette: CRM & Client Management (professional blue + deal green)
   Type: Inter (self-hosted, static/vendor/fonts/) — Data-Dense Dashboard density
   ============================================================ */

@font-face {
    font-family: 'Inter';
    src: url('/static/vendor/fonts/inter-var.woff2') format('woff2-variations'),
         url('/static/vendor/fonts/inter-var.woff2') format('woff2');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

:root {
    color-scheme: light;

    /* --- Semantic tokens (light) ---
       Primary/ring follow the KQPAC brand violet (same as the login button)
       everywhere in the app — not just the login page. */
    --color-primary: #775ef6;
    --color-primary-hover: #6845f5;
    --color-on-primary: #ffffff;
    --color-accent: #059669;
    --color-accent-hover: #047857;
    --color-on-accent: #ffffff;

    --color-bg: #f8fafc;
    --color-surface: #ffffff;
    --color-surface-raised: #ffffff;
    --color-foreground: #0f172a;
    --color-muted: #f1f5fd;
    --color-muted-foreground: #64748b;
    --color-border: #e2e8f0;
    --color-border-strong: #cbd5e1;

    --color-destructive: #dc2626;
    --color-destructive-bg: #fef2f2;
    --color-warning: #b45309;
    --color-warning-bg: #fef3c7;
    --color-grace: #b3541e;
    --color-grace-bg: #ffe9d6;
    --color-success: #059669;
    --color-success-bg: #ecfdf5;
    --color-ring: #775ef6;

    /* Dashboard chart palette — validated with the dataviz skill's CVD/contrast
       checker (scripts/validate_palette.js), not reused from the badge tokens
       above: validating those turned up a real bug (--color-warning and
       --color-grace are ΔE 0.9 apart — nearly indistinguishable even with
       normal color vision). Flagged, not fixed here — out of scope for this
       change since it'd touch every badge across the app.
       Categorical triad (violet/blue/gold) passes CVD-safe adjacency in both
       modes; the status quad (good/warning/serious/critical) cannot ALL
       mutually clear the adjacency floor (3 warm hues can't be pairwise ≥15
       ΔE apart), so status counts render as separate labeled stat cards, not
       adjacent chart marks — sidesteps the adjacency requirement entirely
       per the skill's own "is it even a chart" checkpoint. */
    --chart-cat-1: #775ef6;
    --chart-cat-2: #0369a1;
    --chart-cat-3: #a16207;
    --chart-status-good: #15803d;
    --chart-status-warning: #ca8a04;
    --chart-status-serious: #c2410c;
    --chart-status-critical: #dc2626;
    --chart-delta-up: #006300;
    --chart-delta-down: #dc2626;

    /* KQPAC wordmark's trailing dot — fixed brand color, exact match to
       docs/logo.png, not theme-adaptive like the semantic tokens above. */
    --color-brand-dot: #65d0eb;

    /* KQPAC marketing-site palette (kqpac.com) — sampled from docs/web-*.png.
       Used only for the login page's brand panel, which stays fixed-dark
       regardless of light/dark preference (brand imagery, not a UI surface). */
    --kqpac-bg: #08080c;
    --kqpac-surface: #0e0e16;
    --kqpac-foreground: #ffffff;
    --kqpac-muted: #9a9ab0;
    --kqpac-border: rgba(255, 255, 255, 0.08);
    --kqpac-cyan: #65d0eb;
    --kqpac-violet: #775ef6;
    --kqpac-violet-hover: #8b73ff;

    /* --- Legacy aliases (still referenced inline in a few templates) --- */
    --border: var(--color-border);
    --muted: var(--color-muted-foreground);
    --ok: var(--color-success);
    --warn: var(--color-warning);
    --danger: var(--color-destructive);
    --accent: var(--color-primary);
    --text: var(--color-foreground);
    --bg-alt: var(--color-muted);

    /* --- Typography --- */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    --text-xs: 0.75rem;
    --text-sm: 0.8125rem;
    --text-base: 0.9375rem;
    --text-md: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.375rem;
    --text-2xl: 1.75rem;
    --leading-normal: 1.5;
    --leading-tight: 1.25;

    /* --- Spacing (dense-dashboard scale) --- */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;

    /* --- Radius / shadow / motion --- */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 10px;
    --radius-pill: 999px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);
    --transition-fast: 140ms ease;
}

@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: dark;

        --color-primary: #8b73ff;
        --color-primary-hover: #a794ff;
        --color-on-primary: #ffffff;
        --color-accent: #10b981;
        --color-accent-hover: #34d399;
        --color-on-accent: #04160f;

        --color-bg: #0b1220;
        --color-surface: #111a2e;
        --color-surface-raised: #16223a;
        --color-foreground: #e2e8f0;
        --color-muted: #182338;
        --color-muted-foreground: #94a3b8;
        --color-border: #24304a;
        --color-border-strong: #33415f;

        --color-destructive: #f87171;
        --color-destructive-bg: #2a1414;
        --color-warning: #fbbf24;
        --color-warning-bg: #2c2410;
        --color-grace: #fb923c;
        --color-grace-bg: #2b1d10;
        --color-success: #34d399;
        --color-success-bg: #0f2a20;
        --color-ring: #8b73ff;

        --chart-cat-1: #8b73ff;
        --chart-cat-2: #0284c7;
        --chart-cat-3: #a16207;
        --chart-status-good: #22c55e;
        --chart-status-warning: #eab308;
        --chart-status-serious: #f97316;
        --chart-status-critical: #f87171;
        --chart-delta-up: #0ca30c;
        --chart-delta-down: #f87171;

        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
        --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
    }
}

/* ============================================================
   Reset & base
   ============================================================ */

* { box-sizing: border-box; }

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

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--color-foreground);
    background: var(--color-bg);
    margin: 0;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: var(--leading-tight); font-weight: 600; margin: 0 0 var(--space-4); }
h1 { font-size: var(--text-xl); letter-spacing: -0.01em; }
h2 { font-size: var(--text-lg); }
h3 {
    font-size: var(--text-sm);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-muted-foreground);
    margin-top: var(--space-6);
}

a { color: var(--color-primary); }

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: var(--text-sm);
    background: var(--color-muted);
    padding: 0.15em 0.4em;
    border-radius: var(--radius-sm);
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}

/* ============================================================
   Top navigation
   ============================================================ */

/* Fixed KQPAC-dark, same as the login page's brand panel — deliberately not
   theme-adaptive, so the brand strip reads identically in light and dark mode. */
.topnav {
    display: flex;
    align-items: center;
    gap: var(--space-6);
    padding: var(--space-3) var(--space-6);
    border-bottom: 1px solid var(--kqpac-border);
    background:
        radial-gradient(ellipse 480px 220px at 8% 0%, color-mix(in srgb, var(--kqpac-violet) 26%, transparent), transparent 70%),
        radial-gradient(ellipse 480px 220px at 96% 100%, color-mix(in srgb, var(--kqpac-cyan) 18%, transparent), transparent 70%),
        var(--kqpac-bg);
    position: sticky;
    top: 0;
    z-index: 40;
}

.topnav .brand {
    font-weight: 800;
    font-size: var(--text-md);
    letter-spacing: -0.03em;
    color: var(--kqpac-foreground);
    text-decoration: none;
}

.brand-logo {
    font-weight: 800;
    font-size: var(--text-2xl);
    letter-spacing: -0.03em;
    color: var(--color-foreground);
    text-align: center;
    margin-bottom: var(--space-6);
}

.brand-dot { color: var(--color-brand-dot); }

.nav-links { display: flex; gap: var(--space-1); flex: 1; }

.nav-links a {
    color: var(--kqpac-muted);
    text-decoration: none;
    font-size: var(--text-sm);
    font-weight: 500;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    transition: background var(--transition-fast), color var(--transition-fast);
}

.nav-links a:hover { color: var(--kqpac-foreground); background: rgba(255, 255, 255, 0.06); }
.nav-links a.active { color: var(--kqpac-cyan); background: color-mix(in srgb, var(--kqpac-cyan) 12%, transparent); }

.logout-form button {
    background: none;
    border: 1px solid var(--kqpac-border);
    border-radius: var(--radius-md);
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-sm);
    font-family: inherit;
    color: var(--kqpac-muted);
    cursor: pointer;
    transition: border-color var(--transition-fast), color var(--transition-fast);
}
.logout-form button:hover { color: var(--kqpac-foreground); border-color: rgba(255, 255, 255, 0.2); }

/* ============================================================
   Page layout
   ============================================================ */

.page-content { max-width: 1200px; margin: 0 auto; padding: var(--space-6); }

/* ============================================================
   Tables — dense, row-hover, horizontal-scroll-safe
   ============================================================ */

.table-wrap {
    overflow-x: auto;
    overflow-y: hidden;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
    margin-top: var(--space-4);
}

table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.table-wrap table { margin-top: 0; }

/* Explicit column widths (via <colgroup>) so columns spread evenly across
   the table's full width instead of auto-layout clustering them to content. */
table.table-fixed { table-layout: fixed; }
table.table-fixed td { overflow: hidden; text-overflow: ellipsis; }

th, td {
    text-align: left;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-border);
    white-space: nowrap;
}

th {
    color: var(--color-muted-foreground);
    font-weight: 600;
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--color-muted);
}

tbody tr { transition: background var(--transition-fast); }
tbody tr:hover { background: var(--color-muted); }
tbody tr:last-child td { border-bottom: none; }

/* ============================================================
   Badges — status dot + label, semantic color
   ============================================================ */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    padding: 0.2rem 0.65rem 0.2rem 0.55rem;
    border-radius: var(--radius-pill);
    font-size: var(--text-xs);
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}
.badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

.badge-active { background: var(--color-success-bg); color: var(--color-success); }
/* Class names match renewal_status()'s actual values ("expiring_soon",
   "grace_period") run through the templates' badge.replace('_', '-') —
   these were "badge-expiring"/"badge-grace" and never matched, so both
   states rendered unstyled everywhere a renewal-status badge appears. */
.badge-expiring-soon { background: var(--color-warning-bg); color: var(--color-warning); }
.badge-grace-period { background: var(--color-grace-bg); color: var(--color-grace); }
.badge-suspended { background: var(--color-destructive-bg); color: var(--color-destructive); }

/* ============================================================
   Filter chips
   ============================================================ */

.chip {
    display: inline-block;
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-pill);
    border: 1px solid var(--color-border);
    font-size: var(--text-sm);
    font-weight: 500;
    margin-right: var(--space-2);
    margin-bottom: var(--space-2);
    cursor: pointer;
    text-decoration: none;
    color: var(--color-muted-foreground);
    background: var(--color-surface);
    transition: all var(--transition-fast);
}
.chip:hover { border-color: var(--color-border-strong); color: var(--color-foreground); }
.chip.active {
    background: var(--color-primary);
    color: var(--color-on-primary);
    border-color: var(--color-primary);
}

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

.btn {
    background: var(--color-primary);
    color: var(--color-on-primary);
    border: 1px solid var(--color-primary);
    border-radius: var(--radius-md);
    padding: var(--space-2) var(--space-4);
    cursor: pointer;
    font-family: inherit;
    font-size: var(--text-sm);
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    min-height: 36px;
    transition: background var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.btn:hover { background: var(--color-primary-hover); border-color: var(--color-primary-hover); }
.btn:focus-visible { outline: 2px solid var(--color-ring); outline-offset: 2px; }

.btn.secondary { background: transparent; color: var(--color-primary); border-color: var(--color-border-strong); }
.btn.secondary:hover { background: var(--color-muted); border-color: var(--color-primary); }

.btn.danger { background: var(--color-destructive); border-color: var(--color-destructive); }
.btn.danger:hover { filter: brightness(0.92); }

.btn:disabled, .btn:disabled:hover {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--color-muted);
    color: var(--color-muted-foreground);
    border-color: var(--color-border);
    filter: none;
}

.btn.sm {
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
    min-height: 30px;
}

/* Page title + primary action on one line, title left, action right —
   used at the top of list pages (Organizations, Plans, etc.). */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}
.page-header h1 { margin: 0; }

/* ============================================================
   Banners
   ============================================================ */

.banner {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    background: var(--color-warning-bg);
    border: 1px solid var(--color-warning);
    color: var(--color-foreground);
    border-radius: var(--radius-lg);
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-4);
    font-size: var(--text-sm);
}
.banner::before { content: "\26A0"; color: var(--color-warning); font-size: var(--text-md); }
.banner.danger { background: var(--color-destructive-bg); border-color: var(--color-destructive); }
.banner.danger::before { color: var(--color-destructive); }
.banner a { font-weight: 600; }

/* ============================================================
   Stat tiles
   ============================================================ */

.stat-row { display: flex; gap: var(--space-4); margin: var(--space-4) 0; flex-wrap: wrap; }

.stat-tile {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
    padding: var(--space-4) var(--space-5);
    min-width: 140px;
    flex: 1 1 140px;
    container-type: inline-size;
}
.stat-tile .value {
    /* Scales down for long values (e.g. "$562,000.00") in a narrow tile
       instead of overflowing the card; caps at --text-2xl for short ones. */
    font-size: clamp(1rem, 9cqi, var(--text-2xl));
    font-weight: 700;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    color: var(--color-foreground);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.stat-tile .label {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-muted-foreground);
    margin-top: var(--space-1);
}

.stat-tile .delta {
    display: inline-flex;
    align-items: center;
    gap: 0.25em;
    font-size: var(--text-xs);
    font-weight: 600;
    margin-top: var(--space-1);
}
.stat-tile .delta.up { color: var(--chart-delta-up); }
.stat-tile .delta.down { color: var(--chart-delta-down); }
.stat-tile .delta.flat { color: var(--color-muted-foreground); }

/* ============================================================
   Dashboard — status stat cards + charts
   ============================================================ */

.status-stat-row { display: flex; gap: var(--space-4); margin: var(--space-4) 0; flex-wrap: wrap; }

.status-stat-card {
    flex: 1 1 140px;
    min-width: 140px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
    padding: var(--space-4) var(--space-5);
    border-top: 3px solid var(--status-color);
}
.status-stat-card .value {
    font-size: var(--text-2xl);
    font-weight: 700;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    color: var(--color-foreground);
}
.status-stat-card .label {
    display: flex;
    align-items: center;
    gap: 0.4em;
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-muted-foreground);
    margin-top: var(--space-1);
}
.status-stat-card .label::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--status-color);
    flex-shrink: 0;
}

.chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: var(--space-4);
    margin: var(--space-4) 0;
}
.chart-grid.chart-grid-thirds { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

.chart-card {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
    padding: var(--space-4) var(--space-5);
}
.chart-card h3 { margin: 0 0 var(--space-3); }
.chart-card .chart-canvas-wrap { position: relative; height: 260px; }
.chart-card.chart-card-compact .chart-canvas-wrap { height: 200px; }

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

form.inline { display: inline-flex; align-items: center; gap: var(--space-2); }

input, select, textarea {
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-family: inherit;
    color: var(--color-foreground);
    background: var(--color-surface);
    min-height: 36px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
textarea { min-height: 72px; }

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-ring) 25%, transparent);
}
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }

label {
    display: block;
    font-size: var(--text-xs);
    font-weight: 600;
    margin-bottom: var(--space-1);
    color: var(--color-muted-foreground);
}

.field { margin-bottom: var(--space-4); }
.field input, .field select, .field textarea { width: 100%; }

button:focus-visible, a:focus-visible {
    outline: 2px solid var(--color-ring);
    outline-offset: 2px;
}

/* ============================================================
   Modal
   ============================================================ */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}
.modal {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: var(--space-6);
    width: 560px;
    max-width: 90vw;
    max-height: 85vh;
    overflow-y: auto;
}

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }

/* Inline filter bars (Reports/Revenue date-range + dropdown filters) — each
   .field sits label-above-input, side by side, submit button baseline-aligned
   to the inputs rather than the labels. */
.filter-form { display: flex; align-items: flex-end; gap: var(--space-4); flex-wrap: wrap; margin: 0; }
.filter-form .field { margin-bottom: 0; }
.filter-form .field input, .filter-form .field select { width: auto; }

.modal-actions { display: flex; gap: var(--space-3); margin-top: var(--space-2); }

.modal-footnote { font-size: var(--text-xs); color: var(--color-muted-foreground); margin: var(--space-4) 0 0; }

/* Secondary org actions (type/status/API key/billing) stacked below the main
   edit form, inside the same modal — each a labeled block with a divider. */
.modal-section { border-top: 1px solid var(--color-border); margin-top: var(--space-6); padding-top: var(--space-2); }
.modal-section h3 { margin-top: 0; }
.modal-section-note { font-size: var(--text-sm); color: var(--color-foreground); margin: 0 0 var(--space-3); }

.link-button {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: var(--color-primary);
    cursor: pointer;
    text-decoration: none;
}
.link-button:hover { text-decoration: underline; }

/* Select2 (timezone field) — light theme overlay to match our tokens instead
   of its default bootstrap-blue look. */
.select2-container { width: 100%; font-family: var(--font-sans); }
.select2-container--default .select2-selection--single {
    height: 36px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 34px;
    padding-left: var(--space-3);
    padding-right: var(--space-6);
    color: var(--color-foreground);
    font-size: var(--text-sm);
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 34px;
    right: var(--space-2);
}
.select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: var(--color-muted-foreground) transparent transparent transparent;
}
.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
    border-color: transparent transparent var(--color-muted-foreground) transparent;
}
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-ring) 25%, transparent);
    outline: none;
}
.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: var(--color-muted-foreground);
}
.select2-dropdown {
    border-color: var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    box-shadow: var(--shadow-md);
}
.select2-search--dropdown .select2-search__field {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-foreground);
    font-family: var(--font-sans);
    padding: var(--space-1) var(--space-2);
}
.select2-search--dropdown .select2-search__field:focus {
    outline: none;
    border-color: var(--color-primary);
}
.select2-results__option { color: var(--color-foreground); }
.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background: var(--color-primary);
    color: var(--color-on-primary);
}
.select2-container--default .select2-results__option[aria-selected="true"] {
    background: var(--color-muted);
}

[x-cloak] { display: none !important; }

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

.error { color: var(--color-destructive); font-size: var(--text-sm); margin-top: var(--space-2); }

/* ============================================================
   Auth layout — split brand panel + form panel (login page)
   ============================================================ */

.auth-layout {
    display: flex;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    max-width: none;
}

.auth-brand-panel {
    position: relative;
    flex: 1 1 50%;
    max-width: 640px;
    background: var(--kqpac-bg);
    color: var(--kqpac-foreground);
    padding: var(--space-8) var(--space-8) var(--space-6);
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
}

.auth-brand-glow {
    position: absolute;
    inset: -20%;
    background:
        radial-gradient(circle at 30% 20%, color-mix(in srgb, var(--kqpac-violet) 28%, transparent), transparent 55%),
        radial-gradient(circle at 75% 75%, color-mix(in srgb, var(--kqpac-cyan) 18%, transparent), transparent 55%);
    pointer-events: none;
}

.auth-brand-inner { position: relative; max-width: 460px; margin: 0 auto; width: 100%; }

.brand-logo-left {
    text-align: left;
    color: var(--kqpac-foreground);
    margin-bottom: var(--space-8);
}

.auth-tagline {
    font-size: var(--text-2xl);
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: var(--leading-tight);
    color: var(--kqpac-foreground);
    margin: 0 0 var(--space-3);
}

.auth-subtagline {
    font-size: var(--text-sm);
    color: var(--kqpac-muted);
    line-height: var(--leading-normal);
    margin-bottom: var(--space-8);
}

.auth-feature-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
}

.feature-card {
    background: var(--kqpac-surface);
    border: 1px solid var(--kqpac-border);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
}

.feature-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--kqpac-cyan) 15%, transparent);
    color: var(--kqpac-cyan);
    margin-bottom: var(--space-3);
}
.feature-icon svg { width: 16px; height: 16px; }

.feature-label {
    display: block;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--kqpac-cyan);
    margin-bottom: var(--space-2);
}

.feature-heading {
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--kqpac-foreground);
    text-transform: none;
    letter-spacing: normal;
    margin: 0 0 var(--space-1);
}

.feature-sub { font-size: var(--text-xs); color: var(--kqpac-muted); line-height: var(--leading-normal); margin: 0; }

.auth-form-panel {
    flex: 1 1 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg);
    padding: var(--space-6);
}

.auth-form-card { width: 100%; max-width: 380px; }
.auth-form-card h1 { margin-bottom: var(--space-2); }
.auth-form-subtitle { color: var(--color-muted-foreground); font-size: var(--text-sm); margin: 0 0 var(--space-6); }

/* Brand-matched focus ring for the login form specifically — violet, same
   accent as the Sign In button and brand panel, instead of the dashboard's
   generic blue ring used everywhere else. */
.password-input { position: relative; }
.password-input input { padding-right: 2.5rem; }
.password-toggle {
    position: absolute;
    top: 50%;
    right: var(--space-2);
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: var(--space-1);
    color: var(--color-muted-foreground);
    cursor: pointer;
    display: flex;
    border-radius: var(--radius-sm);
}
.password-toggle:hover { color: var(--color-foreground); }
.password-toggle svg { width: 18px; height: 18px; }

.auth-submit { width: 100%; justify-content: center; margin-top: var(--space-2); }

@media (max-width: 900px) {
    .auth-brand-panel { display: none; }
}

@media (max-width: 640px) {
    .page-content { padding: var(--space-4); }
    .topnav { flex-wrap: wrap; padding: var(--space-3) var(--space-4); }
    .nav-links { order: 3; width: 100%; overflow-x: auto; }
    .auth-form-panel { padding: var(--space-4); }
}
