/* ============================================================
   MIGRC - Compliance Management Platform Styles
   ------------------------------------------------------------
   Token architecture: PRIMITIVE -> SEMANTIC -> COMPONENT.
   Primitives are raw values (palette, scale) and never referenced
   directly from component rules. Semantic tokens (--bg-primary,
   --text-primary, --accent-*, etc.) are the stable public API that
   every template already uses via var(--token-name) - their NAMES
   must not change even as the underlying values evolve. Component
   tokens (--btn-*, --input-*) compose semantic tokens for a single
   component family.
   Full usage guide: docs/design-system.md
   ============================================================ */

/* ============================================================
   FONTS
   Inter for UI/body/headings - the same precise, high-legibility
   workhorse used across Linear/GitHub/Stripe-grade dashboards.
   JetBrains Mono for anything that must look exact: control IDs,
   evidence hashes, policy version numbers, API keys.
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ============================================================
   PRIMITIVE TOKENS - raw values only
   ============================================================ */
:root {
    /* Type */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;

    --text-xs: 0.6875rem;   /* 11px - table captions, meta */
    --text-sm: 0.8125rem;   /* 13px - secondary UI text, buttons */
    --text-base: 0.875rem;  /* 14px - app body (denser than marketing sites) */
    --text-md: 0.9375rem;   /* 15px - card titles */
    --text-lg: 1.0625rem;   /* 17px - modal titles */
    --text-xl: 1.25rem;     /* 20px - page H1 (compact) */
    --text-2xl: 1.5rem;     /* 24px - page H1 (standard) */
    --text-3xl: 1.875rem;   /* 30px - hero / Trust Center */

    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    --font-weight-extrabold: 800;

    --leading-tight: 1.2;
    --leading-snug: 1.35;
    --leading-normal: 1.5;

    /* Space - 4px grid */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;

    /* Radius */
    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 999px;

    /* Motion */
    --duration-fast: 120ms;
    --duration-base: 180ms;
    --duration-slow: 300ms;
    --ease-standard: cubic-bezier(0.2, 0, 0, 1);
    --ease-out: cubic-bezier(0, 0, 0.2, 1);
    --transition: all var(--duration-base) var(--ease-standard);

    /* Palette: neutral - cool charcoal, deliberately not stock Tailwind slate */
    --gray-0: #ffffff;
    --gray-25: #fbfbfc;
    --gray-50: #f5f6f8;
    --gray-100: #ebedf1;
    --gray-200: #dde1e8;
    --gray-300: #c3c9d4;
    --gray-400: #9aa2b1;
    /* --gray-450 / --gray-550: added for the accessibility pass - accessible
       "muted" text stops. --gray-400 on a white/near-white surface and
       --gray-600 on a near-black surface both measured under 3:1 contrast
       (WCAG 1.4.3 requires 4.5:1 for normal-size text), so --text-muted and
       light-mode --sidebar-text now resolve to these in-between stops
       instead. Added as new primitives rather than changing --gray-400/
       --gray-600 themselves, since those two are also used directly
       elsewhere and changing them would ripple beyond this fix. */
    --gray-450: #8c94a4;
    --gray-500: #717a8c;
    --gray-550: #60697b;
    --gray-600: #545d70;
    --gray-700: #3b4254;
    --gray-800: #262b3b;
    --gray-900: #161925;
    --gray-950: #0c0e16;

    /* Palette: brand - deep petrol/cyan-teal (kept under legacy --blue-* names so old
       references still resolve). Deliberately hue-separated from success green. */
    --blue-50: #e6f4f8;
    --blue-100: #c9e6ef;
    --blue-200: #98cfe0;
    --blue-300: #5fb2cc;
    --blue-400: #2f93b4;
    --blue-500: #12789b;
    --blue-600: #0e6786;
    --blue-700: #0b536c;
    --blue-800: #0a4256;
    --blue-900: #08323f;

    /* Palette: success */
    --green-50: #eaf7ee;
    --green-100: #d1eeda;
    --green-500: #2f9e5b;
    --green-600: #228148;
    --green-700: #1a6538;
    --green-900: #0e3a20;

    /* Palette: danger */
    --red-50: #fbeaea;
    --red-100: #f5d0d1;
    --red-500: #d1393c;
    --red-600: #b82a2e;
    --red-700: #952226;
    --red-900: #4f1113;

    /* Palette: warning */
    --amber-50: #fbf3e3;
    --amber-100: #f5e2bc;
    --amber-500: #c68a1a;
    --amber-600: #a66f10;
    --amber-700: #7f560c;
    --amber-900: #452d05;

    /* Palette: info (kept distinct from brand blue so it doesn't compete with primary actions) */
    --violet-50: #f1eefc;
    --violet-100: #e0daf8;
    --violet-500: #7c6ae0;
    --violet-600: #6150c4;
    --violet-700: #4b3c9c;
}

/* ============================================================
   SEMANTIC TOKENS - Light Theme (default public API; names are stable)
   ============================================================ */
:root, [data-theme="light"] {
    --bg-primary: var(--gray-50);
    --bg-secondary: var(--gray-0);
    --bg-tertiary: var(--gray-100);
    --surface-raised: var(--gray-0);
    --surface-inverse: var(--gray-900);
    --overlay-scrim: rgba(12,14,22,0.5);

    --sidebar-bg: #0d1a2b;
    --sidebar-hover: rgba(255,255,255,0.07);
    --sidebar-active: var(--blue-600);
    /* Accessibility fix: was --gray-500 (#717a8c), which measured 4.32:1
       against the white sidebar background - just under the 4.5:1 WCAG AA
       minimum for normal-size text (nav item labels render at 13.5px). */
    --sidebar-text: #b4c0d2;
    --sidebar-text-active: #ffffff;
    --sidebar-text-hover: #ffffff;
    --sidebar-heading: #ffffff;
    --sidebar-border: rgba(255,255,255,0.08);
    --sidebar-surface: rgba(255,255,255,0.06);
    --sidebar-surface-hover: rgba(255,255,255,0.12);
    --sidebar-scrollbar: rgba(255,255,255,0.15);
    /* Accessibility fix: was rgba(113,122,140,0.8) (~3.0:1 on the white
       sidebar bg) - the section category labels/chevrons/icons (e.g.
       "OVERVIEW", "GOVERNANCE") failed WCAG AA. Now ~5.2:1. */
    --sidebar-muted: rgba(180,192,210,0.78);

    --text-primary: var(--gray-900);
    --text-secondary: var(--gray-600);
    /* Accessibility fix: was --gray-400 (#9aa2b1), which measured 2.19-2.57:1
       against white/gray-50/gray-100 surfaces - far under the 4.5:1 WCAG AA
       minimum for normal text. --gray-400 is still used elsewhere (e.g.
       disabled icon states) where it isn't carrying text, so it was left
       alone and this token was pointed at the new --gray-550 stop instead. */
    --text-muted: var(--gray-550);
    --text-inverse: var(--gray-0);

    --border-color: var(--gray-200);
    --border-light: var(--gray-100);
    --border-strong: var(--gray-300);

    --accent-primary: var(--blue-600);
    --accent-primary-hover: var(--blue-700);
    --accent-primary-active: var(--blue-800);
    --accent-primary-light: var(--blue-100);
    --accent-success: var(--green-600);
    --accent-success-hover: var(--green-700);
    --accent-success-light: var(--green-100);
    --accent-warning: var(--amber-600);
    --accent-warning-hover: var(--amber-700);
    --accent-warning-light: var(--amber-100);
    --accent-danger: var(--red-600);
    --accent-danger-hover: var(--red-700);
    --accent-danger-light: var(--red-100);
    --accent-info: var(--violet-600);
    --accent-info-hover: var(--violet-700);
    --accent-info-light: var(--violet-100);

    --focus-ring-color: rgba(14,103,134,0.35);

    --shadow-xs: 0 1px 2px rgba(15,23,42,0.04);
    --shadow-sm: 0 1px 2px rgba(15,23,42,0.06), 0 1px 1px rgba(15,23,42,0.04);
    --shadow-md: 0 4px 10px -2px rgba(15,23,42,0.10), 0 2px 4px -2px rgba(15,23,42,0.06);
    --shadow-lg: 0 16px 32px -8px rgba(15,23,42,0.16), 0 4px 10px -4px rgba(15,23,42,0.08);
}

/* Dark Theme */
[data-theme="dark"] {
    --bg-primary: var(--gray-950);
    --bg-secondary: var(--gray-900);
    --bg-tertiary: var(--gray-800);
    --surface-raised: var(--gray-800);
    --surface-inverse: #05060a;
    --overlay-scrim: rgba(3,4,8,0.65);

    --sidebar-bg: #08111d;
    --sidebar-hover: rgba(255,255,255,0.07);
    --sidebar-active: var(--blue-600);
    --sidebar-text: #aab7ca;
    --sidebar-text-active: #ffffff;
    --sidebar-text-hover: var(--gray-100);
    --sidebar-heading: var(--gray-0);
    --sidebar-border: rgba(255,255,255,0.08);
    --sidebar-surface: rgba(255,255,255,0.06);
    --sidebar-surface-hover: rgba(255,255,255,0.14);
    --sidebar-scrollbar: rgba(255,255,255,0.12);
    /* Accessibility fix: was rgba(154,162,177,0.7) (~4.3:1 on the near-black
       sidebar bg) - just under WCAG AA for the small-caps section labels.
       Now ~6.2:1 using --gray-300 at higher opacity. */
    --sidebar-muted: rgba(195,201,212,0.75);

    --text-primary: var(--gray-50);
    --text-secondary: var(--gray-400);
    /* Accessibility fix: was --gray-600 (#545d70), which measured 2.13-2.91:1
       against the dark surfaces - far under 4.5:1. --gray-450 (new stop,
       see primitives) restores legibility (~4.6-6.3:1) while staying
       visually "muted" relative to --text-secondary. */
    --text-muted: var(--gray-450);
    --text-inverse: var(--gray-950);

    --border-color: var(--gray-700);
    --border-light: var(--gray-800);
    --border-strong: var(--gray-600);

    --accent-primary: var(--blue-400);
    --accent-primary-hover: var(--blue-300);
    --accent-primary-active: var(--blue-200);
    --accent-primary-light: rgba(47,147,180,0.18);
    --accent-success: var(--green-500);
    --accent-success-hover: #3fb36e;
    --accent-success-light: rgba(47,158,91,0.18);
    --accent-warning: var(--amber-500);
    --accent-warning-hover: #d79b2e;
    --accent-warning-light: rgba(198,138,26,0.18);
    --accent-danger: var(--red-500);
    --accent-danger-hover: #dd5558;
    --accent-danger-light: rgba(209,57,60,0.18);
    --accent-info: var(--violet-500);
    --accent-info-hover: #9384e8;
    --accent-info-light: rgba(124,106,224,0.18);

    --focus-ring-color: rgba(47,147,180,0.55);

    --shadow-xs: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.5);
}

/* Dark Theme via OS preference (when user has not chosen explicitly) */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        --bg-primary: var(--gray-950);
        --bg-secondary: var(--gray-900);
        --bg-tertiary: var(--gray-800);
        --surface-raised: var(--gray-800);
        --surface-inverse: #05060a;
        --overlay-scrim: rgba(3,4,8,0.65);
    
        --sidebar-bg: #08111d;
        --sidebar-hover: rgba(255,255,255,0.07);
        --sidebar-active: var(--blue-600);
        --sidebar-text: #aab7ca;
        --sidebar-text-active: #ffffff;
        --sidebar-text-hover: var(--gray-100);
        --sidebar-heading: var(--gray-0);
        --sidebar-border: rgba(255,255,255,0.08);
        --sidebar-surface: rgba(255,255,255,0.06);
        --sidebar-surface-hover: rgba(255,255,255,0.14);
        --sidebar-scrollbar: rgba(255,255,255,0.12);
        /* Accessibility fix: was rgba(154,162,177,0.7) (~4.3:1 on the near-black
           sidebar bg) - just under WCAG AA for the small-caps section labels.
           Now ~6.2:1 using --gray-300 at higher opacity. */
        --sidebar-muted: rgba(195,201,212,0.75);
    
        --text-primary: var(--gray-50);
        --text-secondary: var(--gray-400);
        /* Accessibility fix: was --gray-600 (#545d70), which measured 2.13-2.91:1
           against the dark surfaces - far under 4.5:1. --gray-450 (new stop,
           see primitives) restores legibility (~4.6-6.3:1) while staying
           visually "muted" relative to --text-secondary. */
        --text-muted: var(--gray-450);
        --text-inverse: var(--gray-950);
    
        --border-color: var(--gray-700);
        --border-light: var(--gray-800);
        --border-strong: var(--gray-600);
    
        --accent-primary: var(--blue-400);
        --accent-primary-hover: var(--blue-300);
        --accent-primary-active: var(--blue-200);
        --accent-primary-light: rgba(47,147,180,0.18);
        --accent-success: var(--green-500);
        --accent-success-hover: #3fb36e;
        --accent-success-light: rgba(47,158,91,0.18);
        --accent-warning: var(--amber-500);
        --accent-warning-hover: #d79b2e;
        --accent-warning-light: rgba(198,138,26,0.18);
        --accent-danger: var(--red-500);
        --accent-danger-hover: #dd5558;
        --accent-danger-light: rgba(209,57,60,0.18);
        --accent-info: var(--violet-500);
        --accent-info-hover: #9384e8;
        --accent-info-light: rgba(124,106,224,0.18);
    
        --focus-ring-color: rgba(47,147,180,0.55);
    
        --shadow-xs: 0 1px 2px rgba(0,0,0,0.3);
        --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
        --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.4);
        --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.5);
        color-scheme: dark;
    }
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 { font-weight: var(--font-weight-bold); line-height: var(--leading-tight); letter-spacing: -0.01em; }

