﻿/* ══════════════════════════════════════════════════════════════
   NDMA KnowledgeWebPro — Design System
   Aesthetic: Command Deck — Horizontal Navigation
   Palette: Deep Navy + Warm Amber + Crisp White
   ══════════════════════════════════════════════════════════════ */

:root {
    /* ── Core Palette ── */
    --kw-navy-900: #0A1628;
    --kw-navy-800: #0D1F3C;
    --kw-navy-700: #132D50;
    --kw-navy-600: #1A3A64;
    --kw-navy-500: #1E4D8C;
    --kw-navy-400: #2563A8;
    --kw-navy-300: #3B82C4;
    --kw-navy-200: #6BA3DB;
    --kw-navy-100: #B8D4EE;
    --kw-navy-50: #E8F1FA;

    --kw-amber-500: #E8920C;
    --kw-amber-400: #F5A623;
    --kw-amber-300: #FBBF4E;
    --kw-amber-200: #FCD88A;
    --kw-amber-100: #FEF0CD;

    --kw-teal-500: #0D9488;
    --kw-teal-400: #14B8A6;
    --kw-emerald-500: #059669;
    --kw-rose-500: #E11D48;
    --kw-violet-500: #7C3AED;

    /* ── Surface & Text ── */
    --kw-surface: #FFFFFF;
    --kw-surface-raised: #FFFFFF;
    --kw-surface-muted: #F7F9FC;
    --kw-surface-hover: #EEF2F9;
    --kw-border: #E2E8F0;
    --kw-border-subtle: #F1F5F9;
    --kw-line: var(--kw-border);   /* legacy alias consumed widely; was never defined */
    --kw-text-primary: #1E293B;
    --kw-text-secondary: #64748B;
    --kw-text-muted: #94A3B8;

    /* ── Spacing ── */
    --kw-radius-sm: 6px;
    --kw-radius-md: 10px;
    --kw-radius-lg: 14px;
    --kw-radius-xl: 20px;

    /* ── Layout ── */
    --kw-topbar-h: 52px;
    --kw-navrail-h: 44px;
    --kw-header-total: calc(var(--kw-topbar-h) + var(--kw-navrail-h));

    /* ── Shadows ── */
    --kw-shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.04), 0 1px 2px rgba(15, 23, 42, 0.06);
    --kw-shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06), 0 2px 4px rgba(15, 23, 42, 0.04);
    --kw-shadow-lg: 0 12px 40px rgba(15, 23, 42, 0.08), 0 4px 12px rgba(15, 23, 42, 0.04);
    --kw-shadow-card: 0 1px 3px rgba(15, 23, 42, 0.03), 0 6px 24px rgba(15, 23, 42, 0.06);
    --kw-shadow-card-hover: 0 4px 8px rgba(15, 23, 42, 0.04), 0 12px 40px rgba(15, 23, 42, 0.10);

    /* ── Transitions ── */
    --kw-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --kw-ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --kw-duration-fast: 150ms;
    --kw-duration-normal: 250ms;
    --kw-duration-slow: 400ms;
}

/* ── Dark mode overrides ──
   Applied by MainLayout/PublicLayout as `kw-dark` when the theme toggle is on.
   NOTE: do NOT rename this back to `.mud-theme-dark`. MudBlazor 9 never emits that
   class (it swaps CSS custom properties on :root instead), AND it ships its own
   `.mud-theme-dark` utility that forces `color`/`background-color` with !important —
   so borrowing the name both fails to apply and, if applied, paints the wrong colours. */
.kw-dark {
    --kw-surface: #141824;
    --kw-surface-raised: #1C2233;
    --kw-surface-muted: #111520;
    --kw-surface-hover: #232940;
    --kw-border: #2A3149;
    --kw-border-subtle: #1E2438;
    --kw-text-primary: #E8ECF4;
    --kw-text-secondary: #8B95AD;
    --kw-text-muted: #5A6478;
    --kw-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
    --kw-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.25);
    --kw-shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.3);
    --kw-shadow-card: 0 2px 8px rgba(0, 0, 0, 0.2), 0 8px 32px rgba(0, 0, 0, 0.15);
    --kw-shadow-card-hover: 0 4px 12px rgba(0, 0, 0, 0.25), 0 16px 48px rgba(0, 0, 0, 0.2);
}

/* ══════════════════════════════════════════════════════════════
   Global Resets & Base
   ══════════════════════════════════════════════════════════════ */

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background: var(--kw-surface-muted);
    color: var(--kw-text-primary);
    margin: 0;
}

h1:focus { outline: none; }

::selection {
    background: var(--kw-navy-200);
    color: var(--kw-navy-900);
}

.kw-dark ::selection {
    background: var(--kw-navy-600);
    color: var(--kw-navy-50);
}

/* ══════════════════════════════════════════════════════════════
   Shell — Stacked Layout (no sidebar)
   ══════════════════════════════════════════════════════════════ */

.kw-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ══════════════════════════════════════════════════════════════
   Top Brand Bar
   ══════════════════════════════════════════════════════════════ */

.kw-topbar {
    height: var(--kw-topbar-h);
    background: linear-gradient(135deg, var(--kw-navy-900) 0%, var(--kw-navy-800) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    position: sticky;
    top: 0;
    z-index: 1100;
    flex-shrink: 0;
}

.kw-topbar-inner {
    max-width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

/* Brand */
.kw-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.kw-logo-mark {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--kw-amber-400), var(--kw-amber-500));
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 0.9rem;
    color: var(--kw-navy-900);
    flex-shrink: 0;
    box-shadow: 0 2px 10px rgba(232, 146, 12, 0.35);
    transition: transform var(--kw-duration-normal) var(--kw-ease-spring);
}

.kw-logo-mark:hover {
    transform: rotate(-6deg) scale(1.05);
}

.kw-brand-text {
    display: flex;
    align-items: center;
    gap: 10px;
}

.kw-brand-name {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.92);
    letter-spacing: -0.01em;
}

.kw-brand-accent {
    color: var(--kw-amber-300);
}

.kw-brand-badge {
    padding: 2px 9px;
    border-radius: 100px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.06);
    line-height: 1.6;
}

/* Topbar Actions */
.kw-topbar-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.kw-topbar-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color var(--kw-duration-fast) var(--kw-ease-out),
                color var(--kw-duration-fast) var(--kw-ease-out);
    position: relative;
}

.kw-topbar-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.9);
}

.kw-topbar-btn--notif {
    position: relative;
}

.kw-notif-dot {
    position: absolute;
    top: 7px;
    right: 8px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--kw-amber-400);
    border: 2px solid var(--kw-navy-900);
    animation: kw-pulse 2s ease-in-out infinite;
}

@keyframes kw-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.kw-topbar-divider {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.08);
    margin: 0 8px;
}

.kw-avatar-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.12);
    background: linear-gradient(135deg, var(--kw-navy-600), var(--kw-navy-500));
    color: rgba(255, 255, 255, 0.85);
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 0.78rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color var(--kw-duration-fast) var(--kw-ease-out),
                transform var(--kw-duration-fast) var(--kw-ease-out);
}

.kw-avatar-btn:hover {
    border-color: var(--kw-amber-400);
    transform: scale(1.06);
}

/* ══════════════════════════════════════════════════════════════
   Navigation Rail — Horizontal
   ══════════════════════════════════════════════════════════════ */

.kw-nav-rail {
    height: var(--kw-navrail-h);
    background: var(--kw-surface);
    border-bottom: 1px solid var(--kw-border);
    position: sticky;
    top: var(--kw-topbar-h);
    z-index: 1090;
    flex-shrink: 0;
}

.kw-dark .kw-nav-rail {
    background: var(--kw-surface-raised);
    border-bottom-color: var(--kw-border);
}

.kw-nav-rail-inner {
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 20px;
}

.kw-nav-items {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.kw-nav-items::-webkit-scrollbar {
    display: none;
}

.kw-nav-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 14px;
    height: 34px;
    border-radius: 8px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--kw-text-secondary);
    text-decoration: none;
    white-space: nowrap;
    transition: background-color var(--kw-duration-fast) var(--kw-ease-out),
                color var(--kw-duration-fast) var(--kw-ease-out);
    position: relative;
    flex-shrink: 0;
}

.kw-nav-item:hover {
    background: var(--kw-surface-hover);
    color: var(--kw-text-primary);
}

.kw-nav-item.active {
    background: var(--kw-navy-50);
    color: var(--kw-navy-600);
    font-weight: 600;
}

.kw-dark .kw-nav-item.active {
    background: rgba(59, 130, 196, 0.12);
    color: var(--kw-navy-200);
}

/* Active indicator line */
.kw-nav-item.active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 14px;
    right: 14px;
    height: 2px;
    border-radius: 2px 2px 0 0;
    background: var(--kw-navy-500);
}

.kw-dark .kw-nav-item.active::after {
    background: var(--kw-navy-300);
}

.kw-nav-item .mud-icon-root {
    font-size: 1.15rem;
    opacity: 0.7;
    transition: opacity var(--kw-duration-fast);
}

.kw-nav-item:hover .mud-icon-root,
.kw-nav-item.active .mud-icon-root {
    opacity: 1;
}

.kw-nav-sep {
    width: 1px;
    height: 20px;
    background: var(--kw-border);
    margin: 0 6px;
    flex-shrink: 0;
}

/* Nav toggle (expandable section) */
.kw-nav-toggle {
    position: relative;
}

.kw-nav-chevron {
    font-size: 0.9rem !important;
    opacity: 0.5;
    margin-left: -2px;
}

/* Nav sub-items (admin sub-routes) */
.kw-nav-sub {
    font-size: 0.72rem !important;
    padding: 4px 8px !important;
    opacity: 0.85;
}

.kw-nav-sub .mud-icon-root {
    font-size: 0.95rem !important;
}

.kw-nav-sub.active {
    opacity: 1;
}

/* ══════════════════════════════════════════════════════════════
   Two-tier contextual navigation (module bar + context bar)
   Each module carries its signature colour via the --kw-mod var.
   ══════════════════════════════════════════════════════════════ */
.kw-mod {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 14px;
    height: 34px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--kw-text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
    transition: background-color var(--kw-duration-fast) var(--kw-ease-out),
                color var(--kw-duration-fast) var(--kw-ease-out);
}
.kw-mod .mud-icon-root { font-size: 1.15rem; opacity: 0.7; }
.kw-mod:hover { background: var(--kw-surface-hover); color: var(--kw-text-primary); }
.kw-mod:hover .mud-icon-root { opacity: 1; }
.kw-mod.active {
    color: var(--kw-mod);
    background: color-mix(in srgb, var(--kw-mod) 12%, transparent);
    font-weight: 600;
}
.kw-mod.active .mud-icon-root { opacity: 1; }

.kw-nav-context {
    position: sticky;
    top: var(--kw-header-total);
    z-index: 1089;
    height: 40px;
    box-sizing: border-box;
    background: var(--kw-surface);
    border-bottom: 1px solid var(--kw-border);
    border-top: 2px solid color-mix(in srgb, var(--kw-mod) 55%, transparent);
    flex-shrink: 0;
}
.kw-dark .kw-nav-context { background: var(--kw-surface-raised); }
.kw-nav-context-inner {
    height: 100%;
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 0 24px;
    overflow-x: auto;
    scrollbar-width: none;
}
.kw-nav-context-inner::-webkit-scrollbar { display: none; }

.kw-ctx {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 0 12px;
    height: 28px;
    border: none;
    background: transparent;
    border-radius: 7px;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--kw-text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
    transition: background-color var(--kw-duration-fast) var(--kw-ease-out),
                color var(--kw-duration-fast) var(--kw-ease-out);
}
.kw-ctx .mud-icon-root { font-size: 1rem; opacity: 0.65; }
.kw-ctx:hover { background: var(--kw-surface-hover); color: var(--kw-text-primary); }
.kw-ctx:hover .mud-icon-root { opacity: 1; }
.kw-ctx.active {
    color: var(--kw-mod);
    background: color-mix(in srgb, var(--kw-mod) 14%, transparent);
    font-weight: 600;
}
.kw-ctx.active .mud-icon-root { opacity: 1; }
.kw-ctx-chev { font-size: 0.85rem !important; opacity: 0.55; margin-left: -1px; }
.kw-ctx-bracket { width: 1px; height: 16px; background: var(--kw-border); margin: 0 6px; flex: 0 0 auto; }
.kw-ctx-sub { height: 26px; font-size: 0.76rem; }

/* Mobile drawer items */
.kw-mobile-nav-item { width: 100%; border: none; background: transparent; text-align: left; cursor: pointer; }
.kw-mobile-nav-sub2 { padding-left: 48px !important; font-size: 0.78rem; opacity: 0.82; }

/* Native <details> dropdown menus (avatar + More) — no popover/JS dependency */
.kw-menu { position: relative; }
.kw-menu > summary { list-style: none; cursor: pointer; }
.kw-menu > summary::-webkit-details-marker { display: none; }
.kw-menu > summary::marker { content: ""; font-size: 0; }
.kw-nav-more { flex-shrink: 0; }
.kw-menu-pop {
    position: absolute;
    top: calc(100% + 8px);
    z-index: 1300;
    min-width: 232px;
    padding: 6px;
    background: var(--kw-surface);
    border: 1px solid var(--kw-border);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
}
.kw-menu-pop--right { right: 0; }
.kw-menu-pop--left { left: 0; }
.kw-dark .kw-menu-pop { background: var(--kw-surface-raised); }
.kw-menu-head { padding: 10px 12px 12px; border-bottom: 1px solid var(--kw-border); margin-bottom: 4px; }
.kw-menu-name { font-weight: 600; font-size: 0.9rem; color: var(--kw-text-primary); }
.kw-menu-email { font-size: 0.78rem; color: var(--kw-text-secondary); margin-top: 2px; word-break: break-all; }
.kw-menu-item {
    display: flex; align-items: center; gap: 12px;
    width: 100%; box-sizing: border-box;
    padding: 9px 12px; border: none; background: transparent;
    border-radius: 8px; cursor: pointer; text-align: left; text-decoration: none;
    font-family: 'DM Sans', sans-serif; font-size: 0.85rem; color: var(--kw-text-primary);
}
.kw-menu-item .mud-icon-root { font-size: 1.15rem; opacity: 0.7; }
.kw-menu-item:hover { background: var(--kw-surface-hover); }
.kw-menu-divider { height: 1px; background: var(--kw-border); margin: 4px 0; }

/* nav items are now <a> — strip link underline */
.kw-mod, .kw-ctx, .kw-mobile-nav-item { text-decoration: none; }

/* ── E-signature pad ── */
.kw-sig-canvas-wrap { position: relative; }
.kw-sig-canvas {
    width: 100%;
    border: 1.5px dashed var(--kw-border);
    border-radius: 10px;
    background: #fff;
    cursor: crosshair;
    touch-action: none;
    display: block;
}
.kw-sig-hint {
    position: absolute; left: 12px; bottom: 8px;
    font-size: 0.72rem; color: var(--kw-text-muted); pointer-events: none;
}
.kw-sig-typed-preview {
    margin-top: 10px; padding: 10px 16px;
    border: 1px solid var(--kw-border); border-radius: 10px; background: #fff;
    font-family: 'Segoe Script', 'Brush Script MT', cursive;
    font-size: 1.9rem; color: #1e3a5f;
}
/* signature shown on the approval timeline */
.kw-sig-thumb { max-height: 56px; max-width: 220px; border: 1px solid var(--kw-border); border-radius: 6px; background:#fff; padding:2px 4px; }
.kw-sig-typed-thumb { font-family: 'Segoe Script', 'Brush Script MT', cursive; font-size: 1.25rem; color: #1e3a5f; }

/* ── Document preview drawer (right-side panel) ── */
.kw-prev-overlay {
    position: fixed; inset: 0;
    background: rgba(15,23,42,0.45);
    backdrop-filter: blur(2px);
    opacity: 0; visibility: hidden;
    transition: opacity .3s ease, visibility .3s ease;
    z-index: 1399;
}
.kw-prev-overlay.open { opacity: 1; visibility: visible; }
.kw-prev-panel {
    position: fixed; top: 0; right: 0; bottom: 0;
    width: min(900px, 92vw);
    background: #fff;
    border-left: 1px solid var(--kw-border, #e2e8f0);
    box-shadow: -8px 0 40px rgba(0,0,0,0.22);
    z-index: 1400;
    display: flex; flex-direction: column;
    transform: translateX(100%);
    transition: transform .35s cubic-bezier(.4,0,.2,1);
}
.kw-prev-panel.open { transform: translateX(0); }
.kw-prev-resize {
    position: absolute; left: 0; top: 0; bottom: 0;
    width: 7px; cursor: ew-resize; z-index: 5;
    background: transparent;
}
.kw-prev-resize:hover, .kw-prev-resize:active { background: rgba(245, 158, 11, 0.35); }
.kw-prev-head {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px; flex: 0 0 auto;
    background: #0f172a; color: #fff;
}
.kw-prev-head-icon { color: #f59e0b; }
.kw-prev-head-meta { flex: 1; min-width: 0; }
.kw-prev-head-title { font-weight: 600; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kw-prev-head-sub { font-size: 0.72rem; color: rgba(255,255,255,0.6); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kw-prev-head-actions { display: flex; align-items: center; gap: 4px; }
.kw-prev-icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 8px;
    background: transparent; border: none; color: rgba(255,255,255,0.85);
    cursor: pointer; text-decoration: none; transition: background .15s ease;
}
.kw-prev-icon-btn:hover { background: rgba(255,255,255,0.14); color: #fff; }
.kw-prev-body { flex: 1; min-height: 0; display: flex; flex-direction: column; background: #f1f5f9; position: relative; }
.kw-prev-frame { flex: 1; width: 100%; border: none; background: #fff; }
.kw-prev-imgwrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 16px; overflow: auto; }
.kw-prev-img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; box-shadow: 0 4px 24px rgba(0,0,0,0.18); }
.kw-prev-center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 24px; text-align: center; }
.kw-prev-fallback { color: var(--kw-text-muted,#64748b); }
.kw-prev-fallback-title { font-weight: 600; font-size: 1rem; color: var(--kw-text-primary,#1e293b); }
.kw-prev-fallback-sub { font-size: 0.82rem; }
.kw-prev-note {
    flex: 0 0 auto; display: flex; align-items: center; gap: 6px;
    padding: 6px 12px; font-size: 0.72rem; color: var(--kw-text-muted,#64748b);
    background: #fff; border-top: 1px solid var(--kw-border,#e2e8f0);
}
@media (max-width: 600px) { .kw-prev-panel { width: 100vw; } }

/* Mobile nav sub-items */
.kw-mobile-nav-sub {
    padding-left: 32px !important;
    font-size: 0.85rem;
}

.kw-mobile-nav-sep {
    height: 1px;
    background: var(--kw-border);
    margin: 4px 8px;
}

/* Mobile toggle (hidden on desktop) */
.kw-mobile-toggle {
    display: none;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--kw-text-secondary);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    transition: background var(--kw-duration-fast);
}

.kw-mobile-toggle:hover {
    background: var(--kw-surface-hover);
}

/* Mobile nav dropdown */
.kw-mobile-nav {
    display: none;
    position: absolute;
    top: var(--kw-navrail-h);
    left: 0;
    right: 0;
    background: var(--kw-surface);
    border-bottom: 1px solid var(--kw-border);
    box-shadow: var(--kw-shadow-lg);
    padding: 8px;
    animation: kw-slideDown 200ms var(--kw-ease-out);
    z-index: 1089;
}

.kw-dark .kw-mobile-nav {
    background: var(--kw-surface-raised);
}

@keyframes kw-slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.kw-mobile-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--kw-text-secondary);
    text-decoration: none;
    transition: background-color var(--kw-duration-fast), color var(--kw-duration-fast);
}

.kw-mobile-nav-item:hover {
    background: var(--kw-surface-hover);
    color: var(--kw-text-primary);
}

.kw-mobile-nav-item.active {
    background: var(--kw-navy-50);
    color: var(--kw-navy-600);
    font-weight: 600;
}

.kw-dark .kw-mobile-nav-item.active {
    background: rgba(59, 130, 196, 0.12);
    color: var(--kw-navy-200);
}

/* ── Responsive: collapse nav to hamburger ── */
@media (max-width: 900px) {
    .kw-nav-items {
        display: none;
    }

    .kw-nav-context {
        display: none;
    }

    .kw-mobile-toggle {
        display: flex;
    }

    .kw-mobile-nav {
        display: block;
    }

    .kw-brand-name {
        font-size: 0.95rem;
    }

    .kw-brand-badge {
        display: none;
    }
}

/* ══════════════════════════════════════════════════════════════
   Main Content Area — Full Width
   ══════════════════════════════════════════════════════════════ */

.kw-content {
    flex: 1;
    padding: 28px 32px 40px;
    background: var(--kw-surface-muted);
    max-width: 1920px;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
}

.kw-dark .kw-content {
    background: var(--kw-surface-muted);
}

@media (max-width: 600px) {
    .kw-content {
        padding: 16px;
    }
}

/* ══════════════════════════════════════════════════════════════
   Dashboard Page Header
   ══════════════════════════════════════════════════════════════ */

.kw-page-header {
    background: linear-gradient(135deg, var(--kw-navy-900) 0%, var(--kw-navy-700) 50%, var(--kw-navy-600) 100%);
    border-radius: var(--kw-radius-lg);
    padding: 36px 40px;
    position: relative;
    overflow: hidden;
    margin-bottom: 28px;
}

.kw-page-header::before {
    content: '';
    position: absolute;
    top: -60%;
    right: -10%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(245, 166, 35, 0.12) 0%, transparent 70%);
    pointer-events: none;
}

.kw-page-header::after {
    content: '';
    position: absolute;
    bottom: -40%;
    left: 20%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(59, 130, 196, 0.10) 0%, transparent 70%);
    pointer-events: none;
}

.kw-page-header-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.75rem;
    color: #FFFFFF;
    margin-bottom: 6px;
    position: relative;
    z-index: 1;
}

.kw-page-header-subtitle {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.65);
    position: relative;
    z-index: 1;
}

.kw-page-header-date {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.45);
    position: relative;
    z-index: 1;
    margin-top: 4px;
}

/* ══════════════════════════════════════════════════════════════
   Stat Cards
   ══════════════════════════════════════════════════════════════ */

.kw-stat-card {
    background: var(--kw-surface-raised);
    border: 1px solid var(--kw-border-subtle);
    border-radius: var(--kw-radius-lg);
    padding: 24px;
    box-shadow: var(--kw-shadow-card);
    transition: box-shadow var(--kw-duration-normal) var(--kw-ease-out),
                transform var(--kw-duration-normal) var(--kw-ease-out),
                border-color var(--kw-duration-normal) var(--kw-ease-out);
    position: relative;
    overflow: hidden;
    cursor: default;
}

.kw-stat-card:hover {
    box-shadow: var(--kw-shadow-card-hover);
    transform: translateY(-3px);
    border-color: var(--kw-border);
}

.kw-stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    border-radius: 4px 0 0 4px;
    transition: width var(--kw-duration-normal) var(--kw-ease-out);
}

.kw-stat-card:hover::before {
    width: 6px;
}

.kw-stat-card--investments::before { background: linear-gradient(180deg, var(--kw-navy-400), var(--kw-navy-500)); }
.kw-stat-card--documents::before { background: linear-gradient(180deg, var(--kw-emerald-500), var(--kw-teal-500)); }
.kw-stat-card--workplans::before { background: linear-gradient(180deg, var(--kw-teal-400), var(--kw-teal-500)); }
.kw-stat-card--approvals::before { background: linear-gradient(180deg, var(--kw-amber-400), var(--kw-amber-500)); }

.kw-stat-icon-wrap {
    width: 48px;
    height: 48px;
    border-radius: var(--kw-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform var(--kw-duration-normal) var(--kw-ease-spring);
}

.kw-stat-card:hover .kw-stat-icon-wrap {
    transform: scale(1.08);
}

.kw-stat-icon-wrap--investments {
    background: linear-gradient(135deg, rgba(37, 99, 168, 0.10), rgba(37, 99, 168, 0.05));
    color: var(--kw-navy-400);
}

.kw-stat-icon-wrap--documents {
    background: linear-gradient(135deg, rgba(5, 150, 105, 0.10), rgba(5, 150, 105, 0.05));
    color: var(--kw-emerald-500);
}

.kw-stat-icon-wrap--workplans {
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.10), rgba(20, 184, 166, 0.05));
    color: var(--kw-teal-400);
}

.kw-stat-icon-wrap--approvals {
    background: linear-gradient(135deg, rgba(232, 146, 12, 0.10), rgba(232, 146, 12, 0.05));
    color: var(--kw-amber-500);
}

.kw-stat-value {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.85rem;
    line-height: 1;
    color: var(--kw-text-primary);
    letter-spacing: -0.02em;
}

.kw-stat-label {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--kw-text-secondary);
    margin-top: 4px;
}

.kw-stat-trend {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    border-radius: 100px;
    margin-top: 8px;
}

.kw-stat-trend--up {
    background: rgba(5, 150, 105, 0.08);
    color: var(--kw-emerald-500);
}

.kw-stat-trend--neutral {
    background: rgba(100, 116, 139, 0.08);
    color: var(--kw-text-secondary);
}

/* ══════════════════════════════════════════════════════════════
   Info / Status Panel
   ══════════════════════════════════════════════════════════════ */

.kw-info-panel {
    background: var(--kw-surface-raised);
    border: 1px solid var(--kw-border-subtle);
    border-radius: var(--kw-radius-lg);
    padding: 28px 32px;
    box-shadow: var(--kw-shadow-sm);
    position: relative;
    overflow: hidden;
}

.kw-info-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--kw-navy-500), var(--kw-amber-400), var(--kw-teal-400));
}

.kw-info-panel-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--kw-text-primary);
    margin-bottom: 8px;
}

.kw-info-panel-text {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.875rem;
    color: var(--kw-text-secondary);
    line-height: 1.65;
}

/* ══════════════════════════════════════════════════════════════
   Quick Action Cards
   ══════════════════════════════════════════════════════════════ */

.kw-action-card {
    background: var(--kw-surface-raised);
    border: 1px solid var(--kw-border-subtle);
    border-radius: var(--kw-radius-lg);
    padding: 24px;
    box-shadow: var(--kw-shadow-sm);
    transition: box-shadow var(--kw-duration-normal) var(--kw-ease-out),
                transform var(--kw-duration-normal) var(--kw-ease-out),
                border-color var(--kw-duration-normal) var(--kw-ease-out);
    cursor: pointer;
    text-decoration: none;
    display: block;
    color: inherit;
}

.kw-action-card:hover {
    box-shadow: var(--kw-shadow-md);
    transform: translateY(-2px);
    border-color: var(--kw-navy-100);
}

.kw-dark .kw-action-card:hover {
    border-color: var(--kw-navy-600);
}

.kw-action-card-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--kw-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    font-size: 1.3rem;
    transition: transform var(--kw-duration-normal) var(--kw-ease-spring);
}

.kw-action-card:hover .kw-action-card-icon {
    transform: scale(1.1) rotate(-3deg);
}

.kw-action-card-title {
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--kw-text-primary);
    margin-bottom: 4px;
}

.kw-action-card-desc {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.78rem;
    color: var(--kw-text-muted);
    line-height: 1.5;
}

/* ══════════════════════════════════════════════════════════════
   Staggered Entrance Animations
   ══════════════════════════════════════════════════════════════ */

@keyframes kw-fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes kw-fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes kw-scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.kw-animate-in {
    animation: kw-fadeInUp var(--kw-duration-slow) var(--kw-ease-out) both;
}

.kw-animate-in--d1 { animation-delay: 0ms; }
.kw-animate-in--d2 { animation-delay: 60ms; }
.kw-animate-in--d3 { animation-delay: 120ms; }
.kw-animate-in--d4 { animation-delay: 180ms; }
.kw-animate-in--d5 { animation-delay: 240ms; }
.kw-animate-in--d6 { animation-delay: 300ms; }
.kw-animate-in--d7 { animation-delay: 360ms; }
.kw-animate-in--d8 { animation-delay: 420ms; }

/* ══════════════════════════════════════════════════════════════
   Activity / Timeline
   ══════════════════════════════════════════════════════════════ */

.kw-activity-item {
    display: flex;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--kw-border-subtle);
    transition: background var(--kw-duration-fast);
}

.kw-activity-item:last-child {
    border-bottom: none;
}

.kw-activity-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 5px;
}

.kw-activity-text {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.84rem;
    color: var(--kw-text-secondary);
    line-height: 1.5;
}

.kw-activity-time {
    font-size: 0.72rem;
    color: var(--kw-text-muted);
    margin-top: 2px;
}

/* ══════════════════════════════════════════════════════════════
   Divider with Label
   ══════════════════════════════════════════════════════════════ */

.kw-section-label {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 28px 0 18px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--kw-text-muted);
}

.kw-section-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--kw-border);
}

/* ══════════════════════════════════════════════════════════════
   Blazor / Validation Defaults (preserved)
   ══════════════════════════════════════════════════════════════ */

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid var(--kw-rose-500);
}

.validation-message {
    color: var(--kw-rose-500);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.82rem;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
    border-radius: var(--kw-radius-sm);
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* ══════════════════════════════════════════════════════════════
   MudBlazor Overrides (minimal, surgical)
   ══════════════════════════════════════════════════════════════ */

.mud-table-root {
    border-radius: var(--kw-radius-lg) !important;
    overflow: hidden;
    border: 1px solid var(--kw-border-subtle) !important;
}

.mud-table-head .mud-table-cell {
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    font-size: 0.78rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--kw-text-muted);
}

.mud-table-body .mud-table-cell {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.875rem;
}

.mud-button-root {
    font-family: 'DM Sans', sans-serif !important;
    font-weight: 600 !important;
    letter-spacing: 0.01em;
    border-radius: var(--kw-radius-sm) !important;
}

.mud-chip {
    font-family: 'DM Sans', sans-serif !important;
    font-weight: 500;
}

/* ══════════════════════════════════════════════════════════════
   Scrollbar Styling
   ══════════════════════════════════════════════════════════════ */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--kw-text-muted);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--kw-text-secondary);
}

/* ══════════════════════════════════════════════════════════════
   Auth Layout — Split-Screen Brand + Form
   ══════════════════════════════════════════════════════════════ */

.kw-auth-shell {
    display: flex;
    min-height: 100vh;
}

/* ── Left Brand Panel ── */
.kw-auth-brand-panel {
    width: 420px;
    min-height: 100vh;
    background: linear-gradient(160deg, var(--kw-navy-900) 0%, var(--kw-navy-800) 40%, var(--kw-navy-700) 100%);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 48px 40px;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.kw-auth-brand-panel::before {
    content: '';
    position: absolute;
    top: -30%;
    right: -30%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(245, 166, 35, 0.08) 0%, transparent 70%);
    pointer-events: none;
}

.kw-auth-brand-panel::after {
    content: '';
    position: absolute;
    bottom: -20%;
    left: -20%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(59, 130, 196, 0.06) 0%, transparent 70%);
    pointer-events: none;
}

