/* ==========================================================================
   bluCompliance v3.0 — Design System
   UI font  : IBM Plex Sans (body, nav, forms, tables, buttons)
   Display  : Sora (page h1, dashboard hero values, brand name)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=Sora:wght@600;700&family=JetBrains+Mono:wght@400;500;700&display=swap');

/* ==========================================================================
   Design tokens
   ========================================================================== */

:root {
    /* Brand — aligned to bluRisk #1565d8 */
    --brand-primary:       #1565d8;
    --brand-primary-dark:  #0d4abf;
    --brand-primary-light: #4a8ef0;
    --brand-accent:        #1565d8;
    --brand-accent-glow:   rgba(21,101,216,.12);
    --brand-secondary:     #0f172a;

    /* Surfaces — light mode */
    --bg-app:          #f4f7fb;
    --bg-surface:      #ffffff;
    --bg-surface-alt:  #f8fafc;
    --bg-elevated:     #ffffff;
    --bg-hover:        #eef4ff;          /* blue-tinted hover, matches risk */
    --bg-sidebar:      #ffffff;
    --bg-sidebar-active: #eef4ff;

    /* Borders — blue-tinted to match risk app */
    --border-light:  #d7e2f1;
    --border-medium: #c4d4ea;
    --border-strong: #a8c0da;

    /* Text */
    --text-primary:   #0f172a;
    --text-secondary: #475569;
    --text-tertiary:  #64748b;
    --text-muted:     #94a3b8;
    --text-inverse:   #ffffff;

    /* Status */
    --status-success:    #059669;
    --status-success-bg: #d1fae5;
    --status-warning:    #d97706;
    --status-warning-bg: #fef3c7;
    --status-danger:     #dc2626;
    --status-danger-bg:  #fee2e2;
    --status-info:       #2563eb;
    --status-info-bg:    #dbeafe;
    --status-neutral:    #64748b;
    --status-neutral-bg: #f1f5f9;

    /* Risk */
    --risk-critical:    #dc2626;
    --risk-critical-bg: #fee2e2;
    --risk-high:        #ea580c;
    --risk-high-bg:     #ffedd5;
    --risk-medium:      #d97706;
    --risk-medium-bg:   #fef3c7;
    --risk-low:         #059669;
    --risk-low-bg:      #d1fae5;
    --risk-info:        #2563eb;
    --risk-info-bg:     #dbeafe;

    /* Layout */
    --sidebar-width:  252px;
    --topbar-height:  60px;

    /* Shadows — flatter, more modern */
    --shadow-sm:   0 1px 2px rgba(15,23,42,.05);
    --shadow-md:   0 2px 6px rgba(15,23,42,.07);
    --shadow-lg:   0 6px 20px rgba(15,23,42,.08);
    --shadow-card: 0 1px 3px rgba(15,23,42,.06);

    /* Radii */
    --radius-sm: 5px;
    --radius-md: 7px;
    --radius-lg: 10px;
    --radius-xl: 14px;

    /* Typography */
    --font-ui:      'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-display: 'Sora', 'IBM Plex Sans', -apple-system, sans-serif;
    --font-mono:    'JetBrains Mono', 'Fira Code', monospace;
    --font-family:  var(--font-ui); /* legacy compat alias */

    /* Transition */
    --transition: 160ms ease;
}

/* ==========================================================================
   Dark mode
   ========================================================================== */

[data-theme="dark"] {
    --bg-app:          #0b0f1a;
    --bg-surface:      #111827;
    --bg-surface-alt:  #0d1525;
    --bg-elevated:     #1f2937;
    --bg-hover:        #1a2235;
    --bg-sidebar:      #111827;
    --bg-sidebar-active: #1a2235;

    --border-light:  #1e2d45;
    --border-medium: #243350;
    --border-strong: #2e4060;

    --brand-primary:       #4a8ef0;
    --brand-primary-dark:  #2f74db;
    --brand-accent-glow:   rgba(74,142,240,.12);

    --text-primary:   #e2e8f0;
    --text-secondary: #94a3b8;
    --text-tertiary:  #6b7f9a;
    --text-muted:     #4a6080;
}

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

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 14px; -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font-ui);
    background: var(--bg-app);
    color: var(--text-primary);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Headings — IBM Plex Sans by default */