a { color: var(--accent-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

code, kbd, samp, .mono { font-family: var(--font-mono); }

::selection { background: var(--accent-primary-light); color: var(--text-primary); }

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

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    width: 260px;
    height: 100vh;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease;
    overflow: hidden;
}

.sidebar.collapsed { width: 68px; }
.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-section-header,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .user-info,
.sidebar.collapsed .search-box input,
.sidebar.collapsed .sidebar-search { display: none; }
.sidebar.collapsed .nav-section-items { max-height: none !important; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 12px; }
.sidebar.collapsed .nav-item i { margin-right: 0; font-size: 18px; }
.sidebar.collapsed .user-profile { justify-content: center; }
.sidebar.collapsed .sidebar-header { flex-direction: column; align-items: center; gap: 10px; padding: 16px 8px; }
.sidebar.collapsed .logo-icon { cursor: pointer; }
.sidebar.collapsed .logo { justify-content: center; }
.sidebar.collapsed .sidebar-toggle {
    width: 36px;
    height: 36px;
    background: var(--sidebar-surface);
    border-radius: 8px;
    color: var(--sidebar-text);
    font-size: 14px;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 18px;
    border-bottom: 1px solid var(--sidebar-border);
    position: relative;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    width: 34px;
    height: 34px;
    background: var(--accent-primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-inverse);
    font-size: 16px;
}

.logo-text {
    font-size: var(--text-xl);
    font-weight: var(--font-weight-bold);
    color: var(--sidebar-heading);
    letter-spacing: -0.02em;
}

.sidebar-toggle {
    background: var(--sidebar-surface);
    border: 1px solid var(--sidebar-border);
    color: var(--sidebar-text);
    cursor: pointer;
    font-size: 14px;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}
.sidebar-toggle:hover { background: var(--sidebar-surface-hover); color: var(--sidebar-heading); border-color: var(--sidebar-border); }

.sidebar-search { padding: 12px 16px; }

.search-box {
    display: flex;
    align-items: center;
    background: var(--sidebar-surface);
    border-radius: 8px;
    padding: 8px 12px;
    gap: 8px;
}
.search-box i { color: var(--sidebar-text); font-size: 13px; }
.search-box input {
    background: none;
    border: none;
    color: var(--sidebar-heading);
    outline: none;
    width: 100%;
    font-size: 13px;
}
.search-box input::placeholder { color: var(--sidebar-text); }

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--sidebar-scrollbar); border-radius: 4px; }

.nav-section { padding: 8px 16px 4px; }

.nav-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    background: none;
    border: none;
    padding: 4px 8px;
    margin-bottom: 4px;
    cursor: pointer;
    font-family: inherit;
}

.nav-section-header .nav-section-icon {
    width: 14px;
    text-align: center;
    font-size: 12px;
    color: var(--sidebar-muted);
}

.nav-section-title {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--sidebar-muted);
    flex: 1;
    text-align: left;
}

.nav-section-chevron {
    font-size: 10px;
    color: var(--sidebar-muted);
    transition: transform 0.2s ease;
}

.nav-section.collapsed .nav-section-chevron { transform: rotate(-90deg); }

.nav-section-items {
    overflow: hidden;
    max-height: 500px;
    transition: max-height 0.25s ease;
}

.nav-section.collapsed .nav-section-items { max-height: 0; }

.nav-item {
    display: flex;
    align-items: center;
    padding: 9px 12px;
    color: var(--sidebar-text);
    border-radius: 8px;
    margin: 1px 0;
    transition: var(--transition);
    font-size: 13.5px;
    font-weight: 450;
    text-decoration: none;
    cursor: pointer;
    gap: 10px;
}
.nav-item:hover { background: var(--sidebar-hover); color: var(--sidebar-text-hover); text-decoration: none; }
.nav-item.active {
    background: var(--sidebar-active);
    color: var(--sidebar-text-active);
    font-weight: 500;
}
.nav-item i { width: 18px; text-align: center; font-size: 15px; }

.sidebar-footer {
    border-top: 1px solid var(--sidebar-border);
    padding: 12px 16px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 8px;
    margin-top: 4px;
}

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--surface-inverse);
    color: var(--text-inverse);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

.user-info { display: flex; flex-direction: column; }
.user-name { color: var(--sidebar-heading); font-size: 13px; font-weight: 500; }
.user-role { color: var(--sidebar-text); font-size: 11px; }

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
    margin-left: 260px;
    flex: 1;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
    display: flex;
    flex-direction: column;
}

.sidebar.collapsed ~ .main-content { margin-left: 68px; }

.topbar {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 0 28px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-left { display: flex; align-items: center; gap: 16px; }

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
}

.breadcrumb {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.topbar-right { display: flex; align-items: center; gap: 6px; }

.topbar-btn {
    background: none;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    font-size: 16px;
}
.topbar-btn:hover { background: var(--bg-tertiary); color: var(--text-primary); }

.notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 16px;
    height: 16px;
    background: var(--accent-danger);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-content {
    padding: 28px;
    flex: 1;
}

/* ============================================================
   ORGANIZATION SETTINGS FORM
   ============================================================ */
.required-star { color: var(--accent-danger); }

.field-counter {
    text-align: right;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

.logo-upload-box {
    width: 64px;
    height: 64px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    background: var(--bg-secondary);
}
.logo-upload-box img { width: 100%; height: 100%; object-fit: contain; }
.logo-upload-box i { font-size: 22px; color: var(--text-muted); }

.radio-card-group { display: flex; gap: 12px; flex-wrap: wrap; }
.radio-card {
    flex: 1;
    min-width: 140px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 400;
    cursor: pointer;
    transition: var(--transition);
}
.radio-card:hover { border-color: var(--accent-primary); }
.radio-card.selected { border-color: var(--text-primary); border-width: 2px; }
.radio-card input[type="radio"] { accent-color: var(--text-primary); }

.chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 500;
    background: var(--bg-tertiary);
    color: var(--text-primary);
}
.chip i { cursor: pointer; color: var(--text-muted); font-size: 11px; }
.chip i:hover { color: var(--accent-danger); }

/* ============================================================
   INTEGRATIONS
   ============================================================ */
.integrations-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.integrations-toolbar-right { display: flex; gap: 10px; }

.tab-pill {
    padding: 9px 18px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border: none;
    cursor: pointer;
    transition: var(--transition);
}
.tab-pill:first-child { border-radius: var(--radius-md) 0 0 var(--radius-md); }
.tab-pill:last-child { border-radius: 0 var(--radius-md) var(--radius-md) 0; }
.tab-pill.active { background: var(--text-primary); color: var(--bg-primary); }

.integrations-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 24px;
    align-items: start;
}

.categories-panel {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    max-height: 640px;
    overflow-y: auto;
    transition: width 0.2s;
}
.categories-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 4px 8px 12px;
}
.categories-collapse-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 13px; padding: 4px; }
.categories-collapse-btn:hover { color: var(--text-primary); }
.categories-list { display: flex; flex-direction: column; gap: 2px; }
.categories-list .settings-nav-item { white-space: normal; line-height: 1.3; }

.categories-panel.collapsed { width: 56px; padding: 16px 8px; }
.categories-panel.collapsed .categories-panel-header span,
.categories-panel.collapsed .categories-list span { display: none; }
.categories-panel.collapsed .settings-nav-item { justify-content: center; }

.integration-category { margin-bottom: 36px; }
.integration-category h3 { font-size: 18px; font-weight: 700; margin-bottom: 4px; }

.integration-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.integration-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.integration-card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.integration-card-head h4 { font-size: 15px; font-weight: 600; }