.kw-auth-brand-content {
    position: relative;
    z-index: 1;
}

.kw-auth-brand-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 2rem;
    color: rgba(255, 255, 255, 0.95);
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.kw-auth-brand-subtitle {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.92rem;
    color: rgba(255, 255, 255, 0.55);
    margin-bottom: 28px;
}

.kw-auth-brand-desc {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.88rem;
    color: rgba(255, 255, 255, 0.45);
    line-height: 1.7;
    margin-bottom: 36px;
}

.kw-auth-brand-features {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.kw-auth-feature {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.84rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.6);
}

.kw-auth-feature .mud-icon-root {
    color: var(--kw-amber-300);
    font-size: 1.1rem;
}

.kw-auth-brand-footer {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.3);
    position: relative;
    z-index: 1;
}

/* ── Right Form Panel ── */
.kw-auth-form-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
    background: var(--kw-surface-muted);
    position: relative;
}

.kw-auth-form-wrapper {
    width: 100%;
    max-width: 440px;
}

.kw-auth-theme-toggle {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 16px;
}

/* ── Auth Form ── */
.kw-auth-form {
    width: 100%;
}

.kw-auth-form-header {
    margin-bottom: 32px;
}

.kw-auth-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.65rem;
    color: var(--kw-text-primary);
    margin: 0 0 6px;
    letter-spacing: -0.02em;
}

.kw-auth-subtitle {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem;
    color: var(--kw-text-secondary);
    margin: 0;
    line-height: 1.5;
}

.kw-auth-fields {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.kw-auth-input .mud-input-outlined-border {
    border-radius: var(--kw-radius-md) !important;
}

.kw-auth-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: -4px 0;
}

.kw-auth-checkbox .mud-typography {
    font-size: 0.84rem;
    color: var(--kw-text-secondary);
}

.kw-auth-link {
    font-family: 'DM Sans', sans-serif !important;
    font-size: 0.84rem !important;
    font-weight: 600 !important;
}

.kw-auth-alert {
    border-radius: var(--kw-radius-md) !important;
}

.kw-auth-error-list {
    margin: 0;
    padding-left: 18px;
    font-size: 0.84rem;
    line-height: 1.6;
}

.kw-auth-submit {
    margin-top: 4px;
    height: 48px !important;
    font-size: 0.92rem !important;
    letter-spacing: 0.02em;
    border-radius: var(--kw-radius-md) !important;
    background: linear-gradient(135deg, var(--kw-navy-700), var(--kw-navy-600)) !important;
    box-shadow: 0 2px 12px rgba(26, 58, 100, 0.25) !important;
    transition: box-shadow var(--kw-duration-normal) var(--kw-ease-out),
                transform var(--kw-duration-normal) var(--kw-ease-out) !important;
}

.kw-auth-submit:hover {
    box-shadow: 0 4px 20px rgba(26, 58, 100, 0.35) !important;
    transform: translateY(-1px);
}

/* Passkey button: outlined variant — keep the sizing but NOT the dark gradient bg,
   so MudBlazor's native (theme-aware, visible) outlined colours show through. */
.kw-auth-passkey {
    margin-top: 4px;
    height: 48px !important;
    font-size: 0.92rem !important;
    letter-spacing: 0.02em;
    border-radius: var(--kw-radius-md) !important;
    transition: transform var(--kw-duration-normal) var(--kw-ease-out) !important;
}
.kw-auth-passkey:hover {
    transform: translateY(-1px);
}

.kw-auth-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--kw-border-subtle);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.84rem;
    color: var(--kw-text-muted);
}

/* ── Icon circle for forgot/reset password ── */
.kw-auth-icon-circle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(26, 58, 100, 0.08), rgba(26, 58, 100, 0.04));
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    color: var(--kw-navy-500);
}

.kw-auth-icon-circle--success {
    background: linear-gradient(135deg, rgba(5, 150, 105, 0.10), rgba(5, 150, 105, 0.04));
    color: var(--kw-emerald-500);
}

/* ── Auth Layout Responsive ── */
@media (max-width: 900px) {
    .kw-auth-shell {
        flex-direction: column;
    }

    .kw-auth-brand-panel {
        width: 100%;
        min-height: auto;
        padding: 32px 24px;
    }

    .kw-auth-brand-desc,
    .kw-auth-brand-features {
        display: none;
    }

    .kw-auth-form-panel {
        padding: 32px 24px;
    }
}

@media (max-width: 480px) {
    .kw-auth-form-panel {
        padding: 24px 16px;
    }

    .kw-auth-title {
        font-size: 1.4rem;
    }
}

/* ══════════════════════════════════════════════════════════════
   Public Portal — "The Drought Atlas"
   An editorial national data-atlas aesthetic: Fraunces display
   serif on warm paper, deep ink-navy bands, survey-amber accents,
   hairline cartographic rules, plate numbering, corner-tick cards.
   Fully token-driven with dark-mode ("night survey") overrides.
   ══════════════════════════════════════════════════════════════ */

.kw-pub-shell {
    /* paper + ink */
    --pp-paper: #FAF7F0;
    --pp-paper-2: #F3EEE2;
    --pp-card: #FFFFFF;
    --pp-ink: #182430;
    --pp-ink-2: #4C5B6B;
    --pp-ink-3: #8593A2;
    --pp-line: #E2DACA;
    --pp-line-2: #C9BEA6;
    /* night bands */
    --pp-night: #0A1628;
    --pp-night-2: #0D1F3C;
    --pp-night-line: rgba(255, 255, 255, 0.10);
    --pp-night-ink: #F3EFE6;
    --pp-night-ink-2: rgba(243, 239, 230, 0.62);
    /* accents */
    --pp-amber: #E8920C;
    --pp-amber-2: #F5A623;
    --pp-amber-soft: #FAEEDA;
    --pp-green: #177A54;
    --pp-red: #C22843;
    --pp-blue: #2563A8;
    /* type */
    --pp-serif: 'Fraunces', Georgia, 'Times New Roman', serif;
    --pp-sans: 'DM Sans', sans-serif;

    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--pp-paper);
    color: var(--pp-ink);
    font-family: var(--pp-sans);
}

.kw-pub-shell--dark,
.kw-dark .kw-pub-shell {
    --pp-paper: #0D141F;
    --pp-paper-2: #0A101A;
    --pp-card: #151F2D;
    --pp-ink: #EAEEF4;
    --pp-ink-2: #A2AEBD;
    --pp-ink-3: #6B7C90;
    --pp-line: #24344A;
    --pp-line-2: #35496A;
    --pp-night: #070E19;
    --pp-night-2: #0B1626;
    --pp-night-ink: #EFF2F6;
    --pp-night-ink-2: rgba(239, 242, 246, 0.60);
    --pp-amber: #F5A623;
    --pp-amber-2: #FBBF4E;
    --pp-amber-soft: rgba(245, 166, 35, 0.13);
    --pp-green: #2FB183;
    --pp-red: #F16481;
    --pp-blue: #5D9BE0;
}

.kw-pub-shell ::selection { background: var(--pp-amber-2); color: var(--pp-night); }

/* ── Skip link ── */
.kw-pub-skip {
    position: absolute; left: -9999px; top: 0;
    background: var(--pp-night); color: #fff;
    padding: 10px 18px; z-index: 3000; font-size: 0.85rem;
}
.kw-pub-skip:focus { left: 0; }

/* ── Utility topbar ── */
.kw-pub-topbar {
    background: var(--pp-night);
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    display: flex; align-items: center; justify-content: space-between;
    padding: 7px 32px;
}
.kw-pub-topbar-note { display: inline-flex; align-items: center; gap: 8px; text-transform: uppercase; }
.kw-pub-topbar-note::before {
    content: ''; width: 5px; height: 5px; border-radius: 50%;
    background: #10B981; box-shadow: 0 0 6px rgba(16, 185, 129, 0.8);
}
.kw-pub-topbar-links { display: flex; gap: 20px; }
.kw-pub-topbar-links a {
    color: rgba(255, 255, 255, 0.55); text-decoration: none;
    text-transform: uppercase; letter-spacing: 0.06em;
    transition: color var(--kw-duration-fast);
}
.kw-pub-topbar-links a:hover { color: var(--pp-amber-2); }

/* ── Main header ── */
.kw-pub-header {
    position: sticky; top: 0; z-index: 1100;
    background: color-mix(in srgb, var(--pp-paper) 88%, transparent);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--pp-line);
    display: flex; align-items: center; justify-content: space-between;
    gap: 24px;
    padding: 0 32px;
    height: 66px;
}

.kw-pub-brand {
    display: flex; align-items: center; gap: 12px;
    text-decoration: none; color: inherit;
    flex-shrink: 0;
}
.kw-pub-brand-mark {
    width: 38px; height: 38px;
    background: var(--pp-night);
    color: var(--pp-amber-2);
    font-family: var(--pp-serif);
    font-weight: 600; font-size: 1.3rem;
    display: flex; align-items: center; justify-content: center;
    position: relative;
}
.kw-pub-brand-mark::after {
    content: ''; position: absolute; inset: 3px;
    border: 1px solid rgba(245, 166, 35, 0.35);
    pointer-events: none;
}
.kw-pub-brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.kw-pub-brand-word {
    font-family: var(--pp-serif);
    font-weight: 600; font-size: 1.22rem;
    color: var(--pp-ink);
    letter-spacing: -0.01em;
}
.kw-pub-brand-word em { font-style: italic; color: var(--pp-amber); }
.kw-pub-brand-sub {
    font-size: 0.6rem; font-weight: 600;
    letter-spacing: 0.22em; text-transform: uppercase;
    color: var(--pp-ink-3);
}

.kw-pub-nav { display: flex; align-items: center; gap: 2px; }
.kw-pub-nav-a {
    position: relative;
    padding: 8px 14px;
    font-size: 0.88rem; font-weight: 500;
    color: var(--pp-ink-2);
    text-decoration: none;
    transition: color var(--kw-duration-fast);
    white-space: nowrap;
}
.kw-pub-nav-a::after {
    content: '';
    position: absolute; left: 14px; right: 14px; bottom: 2px;
    height: 2px; background: var(--pp-amber);
    transform: scaleX(0); transform-origin: left;
    transition: transform 0.22s var(--kw-ease-out);
}
.kw-pub-nav-a:hover { color: var(--pp-ink); }
.kw-pub-nav-a:hover::after { transform: scaleX(1); }
.kw-pub-nav-a.active { color: var(--pp-ink); font-weight: 600; }
.kw-pub-nav-a.active::after { transform: scaleX(1); }

.kw-pub-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.kw-pub-iconbtn {
    width: 36px; height: 36px;
    display: inline-flex; align-items: center; justify-content: center;
    background: transparent;
    border: 1px solid var(--pp-line);
    color: var(--pp-ink-2);
    cursor: pointer;
    transition: border-color var(--kw-duration-fast), color var(--kw-duration-fast);
}
.kw-pub-iconbtn:hover { border-color: var(--pp-amber); color: var(--pp-amber); }
.kw-pub-signin {
    font-size: 0.82rem; font-weight: 600;
    color: var(--pp-ink); text-decoration: none;
    border: 1px solid var(--pp-line-2);
    padding: 8px 18px;
    transition: background-color var(--kw-duration-fast), color var(--kw-duration-fast), border-color var(--kw-duration-fast);
    white-space: nowrap;
}
.kw-pub-signin:hover { background: var(--pp-night); border-color: var(--pp-night); color: #fff; }

/* ── Mobile burger + drawer ── */
.kw-pub-burger {
    display: none;
    width: 40px; height: 40px;
    background: transparent; border: 1px solid var(--pp-line);
    color: var(--pp-ink); cursor: pointer;
    align-items: center; justify-content: center;
}
.kw-pub-scrim {
    position: fixed; inset: 0; z-index: 1490;
    background: rgba(10, 22, 40, 0.5);
    opacity: 0; pointer-events: none;
    transition: opacity 0.25s ease;
}
.kw-pub-scrim.open { opacity: 1; pointer-events: auto; }
.kw-pub-drawer {
    position: fixed; top: 0; right: 0; bottom: 0; z-index: 1500;
    width: min(320px, 86vw);
    background: var(--pp-paper);
    border-left: 1px solid var(--pp-line);
    transform: translateX(100%);
    transition: transform 0.3s var(--kw-ease-out);
    display: flex; flex-direction: column;
    padding: 20px;
}
.kw-pub-drawer.open { transform: translateX(0); }
.kw-pub-drawer-head {
    display: flex; align-items: center; justify-content: space-between;
    padding-bottom: 16px; margin-bottom: 8px;
    border-bottom: 1px solid var(--pp-line);
}
.kw-pub-drawer-title {
    font-family: var(--pp-serif); font-size: 1.1rem; font-weight: 600;
}
.kw-pub-drawer-a {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 6px;
    font-size: 1rem; font-weight: 500;
    color: var(--pp-ink-2); text-decoration: none;
    border-bottom: 1px dotted var(--pp-line);
    transition: color var(--kw-duration-fast), padding-left var(--kw-duration-fast);
}
.kw-pub-drawer-a:hover, .kw-pub-drawer-a.active { color: var(--pp-amber); padding-left: 12px; }
.kw-pub-drawer-foot { margin-top: auto; padding-top: 18px; display: flex; flex-direction: column; gap: 10px; }

/* ── Content well ── */
.kw-pub-content { flex: 1; }

/* ── Footer (colophon) ── */
.kw-pub-footer {
    background: var(--pp-night);
    color: var(--pp-night-ink-2);
    margin-top: auto;
}
.kw-pub-footer-grid {
    max-width: 1240px; margin: 0 auto;
    padding: 56px 32px 40px;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1.2fr;
    gap: 40px;
}
.kw-pub-footer-brand .kw-pub-brand-word { color: var(--pp-night-ink); font-size: 1.35rem; }
.kw-pub-footer-blurb {
    font-size: 0.85rem; line-height: 1.7;
    margin: 14px 0 0; max-width: 340px;
}
.kw-pub-footer-h {
    font-size: 0.7rem; font-weight: 700;
    letter-spacing: 0.18em; text-transform: uppercase;
    color: var(--pp-amber-2);
    margin: 0 0 16px;
}
.kw-pub-footer-a {
    display: block;
    font-size: 0.87rem; color: var(--pp-night-ink-2);
    text-decoration: none; padding: 5px 0;
    transition: color var(--kw-duration-fast), padding-left var(--kw-duration-fast);
}
.kw-pub-footer-a:hover { color: var(--pp-night-ink); padding-left: 6px; }
.kw-pub-footer-base {
    border-top: 1px solid var(--pp-night-line);
    padding: 18px 32px;
}
.kw-pub-footer-base-inner {
    max-width: 1240px; margin: 0 auto;
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 10px;
    font-size: 0.75rem;
}
.kw-pub-footer-coords {
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.30);
}

/* ══════════ PRIMITIVES ══════════ */

.kw-pub { font-family: var(--pp-sans); }

.kw-pub-container { max-width: 1240px; margin: 0 auto; padding: 0 32px; }
.kw-pub-container--narrow { max-width: 880px; }
.kw-pub-container--wide { max-width: 1400px; }