h1, h2, h3, h4, h5, h6 {
    margin: 0 0 .5rem;
    font-family: var(--font-ui);
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}
h1 { font-size: 1.45rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
h4 { font-size: .95rem; }
p  { margin: 0 0 .75rem; }

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

/* ==========================================================================
   Display font — Sora applied only where impactful
   ========================================================================== */

/* Major page titles */
.page-header h1 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -.025em;
}

/* Dashboard hero numbers — JetBrains Mono for precision, matches risk app */
.stat-card .stat-value {
    font-family: var(--font-mono);
}

/* Donut centre number */
.donut-center .num {
    font-family: var(--font-mono);
}

/* Login brand heading */
.login-brand h1 {
    font-family: var(--font-display);
}

/* Sidebar brand logotype */
.sidebar-brand .brand-name {
    font-family: var(--font-display);
}

/* ==========================================================================
   Layout shell
   ========================================================================== */

.app-shell { display: flex; min-height: 100vh; }

/* ----- Sidebar ----- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-light);
    border-top: 3px solid var(--brand-primary);   /* risk app signature accent bar */
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 0 14px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: .65rem;
    height: var(--topbar-height);
    min-height: var(--topbar-height);
    flex-shrink: 0;
}
.sidebar-brand .logo-mark     { width: 32px; height: 32px; flex-shrink: 0; }
.sidebar-brand .brand-text    { line-height: 1.2; }
.sidebar-brand .brand-name    { font-size: 1.05rem; font-weight: 700; color: var(--text-primary); letter-spacing: -.02em; }
.sidebar-brand .brand-name .blu { color: var(--brand-primary); }
.sidebar-brand .brand-tagline { font-size: .68rem; color: var(--text-muted); font-weight: 400; }

.sidebar-nav { padding: .75rem 0; flex: 1; }

.nav-section-title {
    padding: .9rem 1.1rem .2rem;
    font-size: .67rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-muted);
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: 8px 10px;
    margin: 0 8px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: .855rem;
    font-weight: 400;
    border-left: none;                             /* risk app uses pill highlight, not left bar */
    transition: all var(--transition);
    text-decoration: none;
}
.sidebar-nav a:hover { background: var(--bg-hover); color: var(--text-primary); text-decoration: none; }
.sidebar-nav a.active {
    background: var(--brand-accent-glow);          /* risk app: subtle blue glow */
    color: var(--brand-primary);
    font-weight: 600;
    border-left: none;
}
.sidebar-nav a svg, .sidebar-nav a .icon { width: 17px; height: 17px; flex-shrink: 0; opacity: .75; }
.sidebar-nav a.active svg, .sidebar-nav a.active .icon { opacity: 1; }

/* ----- Topbar ----- */
.topbar {
    height: var(--topbar-height);
    background: var(--bg-surface);
    border-top: 3px solid var(--brand-primary);    /* risk app signature accent bar */
    border-bottom: 1px solid var(--border-light);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}
.topbar-title  { font-size: .95rem; font-weight: 600; color: var(--text-primary); }
.topbar-actions{ display: flex; align-items: center; gap: .85rem; }

.user-menu {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .3rem .65rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background .12s;
}
.user-menu:hover { background: var(--bg-hover); }

.user-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: .82rem;
    flex-shrink: 0;
}
.user-info           { line-height: 1.2; }
.user-info .user-name{ font-size: .82rem; font-weight: 600; color: var(--text-primary); }
.user-info .user-role{ font-size: .7rem; color: var(--text-muted); }

/* ----- Main content ----- */
.main-content { margin-left: var(--sidebar-width); flex: 1; min-width: 0; }
.page-content { padding: 1.4rem 1.5rem; max-width: 100%; }

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.4rem;
}
.page-header h1       { margin: 0; }
.page-header .page-subtitle { color: var(--text-tertiary); font-size: .875rem; margin-top: .2rem; }
.page-header-actions  { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* ==========================================================================
   Cards
   ========================================================================== */

.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}
.card-header {
    padding: .85rem 1.25rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
    background: var(--bg-surface);
}
.card-header h3     { margin: 0; font-size: .95rem; font-weight: 600; color: var(--text-primary); }
.card-body          { padding: 1.25rem; }
.card-body.no-padding { padding: 0; }
.card-footer {
    padding: .7rem 1.25rem;
    border-top: 1px solid var(--border-light);
    background: var(--bg-surface-alt);
}