.integration-badge {
    width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 17px; font-weight: 700;
}
.integration-badge.blue { background: var(--accent-primary-light); color: var(--blue-700); }
.integration-badge.green { background: var(--accent-success-light); color: var(--green-700); }
.integration-badge.orange { background: var(--accent-warning-light); color: var(--amber-700); }
.integration-badge.red { background: var(--accent-danger-light); color: var(--red-700); }
.integration-badge.purple { background: var(--accent-info-light); color: var(--violet-700); }
.integration-badge.dark { background: var(--bg-tertiary); color: var(--text-primary); }
[data-theme="dark"] .integration-badge.purple { background: rgba(124,58,237,0.2); color: #c4b5fd; }

/* .btn-integrate (bespoke filled-purple CTA button) removed during the
   design-system migration pass - it was a one-off "orange/purple CTA
   accent" color that directly contradicts this app's single-accent-color
   rule (see docs/design-system.md section 3: "no separate CTA accent -
   primary blue is the only call-to-action color"). Integration cards now
   use the standard .btn .btn-primary .btn-sm button; this rule keeps that
   button pinned to the bottom of the flex-column card like the old one was. */
.integration-card .btn { align-self: flex-start; margin-top: auto; }

@media (max-width: 1100px) {
    .integration-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
    .integrations-layout { grid-template-columns: 1fr; }
    .integration-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   INFO BANNER
   ============================================================ */
.info-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 20px;
}

/* ============================================================
   WIZARD (generic multi-step modal)
   ============================================================ */
.wizard-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.wizard-overlay.active { display: flex; }

.wizard-modal {
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    width: 940px;
    max-width: 100%;
    height: 660px;
    max-height: 100%;
    display: flex;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.wizard-rail {
    width: 220px;
    flex-shrink: 0;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 24px 20px;
    overflow-y: auto;
}
.wizard-rail-title { font-size: 17px; font-weight: 700; margin-bottom: 24px; color: var(--text-primary); }

.wizard-step-item { display: flex; gap: 12px; padding-bottom: 26px; position: relative; }
.wizard-step-item:not(:last-child)::before {
    content: '';
    position: absolute;
    left: 13px;
    top: 28px;
    bottom: 0;
    width: 2px;
    background: var(--border-color);
}
.wizard-step-item.done:not(:last-child)::before { background: var(--accent-success); }

.wizard-step-circle {
    width: 28px; height: 28px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; flex-shrink: 0;
    background: var(--bg-primary); color: var(--text-secondary);
    border: 2px solid var(--border-color);
}
.wizard-step-item.active .wizard-step-circle { background: var(--accent-primary); color: #fff; border-color: var(--accent-primary); }
.wizard-step-item.done .wizard-step-circle { background: var(--accent-success); color: #fff; border-color: var(--accent-success); }

.wizard-step-label-num { font-size: 11px; color: var(--text-muted); margin-bottom: 2px; }
.wizard-step-label-title { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.wizard-step-item.active .wizard-step-label-title { color: var(--text-primary); }

.wizard-content { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.wizard-content-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 28px; border-bottom: 1px solid var(--border-color); flex-shrink: 0; }
.wizard-content-header h3 { font-size: 17px; font-weight: 700; }
.wizard-content-body { flex: 1; overflow-y: auto; padding: 22px 28px; }
.wizard-content-footer { display: flex; justify-content: space-between; padding: 14px 28px; border-top: 1px solid var(--border-color); flex-shrink: 0; }

.wizard-step-panel { display: none; }
.wizard-step-panel.active { display: block; }

.wizard-review-row { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--border-color); font-size: 13px; }
.wizard-review-row:last-child { border-bottom: none; }
.wizard-review-row .label { color: var(--text-muted); flex-shrink: 0; }
.wizard-review-row .value { font-weight: 600; color: var(--text-primary); text-align: right; }

.material-picker-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; max-height: 200px; overflow-y: auto; }
.material-picker-card {
    display: flex; align-items: center; gap: 10px;
    padding: 12px; border: 1px solid var(--border-color); border-radius: 8px;
    cursor: pointer; font-size: 13px; transition: var(--transition);
}
.material-picker-card:hover { border-color: var(--accent-primary); }
.material-picker-card:has(input:checked) { border-color: var(--accent-primary); background: var(--accent-primary-light); }
.material-picker-card input { accent-color: var(--accent-primary); }
.material-picker-card i { color: var(--accent-danger); font-size: 16px; }

@media (max-width: 768px) {
    .wizard-modal { flex-direction: column; height: 100%; }
    .wizard-rail { width: 100%; display: flex; overflow-x: auto; padding: 16px; gap: 16px; }
    .wizard-rail-title { display: none; }
    .wizard-step-item { padding-bottom: 0; flex-shrink: 0; }
    .wizard-step-item::before { display: none; }
    .material-picker-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   NOTIFICATION DROPDOWN
   ============================================================ */
.notification-bell-wrapper { position: relative; }

.notification-dropdown {
    display: none;
    position: absolute;
    top: 46px;
    right: 0;
    width: 340px;
    max-height: 420px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    flex-direction: column;
    overflow: hidden;
}
.notification-dropdown.open { display: flex; }

.notification-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
}

.notification-markall-btn {
    background: none;
    border: none;
    color: var(--accent-primary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    padding: 0;
}

.notification-dropdown-list {
    overflow-y: auto;
    max-height: 320px;
}

.notification-dropdown-item {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    border-bottom: 1px solid var(--border-color);
    padding: 12px 16px;
    cursor: pointer;
    transition: var(--transition);
}
.notification-dropdown-item:hover { background: var(--bg-tertiary); }
.notification-dropdown-item:last-child { border-bottom: none; }

.notification-item-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.notification-item-message {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    white-space: normal;
}

.notification-item-time {
    font-size: 11px;
    color: var(--text-muted);
}

.notification-dropdown-empty {
    padding: 24px 16px;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
}

.notification-dropdown-footer {
    display: block;
    text-align: center;
    padding: 10px;
    font-size: 12px;
    font-weight: 500;
    color: var(--accent-primary);
    text-decoration: none;
    border-top: 1px solid var(--border-color);
}
.notification-dropdown-footer:hover { background: var(--bg-tertiary); }

/* ============================================================
   GENERIC DROPDOWN PANEL (Columns / More Filters popovers)
   ============================================================ */
.dropdown-panel-wrapper { position: relative; display: inline-block; }
.dropdown-panel {
    display: none;
    position: absolute;
    top: 44px;
    right: 0;
    min-width: 220px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 8px;
    z-index: 50;
}
.dropdown-panel.open { display: block; }
.dropdown-panel-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    font-size: 13px;
    color: var(--text-primary);
    border-radius: 6px;
    cursor: pointer;
}
.dropdown-panel-item:hover { background: var(--bg-tertiary); }
.dropdown-panel-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 4px;
    min-width: 320px;
}

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.page-header h1 {
    font-size: var(--text-2xl);
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
    letter-spacing: -0.015em;
}

.page-header p {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    margin-top: 2px;
}

.page-actions { display: flex; gap: var(--space-3); flex-wrap: wrap; }

/* ============================================================
   BUTTONS
   Variants: primary, secondary, danger, success, ghost, icon-only.
   Every variant defines default/hover/active/focus-visible/disabled.
   Loading state: toggle `.is-loading` + set `disabled` from JS
   (see app.js `setButtonLoading`) - do not remove the label text,
   it is hidden visually but kept for consistent button width.
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    position: relative;
    padding: 8px 18px;
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: var(--font-weight-semibold);
    line-height: 1;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition);
    white-space: nowrap;
}
.btn:disabled,
.btn.is-disabled { cursor: not-allowed; opacity: 0.55; box-shadow: none; }
.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--focus-ring-color);
}

/* Primary - the one high-emphasis action per view */
.btn-primary {
    background: var(--accent-primary);
    color: var(--text-inverse);
    border-color: var(--accent-primary);
}
.btn-primary:hover:not(:disabled) { background: var(--accent-primary-hover); border-color: var(--accent-primary-hover); }
.btn-primary:active:not(:disabled) { background: var(--accent-primary-active); border-color: var(--accent-primary-active); }

/* Secondary - default workhorse button */
.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--border-color);
}
.btn-secondary:hover:not(:disabled) { background: var(--bg-tertiary); border-color: var(--border-strong); }
.btn-secondary:active:not(:disabled) { background: var(--border-light); }

/* Ghost / tertiary - lowest emphasis, used inline or in dense toolbars */
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
}
.btn-ghost:hover:not(:disabled) { background: var(--bg-tertiary); color: var(--text-primary); }
.btn-ghost:active:not(:disabled) { background: var(--border-light); }

.btn-success { background: var(--accent-success); color: var(--text-inverse); border-color: var(--accent-success); }
.btn-success:hover:not(:disabled) { background: var(--accent-success-hover); border-color: var(--accent-success-hover); }

.btn-danger { background: var(--accent-danger); color: var(--text-inverse); border-color: var(--accent-danger); }
.btn-danger:hover:not(:disabled) { background: var(--accent-danger-hover); border-color: var(--accent-danger-hover); }
.btn-danger:active:not(:disabled) { filter: brightness(0.92); }

/* Outline-danger - for destructive actions that shouldn't shout as loud as a filled danger button */
.btn-danger-outline {
    background: var(--bg-secondary);
    color: var(--accent-danger);
    border-color: var(--border-color);
}
.btn-danger-outline:hover:not(:disabled) { background: var(--accent-danger-light); border-color: var(--accent-danger); }

.btn-sm { padding: 5px 12px; font-size: var(--text-xs); gap: var(--space-1); }
.btn-lg { padding: 10px 22px; font-size: var(--text-md); }

/* Icon-only - always pair with a descriptive aria-label/title in markup, never bare */
.btn-icon { padding: 8px; width: 36px; height: 36px; justify-content: center; }
.btn-icon.btn-sm { width: 28px; height: 28px; padding: 5px; }

/* Loading state - keeps button size stable, swaps label for a spinner */
.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
    content: '';
    position: absolute;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    border: 2px solid currentColor;
    border-right-color: transparent;
    color: inherit;
    opacity: 0.9;
    animation: btnSpin 0.6s linear infinite;
}
.btn-primary.is-loading::after,
.btn-success.is-loading::after,
.btn-danger.is-loading::after { color: var(--text-inverse); }
.btn-secondary.is-loading::after,
.btn-ghost.is-loading::after { color: var(--text-secondary); }
@keyframes btnSpin { to { transform: rotate(360deg); } }

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--duration-base) var(--ease-standard);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--border-color);
}

.card-header h3 {
    font-size: var(--text-md);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
}

.card-body { padding: var(--space-6); }
.card-body.no-padding { padding: 0; }

/* ============================================================
   STAT CARDS (Dashboard KPIs)
   ============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-5);
    margin-bottom: var(--space-6);
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    display: flex;
    align-items: flex-start;
    gap: var(--space-4);
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-card-active { border-color: var(--accent-primary); box-shadow: 0 0 0 1px var(--accent-primary); }

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.stat-icon.blue { background: var(--accent-primary-light); color: var(--accent-primary); }
.stat-icon.green { background: var(--accent-success-light); color: var(--accent-success); }
.stat-icon.orange { background: var(--accent-warning-light); color: var(--accent-warning); }
.stat-icon.red { background: var(--accent-danger-light); color: var(--accent-danger); }
.stat-icon.purple { background: var(--accent-info-light); color: var(--accent-info); }

.stat-info { flex: 1; min-width: 0; }
.stat-label {
    font-size: var(--text-xs);
    font-weight: var(--font-weight-medium);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 4px;
}
.stat-value {
    font-size: var(--text-2xl);
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
    line-height: var(--leading-tight);
}
.stat-change {
    font-size: var(--text-xs);
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--text-muted);
}
.stat-change.up { color: var(--accent-success); }
.stat-change.down { color: var(--accent-danger); }

/* ============================================================
   GRID LAYOUTS
   ============================================================ */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}
.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}
.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 24px;
}

/* ============================================================
   TABLES
   ============================================================ */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

thead th {
    background: var(--bg-tertiary);
    padding: 10px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

thead th:first-child { border-radius: var(--radius-md) 0 0 0; }
thead th:last-child { border-radius: 0 var(--radius-md) 0 0; }

tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
    color: var(--text-primary);
    vertical-align: middle;
}

tbody tr:hover { background: var(--bg-tertiary); }
tbody tr:last-child td { border-bottom: none; }

/* ============================================================
   BADGES / STATUS PILLS
   ============================================================ */
/* Status pills. Pair every color with an icon or label text in markup -
   never rely on color alone to convey PASS/FAIL/NEEDS REVIEW meaning.
   `.badge-pass` / `.badge-fail` / `.badge-review` are the GRC-semantic
   names for verification results (control tests, evidence review,
   audit findings); they render identically to success/danger/warning
   but should be reached for whenever the thing being labelled is a
   pass/fail/needs-review verdict rather than a generic status. */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: var(--font-weight-semibold);
    white-space: nowrap;
    max-width: 100%;
}
.badge > span { overflow: hidden; text-overflow: ellipsis; }
.badge i, .badge svg { font-size: 9px; flex-shrink: 0; }

.badge-success,
.badge-pass { background: var(--accent-success-light); color: var(--green-700); }
.badge-warning,
.badge-review { background: var(--accent-warning-light); color: var(--amber-900); }
.badge-danger,
.badge-fail { background: var(--accent-danger-light); color: var(--red-700); }
.badge-info { background: var(--accent-info-light); color: var(--violet-700); }
.badge-neutral { background: var(--bg-tertiary); color: var(--text-secondary); }
.badge-primary { background: var(--accent-primary-light); color: var(--blue-700); }

[data-theme="dark"] .badge-success,
[data-theme="dark"] .badge-pass { color: #86e0ab; }
[data-theme="dark"] .badge-warning,
[data-theme="dark"] .badge-review { color: #f0c674; }
[data-theme="dark"] .badge-danger,
[data-theme="dark"] .badge-fail { color: #f29a9c; }
[data-theme="dark"] .badge-info { color: #c3b8f5; }
[data-theme="dark"] .badge-primary { color: #aec3f7; }

/* ============================================================
   PROGRESS BARS
   ============================================================ */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 100px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    border-radius: 100px;
    transition: width 0.5s ease;
}

.progress-fill.green { background: var(--accent-success); }
.progress-fill.blue { background: var(--accent-primary); }
.progress-fill.orange { background: var(--accent-warning); }
.progress-fill.red { background: var(--accent-danger); }
.progress-fill.purple { background: var(--accent-info); }

.progress-stacked {
    display: flex;
    height: 8px;
    border-radius: 100px;
    overflow: hidden;
    background: var(--bg-tertiary);
}

.progress-stacked .segment {
    height: 100%;
    transition: width 0.5s ease;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* ============================================================
   FRAMEWORK CARDS
   ============================================================ */
.framework-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 22px;
    transition: var(--transition);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}
.framework-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--accent-primary); }

.framework-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.framework-card-header .fw-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
}

.framework-card h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.framework-card .fw-category {
    font-size: 12px;
    color: var(--text-secondary);
}

.framework-stats {
    display: flex;
    gap: 16px;
    margin-top: 16px;
}

.fw-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}

.fw-stat .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}
.fw-stat .dot.green { background: var(--accent-success); }
.fw-stat .dot.red { background: var(--accent-danger); }
.fw-stat .dot.gray { background: var(--text-muted); }

/* ============================================================
   REUSABLE STATUS DOT (Effort Estimate, legends, etc.)
   ============================================================ */
.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.dot.green { background: var(--accent-success); }
.dot.orange { background: var(--accent-warning); }
.dot.red { background: var(--accent-danger); }
.dot.gray { background: var(--text-muted); }

/* ============================================================
   LOCKED / DISABLED FEATURE CARD (AI panels, JIRA tab, etc.)
   ============================================================ */