/* Buttons */
.kw-pub-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font-family: var(--pp-sans);
    font-size: 0.88rem; font-weight: 600;
    padding: 11px 22px;
    border: 1px solid transparent;
    cursor: pointer; text-decoration: none;
    transition: background-color var(--kw-duration-fast), color var(--kw-duration-fast),
                border-color var(--kw-duration-fast), transform var(--kw-duration-fast);
    white-space: nowrap;
}
.kw-pub-btn:active { transform: translateY(1px); }
.kw-pub-btn--primary { background: var(--pp-amber); color: #fff; }
.kw-pub-btn--primary:hover { background: var(--pp-amber-2); }
.kw-pub-btn--ink { background: var(--pp-night); color: var(--pp-night-ink); }
.kw-pub-btn--ink:hover { background: var(--pp-night-2); }
.kw-pub-btn--ghost { background: transparent; border-color: var(--pp-line-2); color: var(--pp-ink); }
.kw-pub-btn--ghost:hover { border-color: var(--pp-amber); color: var(--pp-amber); }
.kw-pub-btn--onnight { background: transparent; border-color: var(--pp-night-line); color: var(--pp-night-ink); }
.kw-pub-btn--onnight:hover { border-color: var(--pp-amber-2); color: var(--pp-amber-2); }
.kw-pub-btn--sm { padding: 7px 14px; font-size: 0.8rem; }
.kw-pub-btn--lg { padding: 14px 30px; font-size: 0.95rem; }
.kw-pub-btn[disabled] { opacity: 0.45; pointer-events: none; }

/* Eyebrow + kicker */
.kw-pub-eyebrow {
    display: inline-flex; align-items: center; gap: 10px;
    font-size: 0.72rem; font-weight: 700;
    letter-spacing: 0.2em; text-transform: uppercase;
    color: var(--pp-amber);
}
.kw-pub-eyebrow::before { content: ''; width: 28px; height: 1px; background: var(--pp-amber); }
.kw-pub-kicker {
    font-size: 0.74rem; letter-spacing: 0.14em;
    font-variant-numeric: tabular-nums;
    text-transform: uppercase;
    color: var(--pp-ink-3);
}

/* Tags — square editorial */
.kw-pub-tag {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 9px;
    font-size: 0.7rem; font-weight: 600;
    letter-spacing: 0.05em;
    border: 1px solid var(--pp-line);
    background: var(--pp-paper-2);
    color: var(--pp-ink-2);
    text-decoration: none;
    white-space: nowrap;
}
.kw-pub-tag--amber { background: var(--pp-amber-soft); border-color: color-mix(in srgb, var(--pp-amber) 40%, transparent); color: var(--pp-amber); }
.kw-pub-tag--green { background: color-mix(in srgb, var(--pp-green) 10%, transparent); border-color: color-mix(in srgb, var(--pp-green) 35%, transparent); color: var(--pp-green); }
.kw-pub-tag--blue { background: color-mix(in srgb, var(--pp-blue) 10%, transparent); border-color: color-mix(in srgb, var(--pp-blue) 35%, transparent); color: var(--pp-blue); }
.kw-pub-tag--red { background: color-mix(in srgb, var(--pp-red) 10%, transparent); border-color: color-mix(in srgb, var(--pp-red) 35%, transparent); color: var(--pp-red); }
/* Partner-implemented, on the public surfaces. Same cyan as the private chip so the two registers
   read as the same fact. */
.kw-pub-tag--partner { background: rgba(8, 145, 178, 0.10); border-color: rgba(8, 145, 178, 0.35); color: #0e7490; }
a.kw-pub-tag { cursor: pointer; transition: border-color var(--kw-duration-fast), color var(--kw-duration-fast); }
a.kw-pub-tag:hover { border-color: var(--pp-amber); color: var(--pp-amber); }

/* Completion meter */
.kw-pub-meter-row {
    display: flex; align-items: center; gap: 10px;
    font-size: 0.75rem; color: var(--pp-ink-3);
    font-variant-numeric: tabular-nums;
}
.kw-pub-meter { flex: 1; height: 4px; background: var(--pp-paper-2); overflow: hidden; border: 1px solid var(--pp-line); }
.kw-pub-meter-fill { display: block; height: 100%; width: var(--val, 0%); transition: width 0.6s var(--kw-ease-out); }
.kw-pub-meter-fill--green { background: var(--pp-green); }
.kw-pub-meter-fill--amber { background: var(--pp-amber-2); }
.kw-pub-meter-fill--red { background: var(--pp-red); }
.kw-pub-meter-pct { font-weight: 700; color: var(--pp-ink-2); min-width: 38px; text-align: right; }

/* Skeletons */
@keyframes kwPubShimmer { 0% { background-position: -400px 0; } 100% { background-position: 400px 0; } }
.kw-pub-skel {
    background: linear-gradient(90deg, var(--pp-paper-2) 25%, color-mix(in srgb, var(--pp-paper-2) 50%, var(--pp-card)) 37%, var(--pp-paper-2) 63%);
    background-size: 800px 100%;
    animation: kwPubShimmer 1.3s linear infinite;
}
.kw-pub-skel--title { height: 22px; width: 65%; margin-bottom: 12px; }
.kw-pub-skel--text { height: 13px; width: 100%; margin-bottom: 8px; }
.kw-pub-skel--card { height: 220px; border: 1px solid var(--pp-line); }
.kw-pub-skel--row { height: 72px; border: 1px solid var(--pp-line); margin-bottom: 10px; }

/* Empty + error states */
.kw-pub-empty {
    text-align: center;
    padding: 72px 24px;
    border: 1px dashed var(--pp-line-2);
    color: var(--pp-ink-3);
}
.kw-pub-empty-title {
    font-family: var(--pp-serif);
    font-size: 1.3rem; font-style: italic;
    color: var(--pp-ink-2);
    margin: 0 0 8px;
}
.kw-pub-empty p { margin: 0 0 18px; font-size: 0.9rem; }

/* ══════════ HERO (editorial, left-aligned) ══════════ */

.kw-pub-hero {
    position: relative;
    padding: 72px 0 64px;
    overflow: hidden;
    background: var(--pp-paper);
}
/* topographic contour watermark — slowly "breathes" like a live survey reading */
.kw-pub-hero::before {
    content: '';
    position: absolute; inset: -20% -10% -20% 30%;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 600 600'%3E%3Cg fill='none' stroke='%23A98F5F' stroke-width='1'%3E%3Cpath d='M100 300c0-110 90-200 200-200s200 90 200 200-90 200-200 200-200-90-200-200z'/%3E%3Cpath d='M140 300c0-88 72-160 160-160s160 72 160 160-72 160-160 160-160-72-160-160z'/%3E%3Cpath d='M180 300c0-66 54-120 120-120s120 54 120 120-54 120-120 120-120-54-120-120z'/%3E%3Cpath d='M220 300c0-44 36-80 80-80s80 36 80 80-36 80-80 80-80-36-80-80z'/%3E%3Cpath d='M260 300c0-22 18-40 40-40s40 18 40 40-18 40-40 40-40-18-40-40z'/%3E%3C/g%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
    background-position: right center;
    opacity: 0.13;
    pointer-events: none;
    transform-origin: 74% 50%;
    animation: kwHeroBreathe 15s ease-in-out infinite;
}
.kw-pub-shell--dark .kw-pub-hero::before,
.kw-dark .kw-pub-hero::before { opacity: 0.08; }

/* survey "ping" — a single hairline ring slowly emanating from the contour centre */
.kw-pub-hero::after {
    content: '';
    position: absolute; top: 50%; right: 13%;
    width: 300px; height: 300px;
    border: 1px solid #A98F5F;
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
    transform: translate(50%, -50%) scale(0.6);
    animation: kwHeroPing 8s ease-out infinite;
}
.kw-pub-shell--dark .kw-pub-hero::after,
.kw-dark .kw-pub-hero::after { border-color: #F5A623; }

@keyframes kwHeroBreathe {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}
@keyframes kwHeroPing {
    0% { transform: translate(50%, -50%) scale(0.6); opacity: 0; }
    18% { opacity: 0.18; }
    100% { transform: translate(50%, -50%) scale(1.35); opacity: 0; }
}

/* cursor-reactive "survey light" — an amber copy of the contour, revealed only within a soft
   spotlight that follows the pointer (position fed live from kw-hero.js via --gx/--gy) so the
   circle lines beneath the cursor light up. Geometry mirrors ::before exactly so the amber
   lines register perfectly over the sand ones. */
.kw-pub-hero-rings {
    position: absolute; inset: -20% -10% -20% 30%;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 600 600'%3E%3Cg fill='none' stroke='%23F5A623' stroke-width='1.3'%3E%3Cpath d='M100 300c0-110 90-200 200-200s200 90 200 200-90 200-200 200-200-90-200-200z'/%3E%3Cpath d='M140 300c0-88 72-160 160-160s160 72 160 160-72 160-160 160-160-72-160-160z'/%3E%3Cpath d='M180 300c0-66 54-120 120-120s120 54 120 120-54 120-120 120-120-54-120-120z'/%3E%3Cpath d='M220 300c0-44 36-80 80-80s80 36 80 80-36 80-80 80-80-36-80-80z'/%3E%3Cpath d='M260 300c0-22 18-40 40-40s40 18 40 40-18 40-40 40-40-18-40-40z'/%3E%3C/g%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
    background-position: right center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.55s var(--kw-ease-out);
    -webkit-mask-image: radial-gradient(200px circle at var(--gx, -300px) var(--gy, -300px), #000 0%, rgba(0,0,0,0.35) 48%, transparent 72%);
    mask-image: radial-gradient(200px circle at var(--gx, -300px) var(--gy, -300px), #000 0%, rgba(0,0,0,0.35) 48%, transparent 72%);
}
.kw-pub-hero.is-hero-lit .kw-pub-hero-rings { opacity: 0.85; }
@media (hover: none) { .kw-pub-hero-rings { display: none; } }

.kw-pub-hero-inner { position: relative; z-index: 1; max-width: 1240px; margin: 0 auto; padding: 0 32px; }
.kw-pub-hero-kicker {
    display: flex; align-items: center; gap: 14px;
    margin-bottom: 22px;
}
.kw-pub-hero-title {
    font-family: var(--pp-serif);
    font-weight: 500;
    font-size: clamp(2.4rem, 5.6vw, 4.4rem);
    line-height: 1.04;
    letter-spacing: -0.015em;
    color: var(--pp-ink);
    margin: 0 0 22px;
    max-width: 15ch;
}
.kw-pub-hero-title em {
    font-style: italic;
    color: var(--pp-amber);
    position: relative;
}
.kw-pub-hero-lede {
    font-size: clamp(1rem, 1.5vw, 1.15rem);
    line-height: 1.65;
    color: var(--pp-ink-2);
    max-width: 520px;
    margin: 0 0 34px;
}

/* hero search */
.kw-pub-search {
    display: flex;
    max-width: 620px;
    background: var(--pp-card);
    border: 1px solid var(--pp-line-2);
    transition: border-color var(--kw-duration-fast), box-shadow var(--kw-duration-fast);
}
.kw-pub-search:focus-within {
    border-color: var(--pp-amber);
    box-shadow: 0 0 0 3px var(--pp-amber-soft);
}
.kw-pub-search input {
    flex: 1;
    border: none; background: transparent;
    padding: 15px 20px;
    font-family: var(--pp-sans);
    font-size: 0.98rem;
    color: var(--pp-ink);
    min-width: 0;
}
.kw-pub-search input::placeholder { color: var(--pp-ink-3); }
.kw-pub-search input:focus { outline: none; }
.kw-pub-search button {
    border: none;
    background: var(--pp-night);
    color: var(--pp-night-ink);
    padding: 0 26px;
    font-family: var(--pp-sans);
    font-weight: 600; font-size: 0.9rem;
    cursor: pointer;
    display: flex; align-items: center; gap: 8px;
    transition: background-color var(--kw-duration-fast);
}
.kw-pub-search button:hover { background: var(--pp-amber); }

.kw-pub-hero-chips {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
    margin-top: 16px;
    font-size: 0.78rem; color: var(--pp-ink-3);
}
.kw-pub-hero-chip {
    padding: 5px 12px;
    border: 1px solid var(--pp-line);
    background: transparent;
    font-size: 0.78rem;
    color: var(--pp-ink-2);
    text-decoration: none; cursor: pointer;
    transition: border-color var(--kw-duration-fast), color var(--kw-duration-fast);
}
.kw-pub-hero-chip:hover { border-color: var(--pp-amber); color: var(--pp-amber); }

/* ══════════ LEDGER (stat band, ink) ══════════ */

.kw-pub-ledger {
    background: var(--pp-night);
    border-top: 3px solid var(--pp-amber);
    color: var(--pp-night-ink);
}
.kw-pub-ledger-inner {
    max-width: 1240px; margin: 0 auto;
    padding: 0 32px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.kw-pub-ledger-cell {
    padding: 30px 28px 28px;
    border-left: 1px solid var(--pp-night-line);
    position: relative;
}
.kw-pub-ledger-cell:first-child { border-left: none; padding-left: 0; }
.kw-pub-ledger-val {
    font-family: var(--pp-serif);
    font-weight: 500;
    font-size: clamp(1.9rem, 3vw, 2.6rem);
    line-height: 1;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
    margin-bottom: 6px;
}
.kw-pub-ledger-val small { font-size: 0.55em; color: var(--pp-amber-2); font-family: var(--pp-sans); font-weight: 600; }
.kw-pub-ledger-label {
    font-size: 0.72rem; font-weight: 600;
    letter-spacing: 0.16em; text-transform: uppercase;
    color: var(--pp-night-ink-2);
}

/* ══════════ SECTIONS & PLATE HEADERS ══════════ */

.kw-pub-sec { padding: 72px 0; }
.kw-pub-sec--tint { background: var(--pp-paper-2); }
.kw-pub-sec--night { background: var(--pp-night); color: var(--pp-night-ink); }

.kw-pub-plate {
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: 24px;
    margin-bottom: 12px;
}
.kw-pub-plate-left { max-width: 640px; }
.kw-pub-plate-no {
    font-size: 0.72rem; font-weight: 700;
    letter-spacing: 0.24em; text-transform: uppercase;
    color: var(--pp-amber);
    margin: 0 0 10px;
    display: flex; align-items: center; gap: 12px;
}
.kw-pub-plate-no::after { content: ''; flex: 0 0 34px; height: 1px; background: var(--pp-amber); }
.kw-pub-plate-title {
    font-family: var(--pp-serif);
    font-weight: 500;
    font-size: clamp(1.6rem, 3vw, 2.3rem);
    letter-spacing: -0.01em;
    line-height: 1.15;
    margin: 0 0 8px;
    color: inherit;
}
.kw-pub-plate-sub { font-size: 0.95rem; line-height: 1.6; color: var(--pp-ink-2); margin: 0; }
.kw-pub-sec--night .kw-pub-plate-sub { color: var(--pp-night-ink-2); }
.kw-pub-plate-cta {
    flex-shrink: 0;
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 0.86rem; font-weight: 600;
    color: var(--pp-amber); text-decoration: none;
    border-bottom: 1px solid transparent;
    padding-bottom: 2px;
    transition: border-color var(--kw-duration-fast);
    white-space: nowrap;
}
.kw-pub-plate-cta:hover { border-bottom-color: var(--pp-amber); }
.kw-pub-plate-rule {
    height: 1px; background: var(--pp-line);
    border: none; margin: 0 0 34px;
    position: relative;
}
.kw-pub-plate-rule::before {
    content: ''; position: absolute; left: 0; top: -1px;
    width: 64px; height: 3px; background: var(--pp-amber);
}
.kw-pub-sec--night .kw-pub-plate-rule { background: var(--pp-night-line); }

/* ══════════ CARDS (atlas plates with corner ticks) ══════════ */

.kw-pub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
    gap: 22px;
}

.kw-pub-card {
    position: relative;
    background: var(--pp-card);
    border: 1px solid var(--pp-line);
    padding: 24px;
    display: flex; flex-direction: column;
    text-decoration: none; color: inherit;
    transition: transform 0.2s var(--kw-ease-out), border-color 0.2s, box-shadow 0.2s;
}
.kw-pub-card::before, .kw-pub-card::after {
    content: '';
    position: absolute;
    width: 14px; height: 14px;
    border: 0 solid var(--pp-line-2);
    transition: border-color 0.2s;
    pointer-events: none;
}
.kw-pub-card::before { top: -1px; left: -1px; border-top-width: 2px; border-left-width: 2px; }
.kw-pub-card::after { bottom: -1px; right: -1px; border-bottom-width: 2px; border-right-width: 2px; }
.kw-pub-card:hover {
    transform: translateY(-3px);
    border-color: var(--pp-line-2);
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.09);
}
.kw-pub-card:hover::before, .kw-pub-card:hover::after { border-color: var(--pp-amber); }

.kw-pub-card-head {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    margin-bottom: 14px;
}
.kw-pub-card-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.kw-pub-card-index {
    font-size: 0.68rem; font-weight: 600;
    letter-spacing: 0.14em;
    color: var(--pp-ink-3);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}
.kw-pub-card-title {
    font-family: var(--pp-serif);
    font-weight: 600;
    font-size: 1.18rem;
    line-height: 1.3;
    letter-spacing: -0.005em;
    color: var(--pp-ink);
    margin: 0 0 8px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.kw-pub-card-desc {
    font-size: 0.87rem; line-height: 1.55;
    color: var(--pp-ink-2);
    flex: 1;
    margin: 0 0 16px;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.kw-pub-card-meter { margin-bottom: 14px; }
.kw-pub-card-foot {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    border-top: 1px solid var(--pp-line);
    padding-top: 14px;
    font-size: 0.8rem; color: var(--pp-ink-3);
}
.kw-pub-card-amount {
    font-family: var(--pp-serif);
    font-weight: 600; font-size: 1.02rem;
    font-variant-numeric: tabular-nums;
    color: var(--pp-ink);
}
.kw-pub-card-amount small { font-size: 0.68em; color: var(--pp-ink-3); font-family: var(--pp-sans); }
.kw-pub-card-cta {
    display: inline-flex; align-items: center; gap: 4px;
    font-weight: 600; color: var(--pp-amber);
}

/* Document row-cards */
.kw-pub-docgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 14px; }
.kw-pub-doccard {
    position: relative;
    display: flex; align-items: flex-start; gap: 16px;
    background: var(--pp-card);
    border: 1px solid var(--pp-line);
    padding: 18px 20px;
    transition: border-color 0.2s, transform 0.2s var(--kw-ease-out), box-shadow 0.2s;
}
.kw-pub-doccard:hover {
    border-color: var(--pp-line-2);
    transform: translateY(-2px);
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.08);
}
.kw-pub-ficon {
    flex-shrink: 0;
    width: 46px; height: 56px;
    background: var(--pp-paper-2);
    border: 1px solid var(--pp-line);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px;
    position: relative;
}
.kw-pub-ficon::before {
    content: '';
    position: absolute; top: 0; right: 0;
    border-style: solid;
    border-width: 0 10px 10px 0;
    border-color: transparent var(--pp-paper) transparent transparent;
}
.kw-pub-shell--dark .kw-pub-ficon::before,
.kw-dark .kw-pub-ficon::before { border-color: transparent var(--pp-paper) transparent transparent; }
.kw-pub-ficon-ext {
    font-size: 0.62rem; font-weight: 800;
    letter-spacing: 0.08em;
    color: var(--pp-ink-2);
}
.kw-pub-ficon-bar { width: 22px; height: 3px; background: var(--ficon-color, var(--pp-amber)); }
.kw-pub-doccard-body { flex: 1; min-width: 0; }
.kw-pub-doccard-title {
    font-family: var(--pp-serif);
    font-weight: 600; font-size: 1.02rem;
    line-height: 1.35;
    color: var(--pp-ink);
    margin: 0 0 5px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.kw-pub-doccard-meta {
    font-size: 0.74rem; color: var(--pp-ink-3);
    display: flex; flex-wrap: wrap; gap: 4px 10px;
    font-variant-numeric: tabular-nums;
    margin-bottom: 8px;
}
.kw-pub-doccard-actions { display: flex; gap: 8px; }
.kw-pub-doccard-act {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 0.76rem; font-weight: 600;
    color: var(--pp-ink-2);
    background: none; border: 1px solid var(--pp-line);
    padding: 5px 12px; cursor: pointer;
    transition: border-color var(--kw-duration-fast), color var(--kw-duration-fast);
}
.kw-pub-doccard-act:hover { border-color: var(--pp-amber); color: var(--pp-amber); }
.kw-pub-doccard-act--primary { border-color: var(--pp-amber); color: var(--pp-amber); }
.kw-pub-doccard-act--primary:hover { background: var(--pp-amber); color: #fff; }

/* List rows (list view of investments) */
.kw-pub-lrow {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 10px 24px;
    align-items: center;
    background: var(--pp-card);
    border: 1px solid var(--pp-line);
    border-top: none;
    padding: 16px 22px;
    text-decoration: none; color: inherit;
    transition: background-color var(--kw-duration-fast);
}
.kw-pub-lrow:first-child { border-top: 1px solid var(--pp-line); }
.kw-pub-lrow:hover { background: var(--pp-amber-soft); }
.kw-pub-lrow-title { font-family: var(--pp-serif); font-weight: 600; font-size: 1.02rem; color: var(--pp-ink); margin-bottom: 3px; }
.kw-pub-lrow-meta { font-size: 0.76rem; color: var(--pp-ink-3); display: flex; flex-wrap: wrap; gap: 4px 12px; }
.kw-pub-lrow-meter { width: 130px; }
.kw-pub-lrow-amount { font-family: var(--pp-serif); font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; min-width: 110px; }

/* ══════════ TOOLBAR (listings) ══════════ */

.kw-pub-toolbar {
    background: var(--pp-card);
    border: 1px solid var(--pp-line);
    padding: 14px 16px;
    display: flex; flex-wrap: wrap; gap: 10px;
    align-items: center;
    margin-bottom: 14px;
}
.kw-pub-tsearch {
    flex: 1 1 240px;
    display: flex; align-items: center; gap: 8px;
    border: 1px solid var(--pp-line);
    padding: 0 12px;
    background: var(--pp-paper);
    transition: border-color var(--kw-duration-fast);
}
.kw-pub-tsearch:focus-within { border-color: var(--pp-amber); }
.kw-pub-tsearch input {
    flex: 1; border: none; background: transparent;
    padding: 10px 0;
    font-family: var(--pp-sans); font-size: 0.88rem;
    color: var(--pp-ink);
    min-width: 0;
}
.kw-pub-tsearch input:focus { outline: none; }
.kw-pub-tsearch-clear {
    background: none; border: none; cursor: pointer;
    color: var(--pp-ink-3); font-size: 1rem; line-height: 1;
    padding: 4px;
}
.kw-pub-tsearch-clear:hover { color: var(--pp-red); }

.kw-pub-tselect {
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid var(--pp-line);
    background: var(--pp-paper);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%238593A2' stroke-width='1.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    color: var(--pp-ink);
    font-family: var(--pp-sans); font-size: 0.85rem;
    padding: 10px 34px 10px 12px;
    cursor: pointer;
    max-width: 190px;
}
.kw-pub-tselect:focus { outline: none; border-color: var(--pp-amber); }

.kw-pub-tview { display: flex; border: 1px solid var(--pp-line); }
.kw-pub-tview button {
    background: var(--pp-paper); border: none; cursor: pointer;
    padding: 8px 12px;
    color: var(--pp-ink-3);
    display: inline-flex; align-items: center;
    transition: background-color var(--kw-duration-fast), color var(--kw-duration-fast);
}
.kw-pub-tview button.on { background: var(--pp-night); color: var(--pp-night-ink); }

.kw-pub-tcount {
    font-size: 0.8rem; color: var(--pp-ink-3);
    font-variant-numeric: tabular-nums;
    margin-left: auto;
    white-space: nowrap;
}

/* Active filter chips */
.kw-pub-fchips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 20px; }
.kw-pub-fchip {
    display: inline-flex; align-items: center; gap: 7px;
    background: var(--pp-amber-soft);
    border: 1px solid color-mix(in srgb, var(--pp-amber) 40%, transparent);
    color: var(--pp-amber);
    font-size: 0.78rem; font-weight: 600;
    padding: 5px 8px 5px 12px;
}
.kw-pub-fchip button {
    background: none; border: none; cursor: pointer;
    color: inherit; font-size: 0.95rem; line-height: 1; padding: 0 2px;
}
.kw-pub-fchip button:hover { color: var(--pp-red); }
.kw-pub-fclear {
    background: none; border: none; cursor: pointer;
    font-size: 0.78rem; font-weight: 600;
    color: var(--pp-ink-3);
    text-decoration: underline; text-underline-offset: 3px;
}
.kw-pub-fclear:hover { color: var(--pp-red); }

/* ══════════ CATEGORY LENS ══════════
   Resilience vs Response is the portfolio's top-level split, so it reads as a segmented control
   above the dropdowns rather than as a tenth equal select. --lens carries the active category's
   colour so the control itself says which lens is on. */

.kw-pub-lens {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
    margin-bottom: 12px;
}
.kw-pub-lens-lab {
    font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
    color: var(--pp-ink-3); margin-right: 6px;
}
.kw-pub-lens-btn {
    --lens: var(--pp-ink-2);
    background: var(--pp-card);
    border: 1px solid var(--pp-line);
    color: var(--pp-ink-2);
    font: inherit; font-size: 0.82rem; font-weight: 600;
    padding: 6px 14px; cursor: pointer;
    transition: border-color .16s ease, color .16s ease, background .16s ease;
}
.kw-pub-lens-btn:hover { border-color: color-mix(in srgb, var(--pp-ink-2) 40%, transparent); color: var(--pp-ink); }
.kw-pub-lens-btn.on {
    background: color-mix(in srgb, var(--lens) 12%, transparent);
    border-color: color-mix(in srgb, var(--lens) 55%, transparent);
    color: var(--lens);
}
.kw-pub-lens-btn.on:hover { color: var(--lens); }

/* ══════════ PAGER (numbered) ══════════ */

.kw-pub-pager {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    margin-top: 40px;
    font-variant-numeric: tabular-nums;
}
.kw-pub-pager-btn {
    min-width: 38px; height: 38px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--pp-card);
    border: 1px solid var(--pp-line);
    color: var(--pp-ink-2);
    font-size: 0.85rem; font-weight: 600;
    cursor: pointer; padding: 0 8px;
    transition: border-color var(--kw-duration-fast), color var(--kw-duration-fast);
}
.kw-pub-pager-btn:hover { border-color: var(--pp-amber); color: var(--pp-amber); }
.kw-pub-pager-btn.on { background: var(--pp-night); border-color: var(--pp-night); color: var(--pp-night-ink); pointer-events: none; }
.kw-pub-pager-btn[disabled] { opacity: 0.4; pointer-events: none; }
.kw-pub-pager-gap { color: var(--pp-ink-3); padding: 0 2px; }

/* ══════════ BREADCRUMBS ══════════ */

.kw-pub-crumbs {
    font-size: 0.78rem;
    color: var(--pp-ink-3);
    display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
    text-transform: uppercase; letter-spacing: 0.1em;
}
.kw-pub-crumbs a { color: var(--pp-ink-3); text-decoration: none; }
.kw-pub-crumbs a:hover { color: var(--pp-amber); }
.kw-pub-crumbs-sep { opacity: 0.5; }
.kw-pub-crumbs--onnight, .kw-pub-crumbs--onnight a { color: var(--pp-night-ink-2); }
.kw-pub-crumbs--onnight a:hover { color: var(--pp-amber-2); }

/* ══════════ DETAIL PAGE ══════════ */

.kw-pub-dhead {
    background: var(--pp-night);
    color: var(--pp-night-ink);
    padding: 40px 0 44px;
    border-bottom: 3px solid var(--pp-amber);
    position: relative;
    overflow: hidden;
}
.kw-pub-dhead::before {
    content: '';
    position: absolute; right: -140px; top: -140px;
    width: 480px; height: 480px;
    border: 1px solid rgba(245, 166, 35, 0.14);
    border-radius: 50%;
    pointer-events: none;
}
.kw-pub-dhead::after {
    content: '';
    position: absolute; right: -60px; top: -60px;
    width: 320px; height: 320px;
    border: 1px dashed rgba(245, 166, 35, 0.12);
    border-radius: 50%;
    pointer-events: none;
}
.kw-pub-dhead-inner { position: relative; }
.kw-pub-dhead-title {
    font-family: var(--pp-serif);
    font-weight: 500;
    font-size: clamp(1.7rem, 3.4vw, 2.7rem);
    line-height: 1.14;
    letter-spacing: -0.01em;
    margin: 16px 0 18px;
    max-width: 22ch;
}
.kw-pub-dhead-meta {
    display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px;
    font-size: 0.84rem;
    color: var(--pp-night-ink-2);
    font-variant-numeric: tabular-nums;
}
.kw-pub-dhead-meta-item { display: inline-flex; align-items: center; gap: 7px; }
.kw-pub-dhead-actions { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }

.kw-pub-dbody { padding: 44px 0 80px; }
.kw-pub-dgrid {
    display: grid;
    grid-template-columns: minmax(0, 2.1fr) minmax(280px, 1fr);
    gap: 30px;
    align-items: start;
}
.kw-pub-dmain { min-width: 0; }
.kw-pub-dside { position: sticky; top: 86px; display: flex; flex-direction: column; gap: 18px; }

.kw-pub-dsec {
    background: var(--pp-card);
    border: 1px solid var(--pp-line);
    padding: 28px 30px;
    margin-bottom: 18px;
}
.kw-pub-dsec-h {
    font-family: var(--pp-serif);
    font-weight: 600; font-size: 1.25rem;
    margin: 0 0 6px;
    color: var(--pp-ink);
    display: flex; align-items: baseline; gap: 12px;
}
.kw-pub-dsec-h small {
    font-family: var(--pp-sans);
    font-size: 0.68rem; font-weight: 700;
    letter-spacing: 0.18em; text-transform: uppercase;
    color: var(--pp-amber);
}
.kw-pub-dsec-rule { height: 1px; background: var(--pp-line); border: none; margin: 14px 0 18px; }
.kw-pub-prose { font-size: 0.94rem; line-height: 1.75; color: var(--pp-ink-2); }
.kw-pub-prose p { margin: 0 0 14px; }
.kw-pub-chiplist { display: flex; flex-wrap: wrap; gap: 8px; }

/* facts card with dotted leaders */
.kw-pub-facts {
    background: var(--pp-card);
    border: 1px solid var(--pp-line);
    padding: 22px 24px;
}
.kw-pub-facts-h {
    font-size: 0.7rem; font-weight: 700;
    letter-spacing: 0.2em; text-transform: uppercase;
    color: var(--pp-amber);
    margin: 0 0 16px;
}
.kw-pub-fact {
    display: flex; align-items: baseline; gap: 8px;
    font-size: 0.85rem;
    padding: 7px 0;
}
.kw-pub-fact dt { color: var(--pp-ink-3); white-space: nowrap; }
.kw-pub-fact::before { content: none; }
.kw-pub-fact-dots {
    flex: 1;
    border-bottom: 1px dotted var(--pp-line-2);
    transform: translateY(-3px);
    min-width: 16px;
}
.kw-pub-fact dd {
    margin: 0; color: var(--pp-ink);
    font-weight: 600; text-align: right;
    font-variant-numeric: tabular-nums;
}

/* completion dial */
.kw-pub-dial-wrap { display: flex; align-items: center; gap: 20px; }
.kw-pub-dial {
    --dial-val: 0;
    --dial-color: var(--pp-green);
    width: 92px; height: 92px;
    border-radius: 50%;
    background:
        radial-gradient(closest-side, var(--pp-card) 78%, transparent 79%),
        conic-gradient(var(--dial-color) calc(var(--dial-val) * 1%), var(--pp-paper-2) 0);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.kw-pub-dial-val {
    font-family: var(--pp-serif);
    font-weight: 600; font-size: 1.25rem;
    font-variant-numeric: tabular-nums;
    color: var(--pp-ink);
}
.kw-pub-dial-meta { font-size: 0.8rem; color: var(--pp-ink-2); line-height: 1.5; }
.kw-pub-dial-meta b { color: var(--pp-ink); }

/* copy-link */
.kw-pub-copybtn {
    display: inline-flex; align-items: center; gap: 7px;
    background: none;
    border: 1px solid var(--pp-night-line);
    color: var(--pp-night-ink);
    font-size: 0.8rem; font-weight: 600;
    padding: 8px 16px; cursor: pointer;
    transition: border-color var(--kw-duration-fast), color var(--kw-duration-fast);
}
.kw-pub-copybtn:hover { border-color: var(--pp-amber-2); color: var(--pp-amber-2); }

/* ══════════ SEARCH PAGE ══════════ */

.kw-pub-tabs {
    display: flex; gap: 0;
    border-bottom: 1px solid var(--pp-line);
    margin-bottom: 26px;
}
.kw-pub-tab {
    background: none; border: none; cursor: pointer;
    font-family: var(--pp-sans);
    font-size: 0.9rem; font-weight: 600;
    color: var(--pp-ink-3);
    padding: 12px 20px;
    position: relative;
    display: inline-flex; align-items: center; gap: 8px;
}
.kw-pub-tab::after {
    content: '';
    position: absolute; left: 0; right: 0; bottom: -1px;
    height: 2px; background: var(--pp-amber);
    transform: scaleX(0);
    transition: transform 0.2s var(--kw-ease-out);
}
.kw-pub-tab.on { color: var(--pp-ink); }
.kw-pub-tab.on::after { transform: scaleX(1); }
.kw-pub-tab-n {
    font-size: 0.7rem; font-weight: 700;
    background: var(--pp-paper-2);
    border: 1px solid var(--pp-line);
    padding: 1px 7px;
    color: var(--pp-ink-3);
    font-variant-numeric: tabular-nums;
}
.kw-pub-tab.on .kw-pub-tab-n { background: var(--pp-amber-soft); border-color: color-mix(in srgb, var(--pp-amber) 40%, transparent); color: var(--pp-amber); }

.kw-pub-result {
    display: flex; align-items: flex-start; gap: 16px;
    background: var(--pp-card);
    border: 1px solid var(--pp-line);
    padding: 20px 22px;
    margin-bottom: 10px;
    text-decoration: none; color: inherit;
    transition: border-color var(--kw-duration-fast), transform 0.18s var(--kw-ease-out);
    cursor: pointer;
    width: 100%; text-align: left;
    font-family: var(--pp-sans);
}
.kw-pub-result:hover { border-color: var(--pp-amber); transform: translateX(3px); }
.kw-pub-result-body { flex: 1; min-width: 0; }
.kw-pub-result-type {
    font-size: 0.66rem; font-weight: 700;
    letter-spacing: 0.16em; text-transform: uppercase;
    color: var(--pp-amber);
    margin-bottom: 5px;
    display: flex; align-items: center; gap: 10px;
}
.kw-pub-result-meta { color: var(--pp-ink-3); letter-spacing: 0.06em; font-weight: 600; }
.kw-pub-result-title {
    font-family: var(--pp-serif);
    font-weight: 600; font-size: 1.08rem;
    margin: 0 0 5px; color: var(--pp-ink);
    line-height: 1.35;
}
.kw-pub-result-desc {
    font-size: 0.86rem; color: var(--pp-ink-2);
    line-height: 1.55; margin: 0;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.kw-pub-result mark, .kw-pub-highlight {
    background: var(--pp-amber-soft);
    color: var(--pp-amber);
    font-weight: 700;
    padding: 0 2px;
}
.kw-pub-sugg { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

/* ══════════ TRACKER ══════════ */

.kw-pub-trk-bar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
    background: var(--pp-card);
    border: 1px solid var(--pp-line);
    padding: 14px 18px;
    margin-bottom: 22px;
}
.kw-pub-trk-bar-label {
    font-size: 0.72rem; font-weight: 700;
    letter-spacing: 0.16em; text-transform: uppercase;
    color: var(--pp-ink-3);
}
.kw-pub-trk-grid {
    display: grid;
    grid-template-columns: minmax(0, 7fr) minmax(300px, 5fr);
    gap: 22px;
    align-items: start;
}
.kw-pub-trk-list {
    display: flex; flex-direction: column;
    max-height: 560px; overflow-y: auto;
    border: 1px solid var(--pp-line);
}
.kw-pub-trk-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px 16px;
    padding: 14px 18px;
    background: var(--pp-card);
    border-bottom: 1px solid var(--pp-line);
    text-decoration: none; color: inherit;
    transition: background-color var(--kw-duration-fast);
}
.kw-pub-trk-row:last-child { border-bottom: none; }
.kw-pub-trk-row:hover { background: var(--pp-amber-soft); }
.kw-pub-trk-row-title { font-family: var(--pp-serif); font-weight: 600; font-size: 0.95rem; color: var(--pp-ink); }
.kw-pub-trk-row-meta { font-size: 0.74rem; color: var(--pp-ink-3); display: flex; gap: 10px; flex-wrap: wrap; }
.kw-pub-trk-row-amount {
    grid-row: span 2; align-self: center;
    font-family: var(--pp-serif); font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--pp-ink); font-size: 0.95rem;
}

/* ══════════ COUNTY BULLETINS ══════════ */

.kw-pub-countygrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 22px;
}
.kw-pub-countycard {
    background: var(--pp-card);
    border: 1px solid var(--pp-line);
    padding: 24px;
    position: relative;
}
.kw-pub-countycard::before {
    content: '';
    position: absolute; top: -1px; left: -1px;
    width: 14px; height: 14px;
    border-top: 2px solid var(--pp-line-2);
    border-left: 2px solid var(--pp-line-2);
}
.kw-pub-countycard-head {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 12px;
    margin-bottom: 4px;
}
.kw-pub-countycard-name {
    font-family: var(--pp-serif);
    font-weight: 600; font-size: 1.35rem;
    color: var(--pp-ink);
    margin: 0;
}
.kw-pub-countycard-count {
    font-size: 0.72rem; font-weight: 700;
    letter-spacing: 0.1em; text-transform: uppercase;
    color: var(--pp-amber);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.kw-pub-countycard-rule { height: 1px; background: var(--pp-line); border: none; margin: 12px 0 6px; }
.kw-pub-bullrow {
    display: flex; align-items: center; gap: 10px;
    width: 100%;
    background: none; border: none;
    border-bottom: 1px dotted var(--pp-line);
    padding: 10px 2px;
    cursor: pointer; text-align: left;
    font-family: var(--pp-sans);
    color: var(--pp-ink-2);
    transition: color var(--kw-duration-fast);
}
.kw-pub-bullrow:last-child { border-bottom: none; }
.kw-pub-bullrow:hover { color: var(--pp-amber); }
.kw-pub-bullrow-title {
    flex: 1; min-width: 0;
    font-size: 0.86rem; font-weight: 500;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kw-pub-bullrow-date {
    font-size: 0.72rem; color: var(--pp-ink-3);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* ══════════ SUBSCRIBE ══════════ */

.kw-pub-form {
    background: var(--pp-card);
    border: 1px solid var(--pp-line);
    padding: 38px 36px;
    position: relative;
}
.kw-pub-form::before, .kw-pub-form::after {
    content: '';
    position: absolute; width: 16px; height: 16px;
    pointer-events: none;
}
.kw-pub-form::before { top: -1px; left: -1px; border-top: 2px solid var(--pp-amber); border-left: 2px solid var(--pp-amber); }
.kw-pub-form::after { bottom: -1px; right: -1px; border-bottom: 2px solid var(--pp-amber); border-right: 2px solid var(--pp-amber); }

.kw-pub-field { margin-bottom: 18px; }
.kw-pub-field label {
    display: block;
    font-size: 0.74rem; font-weight: 700;
    letter-spacing: 0.12em; text-transform: uppercase;
    color: var(--pp-ink-2);
    margin-bottom: 7px;
}
.kw-pub-field label small { color: var(--pp-ink-3); font-weight: 500; letter-spacing: 0.04em; text-transform: none; }
.kw-pub-field input, .kw-pub-field select {
    width: 100%;
    border: 1px solid var(--pp-line);
    background: var(--pp-paper);
    color: var(--pp-ink);
    font-family: var(--pp-sans); font-size: 0.92rem;
    padding: 11px 14px;
    transition: border-color var(--kw-duration-fast), box-shadow var(--kw-duration-fast);
}
.kw-pub-field input:focus, .kw-pub-field select:focus {
    outline: none;
    border-color: var(--pp-amber);
    box-shadow: 0 0 0 3px var(--pp-amber-soft);
}
.kw-pub-field select {
    appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%238593A2' stroke-width='1.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    cursor: pointer;
}

.kw-pub-topics {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 22px;
}
.kw-pub-topic {
    position: relative;
    border: 1px solid var(--pp-line);
    background: var(--pp-paper);
    padding: 14px 14px 14px 16px;
    cursor: pointer;
    display: flex; align-items: flex-start; gap: 10px;
    transition: border-color var(--kw-duration-fast), background-color var(--kw-duration-fast);
}
.kw-pub-topic:hover { border-color: var(--pp-amber); }
.kw-pub-topic:focus-within { box-shadow: 0 0 0 3px var(--pp-amber-soft); }
.kw-pub-topic input { position: absolute; opacity: 0; pointer-events: none; }
.kw-pub-topic-body { flex: 1; }
.kw-pub-topic-name { font-size: 0.88rem; font-weight: 600; color: var(--pp-ink); margin-bottom: 2px; display: block; }
.kw-pub-topic-desc { font-size: 0.75rem; color: var(--pp-ink-3); line-height: 1.45; }
.kw-pub-topic-check {
    width: 20px; height: 20px; flex-shrink: 0;
    border: 1px solid var(--pp-line-2);
    background: var(--pp-card);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.75rem; color: transparent;
    transition: background-color var(--kw-duration-fast), border-color var(--kw-duration-fast), color var(--kw-duration-fast);
}
.kw-pub-topic.on { border-color: var(--pp-amber); background: var(--pp-amber-soft); }
.kw-pub-topic.on .kw-pub-topic-check { background: var(--pp-amber); border-color: var(--pp-amber); color: #fff; }

.kw-pub-success {
    text-align: center;
    padding: 48px 32px;
}
.kw-pub-success-icon {
    width: 64px; height: 64px;
    margin: 0 auto 18px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--pp-green) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--pp-green) 35%, transparent);
    color: var(--pp-green);
    display: flex; align-items: center; justify-content: center;
}
.kw-pub-success-title {
    font-family: var(--pp-serif);
    font-weight: 600; font-size: 1.5rem;
    margin: 0 0 8px; color: var(--pp-ink);
}

/* ══════════ MAP EXTRAS ══════════ */

.kw-pub-map-note {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.78rem;
    color: var(--pp-ink-3);
    font-variant-numeric: tabular-nums;
    margin-top: 12px;
}
.kw-pub-map-frame {
    position: relative;
    border: 1px solid var(--pp-line);
    padding: 10px;
    background: var(--pp-card);
}
.kw-pub-map-frame::before, .kw-pub-map-frame::after {
    content: ''; position: absolute; width: 16px; height: 16px; pointer-events: none; z-index: 500;
}
.kw-pub-map-frame::before { top: -1px; left: -1px; border-top: 2px solid var(--pp-amber); border-left: 2px solid var(--pp-amber); }
.kw-pub-map-frame::after { bottom: -1px; right: -1px; border-bottom: 2px solid var(--pp-amber); border-right: 2px solid var(--pp-amber); }

/* ══════════ CTA BAND ══════════ */

.kw-pub-cta {
    background: var(--pp-night);
    border-top: 3px solid var(--pp-amber);
    color: var(--pp-night-ink);
    padding: 64px 32px;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.kw-pub-cta::before {
    content: '';
    position: absolute; left: 50%; top: 50%;
    transform: translate(-50%, -50%);
    width: 620px; height: 620px;
    border: 1px solid rgba(245, 166, 35, 0.10);
    border-radius: 50%;
    pointer-events: none;
}
.kw-pub-cta-title {
    font-family: var(--pp-serif);
    font-weight: 500; font-size: clamp(1.5rem, 3vw, 2.2rem);
    margin: 0 0 10px;
    position: relative;
}
.kw-pub-cta-sub {
    font-size: 0.95rem; color: var(--pp-night-ink-2);
    max-width: 520px; margin: 0 auto 26px;
    line-height: 1.65;
    position: relative;
}

/* ══════════ MOTION ══════════ */

@keyframes kwPubRise {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}
.kw-pub-rev { animation: kwPubRise 0.55s var(--kw-ease-out) both; }
.kw-pub-grid > *, .kw-pub-docgrid > *, .kw-pub-countygrid > *, .kw-pub-gallery > * { animation: kwPubRise 0.5s var(--kw-ease-out) both; }
.kw-pub-grid > *:nth-child(1), .kw-pub-docgrid > *:nth-child(1), .kw-pub-countygrid > *:nth-child(1), .kw-pub-gallery > *:nth-child(1) { animation-delay: 0.03s; }
.kw-pub-grid > *:nth-child(2), .kw-pub-docgrid > *:nth-child(2), .kw-pub-countygrid > *:nth-child(2), .kw-pub-gallery > *:nth-child(2) { animation-delay: 0.08s; }
.kw-pub-grid > *:nth-child(3), .kw-pub-docgrid > *:nth-child(3), .kw-pub-countygrid > *:nth-child(3), .kw-pub-gallery > *:nth-child(3) { animation-delay: 0.13s; }
.kw-pub-grid > *:nth-child(4), .kw-pub-docgrid > *:nth-child(4), .kw-pub-countygrid > *:nth-child(4), .kw-pub-gallery > *:nth-child(4) { animation-delay: 0.18s; }
.kw-pub-grid > *:nth-child(5), .kw-pub-docgrid > *:nth-child(5), .kw-pub-countygrid > *:nth-child(5), .kw-pub-gallery > *:nth-child(5) { animation-delay: 0.23s; }
.kw-pub-grid > *:nth-child(6), .kw-pub-docgrid > *:nth-child(6), .kw-pub-countygrid > *:nth-child(6), .kw-pub-gallery > *:nth-child(6) { animation-delay: 0.28s; }

@media (prefers-reduced-motion: reduce) {
    .kw-pub-rev,
    .kw-pub-grid > *, .kw-pub-docgrid > *, .kw-pub-countygrid > *, .kw-pub-gallery > *,
    .kw-pub-hero::before, .kw-pub-hero::after,
    .kw-pub-skel { animation: none !important; }
    .kw-pub-hero::after { display: none; }
    .kw-pub-card, .kw-pub-doccard, .kw-pub-result { transition: none; }
}

/* ── Whole-card links ──
   A document card that only responds on its title reads as broken, not as inert. The title's anchor
   is stretched over the whole card; anything that must stay separately clickable is lifted above it
   rather than nested inside it, which would be invalid HTML. */
.kw-pub-doccard--linked { position: relative; }
.kw-pub-stretch { text-decoration: none; color: inherit; }
.kw-pub-stretch::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.kw-pub-doccard--linked:hover .kw-pub-doccard-title { color: var(--pp-amber); }
.kw-pub-doccard-act--above { position: relative; z-index: 2; }

/* ══════════ THE READING ROOM ══════════
   The resource library's own furniture: a year rail that is also a chart, folder rows for the
   explorer, book-plate covers, the gallery shelf, and the bulletin almanac. Tokens only. */

/* ── The year rail ──
   A facet and a bar chart in one object. Scroll-snapped so a long record can be thumbed. */
.kw-pub-yearrail {
    display: flex; align-items: flex-end; gap: 3px;
    margin: 18px 0 4px; padding: 0 0 6px;
    overflow-x: auto; scroll-snap-type: x proximity;
    border-bottom: 1px solid var(--pp-line);
}
.kw-pub-yearrail-y {
    display: flex; flex-direction: column; align-items: center; gap: 5px;
    flex: 1 0 34px; min-width: 34px; scroll-snap-align: start;
    padding: 0; border: 0; background: none; cursor: pointer;
    font-family: var(--pp-sans);
}
.kw-pub-yearrail-bar {
    width: 100%; height: var(--h); min-height: 6px; max-height: 56px;
    background: color-mix(in srgb, var(--pp-ink-3) 30%, transparent);
    border-radius: 2px 2px 0 0;
    transition: background var(--kw-duration-fast);
}
.kw-pub-yearrail-y:hover .kw-pub-yearrail-bar { background: color-mix(in srgb, var(--pp-amber) 55%, transparent); }
.kw-pub-yearrail-y.on .kw-pub-yearrail-bar { background: var(--pp-amber); }
.kw-pub-yearrail-lab {
    font-size: 0.64rem; font-weight: 600; letter-spacing: 0.04em;
    color: var(--pp-ink-3); font-variant-numeric: tabular-nums;
}
.kw-pub-yearrail-y.on .kw-pub-yearrail-lab { color: var(--pp-ink); }

/* count badge on a lens button */
.kw-pub-lens-n {
    margin-left: 5px; padding: 1px 5px; border-radius: 999px;
    background: color-mix(in srgb, currentColor 12%, transparent);
    font-size: 0.64rem; font-variant-numeric: tabular-nums;
}

/* ── Explorer ── */
.kw-pub-axes { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 18px 0 4px; }
.kw-pub-crumbbtn {
    padding: 0; border: 0; background: none; cursor: pointer;
    font: inherit; color: var(--pp-ink-2); text-decoration: underline;
    text-underline-offset: 3px; text-decoration-color: var(--pp-line-2);
}
.kw-pub-crumbbtn:hover { color: var(--pp-amber); }

.kw-pub-folders {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 10px; margin-top: 16px;
}
.kw-pub-folder {
    display: flex; align-items: center; gap: 12px; text-align: left; cursor: pointer;
    padding: 14px 16px; border: 1px solid var(--pp-line); background: var(--pp-card);
    font-family: var(--pp-sans);
    transition: border-color var(--kw-duration-fast), transform var(--kw-duration-fast);
}
.kw-pub-folder:hover { border-color: var(--pp-amber); transform: translateY(-1px); }
.kw-pub-folder-ic { color: var(--pp-amber); flex: none; display: inline-flex; }
.kw-pub-folder-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.kw-pub-folder-name { font-weight: 700; font-size: 0.88rem; color: var(--pp-ink); }
.kw-pub-folder-sub { font-size: 0.72rem; color: var(--pp-ink-3); }
.kw-pub-folder-n {
    flex: none; font-family: var(--pp-serif); font-size: 1.05rem;
    color: var(--pp-ink-2); font-variant-numeric: tabular-nums;
}

/* ── Sticky year rules in list mode ──
   Scrolling the shelf should feel like thumbing a printed index. */
.kw-pub-yearhead {
    position: sticky; top: 0; z-index: 2;
    margin: 26px 0 0; padding: 6px 0;
    border-bottom: 1px solid var(--pp-ink);
    background: var(--pp-paper);
}
.kw-pub-yearhead span {
    font-family: var(--pp-serif); font-size: 1.15rem; font-weight: 600;
    color: var(--pp-ink); font-variant-numeric: tabular-nums;
}

/* ── The book plate ──
   Drawn in CSS, because only PDFs can be rendered and the library holds far more than PDFs. A real
   page-1 image, when one exists, is layered on top of this. */
.kw-pub-cover {
    position: relative; aspect-ratio: 3 / 4; overflow: hidden;
    background: var(--pp-paper-2); border: 1px solid var(--pp-line);
}
.kw-pub-cover-img {
    position: absolute; inset: 0; width: 100%; height: 100%;
    object-fit: cover; object-position: top center; z-index: 1;
    background: var(--pp-card);
}
.kw-pub-cover-plate {
    position: absolute; inset: 0; display: flex; flex-direction: column;
    padding: 14px; gap: 10px;
}
.kw-pub-cover-plate::before {
    content: ""; position: absolute; inset: 0 auto 0 0; width: 4px;
    background: var(--cover-ac);
}
.kw-pub-cover-ext {
    align-self: flex-start; padding: 2px 7px;
    background: var(--cover-ac); color: #fff;
    font-family: var(--pp-sans); font-size: 0.6rem; font-weight: 800;
    letter-spacing: 0.09em;
}
.kw-pub-cover-title {
    font-family: var(--pp-serif); font-size: 0.92rem; line-height: 1.32;
    color: var(--pp-ink); overflow: hidden;
    display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical;
}
.kw-pub-cover-rule { margin-top: auto; height: 1px; background: var(--pp-amber); opacity: 0.7; }
.kw-pub-cover-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kw-pub-cover-year {
    font-family: var(--pp-serif); font-size: 0.9rem; color: var(--pp-ink-2);
    font-variant-numeric: tabular-nums;
}
.kw-pub-cover-stamp {
    padding: 1px 6px; border: 1px solid var(--pp-line-2);
    font-family: var(--pp-sans); font-size: 0.58rem; font-weight: 700;
    letter-spacing: 0.07em; text-transform: uppercase; color: var(--pp-ink-3);
}
.kw-pub-cover--bulletin .kw-pub-cover-stamp { border-color: var(--pp-amber); color: var(--pp-amber); }

/* ── The shelf ── */
.kw-pub-gallery {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 22px 18px; margin-top: 20px;
}
.kw-pub-galcard { display: flex; flex-direction: column; gap: 8px; text-decoration: none; }
.kw-pub-galcard .kw-pub-cover { transition: transform var(--kw-duration-fast), box-shadow var(--kw-duration-fast); }
.kw-pub-galcard:hover .kw-pub-cover {
    transform: translateY(-3px);
    box-shadow: 0 8px 22px color-mix(in srgb, var(--pp-ink) 16%, transparent);
}
.kw-pub-galcard-title {
    font-family: var(--pp-serif); font-size: 0.85rem; line-height: 1.35; color: var(--pp-ink);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.kw-pub-galcard-meta { font-size: 0.7rem; color: var(--pp-ink-3); font-variant-numeric: tabular-nums; }

/* ── The bulletin almanac ──
   Deliberately not in the stagger list: a ledger of record shouldn't fly in. */
.kw-pub-matrix-wrap { margin-top: 22px; overflow-x: auto; border: 1px solid var(--pp-line); background: var(--pp-card); }
.kw-pub-matrix { width: 100%; border-collapse: collapse; font-family: var(--pp-sans); }
.kw-pub-matrix-cap { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.kw-pub-matrix-rowhead {
    position: sticky; left: 0; z-index: 1;
    padding: 7px 14px; text-align: left; white-space: nowrap;
    background: var(--pp-card); border-right: 1px solid var(--pp-line);
    font-size: 0.78rem; font-weight: 600; color: var(--pp-ink-2);
}
.kw-pub-matrix-rowhead a { color: inherit; text-decoration: none; }
.kw-pub-matrix-rowhead a:hover { color: var(--pp-amber); text-decoration: underline; }
.kw-pub-matrix-monthhead {
    padding: 8px 0; width: 30px;
    font-size: 0.62rem; font-weight: 700; letter-spacing: 0.05em; color: var(--pp-ink-3);
    border-bottom: 1px solid var(--pp-line);
}
.kw-pub-matrix-cell { padding: 3px 0; text-align: center; }
.kw-pub-matrix-sq {
    display: inline-block; width: 15px; height: 15px;
    border: 1px solid var(--pp-line-2); border-radius: 2px;
    background: transparent;
}
.kw-pub-matrix-sq.on {
    background: var(--pp-amber); border-color: var(--pp-amber);
    cursor: pointer; transition: transform var(--kw-duration-fast);
}
.kw-pub-matrix-sq.on:hover { transform: scale(1.25); }
.kw-pub-matrix-sq.undated { background: var(--pp-ink-3); border-color: var(--pp-ink-3); }
.kw-pub-matrix-tally {
    padding: 0 14px; text-align: right; white-space: nowrap;
    font-size: 0.75rem; color: var(--pp-ink-2); font-variant-numeric: tabular-nums;
}
.kw-pub-matrix-tally span { color: var(--pp-ink-3); font-size: 0.66rem; }
.kw-pub-matrix-national th, .kw-pub-matrix-national td { background: color-mix(in srgb, var(--pp-amber) 6%, transparent); }
.kw-pub-matrix-national .kw-pub-matrix-rowhead { font-weight: 800; color: var(--pp-ink); }
.kw-pub-matrix-rule td { height: 1px; padding: 0; background: var(--pp-ink); opacity: 0.5; }
.kw-pub-matrix-note { margin-top: 10px; font-size: 0.74rem; color: var(--pp-ink-3); }

.kw-pub-yearscrub { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-top: 18px; }
.kw-pub-yearscrub-y {
    padding: 5px 12px; cursor: pointer;
    border: 1px solid var(--pp-line); background: transparent;
    font-family: var(--pp-sans); font-size: 0.76rem; font-weight: 600;
    color: var(--pp-ink-2); font-variant-numeric: tabular-nums;
}
.kw-pub-yearscrub-y:hover { border-color: var(--pp-amber); color: var(--pp-ink); }
.kw-pub-yearscrub-y.on { background: var(--pp-ink); border-color: var(--pp-ink); color: var(--pp-paper); }

@media (max-width: 640px) {
    .kw-pub-gallery { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 16px 12px; }
    .kw-pub-folders { grid-template-columns: 1fr; }
    .kw-pub-yearrail-y { flex: 0 0 30px; min-width: 30px; }
}

/* ══════════ RESPONSIVE ══════════ */

@media (max-width: 1024px) {
    .kw-pub-dgrid { grid-template-columns: 1fr; }
    .kw-pub-dside { position: static; }
    .kw-pub-trk-grid { grid-template-columns: 1fr; }
    .kw-pub-footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; }
}

@media (max-width: 900px) {
    .kw-pub-nav { display: none; }
    .kw-pub-burger { display: inline-flex; }
    .kw-pub-signin { display: none; }
}

@media (max-width: 600px) {
    .kw-pub-topbar { display: none; }
    .kw-pub-header { padding: 0 18px; height: 60px; }
    .kw-pub-container, .kw-pub-hero-inner { padding-left: 18px; padding-right: 18px; }
    .kw-pub-hero { padding: 44px 0 40px; }
    .kw-pub-sec { padding: 48px 0; }
    .kw-pub-ledger-inner { grid-template-columns: 1fr 1fr; padding: 0 18px; }
    .kw-pub-ledger-cell { padding: 20px 16px; border-left: none; border-top: 1px solid var(--pp-night-line); }
    .kw-pub-ledger-cell:first-child, .kw-pub-ledger-cell:nth-child(2) { border-top: none; }
    .kw-pub-ledger-cell:nth-child(odd) { padding-left: 0; }
    .kw-pub-plate { flex-direction: column; align-items: flex-start; gap: 10px; }
    .kw-pub-docgrid { grid-template-columns: 1fr; }
    .kw-pub-topics { grid-template-columns: 1fr; }
    .kw-pub-lrow { grid-template-columns: 1fr; gap: 8px; }
    .kw-pub-lrow-amount { text-align: left; }
    .kw-pub-lrow-meter { width: 100%; }
    .kw-pub-footer-grid { grid-template-columns: 1fr; padding: 40px 18px 28px; }
    .kw-pub-footer-base { padding: 16px 18px; }
    .kw-pub-tcount { margin-left: 0; width: 100%; }
    .kw-pub-toolbar { position: static; }
    .kw-pub-dhead-actions { flex-direction: column; align-items: stretch; }
}

/* ── Per-page additions (returned by page implementers) ── */

/* Investments register — search submit button inside the toolbar search field */
.kw-pub-inv-tsubmit {
    background: none; border: none; cursor: pointer;
    color: var(--pp-ink-3);
    display: inline-flex; align-items: center;
    padding: 4px; margin-left: -2px;
    transition: color var(--kw-duration-fast);
}
.kw-pub-inv-tsubmit:hover { color: var(--pp-amber); }

/* Documents library — bulletins-only toggle label typography */
.kw-pub-lib-bull button { gap: 7px; font-size: 0.8rem; font-weight: 600; font-family: var(--pp-sans); padding: 8px 14px; }

/* Search page — full-width hero input + truncation note */
.kw-pub-srch-form { max-width: none; }
.kw-pub-srch-note {
    font-size: 0.8rem;
    color: var(--pp-ink-3);
    font-variant-numeric: tabular-nums;
    margin: 4px 0 24px;
    padding-left: 2px;
}

/* Subscribe / Unsubscribe ("Dispatches") */
.kw-pub-sub-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.kw-pub-sub-err { display: block; font-size: 0.78rem; font-weight: 500; color: var(--pp-red); margin-top: 6px; }
.kw-pub-sub-retrylink { background: none; border: none; padding: 0; font: inherit; color: var(--pp-red); text-decoration: underline; cursor: pointer; }
.kw-pub-sub-retrylink:hover { color: var(--pp-amber); }
.kw-pub-sub-note { font-size: 0.92rem; color: var(--pp-ink-2); line-height: 1.6; margin: 0 0 6px; }
.kw-pub-sub-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 12px 0 26px; }
.kw-pub-sub-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 20px; }
.kw-pub-sub-fine { text-align: center; font-size: 0.76rem; color: var(--pp-ink-3); margin: 16px 0 0; }
.kw-pub-success-icon.kw-pub-sub-icon--red { background: color-mix(in srgb, var(--pp-red) 12%, transparent); border-color: color-mix(in srgb, var(--pp-red) 35%, transparent); color: var(--pp-red); }
@media (max-width: 640px) { .kw-pub-sub-grid2 { grid-template-columns: 1fr; } }

/* ══════════════════════════════════════════════════════════════
   Phase 12 — Notification Center
   Bell badge animation, dropdown panel, list cards, preference toggles
   ══════════════════════════════════════════════════════════════ */

/* ── BELL BUTTON & BADGE ── */
.kw-notif-trigger {
    position: relative;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 6px;
    color: rgba(255, 255, 255, 0.85);
    cursor: pointer;
    transition: background 0.15s ease;
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px;
}
.kw-notif-trigger:hover { background: rgba(255, 255, 255, 0.06); }
.kw-notif-badge {
    position: absolute;
    top: -2px; right: -2px;
    min-width: 18px; height: 18px;
    border-radius: 999px;
    background: linear-gradient(135deg, #F59E0B 0%, #EA580C 100%);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    padding: 0 5px;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.5);
    animation: kwNotifPulse 2s ease-in-out infinite;
}
@keyframes kwNotifPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

/* ── DROPDOWN PANEL ── */
.kw-notif-panel {
    width: 380px;
    max-height: 540px;
    display: flex; flex-direction: column;
    background: var(--kw-surface);
    border: 1px solid var(--kw-line);
    border-radius: 14px;
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.18);
    overflow: hidden;
}
.kw-notif-panel-head {
    padding: 16px 18px;
    border-bottom: 1px solid var(--kw-line);
    background: var(--kw-surface-muted);
    display: flex; align-items: center; gap: 8px;
}
.kw-notif-panel-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--kw-text-primary);
    margin: 0;
    flex: 1;
}
.kw-notif-panel-action {
    background: transparent; border: none; cursor: pointer;
    color: #F59E0B;
    font-size: 0.78rem; font-weight: 600;
    padding: 4px 8px; border-radius: 6px;
    transition: background 0.15s ease;
}
.kw-notif-panel-action:hover { background: rgba(245, 158, 11, 0.08); }
.kw-notif-list {
    flex: 1;
    overflow-y: auto;
    max-height: 420px;
}
.kw-notif-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 12px;
    padding: 14px 18px 14px 24px;
    border-bottom: 1px solid var(--kw-line);
    cursor: pointer;
    transition: background 0.15s ease;
    text-decoration: none; color: inherit;
    position: relative;
}
.kw-notif-item:hover { background: var(--kw-surface-muted); }
.kw-notif-item.is-unread::before {
    content: '';
    position: absolute;
    left: 8px; top: 22px;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: #F59E0B;
}
.kw-notif-item-icon {
    width: 36px; height: 36px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    background: color-mix(in srgb, var(--notif-color, #64748B) 14%, transparent);
    color: var(--notif-color, #64748B);
    flex-shrink: 0;
}
.kw-notif-item-body { min-width: 0; }
.kw-notif-item-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--kw-text-primary);
    margin: 0 0 2px;
    line-height: 1.3;
}
.kw-notif-item-msg {
    font-size: 0.78rem;
    color: var(--kw-text-muted);
    margin: 0;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.kw-notif-item-time {
    font-size: 0.7rem;
    color: var(--kw-text-muted);
    flex-shrink: 0;
    padding-top: 2px;
}
.kw-notif-panel-foot {
    padding: 12px 18px;
    text-align: center;
    border-top: 1px solid var(--kw-line);
    background: var(--kw-surface-muted);
}
.kw-notif-panel-foot a {
    color: var(--kw-text-secondary);
    font-size: 0.85rem; font-weight: 600;
    text-decoration: none;
    display: inline-flex; align-items: center; gap: 4px;
}
.kw-notif-panel-foot a:hover { color: #F59E0B; }
.kw-notif-empty {
    padding: 48px 20px;
    text-align: center;
    color: var(--kw-text-muted);
}
.kw-notif-empty-icon {
    font-size: 2.5rem;
    opacity: 0.35;
    margin-bottom: 10px;
}

/* ── PREFERENCES PAGE ── */
.kw-notif-pref-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}
.kw-notif-pref-row {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    gap: 14px;
    align-items: center;
    padding: 16px 20px;
    background: var(--kw-surface);
    border: 1px solid var(--kw-line);
    border-radius: 14px;
    transition: border-color 0.15s ease;
}
.kw-notif-pref-row:hover { border-color: color-mix(in srgb, var(--pref-color, #1A3A64) 50%, var(--kw-line)); }
.kw-notif-pref-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    background: color-mix(in srgb, var(--pref-color, #1A3A64) 14%, transparent);
    color: var(--pref-color, #1A3A64);
    display: flex; align-items: center; justify-content: center;
}
.kw-notif-pref-body { min-width: 0; }
.kw-notif-pref-title {
    font-weight: 600;
    color: var(--kw-text-primary);
    margin: 0 0 2px;
    font-size: 0.92rem;
}
.kw-notif-pref-desc {
    font-size: 0.78rem;
    color: var(--kw-text-muted);
    margin: 0;
}
.kw-notif-pref-toggle {
    display: flex; flex-direction: column; align-items: center;
    gap: 2px;
}
.kw-notif-pref-toggle-label {
    font-size: 0.68rem;
    color: var(--kw-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

/* ── DIGEST CARD (preferences page top) ── */
.kw-notif-digest-card {
    background: linear-gradient(135deg, #0F172A 0%, #1E293B 100%);
    color: #fff;
    border-radius: 18px;
    padding: 28px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}
.kw-notif-digest-card::before {
    content: '';
    position: absolute; inset: 0;
    background: radial-gradient(circle at 90% 10%, rgba(245,158,11,0.2), transparent 50%);
    pointer-events: none;
}
.kw-notif-digest-card-inner { position: relative; }
.kw-notif-digest-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    position: relative;
    margin-top: 18px;
}
.kw-notif-digest-tile {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 16px;
    display: flex; align-items: center; gap: 14px;
}
.kw-notif-digest-tile-info { flex: 1; }
.kw-notif-digest-tile-title {
    font-weight: 600;
    margin: 0 0 2px;
    color: rgba(255, 255, 255, 0.95);
    font-size: 0.92rem;
}
.kw-notif-digest-tile-desc {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.6);
    margin: 0;
}
@media (max-width: 600px) {
    .kw-notif-digest-grid { grid-template-columns: 1fr; }
    .kw-notif-pref-row { grid-template-columns: auto 1fr; }
    .kw-notif-pref-toggle { grid-column: 1 / -1; flex-direction: row; }
    .kw-notif-panel { width: calc(100vw - 32px); max-width: 380px; }
}

/* ══════════════════════════════════════════════════════════════
   Phase 13 — AI Knowledge Assistant
   Chat bubbles, citations, search results, suggestion chips
   ══════════════════════════════════════════════════════════════ */

.kw-ai-shell {
    display: grid;
    grid-template-rows: auto 1fr auto;
    height: calc(100vh - 180px);
    min-height: 540px;
    background: var(--kw-surface);
    border-radius: 18px;
    border: 1px solid var(--kw-line);
    overflow: hidden;
}

/* ── HERO header ── */
.kw-ai-hero {
    background:
        radial-gradient(800px 300px at 100% -20%, rgba(168,85,247,0.22), transparent 60%),
        radial-gradient(600px 300px at 0% 120%, rgba(245,158,11,0.15), transparent 60%),
        linear-gradient(135deg, #1E1B4B 0%, #312E81 60%, #4F46E5 100%);
    color: #fff;
    padding: 22px 28px;
    display: flex; align-items: center; gap: 16px;
}
.kw-ai-hero-avatar {
    width: 48px; height: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg, #A855F7 0%, #6366F1 100%);
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 8px 24px rgba(168, 85, 247, 0.35);
    flex-shrink: 0;
}
.kw-ai-hero-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.3rem;
    margin: 0; line-height: 1.2;
}
.kw-ai-hero-sub {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.7);
    margin: 4px 0 0;
}
.kw-ai-hero-status {
    margin-left: auto;
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 12px;
    border-radius: 999px;
    background: rgba(255,255,255,0.1);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
}
.kw-ai-hero-status-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #10B981;
    box-shadow: 0 0 0 4px rgba(16,185,129,0.18);
    animation: kwAiPulse 2s ease-in-out infinite;
}
@keyframes kwAiPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.55; }
}

/* ── Conversation log ── */
.kw-ai-log {
    overflow-y: auto;
    padding: 24px 28px;
    background: var(--kw-surface-muted);
    display: flex; flex-direction: column; gap: 18px;
}
.kw-ai-row { display: flex; gap: 12px; }
.kw-ai-row--user { flex-direction: row-reverse; }
.kw-ai-bubble {
    max-width: min(720px, 80%);
    padding: 14px 18px;
    border-radius: 18px;
    line-height: 1.55;
    font-size: 0.93rem;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}
.kw-ai-bubble--user {
    background: linear-gradient(135deg, #6366F1 0%, #4F46E5 100%);
    color: #fff;
    border-bottom-right-radius: 6px;
}
.kw-ai-bubble--assistant {
    background: #fff;
    color: var(--kw-text-primary);
    border: 1px solid var(--kw-line);
    border-bottom-left-radius: 6px;
}
.kw-ai-avatar {
    width: 36px; height: 36px;
    border-radius: 12px;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
}
.kw-ai-avatar--assistant {
    background: linear-gradient(135deg, #A855F7 0%, #6366F1 100%);
    box-shadow: 0 4px 12px rgba(168,85,247,0.3);
}
.kw-ai-avatar--user {
    background: linear-gradient(135deg, #0F172A 0%, #1E293B 100%);
}

/* ── Citations ── */
.kw-ai-citations {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--kw-line);
    display: flex; flex-direction: column; gap: 6px;
}
.kw-ai-citations-head {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--kw-text-muted);
    margin-bottom: 4px;
}
.kw-ai-citation {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 8px 12px;
    border-radius: 10px;
    background: var(--kw-surface-muted);
    border-left: 3px solid var(--cite-color, #A855F7);
    text-decoration: none; color: inherit;
    transition: transform 0.15s ease;
}
.kw-ai-citation:hover { transform: translateX(2px); }
.kw-ai-citation-icon {
    width: 28px; height: 28px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    background: color-mix(in srgb, var(--cite-color, #A855F7) 14%, transparent);
    color: var(--cite-color, #A855F7);
}
.kw-ai-citation-title {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--kw-text-primary);
    margin: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.kw-ai-citation-snippet {
    font-size: 0.74rem;
    color: var(--kw-text-muted);
    margin: 0;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
}
.kw-ai-citation-score {
    font-size: 0.7rem; font-weight: 600;
    color: var(--cite-color, #A855F7);
    font-variant-numeric: tabular-nums;
}

/* ── Composer ── */
.kw-ai-composer {
    padding: 16px 20px;
    border-top: 1px solid var(--kw-line);
    background: var(--kw-surface);
    display: flex; flex-direction: column; gap: 10px;
}
.kw-ai-composer-input {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: end;
}
.kw-ai-textarea {
    background: var(--kw-surface-muted);
    border: 1px solid var(--kw-line);
    border-radius: 14px;
    padding: 12px 16px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.93rem;
    resize: none;
    min-height: 48px;
    max-height: 160px;
    color: var(--kw-text-primary);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.kw-ai-textarea:focus {
    outline: none;
    border-color: #6366F1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
.kw-ai-send {
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, #6366F1 0%, #4F46E5 100%);
    color: #fff;
    padding: 0 20px;
    height: 48px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex; align-items: center; gap: 6px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.kw-ai-send:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 8px 16px rgba(79, 70, 229, 0.35);
}
.kw-ai-send:disabled {
    background: var(--kw-surface-muted);
    color: var(--kw-text-muted);
    cursor: not-allowed;
}

.kw-ai-suggestions {
    display: flex; flex-wrap: wrap; gap: 6px;
}
.kw-ai-chip {
    background: var(--kw-surface-muted);
    border: 1px solid var(--kw-line);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 0.78rem;
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease;
    color: var(--kw-text-secondary);
}
.kw-ai-chip:hover {
    border-color: #6366F1;
    color: #4F46E5;
}

/* ── Thinking indicator ── */
.kw-ai-thinking {
    display: inline-flex; gap: 4px; padding: 14px 20px;
    background: #fff;
    border: 1px solid var(--kw-line);
    border-radius: 18px;
    border-bottom-left-radius: 6px;
}
.kw-ai-thinking-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #A855F7;
    animation: kwAiThink 1.4s infinite ease-in-out both;
}
.kw-ai-thinking-dot:nth-child(1) { animation-delay: -0.32s; }
.kw-ai-thinking-dot:nth-child(2) { animation-delay: -0.16s; }
@keyframes kwAiThink {
    0%, 80%, 100% { transform: scale(0.4); opacity: 0.5; }
    40% { transform: scale(1.0); opacity: 1; }
}

/* ── Search results page ── */
.kw-ai-search-result {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 14px;
    align-items: center;
    padding: 14px 18px;
    background: var(--kw-surface);
    border: 1px solid var(--kw-line);
    border-left: 3px solid var(--result-color, #6366F1);
    border-radius: 14px;
    margin-bottom: 10px;
    text-decoration: none; color: inherit;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.kw-ai-search-result:hover {
    transform: translateX(2px);
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.06);
}

/* ── Conversation history list ── */
.kw-ai-conv {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    gap: 14px;
    align-items: center;
    padding: 14px 18px;
    background: var(--kw-surface);
    border: 1px solid var(--kw-line);
    border-radius: 14px;
    margin-bottom: 10px;
    transition: border-color 0.15s ease;
}
.kw-ai-conv:hover { border-color: #6366F1; }
.kw-ai-conv-icon {
    width: 40px; height: 40px;
    border-radius: 12px;
    background: color-mix(in srgb, #6366F1 14%, transparent);
    color: #6366F1;
    display: flex; align-items: center; justify-content: center;
}
.kw-ai-conv-title {
    font-weight: 600;
    margin: 0;
    color: var(--kw-text-primary);
    font-size: 0.95rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.kw-ai-conv-meta {
    font-size: 0.78rem;
    color: var(--kw-text-muted);
    margin: 4px 0 0;
}

@media (max-width: 720px) {
    .kw-ai-bubble { max-width: 92%; }
    .kw-ai-shell { height: calc(100vh - 120px); border-radius: 0; }
}

/* ── 2FA Setup Page ── */
.kw-2fa-page {
    max-width: 680px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.kw-2fa-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.kw-2fa-header-icon {
    color: var(--mud-palette-primary);
}

.kw-2fa-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--mud-palette-text-primary);
    margin: 0;
}

.kw-2fa-subtitle {
    font-size: 0.875rem;
    color: var(--mud-palette-text-secondary);
    margin: 0.25rem 0 0;
}

.kw-2fa-card {
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 12px;
    padding: 1.5rem;
}

.kw-2fa-manual-key {
    background: var(--mud-palette-background-grey);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 0.5rem;
}

.kw-2fa-shared-key {
    display: block;
    font-family: 'DM Sans', monospace;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.15em;
    color: var(--mud-palette-primary);
    margin-top: 0.5rem;
    word-break: break-all;
}

.kw-2fa-codes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.5rem;
}

.kw-2fa-code {
    display: block;
    background: var(--mud-palette-background-grey);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    font-family: 'DM Sans', monospace;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--mud-palette-text-primary);
    text-align: center;
}

/* ══════════════════════════════════════════════════════════════
   Approval Timeline
   ══════════════════════════════════════════════════════════════ */

.kw-approval-timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
    padding-left: 4px;
}

.kw-timeline-item {
    display: flex;
    gap: 16px;
    padding: 16px 0;
    position: relative;
}

.kw-timeline-item:not(:last-child)::before {
    content: '';
    position: absolute;
    left: 11px;
    top: 40px;
    bottom: 0;
    width: 2px;
    background: var(--kw-border);
}

.kw-timeline-marker {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    z-index: 1;
    background: var(--kw-surface);
}

.kw-timeline-completed .kw-timeline-marker {
    color: var(--kw-emerald-500);
}

.kw-timeline-current .kw-timeline-marker {
    color: var(--kw-amber-500);
    animation: kw-pulse 2s ease-in-out infinite;
}

.kw-timeline-returned .kw-timeline-marker {
    color: var(--kw-rose-500);
}

.kw-timeline-rejected .kw-timeline-marker {
    color: #e11d48;
}

.kw-timeline-upcoming .kw-timeline-marker {
    color: var(--kw-text-muted);
}

.kw-timeline-content {
    flex: 1;
    min-width: 0;
}

.kw-timeline-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}

.kw-timeline-header strong {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem;
    color: var(--kw-text-primary);
}

.kw-timeline-status-label {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 100px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.kw-timeline-completed .kw-timeline-status-label {
    background: rgba(5, 150, 105, 0.08);
    color: var(--kw-emerald-500);
}

.kw-timeline-current .kw-timeline-status-label {
    background: rgba(232, 146, 12, 0.08);
    color: var(--kw-amber-500);
}

.kw-timeline-returned .kw-timeline-status-label {
    background: rgba(225, 29, 72, 0.08);
    color: var(--kw-rose-500);
}

.kw-timeline-rejected .kw-timeline-status-label {
    background: rgba(225, 29, 72, 0.12);
    color: #be123c;
}

.kw-timeline-upcoming .kw-timeline-status-label {
    background: rgba(100, 116, 139, 0.08);
    color: var(--kw-text-muted);
}

.kw-timeline-approvers {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.82rem;
    color: var(--kw-text-secondary);
    margin-bottom: 6px;
}

.kw-timeline-action {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.8rem;
    margin-top: 6px;
}

.kw-timeline-action-by {
    font-weight: 600;
    color: var(--kw-text-primary);
}

.kw-timeline-action-type {
    color: var(--kw-text-secondary);
}

.kw-timeline-date {
    color: var(--kw-text-muted);
    font-size: 0.75rem;
}

.kw-timeline-comments {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.8rem;
    color: var(--kw-text-secondary);
    margin-top: 6px;
    padding: 8px 12px;
    background: var(--kw-surface-muted);
    border-radius: var(--kw-radius-sm);
    border-left: 3px solid var(--kw-border);
    font-style: italic;
}

/* ══════════════════════════════════════════════════════════════
   Module Page Headers (reusable across all modules)
   ══════════════════════════════════════════════════════════════ */

/* The legacy module shell. Pages not yet hand-converted to `kw-ui` still use these three
   classes, so they are styled to MATCH the new shell: same width, same hero treatment, same
   token scope. That gives every remaining module the modern look and correct dark mode without
   touching its markup, and lets a legacy page drop in `kw-ui-*` pieces (stat bands, cards,
   tables) incrementally. New pages should use `kw-ui` directly. */
.kw-module-page {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 8px 48px;
}

.kw-module-header {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 26px 28px 28px;
    border-radius: 18px;
    margin-bottom: 22px;
    color: #fff;
}

/* Same soft grid + corner glow as .kw-ui-hero, so a legacy header reads as the same object. */
.kw-module-header::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(90% 120% at 100% 0%, rgba(255, 255, 255, 0.10), transparent 55%),
        linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
    background-size: auto, 30px 30px, 30px 30px;
}

/* Keep the header's own children above the texture layer. */
.kw-module-header > * { position: relative; }

.kw-module-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: clamp(1.35rem, 2.2vw, 1.9rem);
    letter-spacing: -0.01em;
    color: #FFFFFF;
    margin: 0;
    line-height: 1.14;
}

.kw-module-subtitle {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.88rem;
    color: rgba(255, 255, 255, 0.78);
    margin: 5px 0 0;
    line-height: 1.5;
    max-width: 640px;
}

/* ══════════════════════════════════════════════════════════════
   Phase 10 — Dashboards & Analytics
   Modern bento layout, gradient KPI tiles, sparklines, RAG bars
   ══════════════════════════════════════════════════════════════ */

.kw-dash {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding-bottom: 32px;
}

/* ── Hero header ── */
.kw-dash-hero {
    position: relative;
    border-radius: 24px;
    padding: 28px 32px;
    color: #fff;
    overflow: hidden;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
}
.kw-dash-hero::before {
    content: '';
    position: absolute; inset: 0;
    background: radial-gradient(circle at 88% -10%, rgba(255,255,255,0.18), transparent 55%),
                radial-gradient(circle at 5% 110%, rgba(255,255,255,0.10), transparent 60%);
    pointer-events: none;
}
.kw-dash-hero-inner {
    position: relative;
    display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
}
.kw-dash-hero-eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.7rem;
    color: rgba(255,255,255,0.7);
    margin: 0;
}
.kw-dash-hero-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.75rem;
    margin: 4px 0 6px;
    line-height: 1.15;
}
.kw-dash-hero-sub {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem;
    color: rgba(255,255,255,0.78);
    margin: 0;
}
.kw-dash-hero-actions { margin-left: auto; display: flex; gap: 8px; }

/* ── KPI tile (modern stat card with sparkline) ── */
.kw-dash-kpi {
    background: var(--kw-surface);
    border: 1px solid var(--kw-line);
    border-radius: 18px;
    padding: 18px 20px 20px;
    position: relative;
    overflow: hidden;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.kw-dash-kpi:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.08);
}
.kw-dash-kpi::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--kpi-color, #1A3A64), transparent);
    opacity: 0.85;
}
.kw-dash-kpi-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 10px;
}
.kw-dash-kpi-label {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--kw-text-muted);
}
.kw-dash-kpi-icon {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 10px;
    color: var(--kpi-color, #1A3A64);
    background: color-mix(in srgb, var(--kpi-color, #1A3A64) 12%, transparent);
}
.kw-dash-kpi-value {
    font-family: 'Outfit', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    color: var(--kw-text-primary);
    line-height: 1.05;
    letter-spacing: -0.02em;
}
.kw-dash-kpi-sub {
    margin-top: 4px;
    font-size: 0.78rem;
    color: var(--kw-text-muted);
    display: flex; align-items: center; gap: 4px;
}

.kw-dash-trend {
    display: inline-flex; align-items: center; gap: 2px;
    font-size: 0.72rem; font-weight: 600;
    padding: 2px 6px; border-radius: 999px;
}
.kw-dash-trend--up { color: #047857; background: rgba(16,185,129,0.12); }
.kw-dash-trend--down { color: #B91C1C; background: rgba(239,68,68,0.12); }
.kw-dash-trend--flat { color: #475569; background: rgba(100,116,139,0.12); }

/* Inline SVG sparkline area — reserved width */
.kw-spark { display: block; width: 100%; height: 36px; margin-top: 10px; }

/* ── Bento grid panel ── */
.kw-dash-panel {
    background: var(--kw-surface);
    border: 1px solid var(--kw-line);
    border-radius: 18px;
    padding: 20px;
    display: flex; flex-direction: column; gap: 14px;
}
.kw-dash-panel-head {
    display: flex; align-items: center; gap: 10px;
}
.kw-dash-panel-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    margin: 0;
    color: var(--kw-text-primary);
}
.kw-dash-panel-sub {
    font-size: 0.78rem;
    color: var(--kw-text-muted);
    margin: 0;
}
.kw-dash-panel-actions { margin-left: auto; }

/* ── RAG status segmented bar ── */
.kw-rag-bar {
    display: flex; height: 8px; border-radius: 999px; overflow: hidden;
    background: var(--kw-line);
    margin: 6px 0 4px;
}
.kw-rag-bar-seg { height: 100%; transition: width 0.3s ease; }
.kw-rag-bar-seg--green { background: #10B981; }
.kw-rag-bar-seg--amber { background: #F59E0B; }
.kw-rag-bar-seg--red { background: #EF4444; }
.kw-rag-legend {
    display: flex; gap: 12px; font-size: 0.74rem; color: var(--kw-text-muted);
}
.kw-rag-legend-item { display: inline-flex; align-items: center; gap: 4px; }
.kw-rag-dot { width: 8px; height: 8px; border-radius: 50%; }

/* ── Activity feed ── */
.kw-dash-feed {
    display: flex; flex-direction: column; gap: 0;
    max-height: 420px; overflow-y: auto;
}
.kw-dash-feed-item {
    display: flex; gap: 12px; padding: 12px 0;
    border-bottom: 1px dashed var(--kw-line);
}
.kw-dash-feed-item:last-child { border-bottom: none; }
.kw-dash-feed-icon {
    width: 32px; height: 32px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    background: color-mix(in srgb, var(--feed-color, #64748B) 14%, transparent);
    color: var(--feed-color, #64748B);
    flex-shrink: 0;
}
.kw-dash-feed-content { flex: 1; min-width: 0; }
.kw-dash-feed-title {
    font-size: 0.88rem; font-weight: 600;
    color: var(--kw-text-primary);
    margin: 0 0 2px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.kw-dash-feed-desc {
    font-size: 0.78rem; color: var(--kw-text-muted); margin: 0;
}
.kw-dash-feed-time {
    font-size: 0.72rem; color: var(--kw-text-muted);
    flex-shrink: 0; padding-top: 4px;
}

/* ── Distribution bars (horizontal category chart) ── */
.kw-dist-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px 12px;
    align-items: center;
    padding: 6px 0;
}
.kw-dist-label {
    font-size: 0.85rem;
    color: var(--kw-text-primary);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.kw-dist-value {
    font-size: 0.82rem; font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--kw-text-secondary);
}
.kw-dist-bar {
    grid-column: 1 / 3;
    height: 6px; border-radius: 999px;
    background: var(--kw-line);
    overflow: hidden;
}
.kw-dist-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--bar-color, #1A3A64), color-mix(in srgb, var(--bar-color, #1A3A64) 60%, white));
    transition: width 0.4s ease;
}

/* ── Empty state ── */
.kw-dash-empty {
    text-align: center;
    padding: 32px 16px;
    color: var(--kw-text-muted);
}
.kw-dash-empty-icon {
    font-size: 2.5rem;
    opacity: 0.35;
    margin-bottom: 8px;
}

/* ── Pending action card (User dashboard) ── */
.kw-action-tile {
    border: 1px solid var(--kw-line);
    border-left: 3px solid var(--action-color, #1A3A64);
    border-radius: 12px;
    padding: 12px 14px;
    background: var(--kw-surface);
    display: flex; gap: 10px; align-items: flex-start;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    text-decoration: none;
    color: inherit;
}
.kw-action-tile:hover {
    transform: translateX(2px);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}
.kw-action-tile-body { flex: 1; min-width: 0; }
.kw-action-tile-title {
    font-size: 0.88rem; font-weight: 600;
    color: var(--kw-text-primary);
    margin: 0;
    overflow: hidden; text-overflow: ellipsis;
}
.kw-action-tile-desc {
    font-size: 0.75rem; color: var(--kw-text-muted);
    margin: 2px 0 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ── Hero gradient variants per dashboard ── */
.kw-hero--executive { background: linear-gradient(135deg, #0F172A 0%, #1E40AF 60%, #0EA5E9 100%); }
.kw-hero--investments { background: linear-gradient(135deg, #1E40AF 0%, #2563EB 50%, #3B82F6 100%); }
.kw-hero--planning { background: linear-gradient(135deg, #115E59 0%, #0D9488 50%, #14B8A6 100%); }
.kw-hero--activities { background: linear-gradient(135deg, #9A3412 0%, #EA580C 50%, #F97316 100%); }
.kw-hero--resources { background: linear-gradient(135deg, #064E3B 0%, #047857 50%, #10B981 100%); }
.kw-hero--user { background: linear-gradient(135deg, #1E293B 0%, #334155 50%, #475569 100%); }
.kw-hero--admin { background: linear-gradient(135deg, #4C1D95 0%, #7C3AED 50%, #A855F7 100%); }
.kw-hero--tracker { background: linear-gradient(135deg, #1E3A8A 0%, #1D4ED8 50%, #6366F1 100%); }

/* ── Stagger fade-in animation ── */
@keyframes kwDashFade {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.kw-dash > * { animation: kwDashFade 0.4s ease both; }
.kw-dash > *:nth-child(2) { animation-delay: 0.06s; }
.kw-dash > *:nth-child(3) { animation-delay: 0.12s; }
.kw-dash > *:nth-child(4) { animation-delay: 0.18s; }
.kw-dash > *:nth-child(5) { animation-delay: 0.24s; }

/* Dark mode */
.kw-dark .kw-dash-kpi,
.kw-dark .kw-dash-panel,
.kw-dark .kw-action-tile {
    background: rgba(255,255,255,0.02);
    border-color: rgba(255,255,255,0.08);
}

/* ──────────────────────────────────────────────────────────────
   Work-plan bulk grid editor (Excel-like): frozen panes + inline cells
   ────────────────────────────────────────────────────────────── */
.kw-grid-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 8px;
}
.kw-grid-toolbar-info { display: flex; align-items: center; gap: 0.5rem; }
.kw-grid-toolbar-actions { display: flex; align-items: center; gap: 0.25rem; flex-wrap: wrap; }

.kw-grid-wrap {
    max-height: 65vh;
    overflow: auto;
    border: 1px solid var(--kw-line, #e2e8f0);
    border-radius: 8px;
    background: var(--mud-palette-surface, #fff);
}
.kw-grid {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    font-size: 0.8rem;
}
.kw-grid th, .kw-grid td {
    border-bottom: 1px solid var(--kw-line, #e2e8f0);
    border-right: 1px solid var(--kw-line, #eef2f7);
    padding: 2px 6px;
    white-space: nowrap;
    background: var(--mud-palette-surface, #fff);
}
.kw-grid thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: var(--mud-palette-background-grey, #f1f5f9);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.68rem;
    letter-spacing: 0.03em;
    color: var(--kw-text-muted, #64748b);
    text-align: left;
}
.kw-grid .kw-grid-num { text-align: right; }
.kw-grid th.kw-grid-num { text-align: right; }
.kw-grid .kw-grid-tint { background: var(--kw-amber-100, #fef3c7); }
.kw-grid thead th.kw-grid-tint { background: #fde9b8; }

/* frozen context columns (Activity, Indicator) */
.kw-grid .kw-grid-c1, .kw-grid .kw-grid-c2 {
    position: sticky;
    z-index: 2;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}
.kw-grid .kw-grid-c1 { left: 0; min-width: 170px; max-width: 170px; }
.kw-grid .kw-grid-c2 { left: 170px; min-width: 150px; max-width: 150px; }
.kw-grid thead th.kw-grid-c1, .kw-grid thead th.kw-grid-c2 { z-index: 4; }

.kw-grid tfoot td {
    font-weight: 700;
    background: var(--mud-palette-background-grey, #f8fafc);
    position: sticky;
    bottom: 0;
    z-index: 2;
}
.kw-grid tfoot td.kw-grid-c1, .kw-grid tfoot td.kw-grid-c2 { z-index: 3; }

.kw-grid-input {
    width: 100%;
    min-width: 64px;
    border: 1px solid transparent;
    background: transparent;
    padding: 3px 4px;
    font-size: 0.8rem;
    font-family: inherit;
    color: inherit;
    border-radius: 3px;
}
.kw-grid-num .kw-grid-input { text-align: right; }
.kw-grid-input:hover { border-color: var(--kw-line, #e2e8f0); }
.kw-grid-input:focus {
    outline: none;
    border-color: var(--kw-amber-400, #fbbf24);
    background: #fff;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.15);
}
.kw-grid-input.kw-grid-dirty { background: var(--kw-amber-100, #fef3c7); border-color: var(--kw-amber-300, #fcd34d); }
.kw-grid-input.kw-grid-invalid { background: #fee2e2; border-color: #ef4444; color: #b91c1c; }
.kw-grid-rowfail td { background: #fef2f2 !important; }
.kw-grid-empty { text-align: center; padding: 16px; color: var(--kw-text-muted, #94a3b8); }

/* ── All-Users Permissions Matrix (collapsed heatmap + drill-down) ── */
.kw-permmatrix-table { border-collapse: collapse; width: 100%; font-size: 0.82rem; }
.kw-permmatrix-table th, .kw-permmatrix-table td {
    border-bottom: 1px solid var(--kw-line, #e2e8f0);
    border-right: 1px solid var(--kw-line, #eef2f7);
    padding: 8px 10px;
    background: var(--mud-palette-surface, #fff);
    white-space: nowrap;
}
.kw-permmatrix-table thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: var(--mud-palette-background-grey, #f1f5f9);
    font-weight: 600;
    font-size: 0.72rem;
    letter-spacing: 0.02em;
    color: var(--kw-text-muted, #64748b);
    text-align: left;
}
.kw-permmatrix-modcol { cursor: pointer; text-align: center; user-select: none; }
.kw-permmatrix-modcol:hover { background: var(--kw-amber-100, #fef3c7); }
.kw-permmatrix-permcol { text-align: center; min-width: 64px; }
.kw-permmatrix-permcol-inner { writing-mode: vertical-rl; transform: rotate(180deg); font-size: 0.68rem; }
.kw-permmatrix-collapse { width: 36px; text-align: center; }
.kw-permmatrix-c1 {
    position: sticky;
    left: 0;
    z-index: 2;
    min-width: 220px;
    max-width: 260px;
    white-space: normal;
}
.kw-permmatrix-table thead th.kw-permmatrix-c1 { z-index: 4; }
.kw-permmatrix-email { font-size: 0.72rem; color: var(--kw-text-muted, #94a3b8); }
.kw-permmatrix-inactive { text-decoration: line-through; color: var(--kw-text-muted, #94a3b8); }
.kw-permmatrix-cell { display: inline-block; width: 22px; height: 12px; border-radius: 6px; }

.kw-dark .kw-grid th,
.kw-dark .kw-grid td { background: #1e293b; border-color: rgba(255,255,255,0.07); }
.kw-dark .kw-grid thead th { background: #0f172a; }

/* ══════════════════════════════════════════════════════════════
   Investment Impact Map (kw-map.js / Leaflet)
   Shared by the public homepage, /public/tracker and /investments/map.
   ══════════════════════════════════════════════════════════════ */

.kw-map-canvas {
    width: 100%;
    height: 440px;
    border-radius: var(--kw-radius-lg);
    overflow: hidden;
    border: 1px solid var(--kw-border);
    box-shadow: var(--kw-shadow-card);
}

/* Pin markers (CSS-drawn teardrop, no image asset) */
.kw-map-pin-wrap { background: transparent; border: none; }
.kw-map-pin {
    width: 24px;
    height: 24px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    position: relative;
    border: 2px solid #fff;
    box-shadow: 0 3px 8px rgba(15, 23, 42, 0.35);
}
.kw-map-pin-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #fff;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
}

/* Hover tooltip */
.kw-map-tooltip {
    background: var(--kw-surface-raised);
    color: var(--kw-text-primary);
    border: 1px solid var(--kw-border);
    border-radius: var(--kw-radius-sm);
    box-shadow: var(--kw-shadow-md);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.78rem;
    padding: 4px 9px;
}
.kw-map-tooltip::before { display: none; }

/* Click popup */
.leaflet-popup-content-wrapper {
    background: var(--kw-surface-raised);
    color: var(--kw-text-primary);
    border-radius: var(--kw-radius-md);
    box-shadow: var(--kw-shadow-lg);
}
.leaflet-popup-tip { background: var(--kw-surface-raised); }
.leaflet-popup-content { margin: 14px 16px; }
.kw-map-popup { font-family: 'DM Sans', sans-serif; min-width: 180px; }
.kw-map-popup h4 {
    margin: 0 0 4px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--kw-text-primary);
}
.kw-map-popup-sub {
    font-size: 0.76rem;
    color: var(--kw-text-secondary);
    margin-bottom: 6px;
}
.kw-map-popup-value {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--kw-navy-500);
    margin-bottom: 8px;
}
.kw-map-popup-progress {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--kw-surface-muted);
    overflow: hidden;
    margin-bottom: 4px;
}
.kw-map-popup-progress-bar { height: 100%; border-radius: 3px; transition: width var(--kw-duration-normal) var(--kw-ease-out); }
.kw-map-popup-pct { font-size: 0.72rem; color: var(--kw-text-muted); margin-bottom: 8px; }
.kw-map-popup-link {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--kw-amber-500);
    text-decoration: none;
}
.kw-map-popup-link:hover { text-decoration: underline; }

/* Legend control */
.kw-map-legend {
    background: var(--kw-surface-raised);
    border: 1px solid var(--kw-border);
    border-radius: var(--kw-radius-sm);
    box-shadow: var(--kw-shadow-md);
    padding: 8px 12px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.72rem;
    color: var(--kw-text-secondary);
    line-height: 1.6;
}
.kw-map-legend-title {
    font-weight: 600;
    color: var(--kw-text-primary);
    margin-bottom: 2px;
}
.kw-map-legend-row { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.kw-map-legend-row--sep { border-top: 1px solid var(--kw-border); margin-top: 4px; padding-top: 5px; }
.kw-map-legend-swatch { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.kw-map-legend-swatch--sq {
    border-radius: 2px;
    background: rgba(245, 166, 35, 0.35);
    border: 1.5px solid #C9840A;
}

/* Permanent ASAL-county name label rendered directly on the choropleth fill */
.kw-map-county-label {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 0.72rem;
    color: #5C3D0A;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.85), 0 0 6px rgba(255, 255, 255, 0.6);
    pointer-events: none;
}
.kw-map-county-label::before { display: none !important; }

.kw-pub-map-caption {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    color: var(--kw-text-secondary, #64748b);
    margin: 0 0 28px;
}
.kw-dark .kw-grid-input:focus { background: #0f172a; }

/* ============================================================================
   PUBLIC VIZ — Drought Atlas analytics (tracker dashboard + profile pages)
   Tokens: --pp-* (defined on .kw-pub-shell, light + dark). All self-contained.
   ============================================================================ */

/* --- layout grids ------------------------------------------------------- */
.kw-pub-viz-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; }
.kw-pub-viz-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.kw-pub-viz-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.kw-pub-viz-span-2 { grid-column: span 2; }
@media (max-width: 940px) {
    .kw-pub-viz-grid-2, .kw-pub-viz-grid-3 { grid-template-columns: 1fr; }
    .kw-pub-viz-span-2 { grid-column: auto; }
}

/* --- panel (corner-tick frame + editorial head + export) ---------------- */
.kw-pub-viz-panel {
    position: relative;
    background: var(--pp-card);
    border: 1px solid var(--pp-line);
    padding: 22px;
    display: flex; flex-direction: column;
}
.kw-pub-viz-panel::before, .kw-pub-viz-panel::after {
    content: ''; position: absolute; width: 13px; height: 13px;
    border: 0 solid var(--pp-line-2); pointer-events: none;
}
.kw-pub-viz-panel::before { top: -1px; left: -1px; border-top-width: 2px; border-left-width: 2px; }
.kw-pub-viz-panel::after { bottom: -1px; right: -1px; border-bottom-width: 2px; border-right-width: 2px; }
.kw-pub-viz-panel-head {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
    padding-bottom: 14px; margin-bottom: 16px;
    border-bottom: 1px solid var(--pp-line);
}
.kw-pub-viz-panel-kicker {
    font-family: var(--pp-sans);
    font-size: 0.66rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
    color: var(--pp-amber); margin: 0 0 5px;
}
.kw-pub-viz-panel-title {
    font-family: var(--pp-serif); font-weight: 600; font-size: 1.12rem; line-height: 1.2;
    color: var(--pp-ink); margin: 0;
}
.kw-pub-viz-panel-sub { font-size: 0.82rem; color: var(--pp-ink-2); margin: 5px 0 0; line-height: 1.5; }
.kw-pub-viz-panel-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.kw-pub-viz-panel-export {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; padding: 0;
    background: transparent; border: 1px solid var(--pp-line);
    color: var(--pp-ink-2); cursor: pointer;
    transition: border-color var(--kw-duration-fast), color var(--kw-duration-fast);
}
.kw-pub-viz-panel-export:hover { border-color: var(--pp-amber); color: var(--pp-amber); }
.kw-pub-viz-panel-body { flex: 1; min-height: 0; }
.kw-pub-viz-empty {
    display: flex; align-items: center; justify-content: center;
    min-height: 120px; padding: 24px;
    font-size: 0.85rem; color: var(--pp-ink-3); font-style: italic; text-align: center;
}

/* --- horizontal category bars ------------------------------------------ */
.kw-pub-viz-bars { display: flex; flex-direction: column; gap: 11px; }
.kw-pub-viz-bar-row {
    display: grid; grid-template-columns: minmax(90px, 34%) 1fr auto; align-items: center; gap: 12px;
    padding: 2px 4px; border-radius: 3px;
}
.kw-pub-viz-bar-row.is-click { cursor: pointer; transition: background var(--kw-duration-fast); }
.kw-pub-viz-bar-row.is-click:hover { background: var(--pp-amber-soft); }
.kw-pub-viz-bar-label {
    font-size: 0.83rem; color: var(--pp-ink); font-weight: 500;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.kw-pub-viz-bar-track {
    position: relative; height: 12px; background: var(--pp-paper-2);
    border-radius: 999px; overflow: hidden;
}
.kw-pub-viz-bar-fill {
    position: absolute; left: 0; top: 0; height: 100%;
    border-radius: 999px; min-width: 3px;
    transition: width 0.5s var(--kw-ease-out);
}
.kw-pub-viz-bar-val {
    font-family: var(--pp-serif); font-variant-numeric: tabular-nums;
    font-size: 0.86rem; font-weight: 600; color: var(--pp-ink); text-align: right; min-width: 42px;
}

/* --- area / line timeline ---------------------------------------------- */
.kw-pub-viz-chart { width: 100%; }
.kw-pub-viz-chart svg { width: 100%; height: 150px; display: block; }
.kw-pub-viz-chart-grid { stroke: var(--pp-line); stroke-width: 0.25; }
.kw-pub-viz-chart-dot { transition: r 0.15s; }
.kw-pub-viz-chart-dot:hover { r: 1.6; }
.kw-pub-viz-chart-axis {
    display: flex; justify-content: space-between; gap: 4px; margin-top: 8px;
    font-size: 0.68rem; color: var(--pp-ink-3); font-variant-numeric: tabular-nums;
}
.kw-pub-viz-chart-axis span { flex: 1; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kw-pub-viz-chart-axis span:first-child { text-align: left; }
.kw-pub-viz-chart-axis span:last-child { text-align: right; }

/* --- donut + legend ----------------------------------------------------- */
.kw-pub-viz-donut { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.kw-pub-viz-donut-svg { width: 150px; height: 150px; flex-shrink: 0; transform: rotate(0deg); }
.kw-pub-viz-donut-seg { transition: opacity 0.15s; }
.kw-pub-viz-donut-seg.is-click { cursor: pointer; }
.kw-pub-viz-donut-seg.is-click:hover { opacity: 0.78; }
.kw-pub-viz-donut-center-val {
    font-family: var(--pp-serif); font-weight: 600; font-size: 6px; fill: var(--pp-ink);
    text-anchor: middle; font-variant-numeric: tabular-nums;
}
.kw-pub-viz-donut-center-lab { font-family: var(--pp-sans); font-size: 2.6px; fill: var(--pp-ink-3); text-anchor: middle; letter-spacing: 0.05em; text-transform: uppercase; }
.kw-pub-viz-legend { display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 150px; }
.kw-pub-viz-legend-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 9px; padding: 2px 4px; border-radius: 3px; }
.kw-pub-viz-legend-row.is-click { cursor: pointer; transition: background var(--kw-duration-fast); }
.kw-pub-viz-legend-row.is-click:hover { background: var(--pp-amber-soft); }
.kw-pub-viz-legend-swatch { width: 11px; height: 11px; border-radius: 2px; flex-shrink: 0; }
.kw-pub-viz-legend-label { font-size: 0.81rem; color: var(--pp-ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kw-pub-viz-legend-val { font-family: var(--pp-serif); font-variant-numeric: tabular-nums; font-size: 0.83rem; font-weight: 600; color: var(--pp-ink); }

/* --- RAG segmented bar --------------------------------------------------- */
.kw-pub-viz-rag { display: flex; flex-direction: column; gap: 12px; }
.kw-pub-viz-rag-track { display: flex; height: 20px; border-radius: 999px; overflow: hidden; background: var(--pp-paper-2); }
.kw-pub-viz-rag-seg { height: 100%; transition: width 0.5s var(--kw-ease-out); }
.kw-pub-viz-rag-seg:not(:last-child) { border-right: 2px solid var(--pp-card); }
.kw-pub-viz-rag-key { display: flex; flex-wrap: wrap; gap: 14px; font-size: 0.76rem; color: var(--pp-ink-2); }
.kw-pub-viz-rag-key span { display: inline-flex; align-items: center; gap: 6px; }
.kw-pub-viz-rag-key i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }

/* --- beneficiary target-vs-reached bars --------------------------------- */
.kw-pub-viz-bt { display: flex; flex-direction: column; gap: 12px; }
.kw-pub-viz-bt-row { display: grid; grid-template-columns: minmax(80px, 26%) 1fr auto; align-items: center; gap: 12px; }
.kw-pub-viz-bt-label { font-size: 0.82rem; color: var(--pp-ink); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kw-pub-viz-bt-track { position: relative; height: 16px; background: var(--pp-paper-2); border-radius: 999px; overflow: hidden; }
.kw-pub-viz-bt-target { position: absolute; left: 0; top: 0; height: 100%; background: var(--pp-line-2); border-radius: 999px; }
.kw-pub-viz-bt-reached { position: absolute; left: 0; top: 0; height: 100%; background: var(--pp-green); border-radius: 999px; transition: width 0.5s var(--kw-ease-out); }
.kw-pub-viz-bt-pct { font-size: 0.78rem; color: var(--pp-ink-2); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kw-pub-viz-bt-pct small { color: var(--pp-ink-3); }
.kw-pub-viz-bt-key { display: flex; gap: 14px; margin-top: 12px; font-size: 0.76rem; color: var(--pp-ink-2); }
.kw-pub-viz-bt-key span { display: inline-flex; align-items: center; gap: 6px; }
.kw-pub-viz-bt-key i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }

/* --- pivot heatmap ------------------------------------------------------ */
.kw-pub-pivot-wrap { overflow-x: auto; margin: -4px; padding: 4px; }
.kw-pub-pivot { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 0.8rem; }
.kw-pub-pivot th, .kw-pub-pivot td { padding: 7px 9px; text-align: center; border-bottom: 1px solid var(--pp-line); white-space: nowrap; }
.kw-pub-pivot-corner {
    position: sticky; left: 0; z-index: 3; background: var(--pp-card);
    text-align: left !important; font-family: var(--pp-sans); font-size: 0.68rem;
    font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--pp-ink-3);
}
.kw-pub-pivot-colh { font-weight: 600; color: var(--pp-ink-2); vertical-align: bottom; background: var(--pp-card); }
.kw-pub-pivot-colh span { display: inline-block; max-width: 92px; overflow: hidden; text-overflow: ellipsis; }
.kw-pub-pivot-colh.is-click { cursor: pointer; }
.kw-pub-pivot-colh.is-click:hover { color: var(--pp-amber); }
.kw-pub-pivot-rowh {
    position: sticky; left: 0; z-index: 2; background: var(--pp-card);
    text-align: left !important; font-weight: 600; color: var(--pp-ink);
    max-width: 160px; overflow: hidden; text-overflow: ellipsis;
}
.kw-pub-pivot-rowh.is-click { cursor: pointer; }
.kw-pub-pivot-rowh.is-click:hover { color: var(--pp-amber); }
.kw-pub-pivot-cell { font-variant-numeric: tabular-nums; color: var(--pp-ink); }
.kw-pub-pivot-cell.is-click { cursor: pointer; }
.kw-pub-pivot-cell.is-click:hover { outline: 2px solid var(--pp-amber); outline-offset: -2px; }
.kw-pub-pivot-total { font-weight: 700; color: var(--pp-ink); background: var(--pp-paper-2); }
.kw-pub-pivot-grand { color: var(--pp-amber); }
.kw-pub-pivot-foot { font-size: 0.72rem; color: var(--pp-ink-3); margin: 10px 0 0; line-height: 1.5; font-style: italic; }

/* --- treemap ------------------------------------------------------------ */
.kw-pub-tree { width: 100%; }
.kw-pub-tree-svg { width: 100%; height: 260px; display: block; }
.kw-pub-tree-cell.is-click { cursor: pointer; }
.kw-pub-tree-cell.is-click:hover rect { opacity: 0.85; }
.kw-pub-tree-cell rect { transition: opacity 0.15s; }
.kw-pub-tree-label { font-family: var(--pp-sans); font-size: 2.7px; font-weight: 700; fill: #fff; letter-spacing: 0.02em; }
.kw-pub-tree-val { font-family: var(--pp-serif); font-size: 2.6px; fill: rgba(255,255,255,0.86); font-variant-numeric: tabular-nums; }

/* --- drilldown slide-in ------------------------------------------------- */
.kw-pub-drill-scrim {
    position: fixed; inset: 0; z-index: 1200;
    background: rgba(10, 22, 40, 0.42); backdrop-filter: blur(2px);
    opacity: 0; visibility: hidden; transition: opacity 0.25s, visibility 0.25s;
}
.kw-pub-drill-scrim.open { opacity: 1; visibility: visible; }
.kw-pub-drill {
    position: fixed; top: 0; right: 0; bottom: 0; z-index: 1201;
    width: min(440px, 92vw); background: var(--pp-paper);
    border-left: 1px solid var(--pp-line);
    display: flex; flex-direction: column;
    transform: translateX(100%); transition: transform 0.3s var(--kw-ease-out);
    box-shadow: -18px 0 44px rgba(10, 22, 40, 0.18);
}
.kw-pub-drill.open { transform: translateX(0); }
.kw-pub-drill-head {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
    padding: 22px 24px; border-bottom: 1px solid var(--pp-line); background: var(--pp-card);
}
.kw-pub-drill-kicker { font-family: var(--pp-sans); font-size: 0.66rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--pp-amber); margin: 0 0 5px; }
.kw-pub-drill-title { font-family: var(--pp-serif); font-weight: 600; font-size: 1.15rem; line-height: 1.25; color: var(--pp-ink); margin: 0; }
.kw-pub-drill-body { flex: 1; overflow-y: auto; padding: 16px 20px 28px; }
.kw-pub-drill-row {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 13px 14px; margin-bottom: 8px;
    background: var(--pp-card); border: 1px solid var(--pp-line);
    text-decoration: none; color: inherit;
    transition: border-color var(--kw-duration-fast), transform var(--kw-duration-fast);
}
.kw-pub-drill-row:hover { border-color: var(--pp-amber); transform: translateX(-2px); }
.kw-pub-drill-row-main { min-width: 0; }
.kw-pub-drill-row-title { font-weight: 600; font-size: 0.9rem; color: var(--pp-ink); margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kw-pub-drill-row-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 0.74rem; color: var(--pp-ink-3); }
.kw-pub-drill-row-meta span { position: relative; }
.kw-pub-drill-row-meta span:not(:last-child)::after { content: '·'; position: absolute; right: -7px; }
.kw-pub-drill-row-amount { font-family: var(--pp-serif); font-variant-numeric: tabular-nums; font-weight: 600; font-size: 0.9rem; color: var(--pp-amber); white-space: nowrap; flex-shrink: 0; }

/* --- the showpiece hero tracker marquee --------------------------------- */
.kw-pub-marquee {
    position: relative; overflow: hidden;
    background: var(--pp-night); color: var(--pp-night-ink);
    border: 1px solid var(--pp-night-line);
    padding: 34px 34px 30px;
}
.kw-pub-marquee::before {
    content: ''; position: absolute; inset: 0; pointer-events: none;
    background:
        radial-gradient(120% 90% at 100% 0%, rgba(245, 166, 35, 0.16), transparent 55%),
        radial-gradient(90% 80% at 0% 100%, rgba(37, 99, 168, 0.14), transparent 55%),
        linear-gradient(rgba(255,255,255,0.028) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.028) 1px, transparent 1px);
    background-size: auto, auto, 34px 34px, 34px 34px;
}
.kw-pub-marquee-inner {
    position: relative; z-index: 1;
    display: grid; grid-template-columns: 1.25fr 1fr; gap: 30px 40px; align-items: center;
}
.kw-pub-marquee-lead { min-width: 0; }
.kw-pub-marquee-eyebrow {
    display: inline-flex; align-items: center; gap: 9px;
    font-family: var(--pp-sans); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase;
    color: var(--pp-amber-2); margin: 0 0 16px;
}
.kw-pub-marquee-live { width: 8px; height: 8px; border-radius: 50%; background: var(--pp-amber-2); box-shadow: 0 0 0 0 rgba(245, 166, 35, 0.6); animation: kwMarqueePulse 2.4s ease-out infinite; }
@keyframes kwMarqueePulse { 0% { box-shadow: 0 0 0 0 rgba(245,166,35,0.55); } 70% { box-shadow: 0 0 0 9px rgba(245,166,35,0); } 100% { box-shadow: 0 0 0 0 rgba(245,166,35,0); } }
.kw-pub-marquee-figure { display: flex; align-items: baseline; gap: 12px; line-height: 0.95; }
.kw-pub-marquee-cur { font-family: var(--pp-sans); font-size: 1.4rem; font-weight: 700; color: var(--pp-night-ink-2); letter-spacing: 0.02em; }
.kw-pub-marquee-val {
    font-family: var(--pp-serif); font-weight: 600; font-size: clamp(3rem, 8vw, 5.4rem);
    font-variant-numeric: tabular-nums; letter-spacing: -0.02em;
    background: linear-gradient(96deg, var(--pp-night-ink) 20%, var(--pp-amber-2) 130%);
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.kw-pub-marquee-figure-sub { font-size: 0.92rem; color: var(--pp-night-ink-2); margin: 14px 0 0; line-height: 1.55; }
.kw-pub-marquee-figure-sub b { color: var(--pp-night-ink); font-weight: 700; }

.kw-pub-marquee-progress { display: flex; align-items: center; gap: 26px; }
.kw-pub-marquee-dial {
    --dial-val: 0; --dial-color: var(--pp-amber-2);
    position: relative; width: 132px; height: 132px; border-radius: 50%; flex-shrink: 0;
    background:
        radial-gradient(closest-side, var(--pp-night) 74%, transparent 75%),
        conic-gradient(var(--dial-color) calc(var(--dial-val) * 1%), rgba(255,255,255,0.11) 0);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.kw-pub-marquee-dial::after { content: ''; position: absolute; inset: 8px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.06); }
.kw-pub-marquee-dial-val { font-family: var(--pp-serif); font-weight: 600; font-size: 1.75rem; color: var(--pp-night-ink); font-variant-numeric: tabular-nums; line-height: 1; }
.kw-pub-marquee-dial-lab { font-family: var(--pp-sans); font-size: 0.62rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--pp-night-ink-2); margin-top: 4px; }
.kw-pub-marquee-abs { flex: 1; min-width: 0; }
.kw-pub-marquee-abs-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 7px; font-size: 0.78rem; color: var(--pp-night-ink-2); }
.kw-pub-marquee-abs-head b { font-family: var(--pp-serif); font-size: 1.05rem; color: var(--pp-night-ink); font-variant-numeric: tabular-nums; }
.kw-pub-marquee-abs-track { height: 8px; border-radius: 999px; background: rgba(255,255,255,0.1); overflow: hidden; }
.kw-pub-marquee-abs-track span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--pp-amber), var(--pp-amber-2)); transition: width 0.6s var(--kw-ease-out); }
.kw-pub-marquee-status { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 15px; }
.kw-pub-marquee-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 11px; border-radius: 999px;
    background: rgba(255,255,255,0.06); border: 1px solid var(--pp-night-line);
    font-size: 0.74rem; font-weight: 500; color: var(--pp-night-ink-2);
}
.kw-pub-marquee-chip b { font-family: var(--pp-serif); font-variant-numeric: tabular-nums; color: var(--pp-night-ink); font-weight: 700; }
.kw-pub-marquee-chip--warn { border-color: color-mix(in srgb, var(--pp-red) 55%, transparent); color: color-mix(in srgb, var(--pp-red) 40%, var(--pp-night-ink)); }

.kw-pub-marquee-counters {
    grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
    margin-top: 30px; padding-top: 26px; border-top: 1px solid var(--pp-night-line);
    background: var(--pp-night-line);
}
.kw-pub-marquee-counter { background: var(--pp-night); padding: 4px 20px; text-align: center; }
.kw-pub-marquee-counter:first-child { padding-left: 0; text-align: left; }
.kw-pub-marquee-counter-val { font-family: var(--pp-serif); font-weight: 600; font-size: 1.9rem; color: var(--pp-night-ink); font-variant-numeric: tabular-nums; line-height: 1; }
.kw-pub-marquee-counter-lab { font-family: var(--pp-sans); font-size: 0.72rem; color: var(--pp-night-ink-2); margin-top: 7px; letter-spacing: 0.02em; }

@media (max-width: 860px) {
    .kw-pub-marquee { padding: 26px 22px; }
    .kw-pub-marquee-inner { grid-template-columns: 1fr; gap: 26px; }
    .kw-pub-marquee-progress { flex-direction: row; }
    .kw-pub-marquee-counters { grid-template-columns: repeat(2, 1fr); gap: 1px; }
    .kw-pub-marquee-counter, .kw-pub-marquee-counter:first-child { text-align: left; padding: 14px 16px; }
}
@media (prefers-reduced-motion: reduce) {
    .kw-pub-marquee-live { animation: none; }
    .kw-pub-viz-bar-fill, .kw-pub-viz-rag-seg, .kw-pub-viz-bt-reached, .kw-pub-marquee-abs-track span { transition: none; }
}

/* public header user menu — lift above the sticky public header */
.kw-pub-usermenu { position: relative; z-index: 60; }
.kw-pub-usermenu .kw-menu-pop { z-index: 61; }

/* ============================================================================
   FIELD CONSOLE — homepage hero split + live instrument panel (kw-con-*)
   Left: editorial text with the contour rings/ping/spotlight moved behind it.
   Right: an ink-navy live console over the public record with deep-link cells
   and rich hover tooltips. Tokens: --pp-* (light+dark safe; console is night).
   ============================================================================ */

/* --- split hero layout --------------------------------------------------- */
.kw-pub-hero--split::before,
.kw-pub-hero--split::after { content: none; }   /* contour + ping move into the left column */

.kw-pub-hero-inner--split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 540px);
    gap: 56px;
    align-items: center;
}
.kw-pub-hero-left { position: relative; }
.kw-pub-hero-left > :not(.kw-pub-hero-rings) { position: relative; z-index: 1; }

/* contour watermark, re-anchored behind the left column (same art as before) */
.kw-pub-hero-left::before {
    content: '';
    position: absolute; inset: -34% -14% -34% -30%;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 600 600'%3E%3Cg fill='none' stroke='%23A98F5F' stroke-width='1'%3E%3Cpath d='M100 300c0-110 90-200 200-200s200 90 200 200-90 200-200 200-200-90-200-200z'/%3E%3Cpath d='M140 300c0-88 72-160 160-160s160 72 160 160-72 160-160 160-160-72-160-160z'/%3E%3Cpath d='M180 300c0-66 54-120 120-120s120 54 120 120-54 120-120 120-120-54-120-120z'/%3E%3Cpath d='M220 300c0-44 36-80 80-80s80 36 80 80-36 80-80 80-80-36-80-80z'/%3E%3Cpath d='M260 300c0-22 18-40 40-40s40 18 40 40-18 40-40 40-40-18-40-40z'/%3E%3C/g%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
    background-position: center;
    opacity: 0.11;
    pointer-events: none;
    animation: kwHeroBreathe 15s ease-in-out infinite;
}
.kw-pub-shell--dark .kw-pub-hero-left::before,
.kw-dark .kw-pub-hero-left::before { opacity: 0.07; }

/* survey ping, re-anchored to the left column's contour centre */
.kw-pub-hero-left::after {
    content: '';
    position: absolute; top: 46%; left: 28%;
    width: 280px; height: 280px;
    border: 1px solid #A98F5F;
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(0.6);
    animation: kwHeroPingLeft 8s ease-out infinite;
}
.kw-pub-shell--dark .kw-pub-hero-left::after,
.kw-dark .kw-pub-hero-left::after { border-color: #F5A623; }
@keyframes kwHeroPingLeft {
    0% { transform: translate(-50%, -50%) scale(0.6); opacity: 0; }
    18% { opacity: 0.18; }
    100% { transform: translate(-50%, -50%) scale(1.35); opacity: 0; }
}

/* cursor-reactive amber reveal — geometry mirrors .kw-pub-hero-left::before exactly */
.kw-pub-hero--split .kw-pub-hero-rings {
    inset: -34% -14% -34% -30%;
    background-position: center;
}

/* --- the console frame ---------------------------------------------------- */
.kw-con {
    --con-r: 18px;
    position: relative;
    background: var(--pp-night);
    color: var(--pp-night-ink);
    border: 1px solid var(--pp-night-line);
    border-radius: var(--con-r);
    outline: 1px solid rgba(255, 255, 255, 0.05);
    outline-offset: -8px;
    padding: 20px 20px 16px;
    display: flex; flex-direction: column; gap: 13px;
    box-shadow: 0 34px 80px rgba(10, 22, 40, 0.24);
}
.kw-con::before, .kw-con::after {
    content: ''; position: absolute; width: 20px; height: 20px;
    border: 0 solid var(--pp-amber-2); pointer-events: none; z-index: 2;
}
.kw-con::before { top: -1px; left: -1px; border-top-width: 2px; border-left-width: 2px; border-top-left-radius: var(--con-r); }
.kw-con::after { bottom: -1px; right: -1px; border-bottom-width: 2px; border-right-width: 2px; border-bottom-right-radius: var(--con-r); }

/* radar sweep — clipped to its own layer so tooltips can overflow the console */
.kw-con-sweep { position: absolute; inset: 0; overflow: hidden; pointer-events: none; border-radius: calc(var(--con-r) - 1px); }
.kw-con-sweep::before {
    content: ''; position: absolute; left: 50%; top: 50%;
    width: 220%; aspect-ratio: 1; border-radius: 50%;
    transform: translate(-50%, -50%);
    background: conic-gradient(from 0deg, transparent 0 82%, rgba(245, 166, 35, 0.055) 93%, transparent 100%);
    animation: kwConSweep 16s linear infinite;
}
@keyframes kwConSweep { to { transform: translate(-50%, -50%) rotate(360deg); } }

.kw-con-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; position: relative; z-index: 1; }
.kw-con-live {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 0.64rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase;
    color: var(--pp-amber-2);
}
.kw-con-live i {
    width: 7px; height: 7px; border-radius: 50%; background: var(--pp-amber-2);
    animation: kwMarqueePulse 2.4s ease-out infinite;
}
.kw-con-stamp { font-size: 0.62rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--pp-night-ink-2); }

/* --- lens: narrow the console without leaving the page --------------------- */
.kw-con-lens {
    display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
    position: relative; z-index: 2;
    margin: 14px 0 2px;
}
.kw-con-lens-seg {
    display: inline-flex; align-items: stretch;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 2px; overflow: hidden;
}
.kw-con-lens-seg button {
    --lens: var(--pp-amber-2);
    background: transparent; border: none; border-right: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--pp-night-ink-2);
    font: inherit; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.04em;
    padding: 5px 11px; cursor: pointer;
    transition: background .16s ease, color .16s ease;
}
.kw-con-lens-seg button:last-child { border-right: none; }
.kw-con-lens-seg button:hover:not(:disabled) { background: rgba(255, 255, 255, 0.06); color: #fff; }
.kw-con-lens-seg button.on {
    background: color-mix(in srgb, var(--lens) 22%, transparent);
    color: color-mix(in srgb, var(--lens) 82%, white);
    box-shadow: inset 0 -2px 0 var(--lens);
}
.kw-con-lens-seg button:disabled { opacity: 0.55; cursor: default; }

/* The count each chip holds. Present on every chip, not just the empty ones — a "0" only reads as
   information when the others are showing real numbers beside it. */
.kw-con-lens-n {
    margin-left: 5px; padding: 1px 5px; border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    font-size: 0.6rem; font-weight: 700; font-variant-numeric: tabular-nums;
    color: var(--pp-night-ink-2);
}
.kw-con-lens-seg button.on .kw-con-lens-n { background: rgba(255, 255, 255, 0.2); color: #fff; }
/* An empty chip is inert and says so, rather than looking clickable and blanking the console. */
.kw-con-lens-seg button.empty { opacity: 0.4; }
.kw-con-lens-seg button.empty .kw-con-lens-n { background: rgba(255, 255, 255, 0.07); }
.kw-con-lens-sel {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: var(--pp-night-ink);
    font: inherit; font-size: 0.7rem; font-weight: 600;
    padding: 5px 8px; max-width: 168px; cursor: pointer;
}
.kw-con-lens-sel option { background: var(--pp-night); color: var(--pp-night-ink); }
.kw-con-lens-sel:disabled { opacity: 0.55; cursor: default; }
.kw-con-lens-busy,
.kw-con-lens-clear {
    background: none; border: none; padding: 0;
    font: inherit; font-size: 0.68rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
    color: var(--pp-night-ink-2);
}
.kw-con-lens-clear { cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.kw-con-lens-clear:hover { color: var(--pp-amber-2); }

@media (max-width: 560px) {
    .kw-con-lens-seg { width: 100%; }
    .kw-con-lens-seg button { flex: 1; padding: 6px 4px; }
    .kw-con-lens-sel { max-width: none; flex: 1; }
}

/* --- cells & tooltips (shared) -------------------------------------------- */
.kw-con-cell { position: relative; }
.kw-con-tip {
    position: absolute; bottom: calc(100% + 10px); left: 50%; z-index: 80;
    width: 290px; --tx: -50%;
    background: var(--pp-card); color: var(--pp-ink);
    border: 1px solid var(--pp-line);
    border-radius: 12px;
    box-shadow: 0 20px 48px rgba(10, 22, 40, 0.30);
    padding: 13px 14px 11px;
    opacity: 0; visibility: hidden; pointer-events: none;
    transform: translate(var(--tx), 6px);
    /* hide is DELAYED (grace period) so the cursor can travel into the card;
       the shown state resets the delay so opening stays instant */
    transition: opacity 0.16s var(--kw-ease-out) 0.35s, transform 0.16s var(--kw-ease-out) 0.35s, visibility 0s linear 0.51s;
}
/* invisible hover bridge across the air gap between cell and card — because the
   card is a child of the cell, hovering the bridge keeps the cell's :hover alive */
.kw-con-tip::before {
    content: ''; position: absolute; left: -8px; right: -8px;
    top: 100%; height: 18px;                    /* tips that open above: bridge below the card */
}
.kw-con-hero-cell .kw-con-tip::before,
.kw-con-mid .kw-con-tip::before {
    top: auto; bottom: 100%;                    /* tips that open below: bridge above the card */
}
.kw-con-tip::after {
    content: ''; position: absolute; bottom: -5.5px; left: calc(50% + var(--ax, 0px));
    width: 10px; height: 10px; background: var(--pp-card);
    border-right: 1px solid var(--pp-line); border-bottom: 1px solid var(--pp-line);
    transform: translateX(-50%) rotate(45deg);
}
.kw-con-cell:hover .kw-con-tip,
.kw-con-cell:focus-within .kw-con-tip {
    opacity: 1; visibility: visible; pointer-events: auto;
    transform: translate(var(--tx), 0);
    transition-delay: 0s, 0s, 0s;   /* open instantly — the delay only applies to hiding */
}
/* the hero + mid cells sit at the console's top edge (the hero section clips
   overflow) — their tooltips open BELOW instead, with the arrow flipped up */
.kw-con-hero-cell .kw-con-tip, .kw-con-mid .kw-con-tip {
    bottom: auto; top: calc(100% + 10px);
    transform: translate(var(--tx), -6px);
}
.kw-con-hero-cell:hover .kw-con-tip, .kw-con-hero-cell:focus-within .kw-con-tip,
.kw-con-mid .kw-con-cell:hover .kw-con-tip, .kw-con-mid .kw-con-cell:focus-within .kw-con-tip {
    transform: translate(var(--tx), 0);
}
.kw-con-hero-cell .kw-con-tip::after, .kw-con-mid .kw-con-tip::after {
    bottom: auto; top: -5.5px;
    border: none; border-left: 1px solid var(--pp-line); border-top: 1px solid var(--pp-line);
}
/* edge-aware alignment inside the 3-col grid */
.kw-con-grid .kw-con-cell:nth-child(3n + 1) .kw-con-tip { left: -4px; --tx: 0%; --ax: -60px; }
.kw-con-grid .kw-con-cell:nth-child(3n) .kw-con-tip { left: auto; right: -4px; --tx: 0%; --ax: 60px; }
.kw-con-hero-cell .kw-con-tip { left: -2px; --tx: 0%; --ax: -68px; }
.kw-con-mid .kw-con-dial-cell .kw-con-tip { left: -2px; --tx: 0%; --ax: -68px; }
.kw-con-mid .kw-con-spark-cell .kw-con-tip { left: auto; right: -2px; --tx: 0%; --ax: 68px; }

.kw-con-tip-kicker {
    font-size: 0.6rem; font-weight: 700; letter-spacing: 0.15em; text-transform: uppercase;
    color: var(--pp-amber); margin: 0 0 8px;
}
.kw-con-tip-sub { font-size: 0.8rem; line-height: 1.5; color: var(--pp-ink-2); margin: 0 0 6px; }
.kw-con-tip-sub b { color: var(--pp-ink); font-variant-numeric: tabular-nums; }
.kw-con-tip-row {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 4.5px 0; font-size: 0.8rem; color: var(--pp-ink-2);
    text-decoration: none; border: none;
}
/* block (not flex) so text-overflow ellipsis actually renders on long names */
.kw-con-tip-row > span { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kw-con-tip-row b { color: var(--pp-ink); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kw-con-tip-row--link:hover > span { color: var(--pp-amber); }
.kw-con-tip-row--link:hover b { color: var(--pp-amber); }
.kw-con-dot { width: 8px; height: 8px; border-radius: 2px; display: inline-block; vertical-align: middle; margin: -2px 7px 0 0; }
.kw-con-tip-meter { display: block; height: 6px; border-radius: 999px; background: var(--pp-paper-2); overflow: hidden; margin: 4px 0 6px; }
.kw-con-tip-meter i { display: block; height: 100%; border-radius: 999px; background: var(--pp-green); }
.kw-con-tip-cta {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 7px; padding-top: 9px; border-top: 1px solid var(--pp-line);
    font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
    color: var(--pp-amber); text-decoration: none;
}
.kw-con-tip-cta span { transition: transform var(--kw-duration-fast); }
.kw-con-tip-cta:hover span { transform: translateX(3px); }

/* --- headline amount ------------------------------------------------------ */
.kw-con-hero { display: block; text-decoration: none; color: inherit; position: relative; z-index: 1; }
.kw-con-cur { font-size: 0.95rem; font-weight: 700; color: var(--pp-night-ink-2); margin-right: 8px; vertical-align: super; }
.kw-con-amount {
    font-family: var(--pp-serif); font-weight: 600;
    font-size: clamp(2.7rem, 4.4vw, 3.6rem); line-height: 0.95;
    letter-spacing: -0.02em; font-variant-numeric: tabular-nums;
    background: linear-gradient(96deg, var(--pp-night-ink) 25%, var(--pp-amber-2) 125%);
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
    transition: filter var(--kw-duration-fast);
}
.kw-con-hero:hover .kw-con-amount { filter: brightness(1.18); }
.kw-con-hero-sub { display: block; margin-top: 8px; font-size: 0.82rem; color: var(--pp-night-ink-2); line-height: 1.5; }
.kw-con-hero-sub b { color: var(--pp-night-ink); font-weight: 700; font-variant-numeric: tabular-nums; }

/* --- mid row: dial + sparkline -------------------------------------------- */
/* NOTE: no z-index here — a stacking context on this row would trap its tooltips
   beneath the later-in-DOM grid below (equal z, DOM order wins). With z auto, the
   tooltips' own z-index escapes to the console level and paints above everything. */
.kw-con-mid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; position: relative; }
.kw-con-dial-a, .kw-con-spark-a {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; height: 100%;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid var(--pp-night-line);
    border-radius: 12px;
    text-decoration: none; color: inherit;
    transition: border-color var(--kw-duration-fast), background var(--kw-duration-fast);
}
.kw-con-dial-a:hover, .kw-con-spark-a:hover { border-color: color-mix(in srgb, var(--pp-amber-2) 55%, transparent); background: rgba(255, 255, 255, 0.06); }
.kw-con-dial {
    --val: 0; --col: var(--pp-amber-2);
    width: 62px; height: 62px; border-radius: 50%; flex-shrink: 0;
    background:
        radial-gradient(closest-side, var(--pp-night) 76%, transparent 77%),
        conic-gradient(var(--col) calc(var(--val) * 1%), rgba(255, 255, 255, 0.12) 0);
    display: flex; align-items: center; justify-content: center;
}
.kw-con-dial b { font-family: var(--pp-serif); font-size: 0.98rem; font-weight: 600; color: var(--pp-night-ink); font-variant-numeric: tabular-nums; }
.kw-con-dial-meta { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 7px; }
.kw-con-dial-lab { font-size: 0.62rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--pp-night-ink-2); }
.kw-con-rag { display: flex; height: 6px; border-radius: 999px; overflow: hidden; background: rgba(255, 255, 255, 0.1); }
.kw-con-rag i { display: block; height: 100%; }
.kw-con-rag i + i { border-left: 1.5px solid var(--pp-night); }
.kw-con-spark-a { flex-direction: column; align-items: stretch; gap: 6px; }
.kw-con-spark-a svg { width: 100%; height: 40px; display: block; }
.kw-con-spark-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.kw-con-spark-lab { font-size: 0.62rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--pp-night-ink-2); }
.kw-con-spark-years { font-size: 0.66rem; color: var(--pp-night-ink-2); font-variant-numeric: tabular-nums; }

/* --- the six instrument cells --------------------------------------------- */
.kw-con-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px;
    background: var(--pp-night-line);
    border: 1px solid var(--pp-night-line);
    border-radius: 12px;
    position: relative; z-index: 1;
}
.kw-con-grid .kw-con-cell { background: var(--pp-night); }
/* corner cells (3×2 grid) follow the container's rounding — no overflow:hidden,
   which would clip the tooltips */
.kw-con-grid .kw-con-cell:nth-child(1), .kw-con-grid .kw-con-cell:nth-child(1) > .kw-con-cell-a { border-top-left-radius: 11px; }
.kw-con-grid .kw-con-cell:nth-child(3), .kw-con-grid .kw-con-cell:nth-child(3) > .kw-con-cell-a { border-top-right-radius: 11px; }
.kw-con-grid .kw-con-cell:nth-child(4), .kw-con-grid .kw-con-cell:nth-child(4) > .kw-con-cell-a { border-bottom-left-radius: 11px; }
.kw-con-grid .kw-con-cell:nth-child(6), .kw-con-grid .kw-con-cell:nth-child(6) > .kw-con-cell-a { border-bottom-right-radius: 11px; }
.kw-con-cell-a {
    display: flex; flex-direction: column; gap: 3px;
    padding: 12px 12px 10px;
    text-decoration: none; color: inherit;
    transition: background var(--kw-duration-fast);
}
.kw-con-grid .kw-con-cell:hover > .kw-con-cell-a,
.kw-con-grid .kw-con-cell:focus-within > .kw-con-cell-a { background: var(--pp-night-2); }
.kw-con-cell-val {
    font-family: var(--pp-serif); font-weight: 600; font-size: 1.55rem; line-height: 1;
    color: var(--pp-night-ink); font-variant-numeric: tabular-nums;
    transition: color var(--kw-duration-fast);
}
.kw-con-grid .kw-con-cell:hover .kw-con-cell-val { color: var(--pp-amber-2); }
.kw-con-cell-lab { font-size: 0.62rem; font-weight: 700; letter-spacing: 0.11em; text-transform: uppercase; color: var(--pp-night-ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* --- funders ticker -------------------------------------------------------- */
.kw-con-ticker { display: flex; align-items: center; gap: 12px; position: relative; z-index: 1; }
.kw-con-ticker-lab { font-size: 0.62rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--pp-night-ink-2); flex-shrink: 0; }
.kw-con-ticker-win { flex: 1; height: 20px; overflow: hidden; min-width: 0; contain: paint; }
.kw-con-ticker-track { display: flex; flex-direction: column; animation: kwConTicker 12s ease-in-out infinite; }
.kw-con-ticker-win:hover .kw-con-ticker-track { animation-play-state: paused; }
.kw-con-ticker-track a {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    height: 20px; line-height: 20px; flex-shrink: 0;
    font-size: 0.78rem; text-decoration: none; color: var(--pp-night-ink-2);
}
.kw-con-ticker-track a:hover { color: var(--pp-amber-2); }
.kw-con-ticker-track a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.kw-con-ticker-track a b { color: var(--pp-amber-2); font-weight: 600; font-size: 0.72rem; font-variant-numeric: tabular-nums; flex-shrink: 0; }
@keyframes kwConTicker {
    0%, 26% { transform: translateY(0); }
    33%, 59% { transform: translateY(-20px); }
    66%, 92% { transform: translateY(-40px); }
    100% { transform: translateY(-60px); }
}

/* --- CTA + offline --------------------------------------------------------- */
.kw-con-cta {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 14px; position: relative; z-index: 1;
    border: 1px solid var(--pp-night-line);
    border-radius: 12px;
    font-size: 0.74rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
    color: var(--pp-night-ink); text-decoration: none;
    transition: border-color var(--kw-duration-fast), color var(--kw-duration-fast);
}
.kw-con-cta:hover { border-color: var(--pp-amber-2); color: var(--pp-amber-2); }
.kw-con-offline { padding: 26px 8px 10px; text-align: center; color: var(--pp-night-ink-2); font-size: 0.9rem; }
.kw-con-offline p { margin: 0 0 16px; }

/* --- responsive + motion --------------------------------------------------- */
@media (max-width: 1080px) {
    .kw-pub-hero-inner--split { grid-template-columns: 1fr; gap: 44px; }
    .kw-con { max-width: 600px; }
}
@media (max-width: 560px) {
    .kw-con { padding: 16px 14px 12px; }
    .kw-con-tip { width: min(258px, 84vw); }
    .kw-con-cell-val { font-size: 1.3rem; }
    .kw-con-mid { grid-template-columns: 1fr; }
}
@media (hover: none) {
    /* touch: tooltips off — every cell is already a direct link */
    .kw-con-tip { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .kw-con-sweep::before, .kw-con-live i, .kw-con-ticker-track { animation: none; }
    .kw-pub-hero-left::before, .kw-pub-hero-left::after { animation: none; }
}

/* ============================================================================
   MAP SUMMARY RAIL — homepage Plate 01: map on the left, "On this map" county
   distribution on the right (paper aesthetic, corner-tick card, deep links).
   ============================================================================ */
.kw-pub-mapgrid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 312px;
    gap: 22px;
    align-items: stretch;
}
.kw-pub-mapgrid--solo { grid-template-columns: 1fr; }
.kw-pub-mapgrid-main { min-width: 0; }

.kw-pub-mapside {
    position: relative;
    background: var(--pp-card);
    border: 1px solid var(--pp-line);
    padding: 20px 20px 16px;
    display: flex; flex-direction: column;
    min-height: 0;
}
.kw-pub-mapside::before, .kw-pub-mapside::after {
    content: ''; position: absolute; width: 14px; height: 14px;
    border: 0 solid var(--pp-line-2); pointer-events: none;
    transition: border-color 0.2s;
}
.kw-pub-mapside::before { top: -1px; left: -1px; border-top-width: 2px; border-left-width: 2px; }
.kw-pub-mapside::after { bottom: -1px; right: -1px; border-bottom-width: 2px; border-right-width: 2px; }
.kw-pub-mapside:hover::before, .kw-pub-mapside:hover::after { border-color: var(--pp-amber); }

.kw-pub-mapside-kicker {
    font-size: 0.64rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase;
    color: var(--pp-amber); margin: 0 0 14px;
    display: flex; align-items: center; gap: 10px;
}
.kw-pub-mapside-kicker::after { content: ''; flex: 1; height: 1px; background: var(--pp-line); }

.kw-pub-mapside-stats {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px;
    background: var(--pp-line); border: 1px solid var(--pp-line);
    margin-bottom: 14px;
}
.kw-pub-mapside-stats > div { background: var(--pp-card); padding: 9px 10px 8px; text-align: center; }
.kw-pub-mapside-stats b {
    display: block; font-family: var(--pp-serif); font-weight: 600; font-size: 1.3rem;
    line-height: 1; color: var(--pp-ink); font-variant-numeric: tabular-nums;
}
.kw-pub-mapside-stats span {
    display: block; margin-top: 4px;
    font-size: 0.6rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
    color: var(--pp-ink-3);
}

.kw-pub-mapside-legend {
    display: flex; flex-wrap: wrap; gap: 6px 14px;
    margin-bottom: 14px; padding-bottom: 13px; border-bottom: 1px solid var(--pp-line);
    font-size: 0.7rem; color: var(--pp-ink-2);
}
.kw-pub-mapside-legend span { display: inline-flex; align-items: center; gap: 6px; }
.kw-pub-mapside-legend i { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }

.kw-pub-mapside-sub {
    font-size: 0.62rem; font-weight: 700; letter-spacing: 0.13em; text-transform: uppercase;
    color: var(--pp-ink-3); margin: 0 0 8px;
}
.kw-pub-mapside-rows { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; }
.kw-pub-mapside-row {
    display: grid; grid-template-columns: minmax(72px, 40%) 1fr auto;
    align-items: center; gap: 10px;
    padding: 6.5px 4px; border-radius: 4px;
    text-decoration: none; color: inherit;
    transition: background var(--kw-duration-fast);
}
.kw-pub-mapside-row:hover { background: var(--pp-amber-soft); }
.kw-pub-mapside-name {
    font-size: 0.82rem; font-weight: 500; color: var(--pp-ink);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.kw-pub-mapside-row:hover .kw-pub-mapside-name { color: var(--pp-amber); }
.kw-pub-mapside-bar { position: relative; height: 9px; background: var(--pp-paper-2); border-radius: 999px; overflow: hidden; }
.kw-pub-mapside-bar i {
    position: absolute; left: 0; top: 0; height: 100%; min-width: 3px;
    background: linear-gradient(90deg, var(--pp-amber), var(--pp-amber-2));
    border-radius: 999px;
}
.kw-pub-mapside-row b {
    font-family: var(--pp-serif); font-weight: 600; font-size: 0.88rem;
    color: var(--pp-ink); font-variant-numeric: tabular-nums; min-width: 18px; text-align: right;
}

.kw-pub-mapside-cta {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--pp-line);
    font-size: 0.7rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase;
    color: var(--pp-amber); text-decoration: none;
}
.kw-pub-mapside-cta:hover { color: var(--pp-amber-2); }

@media (max-width: 1000px) {
    .kw-pub-mapgrid { grid-template-columns: 1fr; }
    .kw-pub-mapside-rows { overflow-y: visible; }
}

/* ============================================================================
   PRIVATE-PORTAL MODULE SHELL — kw-ui-*
   The shared design system for private-portal module pages: gradient hero +
   glass stat band, section cards, form rail navigation, refined tables, status
   pills, progress meters/rings, and the results-framework editor/view.
   Introduced with the Investments module; adopted by the Executive Dashboard.
   Any new module page should compose from these rather than inventing its own.
   Put the module's accent on the hero (inline gradient) and per-tile via --tile.
   ============================================================================ */
/* `.kw-module-page` shares this scope so not-yet-converted pages can drop in kw-ui-* pieces
   (stat bands, cards, tables) and get the same theme-aware surfaces. */
.kw-ui, .kw-module-page {
    /* Brand accents — identical in both themes; they always sit on their own fill. */
    --ui-blue: #3b82f6;
    --ui-deep: #1d4ed8;
    --ui-navy: #0f2b5b;
    --ui-green: #10b981;
    --ui-amber: #f59e0b;
    --ui-red: #ef4444;

    /* Surfaces and ink follow MudBlazor's palette, which is the ONLY thing that changes
       when the theme is toggled. MudBlazor 9 swaps CSS custom properties on :root and never
       emits a `.mud-theme-dark` class, so keying off such a class silently does nothing —
       these var() references are what make the shell genuinely theme-aware. Fallbacks keep
       the light look if a palette variable is ever renamed. */
    --ui-card: var(--mud-palette-surface, #ffffff);
    --ui-bg: var(--mud-palette-background, #f8fafc);
    --ui-ink: var(--mud-palette-text-primary, #0f172a);
    --ui-ink-2: var(--mud-palette-text-secondary, #475569);
    --ui-ink-3: color-mix(in srgb, var(--ui-ink-2) 70%, transparent);
    --ui-line: var(--mud-palette-lines-default, #e2e8f0);

    /* Accent used for TEXT on a card. Mixing the brand blue toward the theme's own ink
       darkens it on light surfaces and lightens it on dark ones, so one token stays
       readable in both themes without a per-theme override. */
    --ui-accent: color-mix(in srgb, var(--ui-blue) 78%, var(--ui-ink));

    max-width: 1280px; margin: 0 auto; padding: 0 8px 48px;
}

/* --- hero ---------------------------------------------------------------- */
.kw-ui-hero {
    position: relative; overflow: hidden;
    background: linear-gradient(128deg, var(--ui-navy) 0%, var(--ui-deep) 55%, var(--ui-blue) 120%);
    border-radius: 18px;
    padding: 26px 28px 30px;
    color: #fff;
    margin-bottom: 0;
}
.kw-ui-hero::before {
    content: ''; position: absolute; inset: 0; pointer-events: none;
    background:
        radial-gradient(90% 120% at 100% 0%, rgba(255, 255, 255, 0.10), transparent 55%),
        linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
    background-size: auto, 30px 30px, 30px 30px;
}
.kw-ui-hero-top { position: relative; display: flex; align-items: flex-start; gap: 14px; }
.kw-ui-hero-body { min-width: 0; flex: 1; }
.kw-ui-hero-eyebrow {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    font-size: 0.68rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
    color: rgba(255, 255, 255, 0.75); margin: 4px 0 8px;
}
.kw-ui-hero-title {
    font-family: 'Outfit', sans-serif; font-weight: 700;
    font-size: clamp(1.4rem, 2.6vw, 2.05rem); line-height: 1.12;
    margin: 0 0 10px; color: #fff; letter-spacing: -0.01em;
}
.kw-ui-hero-sub { font-size: 0.9rem; color: rgba(255, 255, 255, 0.78); margin: 0; max-width: 640px; line-height: 1.5; }
.kw-ui-hero-actions { position: relative; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; flex-shrink: 0; }

.kw-ui-pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 12px; border-radius: 999px;
    font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em;
    background: rgba(255, 255, 255, 0.16); color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.25);
}
.kw-ui-pill i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }
.kw-ui-pill--published { background: rgba(16, 185, 129, 0.25); border-color: rgba(16, 185, 129, 0.6); }
.kw-ui-pill--approved { background: rgba(52, 211, 153, 0.18); border-color: rgba(52, 211, 153, 0.5); }
.kw-ui-pill--draft { background: rgba(255, 255, 255, 0.14); }
.kw-ui-pill--stalled { background: rgba(239, 68, 68, 0.28); border-color: rgba(239, 68, 68, 0.6); }
/* Partner-implemented. Cyan, which carries no other meaning in the status vocabulary — it must read
   as "a different kind of record", not as a stage in the NDMA approval chain. */
.kw-ui-pill--partner { background: rgba(8, 145, 178, 0.24); border-color: rgba(8, 145, 178, 0.6); }

/* table-context status pills (light surface) */
.kw-ui-status {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 10px; border-radius: 999px;
    font-size: 0.72rem; font-weight: 700;
}
.kw-ui-status i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
/* Tinted from the status hue against the live surface, so each pill keeps its identity
   and its contrast in either theme without a second set of rules. */
.kw-ui-status--Draft {
    background: color-mix(in srgb, var(--ui-ink-2) 14%, transparent);
    color: var(--ui-ink-2);
}
.kw-ui-status--Approved {
    background: color-mix(in srgb, var(--ui-green) 16%, transparent);
    color: color-mix(in srgb, var(--ui-green) 78%, var(--ui-ink));
}
.kw-ui-status--Published {
    background: color-mix(in srgb, var(--ui-blue) 16%, transparent);
    color: var(--ui-accent);
}
.kw-ui-status--Submitted {
    background: color-mix(in srgb, var(--ui-amber) 18%, transparent);
    color: color-mix(in srgb, var(--ui-amber) 78%, var(--ui-ink));
}

/* --- glass stat band (overlaps hero) -------------------------------------- */
.kw-ui-stats {
    position: relative; z-index: 2;
    /* 154px min keeps up to seven tiles on one row at desktop width — several modules
       expose 6–7 statuses, and a single orphaned tile on a second row reads as broken. */
    display: grid; grid-template-columns: repeat(auto-fit, minmax(154px, 1fr)); gap: 14px;
    margin: -26px 18px 24px;
}
.kw-ui-stat {
    background: var(--ui-card);
    border: 1px solid var(--ui-line);
    border-radius: 14px;
    padding: 14px 16px 12px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    display: flex; align-items: center; gap: 12px; min-width: 0;
}
.kw-ui-stat-ic {
    width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: color-mix(in srgb, var(--tile, var(--ui-blue)) 14%, transparent);
    color: var(--tile, var(--ui-blue));
}
.kw-ui-stat-val {
    font-family: 'Outfit', sans-serif; font-weight: 700; font-size: 1.22rem; line-height: 1.1;
    color: var(--ui-ink); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.kw-ui-stat-lab { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ui-ink-3); margin-top: 2px; }

/* --- layout & cards -------------------------------------------------------- */
.kw-ui-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 22px; align-items: start; }
.kw-ui-side { display: flex; flex-direction: column; gap: 18px; position: sticky; top: 86px; }
.kw-ui-main { display: flex; flex-direction: column; gap: 22px; min-width: 0; }

.kw-ui-card { background: var(--ui-card); border: 1px solid var(--ui-line); border-radius: 16px; overflow: hidden; }
.kw-ui-card-head {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 18px; border-bottom: 1px solid var(--ui-line);
}
.kw-ui-card-ic {
    width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: color-mix(in srgb, var(--card-ac, var(--ui-blue)) 13%, transparent);
    color: var(--card-ac, var(--ui-blue));
}
.kw-ui-card-title { font-family: 'Outfit', sans-serif; font-weight: 700; font-size: 0.98rem; color: var(--ui-ink); margin: 0; }
.kw-ui-card-sub { font-size: 0.76rem; color: var(--ui-ink-3); margin: 1px 0 0; }
.kw-ui-card-head-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.kw-ui-card-body { padding: 16px 18px; }
.kw-ui-card-body--flush { padding: 0; }

/* ── document capture: the file comes first ─────────────────────────── */
/* Sits above the form, so the thing being described is chosen before it is
   described. Dashed until a file is present, solid once one is. */
.kw-doc-filepick {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    padding: 16px; margin-bottom: 20px;
    border: 1px dashed var(--ui-line); border-radius: 12px;
    background: var(--ui-bg);
    transition: border-color var(--kw-duration-fast), background var(--kw-duration-fast);
}
.kw-doc-filepick.has-file { border-style: solid; border-color: var(--ui-line-2, var(--ui-line)); }
.kw-doc-filepick-ic {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; flex: none; border-radius: 10px;
    background: var(--ui-bg-2, rgba(0,0,0,0.04)); color: var(--ui-ink-3);
}
.kw-doc-filepick-name { font-weight: 600; font-size: 0.88rem; color: var(--ui-ink); overflow-wrap: anywhere; }
.kw-doc-filepick-meta { font-size: 0.75rem; color: var(--ui-ink-3); }
.kw-doc-filenote { margin: 6px 0 0; font-size: 0.75rem; color: var(--ui-ink-3); }

.kw-doc-rule { border: 0; border-top: 1px solid var(--ui-line); margin: 22px 0 14px; }

/* the bulletin fields, revealed by the checkbox above them */
.kw-doc-reveal {
    margin-top: 10px; padding: 14px 16px;
    border: 1px dashed var(--ui-line); border-radius: 12px;
    background: var(--ui-bg);
    animation: kwDocReveal 0.18s ease-out;
}
@keyframes kwDocReveal { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .kw-doc-reveal { animation: none; } }

/* ── Approval sequence preview ───────────────────────────────────────
   The chain a record will travel, shown before anything is submitted. A numbered vertical run with
   a connecting rule, so the order reads as order rather than as a list. */
.kw-seq-panel {
    margin-top: 12px; padding: 14px 16px;
    border: 1px solid var(--ui-line); border-left: 3px solid #059669;
    border-radius: 10px; background: var(--ui-bg);
}
.kw-seq-panel--row { margin: 0; border-radius: 0; border-left-width: 3px; }
.kw-seq-panel-head {
    display: flex; align-items: center; gap: 7px; margin-bottom: 12px;
    font-size: 0.78rem; font-weight: 600; color: var(--ui-ink-2);
}

.kw-seq { list-style: none; margin: 0; padding: 0; }
.kw-seq-step { position: relative; display: flex; gap: 12px; padding-bottom: 16px; }
/* The connector stops at the last step rather than trailing into nothing. */
.kw-seq-step:not(:last-child)::before {
    content: ""; position: absolute; left: 13px; top: 28px; bottom: 0;
    width: 2px; background: var(--ui-line);
}
.kw-seq-step:last-child { padding-bottom: 0; }

.kw-seq-num {
    flex: none; width: 28px; height: 28px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: #059669; color: #fff;
    font-size: 0.78rem; font-weight: 700; font-variant-numeric: tabular-nums;
}
.kw-seq-num--end { background: var(--ui-ink-3); }

.kw-seq-body { min-width: 0; flex: 1; padding-top: 3px; }
.kw-seq-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.kw-seq-title { font-size: 0.82rem; font-weight: 700; color: var(--ui-ink); }
.kw-seq-any, .kw-seq-sla { font-size: 0.7rem; color: var(--ui-ink-3); }
.kw-seq-sla { display: inline-flex; align-items: center; gap: 3px; }

.kw-seq-people { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 7px; }
.kw-seq-person {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 5px 11px 5px 5px;
    border: 1px solid var(--ui-line); border-radius: 999px; background: var(--ui-card, #fff);
}
.kw-seq-avatar {
    flex: none; width: 24px; height: 24px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: #d1fae5; color: #065f46; font-size: 0.62rem; font-weight: 800;
}
.kw-seq-person-body { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.kw-seq-name { font-size: 0.76rem; font-weight: 600; color: var(--ui-ink); }
.kw-seq-email { font-size: 0.68rem; color: var(--ui-ink-3); overflow-wrap: anywhere; }

/* A level with nobody on it is a dead end, and must not look like an ordinary empty row. */
.kw-seq-empty {
    display: inline-flex; align-items: center; gap: 6px; margin-top: 7px;
    font-size: 0.73rem; color: #b45309;
}
.kw-seq-endnote { font-size: 0.72rem; color: var(--ui-ink-3); margin-top: 2px; }

.kw-seq-loading, .kw-seq-note {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.78rem; color: var(--ui-ink-3);
}
.kw-seq-note--warn { color: #b45309; }

@media (max-width: 640px) {
    .kw-seq-people { flex-direction: column; align-items: flex-start; }
}

/* ── document capture: AI auto-fill ─────────────────────────────────── */
.kw-doc-aitoggle {
    display: flex; align-items: center; gap: 4px; margin-left: auto;
    font-size: 0.78rem; color: var(--ui-ink-2); white-space: nowrap;
}
.kw-doc-aitoggle span { display: inline-flex; align-items: center; gap: 5px; }

/* One status line with three faces: working, went wrong, done. Never absent while something
   is happening — a silent stop is indistinguishable from a bug. */
.kw-doc-aibar {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 10px 14px; margin: -8px 0 18px;
    border: 1px solid var(--ui-line); border-left: 3px solid #7c3aed;
    border-radius: 10px; background: var(--ui-bg);
    font-size: 0.82rem; color: var(--ui-ink-2);
}
.kw-doc-aibar--busy { border-left-color: #3b82f6; }
.kw-doc-aibar--warn { border-left-color: #d97706; background: rgba(217, 119, 6, 0.06); }
.kw-doc-ailink {
    background: none; border: 0; padding: 0; cursor: pointer;
    font: inherit; font-weight: 600; color: #7c3aed; text-decoration: underline;
    text-underline-offset: 2px;
}
.kw-doc-ailink:hover { color: #5b21b6; }

.kw-doc-hintbox {
    display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap;
    padding: 12px 14px; margin: -8px 0 18px;
    border: 1px dashed var(--ui-line); border-radius: 10px; background: var(--ui-bg);
}
.kw-doc-hintbox > :first-child { flex: 1; min-width: 240px; }

/* Per-field provenance. The rule down the left says how far to trust it; the sparkle opens the
   passage it came from. Three states, because "verified" and "we couldn't find the quote" are
   genuinely different things and collapsing them hides the one that matters. */
.kw-doc-ai { position: relative; }
.kw-doc-ai--ok       { box-shadow: inset 2px 0 0 0 #10b981; border-radius: 4px; }
.kw-doc-ai--unsure   { box-shadow: inset 2px 0 0 0 #d97706; border-radius: 4px; }
.kw-doc-ai--inferred { box-shadow: inset 2px 0 0 0 var(--ui-ink-3); border-radius: 4px; }
.kw-doc-ai-mark {
    position: absolute; top: -7px; right: -6px; z-index: 2;
    width: 20px; height: 20px; padding: 0; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    border: 0; border-radius: 50%;
    background: #7c3aed; color: #fff; font-size: 11px; line-height: 1;
    box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}
.kw-doc-ai-mark:hover { background: #5b21b6; }
.kw-doc-ai--ok       .kw-doc-ai-mark { background: #10b981; }
.kw-doc-ai--ok       .kw-doc-ai-mark:hover { background: #059669; }
.kw-doc-ai--unsure   .kw-doc-ai-mark { background: #d97706; }
.kw-doc-ai--inferred .kw-doc-ai-mark { background: var(--ui-ink-3); }

/* candidate chips for an ambiguous lookup — offered, never preselected */
.kw-doc-cands { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.kw-doc-cands-lab { font-size: 0.72rem; color: var(--ui-ink-3); }
.kw-doc-cand {
    padding: 3px 10px; cursor: pointer;
    border: 1px solid var(--ui-line); border-radius: 999px; background: transparent;
    font-size: 0.72rem; font-weight: 600; color: var(--ui-ink-2);
}
.kw-doc-cand:hover { border-color: #7c3aed; color: #7c3aed; }
.kw-doc-cand.on { background: #7c3aed; border-color: #7c3aed; color: #fff; }

/* the source, with every quote highlighted at once */
.kw-doc-srcpanel {
    margin: 0 0 18px; border: 1px solid var(--ui-line); border-radius: 12px;
    background: var(--ui-card, #fff); overflow: hidden;
}
.kw-doc-srcpanel-head {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
    padding: 12px 16px; border-bottom: 1px solid var(--ui-line); background: var(--ui-bg);
}
.kw-doc-srcpanel-title { margin: 0; font-size: 0.92rem; font-weight: 700; color: var(--ui-ink); }
.kw-doc-srcpanel-sub { margin: 2px 0 0; font-size: 0.75rem; color: var(--ui-ink-3); }
.kw-doc-srcpanel-body {
    max-height: 420px; overflow: auto; padding: 16px;
    font-size: 0.8rem; line-height: 1.75; color: var(--ui-ink-2);
    white-space: pre-wrap; overflow-wrap: anywhere;
}
.kw-doc-srcpanel-body mark {
    background: rgba(124, 58, 237, 0.16); color: inherit;
    padding: 1px 2px; border-radius: 3px;
}
.kw-doc-srcpanel-body mark.on {
    background: rgba(124, 58, 237, 0.38);
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.25);
}

/* key-value facts */
.kw-ui-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 18px; }
.kw-ui-fact-lab { font-size: 0.66rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--ui-ink-3); margin-bottom: 3px; }
.kw-ui-fact-val { font-size: 0.9rem; font-weight: 600; color: var(--ui-ink); overflow-wrap: anywhere; }
.kw-ui-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.kw-ui-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 11px; border-radius: 999px; font-size: 0.76rem; font-weight: 600;
    background: color-mix(in srgb, var(--ui-blue) 9%, transparent);
    color: var(--ui-accent); border: 1px solid color-mix(in srgb, var(--ui-blue) 28%, transparent);
}

/* progress meter */
.kw-ui-meter { display: flex; align-items: center; gap: 8px; min-width: 0; }
.kw-ui-meter-track { flex: 1; height: 8px; border-radius: 999px; background: var(--ui-bg); border: 1px solid var(--ui-line); overflow: hidden; min-width: 40px; }
.kw-ui-meter-fill { display: block; height: 100%; border-radius: 999px; transition: width 0.4s var(--kw-ease-out); }
.kw-ui-meter-fill--green { background: linear-gradient(90deg, #34d399, var(--ui-green)); }
.kw-ui-meter-fill--amber { background: linear-gradient(90deg, #fbbf24, var(--ui-amber)); }
.kw-ui-meter-fill--red { background: linear-gradient(90deg, #f87171, var(--ui-red)); }
.kw-ui-meter-pct { font-size: 0.78rem; font-weight: 700; color: var(--ui-ink); font-variant-numeric: tabular-nums; min-width: 38px; text-align: right; }

/* conic ring */
.kw-ui-ring {
    --val: 0; --col: var(--ui-amber);
    width: 52px; height: 52px; border-radius: 50%; flex-shrink: 0;
    background:
        radial-gradient(closest-side, var(--ui-card) 72%, transparent 73%),
        conic-gradient(var(--col) calc(var(--val) * 1%), var(--ui-bg) 0);
    display: flex; align-items: center; justify-content: center;
    font-family: 'Outfit', sans-serif; font-weight: 700; font-size: 0.76rem; color: var(--ui-ink);
    font-variant-numeric: tabular-nums;
}

/* --- refined data table ----------------------------------------------------- */
.kw-ui-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.kw-ui-table th {
    text-align: left; padding: 10px 16px;
    font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--ui-ink-3); background: var(--ui-bg);
    border-bottom: 1px solid var(--ui-line); white-space: nowrap;
}
.kw-ui-table td { padding: 11px 16px; border-bottom: 1px solid var(--ui-line); color: var(--ui-ink); vertical-align: middle; }
.kw-ui-table tr:last-child td { border-bottom: none; }
.kw-ui-table tbody tr { transition: background var(--kw-duration-fast); }
.kw-ui-table tbody tr:hover { background: color-mix(in srgb, var(--ui-blue) 4%, transparent); }
.kw-ui-table .num { font-variant-numeric: tabular-nums; text-align: right; }
.kw-ui-empty { padding: 28px 16px; text-align: center; color: var(--ui-ink-3); font-size: 0.86rem; font-style: italic; }

/* --- results framework (shared view + editor) ------------------------------ */
.kw-ui-out { border: 1px solid var(--ui-line); border-radius: 14px; overflow: hidden; margin-bottom: 14px; background: var(--ui-card); }
.kw-ui-out-head {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px; background: var(--ui-bg); border-bottom: 1px solid var(--ui-line);
}
.kw-ui-out-no {
    font-family: 'Outfit', sans-serif; font-weight: 800; font-size: 0.72rem;
    color: var(--ui-accent); background: color-mix(in srgb, var(--ui-blue) 13%, transparent);
    border-radius: 8px; padding: 4px 8px; flex-shrink: 0;
}
.kw-ui-out-name { font-weight: 700; font-size: 0.92rem; color: var(--ui-ink); min-width: 0; flex: 1; overflow-wrap: anywhere; }
.kw-ui-out-meta { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.kw-ui-indrow { border-bottom: 1px solid var(--ui-line); }
.kw-ui-indrow:last-child { border-bottom: none; }
.kw-ui-indrow-main {
    display: grid; grid-template-columns: minmax(0, 1.6fr) auto minmax(140px, 1fr) auto;
    gap: 8px 14px; align-items: center; padding: 11px 16px;
}
.kw-ui-ind-name { font-weight: 600; font-size: 0.87rem; color: var(--ui-ink); overflow-wrap: anywhere; }
.kw-ui-ind-meta { display: flex; gap: 6px; flex-wrap: wrap; font-size: 0.7rem; color: var(--ui-ink-3); }
.kw-ui-ind-tag {
    padding: 2px 8px; border-radius: 999px; font-weight: 600;
    background: var(--ui-bg); border: 1px solid var(--ui-line); white-space: nowrap;
}
.kw-ui-ind-vals { font-size: 0.76rem; color: var(--ui-ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.kw-ui-ind-actions { display: flex; align-items: center; gap: 2px; }

/* FY matrix (capture) */
.kw-ui-matrix { padding: 12px 16px 16px; background: color-mix(in srgb, var(--ui-blue) 3%, transparent); border-top: 1px dashed var(--ui-line); }
.kw-ui-matrix-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.kw-ui-matrix-fy {
    padding: 6px 12px; border-radius: 9px; border: 1px solid var(--ui-line);
    background: var(--ui-card); font-size: 0.8rem; font-weight: 700; color: var(--ui-ink);
    cursor: pointer; transition: border-color var(--kw-duration-fast), color var(--kw-duration-fast);
}
.kw-ui-matrix-fy:hover { border-color: var(--ui-blue); }
.kw-ui-matrix-fy.on { background: var(--ui-deep); border-color: var(--ui-deep); color: #fff; }
.kw-ui-matrix-grid { display: grid; grid-template-columns: 64px 1fr 1fr 74px; gap: 8px 10px; align-items: center; max-width: 560px; }
.kw-ui-matrix-grid .head { font-size: 0.66rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ui-ink-3); }
.kw-ui-matrix-q { font-weight: 700; font-size: 0.82rem; color: var(--ui-ink-2); }
.kw-ui-matrix input[type="number"] {
    width: 100%; padding: 7px 10px; border-radius: 9px;
    border: 1px solid var(--ui-line); background: var(--ui-card); color: var(--ui-ink);
    font-size: 0.86rem; font-variant-numeric: tabular-nums;
    transition: border-color var(--kw-duration-fast), box-shadow var(--kw-duration-fast);
}
.kw-ui-matrix input[type="number"]:focus { outline: none; border-color: var(--ui-blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ui-blue) 18%, transparent); }
.kw-ui-matrix-pct { font-size: 0.78rem; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.kw-ui-matrix-foot { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.kw-ui-matrix-note { font-size: 0.72rem; color: var(--ui-ink-3); }

/* periods (read view) */
.kw-ui-periods { padding: 4px 16px 14px; }
.kw-ui-periods table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.kw-ui-periods th { text-align: left; padding: 6px 10px; color: var(--ui-ink-3); font-size: 0.64rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; border-bottom: 1px solid var(--ui-line); }
.kw-ui-periods td { padding: 6px 10px; border-bottom: 1px solid color-mix(in srgb, var(--ui-line) 55%, transparent); color: var(--ui-ink-2); font-variant-numeric: tabular-nums; }
.kw-ui-periods tr:last-child td { border-bottom: none; }

/* inline add rows */
.kw-ui-addrow { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 12px 16px; background: var(--ui-bg); border-top: 1px solid var(--ui-line); }
.kw-ui-input {
    padding: 8px 12px; border-radius: 10px; border: 1px solid var(--ui-line);
    background: var(--ui-card); color: var(--ui-ink); font-size: 0.86rem; min-width: 0;
    transition: border-color var(--kw-duration-fast), box-shadow var(--kw-duration-fast);
}
.kw-ui-input:focus { outline: none; border-color: var(--ui-blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ui-blue) 18%, transparent); }
.kw-ui-btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 8px 16px; border-radius: 10px; border: none; cursor: pointer;
    font-size: 0.82rem; font-weight: 700; letter-spacing: 0.01em;
    background: var(--ui-deep); color: #fff;
    transition: filter var(--kw-duration-fast), transform var(--kw-duration-fast);
}
.kw-ui-btn:hover { filter: brightness(1.12); }
.kw-ui-btn:active { transform: translateY(1px); }
.kw-ui-btn[disabled] { opacity: 0.5; pointer-events: none; }
.kw-ui-btn--ghost { background: transparent; color: var(--ui-accent); border: 1px solid var(--ui-line); }
.kw-ui-btn--ghost:hover { border-color: var(--ui-blue); filter: none; }
.kw-ui-btn--sm { padding: 6px 12px; font-size: 0.76rem; border-radius: 8px; }

/* --- form rail layout ------------------------------------------------------- */
.kw-ui-formgrid { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 22px; align-items: start; }
.kw-ui-rail { position: sticky; top: 86px; display: flex; flex-direction: column; gap: 4px; }
.kw-ui-rail-item {
    display: flex; align-items: center; gap: 11px;
    padding: 10px 14px; border-radius: 12px; border: 1px solid transparent;
    background: transparent; cursor: pointer; text-align: left; width: 100%;
    color: var(--ui-ink-2); font-size: 0.86rem; font-weight: 600;
    transition: background var(--kw-duration-fast), color var(--kw-duration-fast), border-color var(--kw-duration-fast);
}
.kw-ui-rail-item:hover { background: color-mix(in srgb, var(--ui-blue) 7%, transparent); color: var(--ui-ink); }
.kw-ui-rail-item.on {
    background: var(--ui-card); color: var(--ui-accent);
    border-color: var(--ui-line);
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.07);
}
.kw-ui-rail-badge {
    margin-left: auto; min-width: 22px; height: 20px; padding: 0 7px; border-radius: 999px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 0.68rem; font-weight: 700;
    background: color-mix(in srgb, var(--ui-blue) 12%, transparent); color: var(--ui-accent);
}
.kw-ui-rail-lock { margin-left: auto; color: var(--ui-ink-3); display: inline-flex; }
.kw-ui-savebar {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    margin-top: 18px; padding: 14px 18px;
    background: var(--ui-card); border: 1px solid var(--ui-line); border-radius: 14px;
}
.kw-ui-savebar-hint { font-size: 0.78rem; color: var(--ui-ink-3); margin-left: auto; }

/* --- list toolbar ------------------------------------------------------------ */
.kw-ui-toolbar {
    display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
    background: var(--ui-card); border: 1px solid var(--ui-line); border-radius: 14px;
    padding: 12px 14px; margin-bottom: 18px;
}
.kw-ui-seg { display: inline-flex; background: var(--ui-bg); border: 1px solid var(--ui-line); border-radius: 11px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.kw-ui-seg button {
    border: none; background: transparent; cursor: pointer;
    padding: 6px 13px; border-radius: 9px; font-size: 0.79rem; font-weight: 600; color: var(--ui-ink-2);
    transition: background var(--kw-duration-fast), color var(--kw-duration-fast);
}
.kw-ui-seg button:hover { color: var(--ui-ink); }
.kw-ui-seg button.on { background: var(--ui-deep); color: #fff; box-shadow: 0 4px 10px rgba(29, 78, 216, 0.3); }

/* --- hero action buttons ----------------------------------------------------
   Buttons dropped into a hero sit on a saturated gradient, so force legible
   on-colour treatment rather than restating it inline on every page. Filled
   buttons keep their own accent (they carry their own background). */
.kw-ui-hero-actions .mud-button-outlined,
.kw-ui-hero-actions .mud-button-text {
    color: #fff !important;
    border-color: rgba(255, 255, 255, 0.5) !important;
}
.kw-ui-hero-actions .mud-button-outlined:hover,
.kw-ui-hero-actions .mud-button-text:hover { background: rgba(255, 255, 255, 0.12) !important; }
.kw-ui-hero-actions .mud-icon-button { color: #fff; }
.kw-ui-hero-top > .mud-icon-button { color: #fff; }

/* --- automatic card treatment ------------------------------------------------
   Pages converted to the shell still use MudTable/MudPaper for their content.
   Rather than rewrite every table's markup, give them the card look here: same
   radius, hairline border and flat surface as .kw-ui-card. Portalled surfaces
   (dialogs, menus, popovers) render outside .kw-ui, so they are unaffected. */
.kw-ui > .mud-table,
.kw-ui .mud-table.mud-table-outlined,
.kw-ui > .mud-paper:not(.mud-alert) {
    border-radius: 16px;
    border: 1px solid var(--ui-line);
    box-shadow: none;
    overflow: hidden;
    background: var(--ui-card);
}
/* Tables already wrapped in a .kw-ui-card must not double-border. */
.kw-ui-card .mud-table { border: none; border-radius: 0; box-shadow: none; background: transparent; }
.kw-ui .mud-table-container { background: transparent; }
/* Match the shell's table header treatment (recessive, uppercase, hairline rule). */
.kw-ui .mud-table-head th, .kw-ui .mud-table-head .mud-table-cell {
    background: var(--ui-bg);
    color: var(--ui-ink-3);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--ui-line);
}
.kw-ui .mud-table-row:hover { background: color-mix(in srgb, var(--ui-blue) 4%, transparent); }

/* Filter strips built as a MudPaper read as the shell's toolbar. */
.kw-ui > .mud-paper.pa-4.mb-4,
.kw-ui > .mud-paper.pa-3.mb-4 {
    border-radius: 14px;
    border: 1px solid var(--ui-line);
    box-shadow: none;
}

/* --- trend chip (on stat tiles) --------------------------------------------- */
.kw-ui-trend {
    display: inline-flex; align-items: center; gap: 3px;
    padding: 1px 7px 1px 5px; border-radius: 999px;
    font-size: 0.66rem; font-weight: 700; letter-spacing: 0.01em; white-space: nowrap;
}
.kw-ui-trend--up { background: color-mix(in srgb, var(--ui-green) 14%, transparent); color: #047857; }
.kw-ui-trend--down { background: color-mix(in srgb, var(--ui-red) 14%, transparent); color: #b91c1c; }
.kw-ui-trend--neutral, .kw-ui-trend--flat { background: var(--ui-bg); color: var(--ui-ink-3); }
.kw-ui-stat-note { font-size: 0.68rem; color: var(--ui-ink-3); margin-top: 3px; overflow-wrap: anywhere; }

/* --- ring stat block (ring + caption) --------------------------------------- */
.kw-ui-ringstat { display: flex; align-items: center; gap: 14px; padding: 12px 0; }
.kw-ui-ringstat + .kw-ui-ringstat { border-top: 1px solid var(--ui-line); }
.kw-ui-ringstat-body { min-width: 0; }
.kw-ui-ringstat-lab { font-size: 0.82rem; font-weight: 700; color: var(--ui-ink); }
.kw-ui-ringstat-sub { font-size: 0.72rem; color: var(--ui-ink-3); margin-top: 2px; }
.kw-ui-ring--lg { width: 66px; height: 66px; font-size: 0.86rem; }

/* --- distribution rows ------------------------------------------------------- */
.kw-ui-dist { display: flex; flex-direction: column; gap: 11px; }
.kw-ui-dist-row {
    display: grid; grid-template-columns: minmax(0, 1fr) auto;
    gap: 3px 12px; align-items: baseline;
}
.kw-ui-dist-lab { font-size: 0.84rem; font-weight: 600; color: var(--ui-ink); min-width: 0; overflow-wrap: anywhere; }
.kw-ui-dist-val { font-size: 0.84rem; font-weight: 700; color: var(--ui-ink); font-variant-numeric: tabular-nums; }
.kw-ui-dist-track {
    grid-column: 1 / -1; height: 7px; border-radius: 999px;
    background: var(--ui-bg); border: 1px solid var(--ui-line); overflow: hidden;
}
.kw-ui-dist-fill {
    display: block; height: 100%; border-radius: 999px;
    background: linear-gradient(90deg, color-mix(in srgb, var(--bar, var(--ui-blue)) 55%, #fff), var(--bar, var(--ui-blue)));
    transition: width 0.5s var(--kw-ease-out);
}

/* --- activity feed ----------------------------------------------------------- */
.kw-ui-feed { display: flex; flex-direction: column; }
.kw-ui-feed-item {
    display: flex; gap: 12px; align-items: flex-start;
    padding: 11px 0; border-bottom: 1px solid var(--ui-line);
    text-decoration: none; color: inherit;
}
.kw-ui-feed-item:last-child { border-bottom: none; }
.kw-ui-feed-item[href]:hover .kw-ui-feed-title { color: var(--ui-accent); }
.kw-ui-feed-ic {
    width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: color-mix(in srgb, var(--fic, var(--ui-blue)) 13%, transparent);
    color: var(--fic, var(--ui-blue));
}
.kw-ui-feed-body { min-width: 0; flex: 1; }
.kw-ui-feed-title {
    font-size: 0.86rem; font-weight: 600; color: var(--ui-ink);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    transition: color var(--kw-duration-fast);
}
.kw-ui-feed-meta { font-size: 0.72rem; color: var(--ui-ink-3); margin-top: 1px; }
.kw-ui-feed-when { font-size: 0.7rem; color: var(--ui-ink-3); white-space: nowrap; flex-shrink: 0; padding-top: 2px; }

/* --- action tiles (drill-down grid) ------------------------------------------ */
.kw-ui-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 10px; }
.kw-ui-tile {
    display: flex; flex-direction: column; gap: 7px;
    /* align-items must be set explicitly: the UA stylesheet gives <button> align-items:center,
       which would centre every child of this column flex. */
    align-items: flex-start;
    padding: 13px 14px; border-radius: 12px; cursor: pointer; text-align: left;
    background: var(--ui-card); border: 1px solid var(--ui-line); color: var(--ui-ink);
    transition: border-color var(--kw-duration-fast), transform var(--kw-duration-fast), box-shadow var(--kw-duration-fast);
    /* min-width:0 lets a long nowrap label actually ellipsize instead of forcing the tile wider. */
    overflow: hidden; min-width: 0;
}
.kw-ui-tile:hover {
    border-color: color-mix(in srgb, var(--tile, var(--ui-blue)) 45%, transparent);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}
.kw-ui-tile-ic {
    width: 32px; height: 32px; border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    background: color-mix(in srgb, var(--tile, var(--ui-blue)) 13%, transparent);
    color: var(--tile, var(--ui-blue));
}
.kw-ui-tile-lab {
    font-size: 0.84rem; font-weight: 700;
    min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.kw-ui-tile-sub {
    font-size: 0.7rem; color: var(--ui-ink-3);
    min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}

/* --- live/status dot --------------------------------------------------------- */
.kw-ui-live { display: inline-flex; align-items: center; gap: 6px; }
.kw-ui-live-dot {
    width: 7px; height: 7px; border-radius: 50%; background: var(--ui-green);
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--ui-green) 65%, transparent);
    animation: kw-ui-pulse 2s infinite;
}
@keyframes kw-ui-pulse {
    70% { box-shadow: 0 0 0 7px transparent; }
    100% { box-shadow: 0 0 0 0 transparent; }
}
@media (prefers-reduced-motion: reduce) { .kw-ui-live-dot { animation: none; } }

/* responsive */
@media (max-width: 1024px) {
    .kw-ui-grid { grid-template-columns: 1fr; }
    .kw-ui-side { position: static; }
    .kw-ui-formgrid { grid-template-columns: 1fr; }
    .kw-ui-rail { position: static; flex-direction: row; flex-wrap: wrap; }
    .kw-ui-rail-item { width: auto; }
    .kw-ui-hero-top { flex-wrap: wrap; }
}
@media (max-width: 640px) {
    .kw-ui-stats { margin: -22px 8px 20px; }
    .kw-ui-indrow-main { grid-template-columns: 1fr auto; }
    .kw-ui-matrix-grid { grid-template-columns: 48px 1fr 1fr 60px; }
}

/* â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
   WIZARD SHELL  (kw-wiz-* / kw-drop-*)
   Lifted out of StrategicPlanImportWizard.razor so more than one wizard can
   use it. The accent is a custom property: set --kw-wiz-accent on the step
   strip or drop zone to re-skin the whole thing per module.
   â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â• */
.kw-wiz-steps {
    --kw-wiz-accent: #14b8a6;
    --kw-wiz-accent-deep: #0f766e;
    display: flex; align-items: center; gap: 6px; margin: 18px 0 6px; flex-wrap: wrap;
}
.kw-wiz-steps.kw-wiz-ai { --kw-wiz-accent: #8b5cf6; --kw-wiz-accent-deep: #6d28d9; }

.kw-wiz-step { display: flex; align-items: center; gap: 8px; opacity: .55; }
.kw-wiz-step.active, .kw-wiz-step.done { opacity: 1; }
.kw-wiz-dot {
    width: 30px; height: 30px; border-radius: 50%; background: #e2e8f0; color: #475569;
    display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem;
}
.kw-wiz-step.active .kw-wiz-dot { background: var(--kw-wiz-accent); color: #fff; }
.kw-wiz-step.done .kw-wiz-dot { background: var(--kw-wiz-accent-deep); color: #fff; }
.kw-wiz-label { font-weight: 600; font-size: .9rem; }
.kw-wiz-bar { flex: 1; min-width: 24px; height: 3px; background: #e2e8f0; border-radius: 2px; }
.kw-wiz-bar.done { background: var(--kw-wiz-accent-deep); }

.kw-drop {
    --kw-wiz-accent: #14b8a6;
    position: relative; min-height: 180px; border: 2px dashed #cbd5e1; border-radius: 14px;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    display: flex; align-items: center; justify-content: center;
    transition: border-color .15s ease, background .15s ease, transform .1s ease; overflow: hidden;
}
.kw-drop:hover { border-color: color-mix(in srgb, var(--kw-wiz-accent) 55%, white); }
.kw-drop-over { border-color: var(--kw-wiz-accent); transform: scale(1.005); }
.kw-drop-filled { border-style: solid; border-color: color-mix(in srgb, var(--kw-wiz-accent) 40%, white); background: #fff; }
.kw-drop-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 1; margin: 0; }
.kw-drop-input:disabled { cursor: default; }
.kw-drop-busy { opacity: .85; }
.kw-drop-prompt { text-align: center; padding: 28px 16px; pointer-events: none; }
.kw-drop-icon { color: var(--kw-wiz-accent); margin-bottom: 6px; }
.kw-drop-over .kw-drop-icon { filter: brightness(.85); }
.kw-drop-file-check { flex-shrink: 0; }
.kw-drop-title { font-weight: 700; color: #0f172a; }
.kw-drop-subtitle { color: #64748b; margin-top: 2px; }
.kw-drop-browse { color: var(--kw-wiz-accent); font-weight: 600; text-decoration: underline; }
.kw-drop-hint { color: #94a3b8; margin-top: 6px; display: block; }
.kw-drop-file { position: relative; z-index: 2; pointer-events: none; display: flex; align-items: center; gap: 14px; width: 100%; padding: 18px 22px; }
.kw-drop-file-icon {
    width: 52px; height: 52px; border-radius: 12px; flex-shrink: 0;
    background: color-mix(in srgb, var(--kw-wiz-accent) 16%, white); color: var(--kw-wiz-accent);
    display: flex; align-items: center; justify-content: center;
}
.kw-drop-file-info { flex: 1; min-width: 0; }
.kw-drop-file-name { font-weight: 700; color: #0f172a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kw-drop-file-meta { color: #64748b; }
.kw-drop-remove { position: relative; z-index: 3; pointer-events: auto; flex-shrink: 0; }

.kw-dark .kw-wiz-dot, .kw-dark .kw-wiz-bar { background: #334155; color: #cbd5e1; }
.kw-dark .kw-drop { border-color: #475569; background: linear-gradient(180deg, #1e293b 0%, #172033 100%); }
.kw-dark .kw-drop-filled { background: #1e293b; }
.kw-dark .kw-drop-title, .kw-dark .kw-drop-file-name { color: #f1f5f9; }
.kw-dark .kw-drop-subtitle, .kw-dark .kw-drop-file-meta { color: #94a3b8; }

/* â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
   DRAFT WITH AI  (kw-draft-*)
   The review screen's job is to make an AI proposal auditable at a glance:
   the quote sits under every value, and anything unverified is visibly
   different rather than quietly identical.
   â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â• */
.kw-draft-dialog .mud-dialog { max-width: 1180px; width: 94vw; }
.kw-draft-muted { color: #64748b; }
.kw-dark .kw-draft-muted { color: #94a3b8; }

.kw-draft-title { display: flex; align-items: center; gap: 14px; }
.kw-draft-title-icon {
    width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0;
    background: linear-gradient(135deg, #8b5cf6, #6366f1); color: #fff;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 6px 16px rgba(139, 92, 246, .35);
}
.kw-draft-title-main { font-weight: 800; font-size: 1.15rem; line-height: 1.2; color: #0f172a; }
.kw-draft-title-sub { font-size: .82rem; color: #64748b; }
.kw-dark .kw-draft-title-main { color: #f1f5f9; }
.kw-dark .kw-draft-title-sub { color: #94a3b8; }

.kw-draft-caption { margin: 2px 0 14px; font-size: .84rem; color: #64748b; }
.kw-dark .kw-draft-caption { color: #94a3b8; }

.kw-draft-notice {
    display: flex; gap: 10px; align-items: flex-start; margin-top: 18px; padding: 12px 14px;
    border-radius: 10px; font-size: .84rem; line-height: 1.5;
    background: rgba(139, 92, 246, .07); border: 1px solid rgba(139, 92, 246, .22); color: #4c1d95;
}
.kw-dark .kw-draft-notice { background: rgba(139, 92, 246, .12); border-color: rgba(139, 92, 246, .35); color: #ddd6fe; }

.kw-draft-doc { display: flex; align-items: center; gap: 10px; padding: 2px 0; }
.kw-draft-doc-name { font-weight: 600; line-height: 1.25; }

/* â”€â”€ working â”€â”€ */
.kw-draft-working { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 56px 16px 48px; }
.kw-draft-orbit {
    width: 76px; height: 76px; border-radius: 50%; color: #fff;
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    display: flex; align-items: center; justify-content: center;
    animation: kwDraftPulse 1.8s ease-in-out infinite;
}
.kw-draft-orbit .mud-icon-root { font-size: 34px; }
@keyframes kwDraftPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(139, 92, 246, .45); }
    50%      { box-shadow: 0 0 0 18px rgba(139, 92, 246, 0); }
}
@media (prefers-reduced-motion: reduce) { .kw-draft-orbit { animation: none; } }

/* â”€â”€ review â”€â”€ */
.kw-draft-panes { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 18px; align-items: start; }
@media (max-width: 900px) { .kw-draft-panes { grid-template-columns: 1fr; } }

.kw-draft-source { border: 1px solid #e2e8f0; border-radius: 12px; overflow: hidden; background: #fff; }
.kw-draft-source-head {
    display: flex; align-items: center; gap: 8px; padding: 10px 14px;
    background: #f8fafc; border-bottom: 1px solid #e2e8f0; font-weight: 700; font-size: .82rem;
    text-transform: uppercase; letter-spacing: .04em; color: #475569;
}
.kw-draft-source-body {
    max-height: 52vh; overflow-y: auto; padding: 16px 18px;
    font-size: .84rem; line-height: 1.7; color: #334155; white-space: pre-wrap; word-break: break-word;
}
.kw-draft-mark { background: rgba(139, 92, 246, .16); color: inherit; border-radius: 3px; padding: 1px 2px; }
.kw-draft-mark.on { background: rgba(245, 158, 11, .42); box-shadow: 0 0 0 2px rgba(245, 158, 11, .25); }
.kw-dark .kw-draft-source { background: #1e293b; border-color: #334155; }
.kw-dark .kw-draft-source-head { background: #172033; border-color: #334155; color: #cbd5e1; }
.kw-dark .kw-draft-source-body { color: #cbd5e1; }
.kw-dark .kw-draft-mark { background: rgba(139, 92, 246, .3); }

.kw-draft-props { display: flex; flex-direction: column; gap: 14px; max-height: 52vh; overflow-y: auto; padding-right: 4px; }
/* flex-shrink:0 is load-bearing. Flex children shrink by default, so inside this max-height column
   each group would compress and clip its own rows against overflow:hidden — the reviewer would see
   a half-row and no scrollbar. Pinning the height makes the column scroll instead. */
.kw-draft-group { flex-shrink: 0; border: 1px solid #e2e8f0; border-radius: 12px; background: #fff; overflow: hidden; }
.kw-draft-group-head {
    display: flex; align-items: center; gap: 8px; padding: 9px 14px; background: #f8fafc;
    border-bottom: 1px solid #e2e8f0; font-weight: 700; font-size: .8rem;
    text-transform: uppercase; letter-spacing: .04em; color: #475569;
}
.kw-draft-group-count { margin-left: auto; font-weight: 600; text-transform: none; letter-spacing: 0; color: #64748b; }
.kw-dark .kw-draft-group { background: #1e293b; border-color: #334155; }
.kw-dark .kw-draft-group-head { background: #172033; border-color: #334155; color: #cbd5e1; }

.kw-draft-row {
    display: flex; gap: 6px; align-items: flex-start; padding: 10px 12px 12px;
    border-bottom: 1px solid #f1f5f9; border-left: 3px solid transparent;
    transition: background .12s ease, border-color .12s ease;
}
.kw-draft-row:last-child { border-bottom: none; }
.kw-draft-row.on { background: #faf5ff; border-left-color: #8b5cf6; }
.kw-draft-row.unsure { background: #fffbeb; }
.kw-draft-row.unsure.on { background: #fef3c7; border-left-color: #f59e0b; }
.kw-dark .kw-draft-row { border-bottom-color: #334155; }
.kw-dark .kw-draft-row.on { background: rgba(139, 92, 246, .14); }
.kw-dark .kw-draft-row.unsure { background: rgba(245, 158, 11, .1); }
.kw-dark .kw-draft-row.unsure.on { background: rgba(245, 158, 11, .18); }

.kw-draft-row-body { flex: 1; min-width: 0; padding-top: 6px; }
.kw-draft-row-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #64748b; }
.kw-draft-row-value { font-weight: 600; color: #0f172a; line-height: 1.4; word-break: break-word; }
.kw-draft-row-pick { margin-top: 8px; max-width: 340px; }
.kw-dark .kw-draft-row-value { color: #f1f5f9; }
.kw-dark .kw-draft-row-label { color: #94a3b8; }

.kw-draft-quote {
    display: flex; gap: 6px; align-items: flex-start; margin-top: 6px; padding-left: 8px;
    border-left: 2px solid #cbd5e1; font-size: .78rem; line-height: 1.5; color: #64748b; font-style: italic;
}
.kw-draft-quote .mud-icon-root { flex-shrink: 0; margin-top: 2px; opacity: .6; }
/* Quotes are whole sentences and can be long. Clamp rather than let them overflow — the group is
   overflow:hidden, so an unclamped quote is cut mid-line at the panel edge and reads as a bug. */
.kw-draft-quote span {
    display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical;
    overflow: hidden;
}
.kw-draft-row.on .kw-draft-quote span { -webkit-line-clamp: unset; line-clamp: unset; overflow: visible; }
.kw-dark .kw-draft-quote { border-left-color: #475569; color: #94a3b8; }

.kw-draft-note { margin-top: 5px; font-size: .77rem; color: #b45309; }
.kw-dark .kw-draft-note { color: #fcd34d; }

.kw-draft-trust { flex-shrink: 0; padding-top: 8px; }
.kw-draft-trust.ok { color: #059669; }
.kw-draft-trust.warn { color: #d97706; }
.kw-draft-trust.inferred { color: #7c3aed; }

.kw-draft-warnlist { margin: 0; padding-left: 18px; font-size: .82rem; line-height: 1.6; }
.kw-draft-empty { text-align: center; padding: 42px 16px; color: #94a3b8; }
.kw-draft-empty .mud-icon-root { color: #cbd5e1; margin-bottom: 8px; }

.kw-draft-tally { margin-right: auto; padding-left: 8px; font-size: .84rem; color: #475569; }
.kw-draft-tally strong { color: #6d28d9; font-size: 1rem; }
.kw-draft-tally-warn { color: #d97706; font-weight: 600; }
.kw-draft-tally-hint { font-size: .76rem; color: #64748b; margin-top: 1px; }
.kw-dark .kw-draft-tally-hint { color: #94a3b8; }
.kw-dark .kw-draft-tally { color: #cbd5e1; }
.kw-dark .kw-draft-tally strong { color: #c4b5fd; }

/* â”€â”€ the entry point on the form â”€â”€ */
.kw-draft-cta {
    background: linear-gradient(135deg, #8b5cf6, #6366f1) !important; color: #fff !important;
    border: none !important; box-shadow: 0 6px 18px rgba(139, 92, 246, .35);
}
.kw-draft-cta:hover { box-shadow: 0 8px 22px rgba(139, 92, 246, .48); }

/* â”€â”€ the queued-draft banner shown between create and flush â”€â”€ */
.kw-draft-pending {
    display: flex; align-items: center; gap: 10px; margin-bottom: 16px; padding: 11px 14px;
    border-radius: 10px; font-size: .85rem;
    background: rgba(139, 92, 246, .08); border: 1px solid rgba(139, 92, 246, .25); color: #4c1d95;
}
.kw-dark .kw-draft-pending { background: rgba(139, 92, 246, .14); border-color: rgba(139, 92, 246, .38); color: #ddd6fe; }


/* â”€â”€ results framework: a tree, not a list â”€â”€
   Indentation and a left rail carry the parent/child relationship, because accepting an indicator
   without its output is not a thing the database can store. */
.kw-draft-results-empty { padding: 18px 16px 20px; text-align: center; }

.kw-draft-out { border-bottom: 1px solid #f1f5f9; }
.kw-draft-out:last-child { border-bottom: none; }
.kw-draft-out-head { display: flex; gap: 6px; align-items: flex-start; padding: 10px 12px 8px; }
.kw-draft-out-body { flex: 1; min-width: 0; padding-top: 6px; }
.kw-dark .kw-draft-out { border-bottom-color: #334155; }

/* Suggestions are inference wearing the same layout as evidence-backed extraction. The tint and the
   left bar are the standing reminder of which one the reviewer is looking at. */
.kw-draft-out.suggested { background: rgba(139, 92, 246, .05); border-left: 3px solid #a78bfa; }
.kw-dark .kw-draft-out.suggested { background: rgba(139, 92, 246, .1); }

.kw-draft-ind { margin: 0 12px 8px 34px; padding-left: 12px; border-left: 2px solid #e2e8f0; }
.kw-draft-ind-head { display: flex; gap: 6px; align-items: flex-start; }
.kw-dark .kw-draft-ind { border-left-color: #475569; }

.kw-draft-uom {
    display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 4px;
    background: #f1f5f9; color: #64748b; font-weight: 600; font-size: .68rem;
    text-transform: none; letter-spacing: 0;
}
.kw-dark .kw-draft-uom { background: #334155; color: #cbd5e1; }

.kw-draft-tgt {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    margin: 2px 0 2px 6px; padding: 2px 0; font-size: .8rem; color: #475569;
}
.kw-draft-tgt-period { font-weight: 700; color: #0f172a; min-width: 92px; }
.kw-draft-tgt-figs { color: #64748b; }
.kw-dark .kw-draft-tgt { color: #cbd5e1; }
.kw-dark .kw-draft-tgt-period { color: #f1f5f9; }
.kw-dark .kw-draft-tgt-figs { color: #94a3b8; }

/* A figure the document gave without a period can't be stored against a quarter, and inventing one
   would make the other three read as zero progress. Shown, greyed, not applicable. */
.kw-draft-tgt.unplaceable .kw-draft-tgt-period { color: #d97706; font-weight: 600; font-style: italic; }
.kw-draft-tgt.unplaceable .kw-draft-tgt-figs { opacity: .7; }


.kw-draft-suggest-more { margin-left: 10px; text-transform: none; letter-spacing: 0; font-size: .74rem; }

/* â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
   BULK IMPORT  (kw-bi-*)
   Rides on the shared kw-wiz-* / kw-drop-* shell; only the pieces the
   import wizard adds live here.
   â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â• */
.kw-wiz-steps.kw-wiz-inv { --kw-wiz-accent: #3b82f6; --kw-wiz-accent-deep: #1d4ed8; }

.kw-bi-muted { color: #64748b; }
.kw-dark .kw-bi-muted { color: #94a3b8; }

/* â”€â”€ the create-vs-update choice â”€â”€
   Cards rather than a radio list: the two modes differ in whether existing
   records get overwritten, which is worth more than one line of label. */
.kw-bi-modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }

.kw-bi-mode {
    display: flex; gap: 12px; align-items: flex-start; text-align: left;
    padding: 14px 16px; border: 1px solid #e2e8f0; border-radius: 12px;
    background: #fff; cursor: pointer; font: inherit; color: inherit;
    transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.kw-bi-mode:hover { border-color: #93c5fd; }
.kw-bi-mode.on { border-color: #1d4ed8; background: #eff6ff; box-shadow: 0 0 0 1px #1d4ed8 inset; }
.kw-bi-mode .mud-icon-root { flex-shrink: 0; margin-top: 2px; color: #64748b; }
.kw-bi-mode.on .mud-icon-root { color: #1d4ed8; }
.kw-bi-mode-title { font-weight: 700; color: #0f172a; line-height: 1.3; }
.kw-bi-mode-sub { font-size: .8rem; color: #64748b; line-height: 1.45; margin-top: 2px; }

.kw-dark .kw-bi-mode { background: #1e293b; border-color: #334155; }
.kw-dark .kw-bi-mode:hover { border-color: #3b82f6; }
.kw-dark .kw-bi-mode.on { background: rgba(59, 130, 246, .14); border-color: #60a5fa; box-shadow: 0 0 0 1px #60a5fa inset; }
.kw-dark .kw-bi-mode-title { color: #f1f5f9; }
.kw-dark .kw-bi-mode-sub { color: #94a3b8; }

/* â”€â”€ preview table tags â”€â”€ */
.kw-bi-tag {
    display: inline-block; padding: 2px 8px; border-radius: 999px;
    font-size: .72rem; font-weight: 700; white-space: nowrap;
}
.kw-bi-tag.new { background: #ecfdf5; color: #059669; }
.kw-bi-tag.upd { background: #eff6ff; color: #2563eb; }
.kw-bi-tag.bad { background: #fef2f2; color: #dc2626; }
.kw-dark .kw-bi-tag.new { background: rgba(16, 185, 129, .16); color: #6ee7b7; }
.kw-dark .kw-bi-tag.upd { background: rgba(59, 130, 246, .18); color: #93c5fd; }
.kw-dark .kw-bi-tag.bad { background: rgba(239, 68, 68, .18); color: #fca5a5; }

.kw-bi-row-bad { background: #fef2f2; }
.kw-dark .kw-bi-row-bad { background: rgba(239, 68, 68, .1); }

.kw-wiz-stat.kw-bi-stat-bad { border-color: #fecaca; background: #fef2f2; }
.kw-wiz-stat.kw-bi-stat-bad .v { color: #dc2626; }
.kw-dark .kw-wiz-stat.kw-bi-stat-bad { border-color: rgba(239, 68, 68, .4); background: rgba(239, 68, 68, .12); }

/* â”€â”€ the commit step â”€â”€
   A determinate bar, because a minute of indeterminate spinner reads as
   "hung" and a refresh mid-import tears down the circuit. */
.kw-bi-progress { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 48px 16px 40px; }


/* â”€â”€ wizard summary tiles and completion panel â”€â”€
   Lifted out of StrategicPlanImportWizard alongside the step strip and drop zone; both wizards
   report their outcome the same way, and a page-scoped copy only reaches one of them. */
.kw-wiz-stats { display: flex; gap: 12px; flex-wrap: wrap; }
.kw-wiz-stat {
    min-width: 96px; padding: 12px 16px; border: 1px solid #e2e8f0; border-radius: 10px;
    text-align: center; background: #f8fafc;
}
.kw-wiz-stat .v { display: block; font-size: 1.5rem; font-weight: 800; color: #0f172a; line-height: 1.1; }
.kw-wiz-stat .k { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: #64748b; }
.kw-wiz-stat.new { border-color: #a7f3d0; background: #ecfdf5; }
.kw-wiz-stat.new .v { color: #059669; }
.kw-wiz-stat.upd { border-color: #bfdbfe; background: #eff6ff; }
.kw-wiz-stat.upd .v { color: #2563eb; }
.kw-wiz-done { text-align: center; padding: 12px 0; }

.kw-dark .kw-wiz-stat { background: #1e293b; border-color: #334155; }
.kw-dark .kw-wiz-stat .v { color: #f1f5f9; }
.kw-dark .kw-wiz-stat .k { color: #94a3b8; }
.kw-dark .kw-wiz-stat.new { background: rgba(16, 185, 129, .12); border-color: rgba(16, 185, 129, .4); }
.kw-dark .kw-wiz-stat.new .v { color: #6ee7b7; }
.kw-dark .kw-wiz-stat.upd { background: rgba(59, 130, 246, .12); border-color: rgba(59, 130, 246, .4); }
.kw-dark .kw-wiz-stat.upd .v { color: #93c5fd; }