/* ==========================================================================
   Stat cards (dashboard)
   ========================================================================== */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.4rem;
}
.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 18px;
    position: relative;
    overflow: hidden;
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

/* Coloured top accent bar — signature risk app stat card treatment */
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--brand-primary);
}
.stat-card.success::before { background: var(--status-success); }
.stat-card.warning::before { background: var(--status-warning); }
.stat-card.danger::before  { background: var(--status-danger);  }
.stat-card.info::before    { background: var(--status-info);    }

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 18px rgba(0,0,0,.09);
    border-color: var(--border-medium);
}

.stat-card .stat-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .7px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0;
}
/* JetBrains Mono for dashboard numbers — matches risk app */
.stat-card .stat-value {
    font-family: var(--font-mono);
    font-size: 30px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin: 8px 0 4px;
    letter-spacing: -.03em;
}
.stat-card .stat-meta {
    margin-top: 0;
    font-size: 12px;
    color: var(--text-muted);
}
/* Ghost icon — very subtle, matches risk app */
.stat-card .stat-icon {
    position: absolute;
    right: 14px; top: 50%;
    transform: translateY(-50%);
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    background: none; border-radius: 0;
    opacity: .08;
    color: var(--text-primary);
}
.stat-card.success .stat-icon { opacity: .2; color: var(--status-success); }
.stat-card.warning .stat-icon { opacity: .2; color: var(--status-warning); }
.stat-card.danger  .stat-icon { opacity: .2; color: var(--status-danger);  }
.stat-card.info    .stat-icon { opacity: .2; color: var(--status-info);    }

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .38rem;
    padding: .5rem .95rem;
    font-family: var(--font-ui);
    font-size: .84rem;
    font-weight: 500;
    line-height: 1.4;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background .12s, border-color .12s, color .12s, box-shadow .12s;
    text-decoration: none;
    white-space: nowrap;
    background: none;
    color: inherit;
    letter-spacing: 0;
}
.btn:hover         { text-decoration: none; }
.btn:disabled, .btn.disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn-sm  { padding: .3rem .65rem; font-size: .77rem; }
.btn-lg  { padding: .65rem 1.3rem; font-size: .92rem; }

.btn-primary {
    background: var(--brand-primary);
    color: #fff;
    border-color: var(--brand-primary);
}
.btn-primary:hover { background: var(--brand-primary-dark); border-color: var(--brand-primary-dark); color: #fff; }

.btn-secondary {
    background: var(--bg-surface);
    color: var(--text-secondary);
    border-color: var(--border-medium);
}
.btn-secondary:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-strong); }