.locked-card {
    text-align: center;
    padding: 32px 20px;
    color: var(--text-muted);
}
.locked-card .locked-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--text-muted);
    margin: 0 auto 12px;
}
.locked-card h4 {
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.locked-card p {
    font-size: 12px;
    margin-bottom: 12px;
}

/* Compact horizontal variant of .locked-card, for banner-style placements */
.locked-banner {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
}
.locked-banner .locked-icon {
    width: 44px;
    height: 44px;
    font-size: 16px;
    margin: 0;
    flex-shrink: 0;
}
.locked-banner .locked-banner-body { flex: 1; }
.locked-banner h4 { font-size: 14px; color: var(--text-primary); margin-bottom: 2px; }
.locked-banner p { font-size: 12px; color: var(--text-muted); margin-bottom: 0; }

/* ============================================================
   LIFECYCLE STEPPER (policy / workflow progress tracks)
   ============================================================ */
.lifecycle-track {
    display: flex;
    align-items: flex-start;
    margin: 4px 0 8px;
}
.lifecycle-step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    padding-top: 6px;
}
.lifecycle-step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 11px;
    left: 50%;
    width: 100%;
    height: 2px;
    background: var(--border-color);
    z-index: 0;
}
.lifecycle-step.done:not(:last-child)::after { background: var(--accent-primary); }
.lifecycle-step .step-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    z-index: 1;
}
.lifecycle-step.done .step-dot { background: var(--accent-primary); border-color: var(--accent-primary); }
.lifecycle-step.current .step-dot { background: var(--accent-primary); border-color: var(--accent-primary); box-shadow: 0 0 0 4px var(--accent-primary-light); }
.lifecycle-step .step-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 8px;
    text-align: center;
    line-height: 1.3;
}
.lifecycle-step.done .step-label, .lifecycle-step.current .step-label { color: var(--text-primary); font-weight: 600; }

/* Hover-lift option cards ("Start Your Policy" style pickers) */
.option-card {
    transition: var(--transition);
    border: 1px solid var(--border-color);
}
.option-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-primary);
}
.option-card .option-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    margin: 0 auto 12px;
}

/* Icon-led metadata chip (policy detail info grid) */
.meta-chip-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 8px;
}
.meta-chip-label i { font-size: 11px; color: var(--accent-primary); }

/* ============================================================
   RISK MATRIX (5x5 Heatmap)
   Rebuilt for the Risk Register migration pass: a true 5x5 grid
   (previously only 3 columns were defined even though the JS always
   rendered 5), severity colors now come from the palette primitives
   (never raw hex) so they stay legible and on-brand in both themes,
   and axis/legend labelling was added so the heatmap reads on its
   own without a caption. See templates/risks.html (#matrixView).
   ============================================================ */
.risk-matrix {
    display: grid;
    grid-template-columns: 90px repeat(5, 1fr);
    grid-template-rows: 34px repeat(5, 56px);
    gap: var(--space-1);
    max-width: 560px;
}

.risk-matrix .axis-label {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xs);
    font-weight: var(--font-weight-semibold);
    color: var(--text-secondary);
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.risk-matrix .x-label {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xs);
    font-weight: var(--font-weight-semibold);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-align: center;
}

.risk-matrix .y-label {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: var(--space-2);
    font-size: var(--text-xs);
    font-weight: var(--font-weight-semibold);
    color: var(--text-secondary);
    text-align: right;
}

.risk-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: var(--text-md);
    font-weight: var(--font-weight-bold);
    color: #fff;
    cursor: pointer;
    transition: var(--transition);
}
.risk-cell:hover { transform: scale(1.05); box-shadow: var(--shadow-md); z-index: 1; }
/* Severity gradient uses the neutral green->amber->red primitives, not
   semantic accent tokens - these five bands must stay visually stable
   and distinct from each other regardless of theme, the way a legend
   color should. */
.risk-cell.negligible { background: var(--green-700); }
/* Accessibility fix: was --green-500 (#2f9e5b), which only gave white cell
   text 3.41:1 contrast (needs 4.5:1 - cell text is 15px bold, not large
   enough to qualify for the 3:1 large-text exception). --green-600 is
   already an existing primitive (used as light-mode --accent-success) and
   gives 4.88:1 while keeping the 5-band gradient visually distinct. */
.risk-cell.low { background: var(--green-600); }
.risk-cell.medium { background: var(--amber-700); }
.risk-cell.high { background: var(--red-500); }
.risk-cell.critical { background: var(--red-700); }

/* Legend dot modifiers matching the risk-cell severity bands above,
   for use with the existing .legend / .legend-item / .legend-dot
   pattern underneath the heatmap. */
.legend-dot.negligible { background: var(--green-700); }
.legend-dot.low { background: var(--green-600); }
.legend-dot.medium { background: var(--amber-700); }
.legend-dot.high { background: var(--red-500); }
.legend-dot.critical { background: var(--red-700); }

/* ============================================================
   DONUT / CHART CONTAINERS
   ============================================================ */
.chart-container {
    position: relative;
    max-width: 280px;
    margin: 0 auto;
}

.chart-container-wide {
    position: relative;
    width: 100%;
    height: 300px;
}

.chart-center-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}
.chart-center-label .value { font-size: 32px; font-weight: 700; color: var(--text-primary); }
.chart-center-label .label { font-size: 12px; color: var(--text-secondary); }

/* ============================================================
   FILTERS / TOOLBAR
   ============================================================ */
.toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-select, .filter-input {
    padding: 7px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    transition: var(--transition);
}
.filter-select:focus, .filter-input:focus { border-color: var(--accent-primary); box-shadow: 0 0 0 3px var(--focus-ring-color); }

.filter-input {
    width: 240px;
}

.search-input-wrapper {
    position: relative;
}
.search-input-wrapper i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 13px;
}
.search-input-wrapper input { padding-left: 36px; }

/* ============================================================
   TABS
   ============================================================ */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 24px;
}

.tab {
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: var(--transition);
    text-decoration: none;
    display: inline-block;
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--accent-primary); border-bottom-color: var(--accent-primary); font-weight: 600; }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}
.modal-overlay.active { display: flex; }

.modal {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: auto;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}
.modal-header h3 { font-size: 17px; font-weight: 600; }

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    border-radius: 6px;
    transition: var(--transition);
}
.modal-close:hover { background: var(--bg-tertiary); }

.modal-body { padding: 24px; }
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ============================================================
   FORM ELEMENTS
   ============================================================ */
.form-group { margin-bottom: var(--space-5); }
.form-group label {
    display: block;
    font-size: var(--text-sm);
    font-weight: var(--font-weight-medium);
    color: var(--text-primary);
    margin-bottom: 6px;
}
.form-group .required-star { color: var(--accent-danger); }
.form-help {
    display: block;
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin-top: 6px;
}
.form-error {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--text-xs);
    color: var(--accent-danger);
    margin-top: 6px;
}

.form-control {
    width: 100%;
    padding: 9px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: var(--text-base);
    outline: none;
    transition: var(--transition);
}
.form-control::placeholder { color: var(--text-muted); }
.form-control:hover:not(:disabled):not(:focus) { border-color: var(--border-strong); }
.form-control:focus { border-color: var(--accent-primary); box-shadow: 0 0 0 3px var(--focus-ring-color); }
.form-control:disabled {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    cursor: not-allowed;
}

.form-control.is-invalid,
.form-control[aria-invalid="true"] { border-color: var(--accent-danger); }
.form-control.is-invalid:focus,
.form-control[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px var(--accent-danger-light); }
.form-control.is-valid { border-color: var(--accent-success); }

select.form-control { cursor: pointer; }
textarea.form-control { min-height: 100px; resize: vertical; line-height: var(--leading-normal); }

/* Checkbox / radio - keep native control, just align it with the type scale */
.form-check {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--text-primary);
}
.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    width: 16px;
    height: 16px;
    margin-top: 2px;
    accent-color: var(--accent-primary);
    flex-shrink: 0;
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    animation: toastIn 0.3s ease;
    min-width: 300px;
}

.toast.success { border-left: 4px solid var(--accent-success); }
.toast.error { border-left: 4px solid var(--accent-danger); }
.toast.warning { border-left: 4px solid var(--accent-warning); }
.toast.info { border-left: 4px solid var(--accent-primary); }

@keyframes toastIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ============================================================
   TRUST CENTER (Public page style)
   ============================================================ */
.trust-hero {
    text-align: center;
    padding: 60px 20px 40px;
    background: var(--surface-inverse);
    border-radius: var(--radius-xl);
    color: var(--text-inverse);
    margin-bottom: 32px;
}

.trust-hero h1 { font-size: 32px; font-weight: 700; margin-bottom: 8px; }
.trust-hero p { font-size: 16px; opacity: 0.85; }

.trust-badge-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 18px;
    margin-bottom: 32px;
}

.trust-badge-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 28px 20px;
    text-align: center;
    transition: var(--transition);
}
.trust-badge-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.trust-badge-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    margin: 0 auto 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

/* ============================================================
   SETTINGS PAGE
   ============================================================ */
.settings-grid {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 24px;
}

.settings-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.settings-nav-item {
    padding: 10px 16px;
    border-radius: var(--radius-md);
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}
.settings-nav-item:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.settings-nav-item.active { background: var(--accent-primary-light); color: var(--accent-primary); font-weight: 500; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
    text-align: center;
    padding: var(--space-12) var(--space-5);
    color: var(--text-secondary);
}
.empty-state-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto var(--space-4);
    border-radius: var(--radius-full);
    background: var(--bg-tertiary);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}
/* Back-compat: a bare <i> directly inside .empty-state (no wrapper) still renders sanely */
.empty-state > i { font-size: 48px; margin-bottom: var(--space-4); color: var(--text-muted); }
.empty-state h3 { font-size: var(--text-lg); font-weight: var(--font-weight-semibold); margin-bottom: var(--space-2); color: var(--text-primary); }
.empty-state p { font-size: var(--text-sm); margin-bottom: var(--space-5); max-width: 420px; margin-left: auto; margin-right: auto; }

/* Error state - same shape as empty state, danger tone, for failed loads/fetches */
.error-state {
    text-align: center;
    padding: var(--space-12) var(--space-5);
    color: var(--text-secondary);
}
.error-state-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto var(--space-4);
    border-radius: var(--radius-full);
    background: var(--accent-danger-light);
    color: var(--accent-danger);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}
.error-state h3 { font-size: var(--text-lg); font-weight: var(--font-weight-semibold); margin-bottom: var(--space-2); color: var(--text-primary); }
.error-state p { font-size: var(--text-sm); margin-bottom: var(--space-5); max-width: 420px; margin-left: auto; margin-right: auto; }

/* Loading skeletons - use while async content is in flight. Keep shapes
   roughly matching the content they stand in for (a line, a block, a circle). */
.skeleton {
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--border-light) 37%, var(--bg-tertiary) 63%);
    background-size: 400% 100%;
    animation: skeletonShimmer 1.4s ease infinite;
    border-radius: var(--radius-sm);
}
.skeleton-text { height: 12px; margin-bottom: 8px; width: 100%; }
.skeleton-text:last-child { margin-bottom: 0; width: 70%; }
.skeleton-title { height: 18px; width: 45%; margin-bottom: var(--space-3); }
.skeleton-circle { border-radius: 50%; }
.skeleton-block { height: 90px; width: 100%; }
@keyframes skeletonShimmer {
    0% { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}
@media (prefers-reduced-motion: reduce) {
    .skeleton { animation: none; background: var(--bg-tertiary); }
}

/* ============================================================
   MISC UTILITIES
   ============================================================ */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-16 { margin-top: 16px; }
.text-sm { font-size: 12px; }
.text-muted { color: var(--text-secondary); }
.font-semibold { font-weight: 600; }
.text-right { text-align: right; }
.w-full { width: 100%; }

.score-ring {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    margin: 0 auto;
}

.compliance-score-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 16px;
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}
.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
}

/* vendor risk score bar */
.risk-score-bar {
    width: 60px;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 100px;
    overflow: hidden;
    display: inline-block;
    vertical-align: middle;
    margin-right: 8px;
}
.risk-score-fill {
    height: 100%;
    border-radius: 100px;
}

/* tag list */
.tag-list { display: flex; flex-wrap: wrap; gap: 4px; }
.tag {
    padding: 2px 8px;
    border-radius: 100px;
    font-size: 10px;
    font-weight: 600;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

/* ============================================================
   ACTIVITY / DEADLINE LIST (Recent Activity, Upcoming Deadlines)
   ============================================================ */
.activity-list { display: flex; flex-direction: column; }
.activity-row {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-6);
    border-bottom: 1px solid var(--border-light);
}
.activity-row:last-child { border-bottom: none; }
.activity-row-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
}
.activity-row-body { flex: 1; min-width: 0; }
.activity-row-text { font-size: var(--text-sm); color: var(--text-primary); line-height: var(--leading-snug); }