.btn-success { background: var(--status-success); color: #fff; border-color: var(--status-success); }
.btn-success:hover { background: #047857; color: #fff; }

.btn-danger  { background: var(--status-danger); color: #fff; border-color: var(--status-danger); }
.btn-danger:hover  { background: #b91c1c; color: #fff; }

.btn-warning { background: var(--status-warning); color: #fff; border-color: var(--status-warning); }
.btn-warning:hover { background: #b45309; color: #fff; }

.btn-ghost { color: var(--text-secondary); background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-icon { padding: .42rem; width: 32px; height: 32px; flex-shrink: 0; }

/* Bare link button — used in table action columns */
.btn-link {
    background: none;
    border: 0;
    padding: 0;
    color: var(--brand-primary);
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    text-decoration: none;
    display: inline;
    font-weight: 400;
}
.btn-link:hover { text-decoration: underline; color: var(--brand-primary-dark); }

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

.form-group { margin-bottom: 1rem; }
.form-row   { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }

.form-label {
    display: block;
    font-size: .8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: .3rem;
    letter-spacing: .01em;
}
.form-label.required::after { content: ' *'; color: var(--status-danger); }

.form-control,
.form-select,
textarea.form-control {
    display: block;
    width: 100%;
    padding: .5rem .75rem;
    font-family: var(--font-ui);
    font-size: .875rem;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-surface);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    transition: border-color .12s, box-shadow .12s;
    appearance: none;
    -webkit-appearance: none;
}
.form-control:focus,
.form-select:focus,
textarea.form-control:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px var(--brand-accent-glow);
}
.form-control:disabled,
.form-select:disabled { background: var(--bg-surface-alt); color: var(--text-tertiary); cursor: not-allowed; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-help { font-size: .75rem; color: var(--text-muted); margin-top: .28rem; }

.form-check { display: flex; align-items: center; gap: .45rem; margin-bottom: .45rem; }
.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    width: 15px; height: 15px;
    accent-color: var(--brand-primary);
    flex-shrink: 0;
}

/* ==========================================================================
   Tables
   ========================================================================== */

.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    background: var(--bg-surface);
}
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: .845rem;
}
.table th {
    background: var(--bg-surface-alt);
    padding: .6rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .045em;
    color: var(--text-tertiary);
    border-bottom: 1px solid var(--border-light);
    white-space: nowrap;
}
.table td {
    padding: .7rem 1rem;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
    color: var(--text-primary);
}
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--bg-hover); }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions a   { margin-left: .5rem; color: var(--text-tertiary); font-size: .84rem; }
.table .actions a:hover { color: var(--brand-primary); text-decoration: none; }
.table .actions form { display: inline; margin-left: .4rem; }

/* ==========================================================================
   Badges
   ========================================================================== */

.badge {
    display: inline-flex;
    align-items: center;
    padding: .15rem .52rem;
    font-size: .7rem;
    font-weight: 600;
    line-height: 1.4;
    border-radius: 999px;
    text-transform: capitalize;
    white-space: nowrap;
    letter-spacing: .01em;
}

.badge-success    { background: var(--status-success-bg); color: var(--status-success); }
.badge-warning    { background: var(--status-warning-bg); color: #92400e; }
.badge-danger     { background: var(--status-danger-bg);  color: var(--status-danger);  }
.badge-info       { background: var(--status-info-bg);    color: var(--status-info);    }
.badge-neutral    { background: var(--status-neutral-bg); color: var(--status-neutral); }

.badge-critical   { background: var(--risk-critical-bg); color: var(--risk-critical); }
.badge-high       { background: var(--risk-high-bg);     color: var(--risk-high);     }
.badge-mediumhigh { background: #fed7aa;                 color: #9a3412;              }
.badge-medium     { background: var(--risk-medium-bg);   color: #92400e;              }
.badge-low        { background: var(--risk-low-bg);      color: var(--risk-low);      }

/* ==========================================================================
   Alerts
   ========================================================================== */

.alert {
    padding: .7rem 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    font-size: .87rem;
    border: 1px solid;
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    line-height: 1.5;
}
.alert-success { background: var(--status-success-bg); border-color: #6ee7b7; color: #064e3b; }
.alert-warning { background: var(--status-warning-bg); border-color: #fcd34d; color: #78350f; }
.alert-danger  { background: var(--status-danger-bg);  border-color: #fca5a5; color: #7f1d1d; }
.alert-info    { background: var(--status-info-bg);    border-color: #93c5fd; color: #1e3a8a; }

/* ==========================================================================
   Login
   ========================================================================== */

.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #f8fbff 0%, #eef4fb 100%);
    background-image:
        radial-gradient(ellipse at 28% 28%, rgba(21,101,216,.1) 0%, transparent 55%),
        radial-gradient(ellipse at 72% 72%, rgba(74,143,240,.08) 0%, transparent 55%);
    padding: 1rem;
}
[data-theme="dark"] .login-shell {
    background: #06090f;
    background-image:
        radial-gradient(ellipse at 28% 28%, rgba(21,101,216,.16) 0%, transparent 55%),
        radial-gradient(ellipse at 72% 72%, rgba(74,143,240,.10) 0%, transparent 55%);
}
.login-card {
    background: var(--bg-surface);
    border: 1px solid rgba(21,101,216,.25);
    border-top: 3px solid var(--brand-primary);    /* risk app login card accent */
    border-radius: var(--radius-lg);
    box-shadow: 0 6px 32px rgba(21,101,216,.12), 0 2px 8px rgba(0,0,0,.06);
    width: 100%;
    max-width: 400px;
    padding: 2.25rem 2rem;
}
.login-brand {
    text-align: center;
    margin-bottom: 1.75rem;
}
.login-brand .logo-mark {
    width: 56px; height: 56px;
    margin: 0 auto .9rem;
    display: block;
}
.login-brand h1 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: .2rem;
    letter-spacing: -.03em;
}
.login-brand h1 .blu { color: var(--brand-primary); }
.login-brand .tagline { color: var(--text-tertiary); font-size: .83rem; margin: 0; }

/* ==========================================================================
   Charts / Visualisations
   ========================================================================== */

/* Chart legend (dashboard compliance mix) */
.chart-legend {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: .9rem;
    flex-wrap: wrap;
}
.legend-item {
    display: flex;
    align-items: center;
    gap: .3rem;
    font-size: .78rem;
    color: var(--text-secondary);
}
.legend-dot {
    display: inline-block;
    width: 9px; height: 9px;
    border-radius: 2px;
    flex-shrink: 0;
}

.donut-chart-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 190px;
}
.donut-center         { position: absolute; text-align: center; }
.donut-center .num    { font-size: 1.9rem; font-weight: 700; color: var(--text-primary); line-height: 1; }
.donut-center .lbl    { font-size: .72rem; color: var(--text-tertiary); }

.progress-bar {
    height: 7px;
    background: var(--bg-hover);
    border-radius: 999px;
    overflow: hidden;
    margin-top: .2rem;
}
.progress-bar .fill   { height: 100%; background: var(--brand-primary); transition: width .35s ease; }
.progress-bar.success .fill { background: var(--status-success); }
.progress-bar.warning .fill { background: var(--status-warning); }
.progress-bar.danger  .fill { background: var(--status-danger); }

.heatmap-grid {
    display: grid;
    grid-template-columns: 80px repeat(5, 1fr);
    gap: 4px;
    margin-top: 1rem;
}
.heatmap-cell {
    padding: .85rem .5rem;
    text-align: center;
    border-radius: 4px;
    font-size: .84rem;
    font-weight: 600;
    color: var(--text-primary);
}
.heatmap-cell.label { background: transparent; font-weight: 500; color: var(--text-tertiary); font-size: .74rem; padding: .5rem; }
.heatmap-l1 { background: #d1fae5; }
.heatmap-l2 { background: #a7f3d0; }
.heatmap-l3 { background: #fde68a; }
.heatmap-l4 { background: #fdba74; }
.heatmap-l5 { background: #fca5a5; }

/* ==========================================================================
   Empty state
   ========================================================================== */

.empty-state {
    padding: 2.5rem 1.5rem;
    text-align: center;
    color: var(--text-tertiary);
}
.empty-state svg { color: var(--text-muted); margin-bottom: .75rem; }
.empty-state h4  { color: var(--text-secondary); margin-bottom: .25rem; }
.empty-state p   { font-size: .88rem; margin-bottom: 1rem; }

/* ==========================================================================
   Module sub-nav (ERM-style pill tabs)
   ========================================================================== */

.module-nav {
    display: flex;
    gap: 3px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.module-nav a {
    padding: 7px 16px;
    border-radius: var(--radius-md);
    font-size: .84rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    transition: all var(--transition);
    border: 1px solid transparent;
}
.module-nav a:hover  { background: var(--bg-hover); color: var(--text-primary); text-decoration: none; }
.module-nav a.active {
    background: var(--brand-accent-glow);
    color: var(--brand-primary);
    border-color: var(--brand-accent-glow);
    font-weight: 600;
}

/* table-wrap alias used on this page */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    background: var(--bg-surface);
}

/* ==========================================================================
   Navigation tabs
   ========================================================================== */

.tabs {
    display: flex;
    gap: .15rem;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 1.4rem;
    overflow-x: auto;
}
.tabs a, .tabs .tab {
    padding: .6rem .95rem;
    color: var(--text-tertiary);
    font-size: .865rem;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    text-decoration: none;
    white-space: nowrap;
    display: inline-block;
    transition: color .12s;
    cursor: pointer;
}
.tabs a:hover, .tabs .tab:hover { color: var(--text-primary); text-decoration: none; }
.tabs a.active, .tabs .tab.active { color: var(--brand-primary); border-bottom-color: var(--brand-primary); font-weight: 600; }

/* ==========================================================================
   Filter bar
   ========================================================================== */

.filter-bar {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1rem;
    margin-bottom: 1rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
    gap: .75rem;
    align-items: end;
    box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   Two-column detail layout
   ========================================================================== */

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 1.4rem;
    align-items: start;
}
.detail-grid .meta-row {
    display: flex;
    justify-content: space-between;
    padding: .5rem 0;
    border-bottom: 1px solid var(--border-light);
}
.detail-grid .meta-row:last-child { border-bottom: 0; }
.detail-grid .meta-row .meta-label { color: var(--text-tertiary); font-size: .79rem; font-weight: 500; }
.detail-grid .meta-row .meta-value { color: var(--text-primary); font-size: .84rem; font-weight: 500; text-align: right; }

/* ==========================================================================
   Modal overlay (used by risks page and other feature modals)
   ========================================================================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 300;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.modal-overlay.open { display: flex; }
.modal {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 6px 32px rgba(15,23,42,.18);
}
.modal-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-title  { font-weight: 700; font-size: .95rem; }
.modal-close  {
    background: none; border: none;
    color: var(--text-muted); font-size: 18px;
    cursor: pointer; padding: 2px 6px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    line-height: 1;
}
.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.modal-body   { padding: 20px 24px; }
.modal-footer {
    padding: 14px 24px;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ==========================================================================
   Settings — theme picker
   ========================================================================== */

.theme-option {
    cursor: pointer;
    border: 2px solid var(--border-medium);
    border-radius: var(--radius-md);
    padding: .75rem 1rem;
    transition: border-color .12s, box-shadow .12s;
}
.theme-option:hover      { border-color: var(--brand-primary); }
.theme-option.selected   {
    border-color: var(--brand-primary) !important;
    background: var(--brand-accent-glow);
    box-shadow: 0 0 0 3px var(--brand-accent-glow);
}

/* ==========================================================================
   Pagination
   ========================================================================== */

.pagination {
    display: flex;
    gap: .2rem;
    justify-content: flex-end;
    align-items: center;
    padding: .85rem 1rem;
}
.pagination a, .pagination span {
    padding: .32rem .62rem;
    border-radius: var(--radius-sm);
    font-size: .8rem;
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
}
.pagination a:hover   { background: var(--bg-hover); text-decoration: none; }
.pagination .current  { background: var(--brand-primary); color: #fff; border-color: var(--brand-primary); }

/* ==========================================================================
   Dashboard grid helpers
   ========================================================================== */

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}
@media (max-width: 900px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Utilities
   ========================================================================== */

.text-muted     { color: var(--text-muted)     !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-tertiary  { color: var(--text-tertiary)  !important; }
.text-success   { color: var(--status-success) !important; }
.text-warning   { color: var(--status-warning) !important; }
.text-danger    { color: var(--status-danger)  !important; }
.text-info      { color: var(--status-info)    !important; }
.text-center    { text-align: center; }
.text-right     { text-align: right; }

.fw-400 { font-weight: 400; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

.mb-0 { margin-bottom: 0     !important; }
.mb-1 { margin-bottom: .5rem !important; }
.mb-2 { margin-bottom: 1rem  !important; }
.mb-3 { margin-bottom: 1.5rem!important; }
.mt-1 { margin-top: .5rem    !important; }
.mt-2 { margin-top: 1rem     !important; }
.mt-3 { margin-top: 1.5rem   !important; }

.d-flex        { display: flex; }
.gap-1         { gap: .5rem; }
.gap-2         { gap: 1rem; }
.flex-grow     { flex-grow: 1; }
.align-center  { align-items: center; }
.justify-between { justify-content: space-between; }
.w-100         { width: 100%; }
.small         { font-size: .8rem; }

/* ==========================================================================
   Responsive
   ========================================================================== */

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

@media (max-width: 768px) {
    :root { --sidebar-width: 0px; }

    .sidebar {
        transform: translateX(-100%);
        width: 252px;
        transition: transform .22s ease;
    }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }

    .menu-toggle   { display: flex !important; }
    .page-content  { padding: 1rem; }
    .stat-grid     { grid-template-columns: repeat(2, 1fr); }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

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

.menu-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border-medium);
    padding: .35rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--text-secondary);
}
.menu-toggle:hover { background: var(--bg-hover); }