/* ============================================================
   FLASH MESSAGES (server-rendered via base.html)
   ============================================================ */
.flash-message {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-4);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    border: 1px solid transparent;
}
.flash-error { background: var(--accent-danger-light); color: var(--red-700); border-color: var(--red-100); }
.flash-success { background: var(--accent-success-light); color: var(--green-700); border-color: var(--green-100); }
.flash-info, .flash-message:not(.flash-error):not(.flash-success) { background: var(--accent-primary-light); color: var(--blue-700); border-color: var(--blue-100); }
[data-theme="dark"] .flash-error { color: #f29a9c; }
[data-theme="dark"] .flash-success { color: #86e0ab; }
[data-theme="dark"] .flash-info, [data-theme="dark"] .flash-message:not(.flash-error):not(.flash-success) { color: #aec3f7; }

/* ============================================================
   FOCUS / KEYBOARD ACCESSIBILITY
   One consistent focus treatment across every interactive element.
   Uses :focus-visible so mouse clicks stay quiet and keyboard/
   switch-control navigation stays clearly visible.
   ============================================================ */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.nav-item:focus-visible,
.tab:focus-visible,
.nav-section-header:focus-visible,
.settings-nav-item:focus-visible,
[tabindex]:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--focus-ring-color);
    border-radius: var(--radius-sm);
}
.topbar-btn:focus-visible,
.sidebar-toggle:focus-visible,
.modal-close:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--focus-ring-color);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1200px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 260px;
    }
    .sidebar.mobile-open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .mobile-toggle { display: flex; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .settings-grid { grid-template-columns: 1fr; }
    .page-content { padding: 16px; }
    .topbar { padding: 0 16px; }
    .page-header { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   NEW - added during the Risk Register / Audits / Vendors design-
   system migration pass (frontend-developer agent). Appended here,
   not mixed into the sections above, since another agent is editing
   this same file concurrently for Policies/Trust Center/Setup
   Wizard/Settings/People/Reports/Integrations - see docs/design-
   system.md for the token architecture these compose on top of.
   ============================================================ */

/* Large status badge - the "current state" pill used in several
   detail-page headers (risk/audit/vendor-assessment). A size
   modifier only; pair with an existing badge-* color class, e.g.
   <span class="badge badge-warning badge-lg">In Treatment</span>. */
.badge-lg {
    font-size: var(--text-sm);
    padding: var(--space-2) var(--space-4);
}

/* Generic toggle switch (checkbox styled as an iOS-style switch).
   Used by the risk-detail "Link / Unlink Controls" picker modal
   below; reusable anywhere a boolean needs richer affordance than a
   bare native checkbox. Markup:
   <label class="toggle">
     <input type="checkbox">
     <span class="toggle-track"><span class="toggle-thumb"></span></span>
     <span>Label text</span>
   </label> */
.toggle { display: inline-flex; align-items: center; gap: var(--space-2); cursor: pointer; white-space: nowrap; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-track {
    width: 34px;
    height: 18px;
    border-radius: var(--radius-full);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    position: relative;
    transition: var(--transition);
    flex-shrink: 0;
}
.toggle-thumb {
    position: absolute;
    top: 1px;
    left: 1px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: var(--transition);
}
.toggle input:checked + .toggle-track { background: var(--accent-primary); }
.toggle input:checked + .toggle-track .toggle-thumb { transform: translateX(16px); background: var(--text-inverse); }
.toggle input:focus-visible + .toggle-track { box-shadow: 0 0 0 3px var(--focus-ring-color); }

/* Generic compact numbered pagination, for record pickers / long
   lists that paginate client-side. */
.pagination { display: flex; gap: var(--space-1); }
.pagination-btn {
    width: 26px;
    height: 26px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: var(--text-xs);
    cursor: pointer;
    transition: var(--transition);
}
.pagination-btn:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.pagination-btn.active { background: var(--accent-primary); color: var(--text-inverse); border-color: var(--accent-primary); }

/* Record-picker modal: a category rail + searchable/paginated
   checklist. Built to replace risk_detail.html's old bespoke `lc-*`
   inline <style> block ("Link / Unlink Controls"); reusable for any
   future "attach N records from M categories" picker. */
.picker-modal {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    width: 95%;
    max-width: 1000px;
    height: 85vh;
    display: flex;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    position: relative;
    animation: modalIn var(--duration-slow) var(--ease-out);
}
.picker-modal-close { position: absolute; top: var(--space-4); right: var(--space-4); z-index: 2; }
.picker-rail {
    width: 220px;
    flex-shrink: 0;
    border-right: 1px solid var(--border-color);
    padding: var(--space-5) var(--space-3);
    overflow-y: auto;
}
.picker-rail-title { font-size: var(--text-lg); font-weight: var(--font-weight-semibold); padding: 0 var(--space-2) var(--space-4); color: var(--text-primary); }
.picker-nav { display: flex; flex-direction: column; gap: 2px; }
.picker-tab {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    padding: var(--space-2);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-weight: var(--font-weight-medium);
    width: 100%;
    font-family: var(--font-sans);
    transition: var(--transition);
}
.picker-tab:hover { background: var(--bg-tertiary); }
.picker-tab.active { color: var(--accent-primary); background: var(--bg-tertiary); }
.picker-count {
    background: var(--text-muted);
    color: var(--bg-secondary);
    font-size: var(--text-xs);
    font-weight: var(--font-weight-bold);
    padding: 2px 7px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
}
.picker-tab.active .picker-count { background: var(--accent-primary); color: var(--text-inverse); }
.picker-main { flex: 1; padding: var(--space-5) var(--space-6); overflow-y: auto; display: flex; flex-direction: column; min-width: 0; }
.picker-main form { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.picker-title { font-size: var(--text-xl); font-weight: var(--font-weight-bold); margin: 0 0 var(--space-4); color: var(--text-primary); }
.picker-hint-box { background: var(--bg-tertiary); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); margin-bottom: var(--space-4); }
.picker-hint-box-header { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); font-weight: var(--font-weight-semibold); color: var(--accent-primary); }
.picker-toolbar { display: flex; gap: var(--space-3); align-items: center; margin-bottom: var(--space-4); flex-wrap: wrap; }
.picker-search { position: relative; flex: 1; min-width: 220px; }
.picker-search i { position: absolute; left: var(--space-3); top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: var(--text-xs); }
.picker-search input {
    width: 100%;
    padding: 9px var(--space-3) 9px 32px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: var(--text-sm);
    font-family: var(--font-sans);
}
.picker-search input:focus { outline: none; border-color: var(--accent-primary); box-shadow: 0 0 0 3px var(--focus-ring-color); }
.picker-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: var(--space-2); min-height: 120px; }
.picker-row {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: var(--transition);
}
.picker-row:hover { background: var(--bg-tertiary); }
.picker-row input { margin-top: 2px; flex-shrink: 0; accent-color: var(--accent-primary); }
.picker-empty { text-align: center; padding: var(--space-10); color: var(--text-muted); font-size: var(--text-sm); }
.picker-footer { display: flex; align-items: center; gap: var(--space-4); padding-top: var(--space-4); margin-top: var(--space-4); border-top: 1px solid var(--border-color); }
.picker-footer-right { display: flex; align-items: center; gap: var(--space-3); margin-left: auto; }
@media (max-width: 720px) {
    .picker-modal { flex-direction: column; height: 90vh; }
    .picker-rail { width: 100%; border-right: none; border-bottom: 1px solid var(--border-color); max-height: 140px; }
}

/* ============================================================
   NEW - added during the Trust Center / Setup Wizard / Settings /
   People / Reports / Integrations design-system migration pass
   (frontend-developer agent). Appended here rather than mixed into
   the sections above, per docs/design-system.md. These replace
   inline style="..." attributes that were duplicating the token
   system across those pages.
   ============================================================ */

/* Small heading used above a card/grid when the heading isn't
   inside a .card-header (e.g. Trust Center's "Compliance
   Certifications" label above the badge grid). */
.subsection-title {
    font-size: var(--text-md);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    margin-bottom: var(--space-4);
}

/* Missing small-gap utility (the existing .mb-8/.mb-16/.mb-24/.mt-16 set
   had no 4px step). */
.mt-4 { margin-top: 4px; }

/* Color variants for .info-banner (previously neutral-only). Used
   wherever a page needs a tinted status/tip banner instead of
   hand-rolled background+border inline styles - e.g. Setup
   Wizard's "AI Assist" status card (connected/unreachable/not
   configured) and its cloud-provider AI tip. Icon inherits the
   banner's text color via currentColor, no separate inline color
   needed on the <i>. */
.info-banner-success { background: var(--accent-success-light); color: var(--green-700); border: 1px solid var(--accent-success); }
.info-banner-warning { background: var(--accent-warning-light); color: var(--amber-900); border: 1px solid var(--accent-warning); }
.info-banner-info { background: var(--accent-primary-light); color: var(--blue-700); border: 1px solid var(--accent-primary); }
[data-theme="dark"] .info-banner-success { color: #86e0ab; }
[data-theme="dark"] .info-banner-warning { color: #f0c674; }
[data-theme="dark"] .info-banner-info { color: #aec3f7; }
.info-banner-success i, .info-banner-warning i, .info-banner-info i { color: inherit; }

/* Settings-style tab panels toggled by JS (Settings page, Trust
   Center none, etc.) - replaces inline style="display:none" /
   style="display:" toggling with a class so the show/hide state is
   visible in markup and consistent with .wizard-step-panel.active
   elsewhere. */
.settings-panel { display: none; }
.settings-panel.active { display: block; }

/* Icon-chip size modifiers for .stat-icon, for contexts smaller
   than a dashboard stat card (inline table/list icons, compact
   security-practice rows). Avoids one-off width/height/font-size
   inline overrides scattered across Trust Center, Access Reviews,
   Reports, and People. */
.stat-icon-xs { width: 28px; height: 28px; font-size: 12px; }
.stat-icon-sm { width: 36px; height: 36px; font-size: 14px; }
.stat-icon-md { width: 40px; height: 40px; font-size: 16px; }

/* Small avatar modifier (table rows, user lists) vs. the default
   34px sidebar avatar. */
.avatar-sm { width: 28px; height: 28px; font-size: 10px; }

/* Icon + title + description + single action row - the "security
   practice" / "report download" row pattern repeated across Trust
   Center and Reports. */
.feature-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-4);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    flex-wrap: wrap;
}
.feature-row-body { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.feature-row-title { font-weight: var(--font-weight-semibold); font-size: var(--text-sm); color: var(--text-primary); }
.feature-row-desc { font-size: var(--text-sm); color: var(--text-secondary); }

/* Read-only code/embed snippet block (e.g. Trust Center's badge
   embed HTML, future API keys/webhook secrets) - always paired
   with .mono on the <code> per the design system's "data that must
   look exact" rule. */
.code-block { position: relative; background: var(--bg-tertiary); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); margin: 0; font-size: var(--text-xs); overflow-x: auto; }
.code-block-copy { position: absolute; top: var(--space-2); right: var(--space-2); }

/* Dark-mode contrast fix: .integration-badge color variants (blue/
   green/orange/red) only ever had a light-mode text color defined
   (e.g. #1e40af on blue), so in dark mode they sat on the dark
   low-opacity *-light token background with the same hard-to-read
   light-mode text color - only .purple had a dark override. Brought
   the rest in line with the same lightened-text pattern already
   used for .badge-success/.badge-warning/.badge-danger in dark mode. */
[data-theme="dark"] .integration-badge.blue { color: #aec3f7; }
[data-theme="dark"] .integration-badge.green { color: #86e0ab; }
[data-theme="dark"] .integration-badge.orange { color: #f0c674; }
[data-theme="dark"] .integration-badge.red { color: #f29a9c; }

/* Setup Wizard: the vertical "Progress X/Y" box in the page header
   actions slot - was a one-off inline-styled flex column. */
.wizard-progress-box { min-width: 220px; flex-direction: column; align-items: stretch; gap: var(--space-2); }

/* Setup Wizard: collapsible task row (replaces per-row inline
   border/display/color styling, and the Jinja-computed inline
   display:none/'' that decided which task started expanded - now a
   plain .expanded class toggled by toggleTaskRow() in the page script). */
.task-row { border-bottom: 1px solid var(--border-color); }
.task-row:last-child { border-bottom: none; }
.task-row-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4) 22px;
    cursor: pointer;
}
.task-row-status-icon { font-size: 16px; color: var(--text-muted); }
.task-row-status-icon.completed { color: var(--accent-success); }
.task-row-text { flex: 1; min-width: 0; }
.task-row-chevron { font-size: 11px; color: var(--text-muted); transition: transform var(--duration-base) var(--ease-standard); }
.task-row.expanded .task-row-chevron { transform: rotate(180deg); }
.task-row-content { display: none; padding: 0 22px var(--space-5) 54px; }
.task-row.expanded .task-row-content { display: block; }

/* Compact padding modifier for a .card used as a small grid tile inside
   a form (Setup Wizard's IDP/cloud-provider/department-owner/audit-
   schedule cards) rather than a full page-level card. */
.card-compact { padding: var(--space-4); }

/* .pagination-btn had no disabled state (used by the Audit Trail log's
   numbered pager for the first/previous and last/next edges). */
.pagination-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* "<count> / <total>" suffix inside a .stat-value (Employees overview
   cards: "3 / 12"). */
.stat-value-sub { font-size: var(--text-md); font-weight: var(--font-weight-normal); color: var(--text-secondary); }


/* ============================================================
   V2 COMPONENT LAYER  (design-system foundation, phase 1)
   ------------------------------------------------------------
   Everything below refines legacy classes and adds new ones.
   Rules: only semantic tokens, AA contrast, visible focus,
   never color alone. Documented in docs/design-system.md.
   ============================================================ */

/* ---- Extra semantic tokens (component layer) ---- */
:root {
    --font-display: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --topbar-h: 60px;
    --sidebar-w: 260px;
    --sidebar-w-collapsed: 68px;
    --control-h: 36px;
    --control-h-sm: 30px;
    --control-h-lg: 42px;
    --row-pad-y: 12px;
    --ring: 0 0 0 3px var(--focus-ring-color);
    --heat-0: #e7f1ea; --heat-1: #f3ecc9; --heat-2: #f6d9a6; --heat-3: #f0b48f; --heat-4: #dd7b73;
    --heat-ink: #1d2433;
}
[data-theme="dark"] {
    --heat-0: #1e3a2c; --heat-1: #4a4524; --heat-2: #5e4521; --heat-3: #6e3b2a; --heat-4: #86302f;
    --heat-ink: #f4f6fa;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        --heat-0: #1e3a2c; --heat-1: #4a4524; --heat-2: #5e4521; --heat-3: #6e3b2a; --heat-4: #86302f;
        --heat-ink: #f4f6fa;
    }
}

body { font-feature-settings: 'cv11', 'ss01'; }
h1 { font-size: var(--text-2xl); letter-spacing: -0.02em; }
.tabular, .stat-value, .kpi-value, td.num, th.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 8px; top: -48px; z-index: 1000; background: var(--accent-primary); color: var(--text-inverse); padding: 8px 14px; border-radius: var(--radius-md); font-weight: 600; }
.skip-link:focus { top: 8px; }

/* Global focus ring (keyboard only) */
:focus-visible { outline: 2px solid var(--accent-primary); outline-offset: 2px; border-radius: 4px; }
.sidebar :focus-visible { outline-color: #8fd3ea; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }

/* ---- App shell ---- */
.sidebar { width: var(--sidebar-w); }
.sidebar.collapsed { width: var(--sidebar-w-collapsed); }
.sidebar .nav-item { border-radius: var(--radius-md); }
.sidebar .nav-item.active { box-shadow: inset 3px 0 0 #8fd3ea; }
.nav-badge { margin-left: auto; font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--accent-danger); color: #fff; }
.logo-icon { background: linear-gradient(0deg, var(--accent-primary), var(--accent-primary)); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.18); color: #fff; }
.main-content { margin-left: var(--sidebar-w); min-width: 0; flex: 1; transition: margin-left .3s ease; }
.sidebar.collapsed ~ .main-content { margin-left: var(--sidebar-w-collapsed); }
.topbar { height: var(--topbar-h); position: sticky; top: 0; z-index: 50; backdrop-filter: saturate(1.4) blur(8px); background: color-mix(in srgb, var(--bg-secondary) 88%, transparent); border-bottom: 1px solid var(--border-color); }
.topbar-btn { position: relative; width: 36px; height: 36px; border-radius: var(--radius-md); display: inline-flex; align-items: center; justify-content: center; background: transparent; border: 1px solid transparent; color: var(--text-secondary); cursor: pointer; transition: var(--transition); }
.topbar-btn:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.topbar-right { display: flex; align-items: center; gap: 6px; }
.org-switcher { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; border: 1px solid var(--border-color); border-radius: var(--radius-md); background: var(--bg-secondary); color: var(--text-primary); cursor: pointer; font: inherit; font-size: var(--text-sm); font-weight: 500; }
.org-switcher:hover { border-color: var(--border-strong); }
.org-switcher .org-mark { width: 22px; height: 22px; border-radius: 6px; background: var(--accent-primary); color: var(--text-inverse); font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.org-switcher .org-name { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu-btn { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 6px 0 4px; border-radius: 999px; border: 1px solid transparent; background: transparent; color: var(--text-primary); cursor: pointer; font: inherit; }
.user-menu-btn:hover { background: var(--bg-tertiary); }
.user-menu-btn .avatar { width: 28px; height: 28px; font-size: 11px; }
.dropdown-panel { border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); border: 1px solid var(--border-color); background: var(--surface-raised); }
.dropdown-panel-item { display: flex; align-items: center; gap: 8px; padding: 8px 12px; color: var(--text-primary); border-radius: var(--radius-sm); font-size: var(--text-sm); }
.dropdown-panel-item:hover { background: var(--bg-tertiary); text-decoration: none; }
.dropdown-panel-item.danger { color: var(--accent-danger); }
.dropdown-panel-label { padding: 8px 12px 4px; font-size: var(--text-xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.dropdown-panel-sep { height: 1px; background: var(--border-color); margin: 6px 0; }
.page-content { padding: var(--space-6) var(--space-8) var(--space-12); max-width: 1600px; margin: 0 auto; width: 100%; }
.sidebar-scrim { display: none; }

@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); width: min(86vw, 300px); transition: transform .25s var(--ease-standard); box-shadow: var(--shadow-lg); }
    .sidebar.collapsed { width: min(86vw, 300px); }
    .sidebar.mobile-open, .sidebar.open { transform: translateX(0); }
    .main-content, .sidebar.collapsed ~ .main-content { margin-left: 0; }
    .page-content { padding: var(--space-4) var(--space-4) var(--space-10); }
    .sidebar-scrim.show { display: block; position: fixed; inset: 0; background: var(--overlay-scrim); z-index: 90; }
    .mobile-toggle { display: inline-flex; width: 36px; height: 36px; align-items: center; justify-content: center; border-radius: var(--radius-md); }
    .sidebar.collapsed .logo-text, .sidebar.collapsed .nav-section-header, .sidebar.collapsed .nav-item span, .sidebar.collapsed .user-info, .sidebar.collapsed .sidebar-search { display: revert; }
    .sidebar.collapsed .nav-item { justify-content: flex-start; padding: 8px 12px; }
    .org-switcher .org-name, .user-menu-btn .user-menu-name { display: none; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ---- Page header, breadcrumbs ---- */
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-6); }
.page-header h1 { font-size: var(--text-2xl); }
.page-header p, .page-subtitle { color: var(--text-secondary); margin-top: 4px; font-size: var(--text-base); max-width: 70ch; }
.page-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; }
.page-eyebrow { font-size: var(--text-xs); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-primary); margin-bottom: 4px; }
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: var(--text-sm); color: var(--text-secondary); min-width: 0; }
.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--text-primary); }
.breadcrumb > span:last-child:not(:only-child), .breadcrumb [aria-current] { color: var(--text-primary); font-weight: 600; }
.breadcrumbs { font-size: var(--text-sm); }
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; color: var(--text-secondary); }
.breadcrumbs li + li::before { content: '/'; margin-right: 6px; color: var(--text-muted); }
.breadcrumbs [aria-current] { color: var(--text-primary); font-weight: 600; }

/* ---- Buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--control-h); padding: 0 14px; border-radius: var(--radius-md); font: inherit; font-size: var(--text-sm); font-weight: 600; line-height: 1; cursor: pointer; border: 1px solid transparent; text-decoration: none; transition: background var(--duration-fast), border-color var(--duration-fast), box-shadow var(--duration-fast), transform var(--duration-fast); white-space: nowrap; }
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn[disabled], .btn.disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn-sm { min-height: var(--control-h-sm); padding: 0 10px; font-size: 12.5px; border-radius: var(--radius-sm); }
.btn-lg { min-height: var(--control-h-lg); padding: 0 20px; font-size: var(--text-base); }
.btn-primary { background: var(--accent-primary); color: var(--text-inverse); box-shadow: var(--shadow-xs), inset 0 1px 0 rgba(255,255,255,.14); }
.btn-primary:hover { background: var(--accent-primary-hover); color: var(--text-inverse); }
.btn-secondary { background: var(--bg-secondary); color: var(--text-primary); border-color: var(--border-strong); box-shadow: var(--shadow-xs); }
.btn-secondary:hover { background: var(--bg-tertiary); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.btn-danger { background: var(--accent-danger); color: #fff; }
.btn-danger:hover { background: var(--accent-danger-hover); color: #fff; }
.btn-danger-outline { background: transparent; color: var(--accent-danger); border-color: var(--accent-danger); }
.btn-danger-outline:hover { background: var(--accent-danger-light); }
.btn-success { background: var(--accent-success); color: #fff; }
.btn-success:hover { background: var(--accent-success-hover); color: #fff; }
.btn-icon { width: var(--control-h); padding: 0; }
.btn-icon.btn-sm { width: var(--control-h-sm); }
.btn-group { display: inline-flex; }
.btn-group > .btn { border-radius: 0; margin-left: -1px; }
.btn-group > .btn:first-child { border-radius: var(--radius-md) 0 0 var(--radius-md); margin-left: 0; }
.btn-group > .btn:last-child { border-radius: 0 var(--radius-md) var(--radius-md) 0; }

/* ---- Forms ---- */
.form-group { margin-bottom: var(--space-4); }
.form-group > label, .form-label { display: block; font-size: var(--text-sm); font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
.form-control, .form-select, .form-textarea, .form-group input[type="text"], .form-group input[type="email"], .form-group input[type="password"], .form-group input[type="number"], .form-group input[type="date"], .form-group input[type="url"], .form-group input[type="search"], .form-group select, .form-group textarea, .filter-input, .filter-select {
    width: 100%; min-height: var(--control-h); padding: 7px 12px; font: inherit; font-size: var(--text-base); color: var(--text-primary); background: var(--bg-secondary); border: 1px solid var(--border-strong); border-radius: var(--radius-md); transition: border-color var(--duration-fast), box-shadow var(--duration-fast); box-shadow: var(--shadow-xs);
}
.filter-input, .filter-select { width: auto; min-height: var(--control-h-sm); font-size: var(--text-sm); }
textarea.form-control, .form-textarea, .form-group textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.form-control::placeholder, .form-group input::placeholder, .form-group textarea::placeholder { color: var(--text-muted); }
.form-control:hover, .form-select:hover, .form-group select:hover { border-color: var(--text-muted); }
.form-control:focus, .form-select:focus, .form-textarea:focus, .form-group input:focus, .form-group select:focus, .form-group textarea:focus, .filter-input:focus, .filter-select:focus { outline: none; border-color: var(--accent-primary); box-shadow: var(--ring); }
.form-control[disabled], .form-control[readonly], .form-select[disabled] { background: var(--bg-tertiary); color: var(--text-secondary); cursor: not-allowed; }
select.form-control, .form-select, .form-group select, .filter-select { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23717a8c' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; }
input[type="file"].form-control, .form-file { padding: 5px; cursor: pointer; }
input[type="file"]::file-selector-button { margin-right: 10px; border: 1px solid var(--border-strong); background: var(--bg-tertiary); color: var(--text-primary); border-radius: var(--radius-sm); padding: 5px 12px; font: inherit; font-size: var(--text-sm); font-weight: 600; cursor: pointer; }
.is-invalid, .form-control.is-invalid { border-color: var(--accent-danger) !important; }
.is-invalid:focus { box-shadow: 0 0 0 3px var(--accent-danger-light) !important; }
.form-help { font-size: var(--text-xs); color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: var(--text-xs); color: var(--accent-danger); margin-top: 4px; display: flex; gap: 6px; align-items: center; font-weight: 500; }
.required-star { color: var(--accent-danger); }
.form-row, .form-grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.form-row > .form-group, .form-grid > .form-group { margin-bottom: 0; }
.form-grid { margin-bottom: var(--space-4); }
.form-actions { display: flex; gap: var(--space-2); justify-content: flex-end; padding-top: var(--space-4); margin-top: var(--space-4); border-top: 1px solid var(--border-color); }
.form-section-title { font-size: var(--text-md); font-weight: 600; margin: var(--space-6) 0 var(--space-3); }
.input-group { display: flex; } .input-group > .form-control { border-radius: 0; margin-left: -1px; }
.input-group > :first-child { border-radius: var(--radius-md) 0 0 var(--radius-md); margin-left: 0; } .input-group > :last-child { border-radius: 0 var(--radius-md) var(--radius-md) 0; }
.input-icon { position: relative; } .input-icon > i, .input-icon > svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; font-size: 13px; }
.input-icon > .form-control { padding-left: 34px; }
.form-check { display: flex; align-items: center; gap: 8px; font-size: var(--text-sm); cursor: pointer; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent-primary); width: 16px; height: 16px; }

/* ---- Cards ---- */
.card { background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); overflow: hidden; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: 14px var(--space-5); border-bottom: 1px solid var(--border-light); min-height: 56px; }
.card-header h3, .card-title { font-size: var(--text-md); font-weight: 600; letter-spacing: -0.01em; }
.card-subtitle { font-size: var(--text-sm); color: var(--text-muted); font-weight: 400; margin-top: 2px; }
.card-body { padding: var(--space-5); }
.card-footer { padding: 12px var(--space-5); border-top: 1px solid var(--border-light); background: var(--bg-primary); display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); font-size: var(--text-sm); }
.card-interactive { transition: var(--transition); cursor: pointer; } .card-interactive:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.card + .card { margin-top: 0; }
.stack { display: flex; flex-direction: column; gap: var(--space-5); }
.cluster { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }

/* ---- KPI tiles ---- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: var(--space-4); margin-bottom: var(--space-6); }
.kpi { background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: var(--space-4) var(--space-5); box-shadow: var(--shadow-xs); display: flex; flex-direction: column; gap: 6px; position: relative; min-width: 0; }
.kpi-label { font-size: var(--text-sm); font-weight: 500; color: var(--text-secondary); display: flex; align-items: center; gap: 8px; }
.kpi-label i { color: var(--text-muted); font-size: 13px; }
.kpi-value { font-size: 2rem; line-height: 1.1; font-weight: 700; letter-spacing: -0.03em; color: var(--text-primary); }
.kpi-value small { font-size: var(--text-base); color: var(--text-muted); font-weight: 500; margin-left: 2px; letter-spacing: 0; }
.kpi-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: var(--text-xs); color: var(--text-muted); min-height: 20px; }
.delta { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; font-size: var(--text-xs); padding: 1px 7px; border-radius: 999px; }
.delta.good { background: var(--accent-success-light); color: var(--green-700); }
.delta.bad { background: var(--accent-danger-light); color: var(--red-700); }
.delta.flat { background: var(--bg-tertiary); color: var(--text-secondary); }
[data-theme="dark"] .delta.good { color: #86e0ab; } [data-theme="dark"] .delta.bad { color: #f29a9c; }
a.kpi { color: inherit; text-decoration: none; transition: var(--transition); } a.kpi:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.kpi-accent-danger::before, .kpi-accent-warning::before, .kpi-accent-success::before, .kpi-accent-primary::before { content: ''; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0; }
.kpi-accent-danger::before { background: var(--accent-danger); } .kpi-accent-warning::before { background: var(--accent-warning); } .kpi-accent-success::before { background: var(--accent-success); } .kpi-accent-primary::before { background: var(--accent-primary); }
/* legacy stat-card aligned with kpi */
.stat-card { border-radius: var(--radius-lg); padding: var(--space-4) var(--space-5); box-shadow: var(--shadow-xs); }
.stat-card:hover { transform: none; }
.stat-value { font-size: 1.75rem; letter-spacing: -0.02em; }
.stat-label { text-transform: none; letter-spacing: 0; font-size: var(--text-sm); }

/* ---- Tables ---- */
.table-container { overflow-x: auto; max-width: 100%; }
.table-scroll { max-height: 520px; overflow: auto; }
table { font-variant-numeric: tabular-nums; }
thead th { background: var(--bg-primary); color: var(--text-secondary); font-size: var(--text-xs); letter-spacing: .05em; padding: 10px 16px; border-bottom: 1px solid var(--border-color); position: relative; }
thead th:first-child, thead th:last-child { border-radius: 0; }
tbody td { padding: var(--row-pad-y) 16px; font-size: var(--text-base); }
tbody tr { transition: background var(--duration-fast); }
tbody tr:hover { background: color-mix(in srgb, var(--accent-primary) 5%, var(--bg-secondary)); }
.table-sticky thead th, .table-scroll thead th { position: sticky; top: 0; z-index: 2; box-shadow: 0 1px 0 var(--border-color); }
.table-zebra tbody tr:nth-child(even) { background: var(--bg-primary); }
.table-compact tbody td { padding: 7px 12px; font-size: var(--text-sm); } .table-compact thead th { padding: 8px 12px; }
.table-sortable th[data-sort], th.sortable { cursor: pointer; user-select: none; }
.table-sortable th[data-sort]::after, th.sortable::after { content: '\2195'; margin-left: 6px; opacity: .35; font-size: 11px; }
th[aria-sort="ascending"]::after { content: '\2191' !important; opacity: 1 !important; color: var(--accent-primary); }
th[aria-sort="descending"]::after { content: '\2193' !important; opacity: 1 !important; color: var(--accent-primary); }
td.num, th.num { text-align: right; }
td.actions, th.actions { text-align: right; width: 1%; white-space: nowrap; }
.cell-title { font-weight: 600; color: var(--text-primary); } .cell-sub { font-size: var(--text-xs); color: var(--text-muted); }
tr[onclick], tr.is-link { cursor: pointer; }

/* ---- Pills / badges (status) ---- */
.badge, .pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.5; white-space: nowrap; border: 1px solid transparent; }
.pill i, .pill svg { font-size: 10px; }
.pill::before { content: none; }
.pill-dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-success, .badge-pass, .pill-success, .pill-passing, .pill-approved, .pill-published, .pill-active, .pill-completed, .pill-compliant { background: var(--accent-success-light); color: var(--green-700); border-color: color-mix(in srgb, var(--green-600) 22%, transparent); }
.badge-danger, .badge-fail, .pill-danger, .pill-failing, .pill-rejected, .pill-overdue, .pill-critical { background: var(--accent-danger-light); color: var(--red-700); border-color: color-mix(in srgb, var(--red-600) 22%, transparent); }
.badge-warning, .badge-review, .pill-warning, .pill-pending, .pill-not-assessed, .pill-in-review, .pill-at-risk { background: var(--accent-warning-light); color: var(--amber-900); border-color: color-mix(in srgb, var(--amber-600) 28%, transparent); }
.badge-info, .pill-info { background: var(--accent-info-light); color: var(--violet-700); border-color: color-mix(in srgb, var(--violet-600) 22%, transparent); }
.badge-primary, .pill-primary, .pill-in-progress { background: var(--accent-primary-light); color: var(--blue-700); border-color: color-mix(in srgb, var(--blue-600) 22%, transparent); }
.badge-neutral, .pill-neutral, .pill-draft, .pill-archived, .pill-na { background: var(--bg-tertiary); color: var(--text-secondary); border-color: var(--border-color); }
[data-theme="dark"] .pill-success, [data-theme="dark"] .pill-passing, [data-theme="dark"] .pill-approved, [data-theme="dark"] .pill-published, [data-theme="dark"] .pill-active, [data-theme="dark"] .pill-completed, [data-theme="dark"] .pill-compliant { color: #86e0ab; }
[data-theme="dark"] .pill-danger, [data-theme="dark"] .pill-failing, [data-theme="dark"] .pill-rejected, [data-theme="dark"] .pill-overdue, [data-theme="dark"] .pill-critical { color: #f29a9c; }
[data-theme="dark"] .pill-warning, [data-theme="dark"] .pill-pending, [data-theme="dark"] .pill-not-assessed, [data-theme="dark"] .pill-in-review, [data-theme="dark"] .pill-at-risk { color: #f0c674; }
[data-theme="dark"] .pill-info { color: #c3b8f5; }
[data-theme="dark"] .pill-primary, [data-theme="dark"] .pill-in-progress { color: #9fd6ea; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) .pill-success, :root:not([data-theme]) .pill-passing, :root:not([data-theme]) .pill-approved, :root:not([data-theme]) .pill-published { color: #86e0ab; }
    :root:not([data-theme]) .pill-danger, :root:not([data-theme]) .pill-failing, :root:not([data-theme]) .pill-rejected { color: #f29a9c; }
    :root:not([data-theme]) .pill-warning, :root:not([data-theme]) .pill-pending, :root:not([data-theme]) .pill-not-assessed { color: #f0c674; }
    :root:not([data-theme]) .pill-primary { color: #9fd6ea; }
}
.tag, .chip { border-radius: var(--radius-sm); }
.code, code.inline { font-family: var(--font-mono); font-size: .85em; background: var(--bg-tertiary); padding: 1px 6px; border-radius: 4px; }

/* ---- Tabs ---- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border-color); margin-bottom: var(--space-5); overflow-x: auto; scrollbar-width: none; }
.tab { padding: 10px 14px; font-size: var(--text-sm); font-weight: 600; color: var(--text-secondary); background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; font-family: inherit; transition: color var(--duration-fast); display: inline-flex; gap: 8px; align-items: center; }
.tab:hover { color: var(--text-primary); text-decoration: none; }
.tab.active, .tab[aria-selected="true"] { color: var(--accent-primary); border-bottom-color: var(--accent-primary); }
.tab .count { font-size: 11px; background: var(--bg-tertiary); color: var(--text-secondary); padding: 0 7px; border-radius: 999px; }
.tab-panel[hidden] { display: none; }
.segmented { display: inline-flex; background: var(--bg-tertiary); padding: 3px; border-radius: var(--radius-md); gap: 2px; }
.segmented button { border: none; background: transparent; padding: 5px 12px; border-radius: 6px; font: inherit; font-size: var(--text-sm); font-weight: 600; color: var(--text-secondary); cursor: pointer; }
.segmented button[aria-pressed="true"], .segmented button.active { background: var(--bg-secondary); color: var(--text-primary); box-shadow: var(--shadow-sm); }

/* ---- Modals ---- */
.modal-overlay { backdrop-filter: blur(3px); }
.modal { border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); border: 1px solid var(--border-color); background: var(--surface-raised); }
.modal-header { padding: 18px 22px; border-bottom: 1px solid var(--border-light); } .modal-body { padding: 20px 22px; } .modal-footer { padding: 14px 22px; border-top: 1px solid var(--border-light); display: flex; gap: 8px; justify-content: flex-end; }
.confirm-icon { width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--accent-danger-light); color: var(--accent-danger); flex-shrink: 0; }
.confirm-icon.neutral { background: var(--accent-primary-light); color: var(--accent-primary); }
.confirm-body { display: flex; gap: 14px; align-items: flex-start; } .confirm-body p { color: var(--text-secondary); margin-top: 4px; }

/* ---- Toasts ---- */
.toast-container { position: fixed; right: 16px; bottom: 16px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; background: var(--surface-inverse); color: #f4f6fa; padding: 12px 14px; border-radius: var(--radius-md); box-shadow: var(--shadow-lg); font-size: var(--text-sm); border-left: 4px solid var(--accent-primary); animation: toast-in .2s var(--ease-out); }
.toast.success { border-left-color: var(--accent-success); } .toast.error { border-left-color: var(--accent-danger); } .toast.warning { border-left-color: var(--accent-warning); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---- Tooltip (CSS only; add tabindex=0 for non-focusable hosts) ---- */
[data-tooltip] { position: relative; }
[data-tooltip]::after { content: attr(data-tooltip); position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%) translateY(2px); background: var(--surface-inverse); color: #f4f6fa; padding: 5px 9px; border-radius: 6px; font-size: 12px; font-weight: 500; white-space: nowrap; max-width: 260px; pointer-events: none; opacity: 0; transition: opacity .12s, transform .12s; z-index: 300; box-shadow: var(--shadow-md); }
[data-tooltip]:hover::after, [data-tooltip]:focus-visible::after { opacity: 1; transform: translateX(-50%); }
[data-tooltip-pos="bottom"]::after { bottom: auto; top: calc(100% + 6px); }

/* ---- Progress ---- */
.progress { height: 8px; background: var(--bg-tertiary); border-radius: 999px; overflow: hidden; }
.progress-bar { height: 8px; background: var(--bg-tertiary); border-radius: 999px; overflow: hidden; }
.progress > span, .progress-fill { display: block; height: 100%; border-radius: 999px; background: var(--accent-primary); transition: width .4s var(--ease-standard); }
.progress-fill.green, .progress.is-success > span { background: var(--accent-success); } .progress-fill.red, .progress.is-danger > span { background: var(--accent-danger); } .progress-fill.orange, .progress.is-warning > span { background: var(--accent-warning); } .progress-fill.blue { background: var(--accent-primary); }
.progress-stacked { display: flex; height: 8px; gap: 2px; background: transparent; border-radius: 999px; overflow: hidden; }
.progress-stacked .segment { height: 100%; min-width: 0; border-radius: 2px; }
.progress-stacked .segment.empty { background: var(--bg-tertiary); }
.progress-label { display: flex; gap: 14px; margin-top: 6px; font-size: var(--text-xs); color: var(--text-muted); }

/* ---- Alerts / banners ---- */
.alert, .flash-message, .info-banner { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-md); border: 1px solid var(--border-color); border-left-width: 4px; font-size: var(--text-sm); background: var(--bg-secondary); margin-bottom: var(--space-4); }
.alert > i, .flash-message > i { margin-top: 2px; }
.alert-title { font-weight: 600; }
.alert-info, .flash-info, .info-banner-info { background: var(--accent-primary-light); border-color: color-mix(in srgb, var(--accent-primary) 40%, transparent); border-left-color: var(--accent-primary); color: var(--text-primary); }
.alert-success, .flash-success, .info-banner-success { background: var(--accent-success-light); border-color: color-mix(in srgb, var(--accent-success) 35%, transparent); border-left-color: var(--accent-success); color: var(--text-primary); }
.alert-warning, .info-banner-warning { background: var(--accent-warning-light); border-color: color-mix(in srgb, var(--accent-warning) 40%, transparent); border-left-color: var(--accent-warning); color: var(--text-primary); }
.alert-danger, .alert-error, .flash-error { background: var(--accent-danger-light); border-color: color-mix(in srgb, var(--accent-danger) 35%, transparent); border-left-color: var(--accent-danger); color: var(--text-primary); }
.alert-info > i, .flash-info > i { color: var(--accent-primary); } .alert-success > i, .flash-success > i { color: var(--accent-success); } .alert-warning > i { color: var(--accent-warning); } .alert-danger > i, .flash-error > i { color: var(--accent-danger); }

/* ---- Filter bar / pagination ---- */
.filter-bar, .toolbar { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; padding: 10px var(--space-4); background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: var(--radius-lg); margin-bottom: var(--space-4); }
.filter-bar .spacer, .toolbar .spacer { flex: 1; }
.filter-bar .search-input-wrapper, .filter-search { position: relative; flex: 1 1 220px; max-width: 360px; }
.filter-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: var(--accent-primary-light); color: var(--accent-primary); font-size: 12px; font-weight: 600; border: none; cursor: pointer; }
.pagination { display: flex; align-items: center; gap: 4px; justify-content: space-between; padding: 12px var(--space-4); font-size: var(--text-sm); color: var(--text-secondary); flex-wrap: wrap; }
.pagination-btn { min-width: 32px; height: 32px; padding: 0 8px; border-radius: var(--radius-sm); border: 1px solid var(--border-color); background: var(--bg-secondary); color: var(--text-primary); font: inherit; font-size: var(--text-sm); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.pagination-btn:hover { background: var(--bg-tertiary); text-decoration: none; }
.pagination-btn.active, .pagination-btn[aria-current="page"] { background: var(--accent-primary); border-color: var(--accent-primary); color: var(--text-inverse); }
.pagination-btn[disabled] { opacity: .45; pointer-events: none; }

/* ---- Empty / skeleton ---- */
.empty-state { text-align: center; padding: var(--space-10) var(--space-5); color: var(--text-secondary); }
.empty-state-icon { width: 52px; height: 52px; margin: 0 auto var(--space-3); display: flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--bg-tertiary); color: var(--text-muted); font-size: 20px; }
.empty-state h3 { font-size: var(--text-md); color: var(--text-primary); margin-bottom: 4px; } .empty-state p { max-width: 46ch; margin: 0 auto var(--space-4); font-size: var(--text-sm); }
.skeleton, .skeleton-block, .skeleton-text, .skeleton-title { background: linear-gradient(90deg, var(--bg-tertiary) 25%, color-mix(in srgb, var(--bg-tertiary) 55%, var(--bg-secondary)) 50%, var(--bg-tertiary) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite linear; border-radius: var(--radius-sm); }
.skeleton-text { height: 12px; margin: 8px 0; } .skeleton-title { height: 20px; width: 40%; } .skeleton-block { height: 80px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---- Lists / avatars ---- */
.list-rows { list-style: none; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px var(--space-5); border-bottom: 1px solid var(--border-light); }
.list-row:last-child { border-bottom: none; }
.list-row-icon { width: 34px; height: 34px; border-radius: var(--radius-md); background: var(--bg-tertiary); color: var(--text-secondary); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 14px; }
.list-row-main { flex: 1; min-width: 0; } .list-row-title { font-size: var(--text-base); font-weight: 500; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; } .list-row-sub { font-size: var(--text-xs); color: var(--text-muted); }
.avatar { background: var(--accent-primary); color: var(--text-inverse); border-radius: 50%; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.activity-row { padding: 12px var(--space-5); border-bottom: 1px solid var(--border-light); display: flex; gap: 12px; }
.activity-row:last-child { border-bottom: none; }
.activity-row-icon { width: 30px; height: 30px; border-radius: 50%; background: var(--bg-tertiary); color: var(--text-secondary); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 12px; }
.activity-row-text { font-size: var(--text-sm); }

/* ---- Charts: ring, trend, heatmap (dashboard) ---- */
.chart-figure { position: relative; }
.ring { position: relative; width: 168px; height: 168px; flex-shrink: 0; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track { stroke: var(--bg-tertiary); }
.ring-seg { transition: stroke-dasharray .5s var(--ease-standard); }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-value { font-size: 2.1rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.ring-label { font-size: var(--text-xs); color: var(--text-muted); margin-top: 4px; text-transform: uppercase; letter-spacing: .08em; }
.legend-list { display: grid; gap: 6px; list-style: none; font-size: var(--text-sm); min-width: 170px; }
.legend-list li { display: flex; align-items: center; gap: 8px; }
.legend-list .swatch { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.legend-list .count { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; }
.trend-chart { width: 100%; height: 220px; display: block; overflow: visible; }
.trend-chart .grid line { stroke: var(--border-light); stroke-width: 1; }
.trend-chart text { fill: var(--text-muted); font-size: 11px; font-family: var(--font-sans); }
.trend-chart .line { fill: none; stroke: var(--accent-primary); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.trend-chart .area { fill: var(--accent-primary); opacity: .1; }
.trend-chart .dot { fill: var(--bg-secondary); stroke: var(--accent-primary); stroke-width: 2; }
.trend-chart .cross { stroke: var(--border-strong); stroke-dasharray: 3 3; }
.chart-tip { position: absolute; pointer-events: none; background: var(--surface-inverse); color: #f4f6fa; font-size: 12px; padding: 6px 10px; border-radius: 6px; box-shadow: var(--shadow-md); transform: translate(-50%, -110%); white-space: nowrap; z-index: 5; }
.heatmap { display: grid; grid-template-columns: 74px repeat(5, 1fr); gap: 2px; font-size: 12px; }
.heatmap .hm-head { color: var(--text-muted); font-size: 11px; display: flex; align-items: center; justify-content: center; text-align: center; padding: 2px; }
.heatmap .hm-row { justify-content: flex-end; padding-right: 8px; }
.hm-cell { aspect-ratio: 1.35; min-height: 34px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; color: var(--heat-ink); font-variant-numeric: tabular-nums; position: relative; }
.hm-cell.l0 { background: var(--heat-0); } .hm-cell.l1 { background: var(--heat-1); } .hm-cell.l2 { background: var(--heat-2); } .hm-cell.l3 { background: var(--heat-3); } .hm-cell.l4 { background: var(--heat-4); }
.hm-cell.zero { color: var(--text-muted); font-weight: 500; }
.hm-axis { font-size: 11px; color: var(--text-muted); text-align: center; margin-top: 8px; }
.hm-legend { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-muted); margin-top: 10px; }
.hm-legend i { width: 18px; height: 10px; border-radius: 3px; display: inline-block; }
.deadline { display: flex; align-items: center; gap: 12px; padding: 11px var(--space-5); border-bottom: 1px solid var(--border-light); }
.deadline:last-child { border-bottom: none; }
.deadline-date { width: 44px; text-align: center; border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 3px 0; flex-shrink: 0; background: var(--bg-primary); }
.deadline-date b { display: block; font-size: 16px; line-height: 1.1; } .deadline-date span { font-size: 10px; text-transform: uppercase; color: var(--text-muted); letter-spacing: .06em; }
.fw-row { padding: 12px 0; border-bottom: 1px solid var(--border-light); } .fw-row:last-child { border-bottom: none; } .fw-row:first-child { padding-top: 0; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: var(--space-4); margin-bottom: var(--space-4); }
.dash-grid.even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1100px) { .dash-grid, .dash-grid.even { grid-template-columns: 1fr; } }

/* ---- Auth (login) ---- */
.auth { min-height: 100vh; width: 100%; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: var(--bg-primary); }
.auth-aside { background: #0d1a2b; color: #e8eef7; padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-aside::before { content: ''; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px); background-size: 44px 44px; mask-image: radial-gradient(ellipse at 30% 40%, #000, transparent 75%); -webkit-mask-image: radial-gradient(ellipse at 30% 40%, #000, transparent 75%); }
.auth-aside > * { position: relative; }
.auth-brand { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 1.35rem; letter-spacing: -0.02em; }
.auth-brand .mark { width: 38px; height: 38px; border-radius: 10px; background: #12789b; display: inline-flex; align-items: center; justify-content: center; color: #fff; }
.auth-aside h2 { font-size: clamp(1.7rem, 2.6vw, 2.4rem); line-height: 1.15; letter-spacing: -0.03em; max-width: 16ch; margin-bottom: 16px; }
.auth-aside p { color: #b4c0d2; max-width: 44ch; }
.auth-points { list-style: none; display: grid; gap: 14px; margin-top: 28px; font-size: var(--text-base); }
.auth-points li { display: flex; gap: 12px; align-items: flex-start; color: #d5deec; } .auth-points i { color: #6fd0a4; margin-top: 3px; }
.auth-fine { font-size: 12px; color: #8fa0b8; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 32px 24px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 1.6rem; letter-spacing: -0.03em; }
.auth-card .lead { color: var(--text-secondary); margin: 6px 0 28px; }
.auth-theme { position: fixed; top: 14px; right: 14px; }
@media (max-width: 900px) { .auth { grid-template-columns: 1fr; } .auth-aside { display: none; } }

/* ---- Utilities ---- */
.text-xs { font-size: var(--text-xs); } .text-success { color: var(--accent-success); } .text-danger { color: var(--accent-danger); } .text-warning { color: var(--accent-warning); } .text-primary-c { color: var(--accent-primary); }
.mb-0 { margin-bottom: 0; } .mb-4 { margin-bottom: 4px; } .mb-32 { margin-bottom: 32px; } .mt-8 { margin-top: 8px; } .mt-24 { margin-top: 24px; } .gap-4 { gap: 4px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.divider { height: 1px; background: var(--border-color); margin: var(--space-4) 0; }
.styleguide-swatch { height: 44px; border-radius: 8px; border: 1px solid var(--border-color); }

@media print { .sidebar, .topbar, .toast-container, .page-actions, .auth-theme { display: none !important; } .main-content { margin: 0; } body { background: #fff; } }
