/* ============================================================
   style.css — NLB CISO Portal
   Brand: NLB Indigo #230078 | Dark Gray #63666A
   Fonts: Sora (headings) + DM Sans (body)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;600;700&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,400&display=swap');

/* ------------------------------------------------------------
   CSS Variables — Dark Theme (default)
   ------------------------------------------------------------ */
:root {
    --bg-base:        #0e0e1f;
    --bg-surface:     #15152e;
    --bg-card:        #1c1c3a;
    --bg-card-hover:  #242450;
    --bg-sidebar:     #0a0a1c;
    --bg-input:       #26264a;

    --border:         rgba(130, 120, 210, 0.24);
    --border-strong:  rgba(130, 120, 210, 0.45);

    --primary:        #230078;
    --primary-light:  #3b00cc;
    --primary-glow:   rgba(35, 0, 120, 0.4);
    --accent:         #7c5dff;
    --accent-soft:    rgba(124, 93, 255, 0.14);

    --text-primary:   #f0eeff;
    --text-secondary: #c8c4e0;
    --text-muted:     #a8a4c8;
    --text-inverse:   #ffffff;

    --status-approved: #22c55e;
    --status-pending:  #f59e0b;
    --status-rejected: #ef4444;
    --status-draft:    #64748b;

    --success-bg:     rgba(34, 197, 94, 0.12);
    --warning-bg:     rgba(245, 158, 11, 0.12);
    --danger-bg:      rgba(239, 68, 68, 0.12);
    --info-bg:        rgba(124, 93, 255, 0.12);

    --sidebar-width:  240px;
    --topnav-height:  62px;
    --radius:         10px;
    --radius-sm:      6px;
    --shadow:         0 4px 24px rgba(0,0,0,0.45);
    --shadow-sm:      0 2px 8px rgba(0,0,0,0.3);
    --transition:     0.2s ease;
}

/* ------------------------------------------------------------
   Light Theme Override
   ------------------------------------------------------------ */
[data-theme="light"] {
    --bg-base:        #f2f0fc;
    --bg-surface:     #e6e3f5;
    --bg-card:        #ffffff;
    --bg-card-hover:  #f7f6fe;
    --bg-sidebar:     #230078;
    --bg-input:       #ffffff;

    --border:         rgba(35, 0, 120, 0.14);
    --border-strong:  rgba(35, 0, 120, 0.28);

    --text-primary:   #0e0030;
    --text-secondary: #3d3070;
    --text-muted:     #7060a8;

    --accent:         #230078;
    --accent-soft:    rgba(35, 0, 120, 0.08);
    --shadow:         0 4px 24px rgba(35, 0, 120, 0.1);
    --shadow-sm:      0 2px 8px rgba(35, 0, 120, 0.07);
}

/* ------------------------------------------------------------
   Reset & Base
   ------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
    font-family: 'DM Sans', sans-serif;
    font-size: 1rem;
    background: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: background var(--transition), color var(--transition);
}

h1, h2, h3, h4, h5 {
    font-family: 'Sora', sans-serif;
    font-weight: 600;
    line-height: 1.25;
    color: var(--text-primary);
}

a { color: var(--accent); text-decoration: none; transition: opacity var(--transition); }
a:hover { opacity: 0.8; }

/* ------------------------------------------------------------
   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);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    z-index: 100;
    transition: background var(--transition);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 20px;
    height: var(--topnav-height);
    border-bottom: 1px solid var(--border);
}

.sidebar-logo-mark {
    width: 34px;
    height: 34px;
    background: var(--primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Sora', sans-serif;
    font-weight: 700;
    font-size: 0.75rem;
    color: #fff;
    letter-spacing: -0.5px;
    flex-shrink: 0;
}

.sidebar-logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.sidebar-logo-name {
    font-family: 'Sora', sans-serif;
    font-weight: 700;
    font-size: 0.9rem;
    color: #fff;
}

.sidebar-logo-sub {
    font-size: 0.68rem;
    color: rgba(255,255,255,0.45);
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

[data-theme="light"] .sidebar-logo-name,
[data-theme="light"] .sidebar-logo-sub { color: #fff; opacity: 1; }
[data-theme="light"] .sidebar-logo-sub { opacity: 0.6; }

/* Logo mark: solid white with indigo text — clearly visible on indigo sidebar */
[data-theme="light"] .sidebar-logo-mark {
    background: #ffffff;
    border: none;
    color: #230078;
}

/* Nav groups */
.sidebar-nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}

.nav-group-label {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.28);
    padding: 14px 20px 4px;
}

[data-theme="light"] .nav-group-label { color: rgba(255,255,255,0.45); }

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 20px;
    margin: 1px 10px;
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,0.6);
    font-size: 0.875rem;
    font-weight: 400;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
}

.nav-item:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

.nav-item.active {
    background: var(--primary);
    color: #fff;
    font-weight: 500;
    box-shadow: 0 4px 12px var(--primary-glow);
}

.nav-item .nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.75;
}
.nav-item.active .nav-icon,
.nav-item:hover .nav-icon { opacity: 1; }

/* Badge on nav items (e.g. pending count) */
.nav-badge {
    margin-left: auto;
    background: var(--status-pending);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 20px;
    min-width: 20px;
    text-align: center;
}

/* Sidebar user card at bottom */
.sidebar-user {
    padding: 14px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Sora', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff;
    flex-shrink: 0;
}

.sidebar-user-info { flex: 1; overflow: hidden; }

.sidebar-user-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255,255,255,0.9);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 0.65rem;
    color: rgba(255,255,255,0.4);
    text-transform: capitalize;
}

.sidebar-logout {
    color: rgba(255,255,255,0.35);
    padding: 5px;
    border-radius: 5px;
    transition: all var(--transition);
    cursor: pointer;
    display: flex;
}
.sidebar-logout:hover { color: var(--status-rejected); background: var(--danger-bg); }

/* ------------------------------------------------------------
   Top Nav
   ------------------------------------------------------------ */
.topnav {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--topnav-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-strong);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    z-index: 90;
    transition: background var(--transition);
    box-shadow: var(--shadow-sm);
}

.topnav-title {
    font-family: 'Sora', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
    flex: 1;
}

.topnav-title span {
    font-weight: 300;
    color: var(--text-muted);
    margin-left: 6px;
    font-size: 0.85rem;
}

/* Theme toggle */
.theme-toggle {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition);
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }

/* Topnav action buttons */
.topnav-btn {
    width: 38px; height: 38px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
}
.topnav-btn:hover { border-color: var(--border-strong); color: var(--text-primary); }

.topnav-btn .badge {
    position: absolute;
    top: -4px; right: -4px;
    background: var(--status-rejected);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    width: 16px; height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Role chip in topnav and admin pages */
.role-chip {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    text-transform: none;
    letter-spacing: 0.02em;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-primary);
}

/* ------------------------------------------------------------
   Main Content Area
   ------------------------------------------------------------ */
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--topnav-height);
    padding: 24px 28px 32px;
    min-height: calc(100vh - var(--topnav-height));
    flex: 1;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    width: calc(100% - var(--sidebar-width));
}

.page-header {
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

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

/* ------------------------------------------------------------
   Cards
   ------------------------------------------------------------ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: background var(--transition), border-color var(--transition);
}

.card:hover { border-color: var(--border-strong); }

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

.card-title {
    font-family: 'Sora', sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* KPI stat cards */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: var(--accent);
    opacity: 0;
    transition: opacity var(--transition);
}

.stat-card:hover::before { opacity: 1; }
.stat-card:hover { border-color: var(--border-strong); background: var(--bg-card-hover); }

.stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
}

.stat-value {
    font-family: 'Sora', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.stat-unit {
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-muted);
    margin-left: 3px;
}

.stat-delta {
    font-size: 0.78rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}
.stat-delta.up   { color: var(--status-approved); }
.stat-delta.down { color: var(--status-rejected); }
.stat-delta.flat { color: var(--text-muted); }

/* Stat card icon */
.stat-icon {
    position: absolute;
    top: 16px; right: 16px;
    width: 36px; height: 36px;
    border-radius: 8px;
    background: var(--accent-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
}

/* ------------------------------------------------------------
   Grid helpers — fluid auto-fit, columns collapse gracefully
   ------------------------------------------------------------ */
.grid { display: grid; gap: 16px; }

/* auto-fit: fills the row, collapses columns when space runs out */
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }

/* Force exact columns when needed (e.g. inside a card) */
.grid-2-fixed { grid-template-columns: repeat(2, 1fr); }
.grid-3-fixed { grid-template-columns: repeat(3, 1fr); }
.grid-4-fixed { grid-template-columns: repeat(4, 1fr); }

/* Chart container — gives Chart.js a sized box to fill */
.chart-container {
    position: relative;
    width: 100%;
    height: 260px;
}

/* Cards that contain charts stretch to match siblings */
.card-chart {
    display: flex;
    flex-direction: column;
}
.card-chart .card-header { flex-shrink: 0; }
.card-chart .chart-container {
    flex: 1;
    min-height: 200px;
}

/* ------------------------------------------------------------
   Buttons
   ------------------------------------------------------------ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-light); border-color: var(--primary-light); box-shadow: 0 4px 12px var(--primary-glow); }

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

.btn-success { background: rgba(34,197,94,0.15); color: var(--status-approved); border-color: rgba(34,197,94,0.3); }
.btn-success:hover { background: rgba(34,197,94,0.25); }

.btn-danger { background: rgba(239,68,68,0.1); color: var(--status-rejected); border-color: rgba(239,68,68,0.3); }
.btn-danger:hover { background: rgba(239,68,68,0.2); }

.btn-sm { padding: 5px 12px; font-size: 0.8rem; }
.btn-icon { padding: 8px; }

/* ------------------------------------------------------------
   Forms
   ------------------------------------------------------------ */
.form-group { margin-bottom: 18px; }
.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.form-control {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: var(--text-primary);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem;
    transition: all var(--transition);
    outline: none;
}
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-control::placeholder { color: var(--text-muted); }
.form-control:disabled { opacity: 0.5; cursor: not-allowed; }

select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 90px; }

.form-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 5px;
}

/* ------------------------------------------------------------
   Tables
   ------------------------------------------------------------ */
.table-wrap { overflow-x: auto; }

table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

table.data-table th {
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    padding: 11px 14px;
    text-align: left;
    border-bottom: 2px solid var(--border-strong);
    white-space: nowrap;
}

table.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    vertical-align: middle;
}

table.data-table tr:last-child td { border-bottom: none; }
table.data-table tbody tr:hover td { background: var(--bg-card-hover); }

/* ------------------------------------------------------------
   Status Badges
   ------------------------------------------------------------ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: capitalize;
    letter-spacing: 0.02em;
}

.badge-approved { background: rgba(34,197,94,0.12);  color: var(--status-approved); border: 1px solid rgba(34,197,94,0.25); }
.badge-pending  { background: rgba(245,158,11,0.12); color: var(--status-pending);  border: 1px solid rgba(245,158,11,0.25); }
.badge-rejected { background: rgba(239,68,68,0.1);  color: var(--status-rejected); border: 1px solid rgba(239,68,68,0.25); }
.badge-draft    { background: rgba(100,116,139,0.1); color: var(--status-draft);    border: 1px solid rgba(100,116,139,0.25); }

/* Status dot */
.badge::before {
    content: '';
    width: 5px; height: 5px;
    border-radius: 50%;
    background: currentColor;
    display: inline-block;
}

/* ------------------------------------------------------------
   Alerts / Flash messages
   ------------------------------------------------------------ */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    border: 1px solid;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.alert-success { background: var(--success-bg); border-color: rgba(34,197,94,0.3);  color: var(--status-approved); }
.alert-warning { background: var(--warning-bg); border-color: rgba(245,158,11,0.3); color: var(--status-pending); }
.alert-danger  { background: var(--danger-bg);  border-color: rgba(239,68,68,0.3);  color: var(--status-rejected); }
.alert-info    { background: var(--info-bg);    border-color: rgba(108,71,255,0.3); color: var(--accent); }

/* ------------------------------------------------------------
   Login Page
   ------------------------------------------------------------ */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-base);
    position: relative;
    overflow: hidden;
}

/* Decorative background mesh */
.login-page::before {
    content: '';
    position: absolute;
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(35,0,120,0.25) 0%, transparent 70%);
    top: -100px; right: -100px;
    pointer-events: none;
}

.login-page::after {
    content: '';
    position: absolute;
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(108,71,255,0.15) 0%, transparent 70%);
    bottom: -50px; left: -50px;
    pointer-events: none;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
    box-shadow: var(--shadow);
}

.login-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
}

.login-logo-mark {
    width: 44px; height: 44px;
    background: var(--primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Sora', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    color: #fff;
}

.login-logo-text h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.login-logo-text p {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.login-card h1 {
    font-size: 1.4rem;
    margin-bottom: 6px;
}

.login-card > p {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 28px;
}

/* ------------------------------------------------------------
   Divider
   ------------------------------------------------------------ */
.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 20px 0;
}

/* ------------------------------------------------------------
   Empty state
   ------------------------------------------------------------ */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-secondary);
}
.empty-state svg {
    width: 48px; height: 48px;
    margin: 0 auto 16px;
    opacity: 0.4;
}
.empty-state p       { font-size: 0.875rem; color: var(--text-muted); margin-top: 6px; }
.empty-state-title   { font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
.empty-state-desc    { color: var(--text-muted); font-size: .875rem; }

/* ------------------------------------------------------------
   Utilities
   ------------------------------------------------------------ */
.text-muted    { color: var(--text-muted); }
.text-sm       { font-size: 0.8rem; }
.text-xs       { font-size: 0.72rem; }
.text-right    { text-align: right; }
.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-0          { margin-bottom: 0; }
.mb-16         { margin-bottom: 16px; }
.mb-24         { margin-bottom: 24px; }
.mb-8          { margin-bottom: 8px; }
.hidden        { display: none !important; }
.mt-auto       { margin-top: auto; }
.w-full        { width: 100%; }
.font-sora     { font-family: 'Sora', sans-serif; }

/* ------------------------------------------------------------
   Scrollbar
   ------------------------------------------------------------ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ------------------------------------------------------------
   Responsive — collapse sidebar on small screens
   Note: auto-fit grids handle most column collapsing automatically.
         These overrides handle sidebar and spacing only.
   ------------------------------------------------------------ */
@media (max-width: 1200px) {
    .chart-container { height: 220px; }
}

@media (max-width: 900px) {
    :root { --sidebar-width: 0px; }
    .sidebar { transform: translateX(-240px); width: 240px; }
    .sidebar.open { transform: translateX(0); }
    .topnav { left: 0; }
    .main-content { margin-left: 0; width: 100%; }
    .chart-container { height: 200px; }
}

@media (max-width: 560px) {
    .main-content { padding: 14px; }
    .chart-container { height: 180px; }
    .stat-value { font-size: 1.6rem; }
    .page-header h1 { font-size: 1.2rem; }
    .flex-between.page-header-row { flex-direction: column; align-items: flex-start; gap: 12px; }
}

/* ------------------------------------------------------------
   Global table defaults — covers ALL tables including custom
   ones in entities, kpi-catalogue, kpi-detail etc.
   ------------------------------------------------------------ */
th {
    color: var(--text-secondary) !important;
    background: var(--bg-surface) !important;
}
td {
    color: var(--text-primary) !important;
}
/* Remove bottom border from last row — covers inline tr styles and DataTables td overrides */
tr:last-child,
tr:last-child td,
tbody tr:last-child td,
table.dataTable tbody tr:last-child td {
    border-bottom: none !important;
}
tr:hover td {
    background: var(--bg-card-hover) !important;
}

/* ------------------------------------------------------------
   DataTables — override plugin defaults for dark/light themes
   ------------------------------------------------------------ */

table.dataTable {
    border-bottom: none !important;
}

/* Table headers */
table.dataTable thead th,
table.dataTable thead td {
    color: var(--text-secondary) !important;
    border-bottom: 2px solid var(--border-strong) !important;
    background: var(--bg-surface) !important;
    font-size: .7rem !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: .07em;
}

/* Sort icons */
table.dataTable thead .sorting:before,
table.dataTable thead .sorting:after,
table.dataTable thead .sorting_asc:before,
table.dataTable thead .sorting_asc:after,
table.dataTable thead .sorting_desc:before,
table.dataTable thead .sorting_desc:after {
    color: var(--text-muted) !important;
}

/* Table cells */
table.dataTable tbody td {
    color: var(--text-primary) !important;
    border-bottom: 1px solid var(--border) !important;
    background: transparent !important;
}

/* Row hover */
table.dataTable tbody tr:hover td {
    background: var(--bg-card-hover) !important;
}

/* Wrapper text: "Showing 1-4 of 4", search, length */
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_paginate {
    color: var(--text-secondary) !important;
    font-size: .82rem;
}

/* Search input + length select */
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    background: var(--bg-input) !important;
    border: 1px solid var(--border-strong) !important;
    color: var(--text-primary) !important;
    border-radius: var(--radius-sm);
    padding: 5px 10px;
    outline: none;
}
.dataTables_wrapper .dataTables_filter input:focus {
    border-color: var(--accent) !important;
}

/* Pagination buttons */
.dataTables_wrapper .dataTables_paginate .paginate_button {
    color: var(--text-secondary) !important;
    border-radius: var(--radius-sm) !important;
    border: 1px solid transparent !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--bg-card-hover) !important;
    border-color: var(--border-strong) !important;
    color: var(--text-primary) !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: var(--accent) !important;
    border-color: var(--accent) !important;
    color: #fff !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
    color: var(--text-muted) !important;
}

/* ── KPI Description Tooltip ─────────────────────────────────
   Discrete info icon beside KPI names on data-entry and
   approval pages. Tooltip appears on hover, CSS-only.
   ──────────────────────────────────────────────────────────── */
.kpi-hint {
    position: relative;
    display: inline-block;
    vertical-align: middle;
    margin-left: 5px;
    line-height: 1;
}
.kpi-hint-icon {
    font-size: .75rem;
    color: var(--text-muted);
    cursor: help;
    opacity: 0.55;
    transition: opacity .15s, color .15s;
    display: inline-block;
    vertical-align: middle;
}
.kpi-hint:hover .kpi-hint-icon {
    opacity: 1;
    color: var(--accent);
}
.kpi-hint-box {
    display: none;
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-card);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    padding: 11px 15px;
    font-size: .775rem;
    line-height: 1.6;
    color: var(--text-secondary);
    width: 320px;
    z-index: 500;
    box-shadow: 0 6px 24px rgba(0,0,0,.18);
    font-weight: 400;
    white-space: normal;
    pointer-events: none;
}
/* Arrow pointing left from tooltip box */
.kpi-hint-box::before {
    content: '';
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-right-color: var(--border-strong);
}
.kpi-hint-box::after {
    content: '';
    position: absolute;
    right: calc(100% - 1px);
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-right-color: var(--bg-card);
}
.kpi-hint:hover .kpi-hint-box {
    display: block;
}
/* Flip tooltip to left side when near right edge (narrow tables) */
.kpi-hint.flip-left .kpi-hint-box {
    left: auto;
    right: calc(100% + 10px);
}
.kpi-hint.flip-left .kpi-hint-box::before {
    right: auto;
    left: 100%;
    border-right-color: transparent;
    border-left-color: var(--border-strong);
}
.kpi-hint.flip-left .kpi-hint-box::after {
    right: auto;
    left: calc(100% - 1px);
    border-right-color: transparent;
    border-left-color: var(--bg-card);
}

/* ── Bootstrap modal dark mode overrides ─────────────────────
   Bootstrap hardcodes color:#212529 on .modal-title and
   .modal-body — invisible on dark backgrounds. Force all
   modal text to use theme variables. */
.modal-content { color: var(--text-primary) !important; }
.modal-title   { color: var(--text-primary) !important; font-size: 1rem; }
.modal-body    { color: var(--text-primary); }
.modal-footer  { color: var(--text-primary); }


/* ------------------------------------------------------------
   v3 layout hardening
   Keeps the fixed sidebar, top navigation, charts, and wide KPI
   grids from overlapping or clipping on XAMPP/browser zoom.
   ------------------------------------------------------------ */
html, body { width: 100%; overflow-x: hidden; }
.app-shell { width: 100%; min-width: 0; }
.main-content { min-width: 0; max-width: calc(100vw - var(--sidebar-width)); overflow-x: hidden; }
.card, .stat-card { min-width: 0; }
.chart-container { min-width: 0; overflow: hidden; }
.table-responsive, .dataTables_wrapper { width: 100%; overflow-x: auto; }
.flex-between { gap: 12px; flex-wrap: wrap; }
canvas { max-width: 100%; }

@media (max-width: 991.98px) {
    .page-header { align-items: flex-start; }
    .topnav { padding: 0 14px; }
}

@media (min-width: 992px) {
    .sidebar { transform: none !important; }
}

/* ============================================================
   v3.1 layout correction
   Fixes the broken design where the fixed sidebar overlays the
   dashboard content. The app now uses a two-column CSS grid so
   the sidebar, top bar and content can never overlap on desktop.
   ============================================================ */
:root {
    --sidebar-width: 268px;
    --topnav-height: 64px;
}

html, body {
    width: 100%;
    min-width: 0;
    overflow-x: hidden;
}

.app-shell {
    display: grid !important;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    grid-template-rows: var(--topnav-height) minmax(0, 1fr);
    min-height: 100vh;
    width: 100%;
}

.sidebar {
    grid-column: 1;
    grid-row: 1 / span 2;
    position: sticky !important;
    top: 0;
    left: auto !important;
    width: var(--sidebar-width) !important;
    height: 100vh;
    z-index: 30;
    overflow: hidden;
}

.sidebar-nav {
    min-width: 0;
}

.sidebar-logo {
    min-width: 0;
    padding: 0 18px;
}

.sidebar-logo-mark {
    width: 42px;
    min-width: 42px;
    height: 36px;
    font-size: 0.72rem;
    letter-spacing: -0.04em;
}

.sidebar-logo-text,
.sidebar-user-info,
.nav-item {
    min-width: 0;
}

.nav-item {
    white-space: nowrap;
}

.nav-item:not(.active) {
    overflow: hidden;
    text-overflow: ellipsis;
}

.topnav {
    grid-column: 2;
    grid-row: 1;
    position: sticky !important;
    top: 0;
    left: auto !important;
    right: auto !important;
    width: 100% !important;
    min-width: 0;
    z-index: 20;
}

.main-content {
    grid-column: 2;
    grid-row: 2;
    margin: 0 !important;
    width: 100% !important;
    min-width: 0;
    max-width: 100%;
    padding: 26px 30px 36px;
    overflow-x: hidden;
}

.main-content > *,
.card,
.stat-card,
.grid,
.dashboard-grid,
.entity-grid,
.table-responsive,
.chart-container {
    min-width: 0;
    max-width: 100%;
}

.chart-container canvas {
    max-width: 100% !important;
}

.table-responsive {
    overflow-x: auto;
}

@media (max-width: 991.98px) {
    :root { --sidebar-width: 280px; }

    .app-shell {
        display: block !important;
        min-height: 100vh;
    }

    .sidebar {
        position: fixed !important;
        inset: 0 auto 0 0;
        transform: translateX(-105%);
        transition: transform 0.22s ease, box-shadow 0.22s ease;
        z-index: 1050;
        box-shadow: none;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 24px 0 70px rgba(0,0,0,0.38);
    }

    .topnav {
        position: sticky !important;
        left: 0 !important;
        top: 0;
        width: 100% !important;
        z-index: 1020;
    }

    .main-content {
        margin: 0 !important;
        width: 100% !important;
        padding: 20px 16px 28px;
    }
}

/* ============================================================
   v8 sidebar viewport fix
   Keeps the left navigation fixed to the browser viewport while
   the report/dashboard content scrolls, and guarantees the menu
   background fills the full window height.
   ============================================================ */
@media (min-width: 992px) {
    .app-shell {
        grid-template-columns: var(--sidebar-width) minmax(0, 1fr) !important;
        align-items: stretch;
    }

    .sidebar {
        position: fixed !important;
        inset: 0 auto 0 0 !important;
        width: var(--sidebar-width) !important;
        height: 100vh !important;
        min-height: 100vh !important;
        height: 100dvh !important;
        min-height: 100dvh !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
        transform: none !important;
        z-index: 1040 !important;
    }

    .sidebar-nav {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        overscroll-behavior: contain;
        scrollbar-width: thin;
    }

    .sidebar-user,
    .sidebar-logo {
        flex: 0 0 auto !important;
    }

    .topnav {
        grid-column: 2 !important;
        left: auto !important;
        width: 100% !important;
    }

    .main-content {
        grid-column: 2 !important;
        width: 100% !important;
        max-width: 100% !important;
    }
}

@media (max-width: 991.98px) {
    .sidebar {
        position: fixed !important;
        inset: 0 auto 0 0 !important;
        height: 100vh !important;
        min-height: 100vh !important;
        height: 100dvh !important;
        min-height: 100dvh !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
    }

    .sidebar-nav {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }

    .sidebar-user,
    .sidebar-logo {
        flex: 0 0 auto !important;
    }
}


/* ------------------------------------------------------------
   Expandable panels / collapsed windows
   ------------------------------------------------------------ */
.expand-window {
    border-top: 1px solid var(--border);
    background: var(--bg-card);
}
.expand-window > summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 20px;
    background: var(--bg-surface);
    color: var(--text-primary);
    user-select: none;
}
.expand-window > summary::-webkit-details-marker { display: none; }
.expand-window > summary:hover { background: var(--bg-card-hover); }
.expand-title {
    font-weight: 800;
    font-size: 0.88rem;
    color: var(--text-primary);
}
.expand-subtitle {
    color: var(--text-muted);
    font-size: 0.72rem;
    margin-top: 2px;
}
.expand-pill {
    margin-left: auto;
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--accent);
    background: var(--accent-soft);
    border: 1px solid var(--border);
    padding: 3px 9px;
    border-radius: 999px;
    white-space: nowrap;
}
.expand-chevron {
    color: var(--text-muted);
    transition: transform 0.18s ease;
}
.expand-window[open] .expand-chevron { transform: rotate(90deg); }
.expand-body { border-top: 1px solid var(--border); }
.security-rating-table-window { border-left: 0; border-right: 0; border-bottom: 0; }
@media (max-width: 720px) {
    .expand-window > summary { align-items: flex-start; }
    .expand-pill { display: none; }
}

/* ------------------------------------------------------------
   Permissions page responsive alignment
   ------------------------------------------------------------ */
@media (max-width: 991.98px) {
    .permissions-layout { grid-template-columns: 1fr !important; }
    .permission-profile-grid { grid-template-columns: 1fr !important; }
}
@media (max-width: 767.98px) {
    .permission-card-grid { grid-template-columns: 1fr !important; }
}

/* ============================================================
   v9 mobile UX + short page separators
   - Tablet breakpoint matches Bootstrap lg and the sidebar CSS.
   - Page toolbars use one short separator instead of long full-width lines.
   - Filters, cards, charts and tables collapse safely on phones.
   ============================================================ */

/* Remove long horizontal chrome lines; use short page rules instead. */
.topnav {
    border-bottom: 0 !important;
    box-shadow: 0 8px 24px rgba(35,0,120,0.06) !important;
}

.page-header {
    position: relative;
    padding-bottom: 14px;
    margin-bottom: 18px;
}
.page-header::after,
.portal-toolbar-card::after,
.portal-tab-card::after {
    content: '';
    display: block;
    width: 64px;
    height: 2px;
    border-radius: 999px;
    background: var(--accent);
    opacity: .55;
}
.page-header::after { margin-top: 12px; }

.portal-toolbar-card,
.portal-tab-card {
    position: relative;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}
.portal-toolbar-card:hover,
.portal-tab-card:hover { border-color: transparent !important; }
.portal-toolbar-card::after,
.portal-tab-card::after {
    position: absolute;
    left: 0;
    bottom: -6px;
}
.portal-tab-card::after { opacity: .35; }

/* Keep common card/table headers visually clean without full-width divider lines. */
.card-header {
    border-bottom: 0 !important;
    padding-bottom: 0 !important;
}

/* Mobile navigation overlay. */
@media (max-width: 991.98px) {
    body.sidebar-open {
        overflow: hidden;
    }
    body.sidebar-open::before {
        content: '';
        position: fixed;
        inset: 0;
        z-index: 1045;
        background: rgba(14, 0, 48, .42);
        backdrop-filter: blur(2px);
    }
    .sidebar { z-index: 1050 !important; }
    #sidebar-toggle.d-lg-none { display: inline-flex !important; }
    .topnav {
        gap: 10px;
        padding: 0 14px !important;
    }
    .topnav-title {
        min-width: 0;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
        font-size: .95rem;
    }
    .topnav-title span { display: none; }
    .role-chip { display: none; }
    .theme-toggle,
    .topnav-btn { width: 36px; height: 36px; flex: 0 0 36px; }
    .main-content {
        padding: 18px 14px 28px !important;
        overflow-x: hidden !important;
    }
    .page-header {
        margin-bottom: 14px;
        padding-bottom: 12px;
    }
    .page-header h1 { font-size: 1.18rem; }
    .page-header p { font-size: .82rem; }
}

/* Global responsive hardening for mixed inline-grid portal pages. */
@media (max-width: 767.98px) {
    html { font-size: 14px; }

    .card,
    .stat-card {
        padding: 14px !important;
        border-radius: 9px !important;
    }

    .portal-toolbar-card,
    .portal-tab-card {
        padding-left: 0 !important;
        padding-right: 0 !important;
        margin-bottom: 18px !important;
    }
    .portal-toolbar-card > div,
    .portal-tab-card > div,
    .dortp-filter-grid,
    .filter-grid,
    .permission-profile-grid,
    .permission-card-grid {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 10px !important;
        width: 100% !important;
    }

    /* Override wide inline grids in dashboard/report/vulnerability/DORTP pages. */
    .main-content [style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }

    /* Filters and selects become touch-friendly full-width fields. */
    .main-content .form-control,
    .main-content select.form-control,
    .main-content input.form-control,
    .main-content textarea.form-control {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }
    .main-content .btn {
        width: 100%;
        justify-content: center;
        white-space: normal;
    }
    .main-content label,
    .form-label {
        display: block;
        margin-bottom: 4px;
    }

    /* Inline flex filter rows wrap reliably on phones. */
    .main-content [style*="display:flex"] {
        flex-wrap: wrap !important;
        max-width: 100% !important;
    }
    .main-content [style*="margin-left:auto"] {
        margin-left: 0 !important;
    }

    /* All wide tables scroll horizontally rather than forcing page overflow. */
    .table-wrap,
    .table-responsive,
    .dataTables_wrapper,
    .heatmap-wrap {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }
    .main-content table {
        display: block;
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }
    .main-content th,
    .main-content td {
        white-space: nowrap;
    }

    /* Chart panels stay inside the viewport. */
    .chart-container,
    .card-chart,
    .security-rating-chart-panel,
    .security-rating-chart-grid,
    .spider-chart {
        min-width: 0 !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
    }
    .chart-container { height: 210px !important; }
    .spider-chart { height: 300px !important; }

    /* Modals with large inline grids become single-column. */
    .modal-dialog {
        width: calc(100% - 20px) !important;
        max-width: calc(100% - 20px) !important;
        margin: 10px auto !important;
    }
}

@media (max-width: 479.98px) {
    .main-content { padding: 14px 10px 24px !important; }
    .topnav { padding: 0 10px !important; }
    .topnav-title { font-size: .86rem; }
    .sidebar { width: min(88vw, 280px) !important; }
    .stat-value { font-size: 1.45rem !important; }
    .chart-container { height: 190px !important; }
    .spider-chart { height: 260px !important; }
    .page-header::after,
    .portal-toolbar-card::after,
    .portal-tab-card::after { width: 52px; }
}

/* ============================================================
   v10 portal line + responsive cleanup
   Removes the remaining full-width chrome lines around page toolbars/tabs,
   keeps one short accent rule, and gives tablet/small laptop layouts the
   same off-canvas sidebar behavior as mobile.
   ============================================================ */

/* Page title / section separator: one short line only. */
.page-header::after {
    content: '';
    display: block;
    width: 58px;
    height: 2px;
    margin-top: 12px;
    border-radius: 999px;
    background: var(--accent);
    opacity: .55;
}

/* Toolbar and tab containers should not create long horizontal lines. */
.portal-toolbar-card,
.portal-tab-card {
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
    position: relative;
}
.portal-toolbar-card::after,
.portal-tab-card::after {
    display: none !important;
    content: none !important;
}

/* Keep a single short separator below the navigation/tab strip. */
.portal-tab-card {
    margin-bottom: 22px !important;
    padding-bottom: 8px !important;
}
.portal-tab-card::before {
    content: '';
    display: block;
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 58px;
    height: 2px;
    border-radius: 999px;
    background: var(--accent);
    opacity: .42;
}

/* Dashboard/Methodology tabs: no long underline; active tab is a soft pill. */
.dash-tab {
    border-bottom: 0 !important;
    border-radius: 999px !important;
    padding: 8px 14px !important;
    line-height: 1.1;
}
.dash-tab.active {
    background: var(--accent-soft) !important;
    box-shadow: inset 0 0 0 1px var(--border-strong);
}
.dash-tab:hover {
    background: var(--bg-card-hover) !important;
    opacity: 1;
}
.portal-tab-card > div {
    align-items: center;
    gap: 8px !important;
}

/* Top navigation: avoid a heavy full-width divider/shadow effect. */
.topnav {
    border-bottom: 0 !important;
    box-shadow: none !important;
}
.topnav-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Small laptop/tablet: use the same off-canvas menu as phones. */
@media (max-width: 1199.98px) {
    :root { --sidebar-width: 280px; }

    .app-shell {
        display: block !important;
        width: 100% !important;
        min-height: 100vh;
    }

    .sidebar {
        position: fixed !important;
        inset: 0 auto 0 0 !important;
        width: min(86vw, var(--sidebar-width)) !important;
        height: 100vh !important;
        min-height: 100vh !important;
        height: 100dvh !important;
        min-height: 100dvh !important;
        transform: translateX(-105%) !important;
        transition: transform .22s ease, box-shadow .22s ease !important;
        z-index: 1050 !important;
        box-shadow: none !important;
    }
    .sidebar.open {
        transform: translateX(0) !important;
        box-shadow: 24px 0 70px rgba(0,0,0,.38) !important;
    }
    body.sidebar-open { overflow: hidden; }
    body.sidebar-open::before {
        content: '';
        position: fixed;
        inset: 0;
        z-index: 1045;
        background: rgba(14, 0, 48, .42);
        backdrop-filter: blur(2px);
    }

    #sidebar-toggle.d-lg-none {
        display: inline-flex !important;
    }

    .topnav {
        position: sticky !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        padding: 0 14px !important;
        gap: 10px;
        z-index: 1020 !important;
    }

    .main-content {
        margin: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 20px 16px 30px !important;
        overflow-x: hidden !important;
    }
}

/* Restore fixed desktop sidebar only on wider desktop screens. */
@media (min-width: 1200px) {
    .app-shell {
        display: grid !important;
        grid-template-columns: var(--sidebar-width) minmax(0, 1fr) !important;
        grid-template-rows: var(--topnav-height) minmax(0, 1fr) !important;
    }
    .sidebar {
        transform: none !important;
        position: fixed !important;
        width: var(--sidebar-width) !important;
    }
    #sidebar-toggle.d-lg-none { display: none !important; }
}

/* Responsive filters/toolbars: wrap cleanly and keep controls usable. */
.portal-toolbar-card > div,
.filter-grid,
.dortp-filter-grid {
    max-width: 100%;
}
@media (max-width: 767.98px) {
    .portal-toolbar-card,
    .portal-tab-card {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
    .portal-toolbar-card > div,
    .portal-tab-card > div {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
        width: 100% !important;
    }
    .dash-tab { flex: 1 1 auto; justify-content: center; }
    .compact-nav-select,
    #dash-period,
    #rpt-period,
    #rpt-entity,
    #rpt-range {
        width: 100% !important;
        max-width: 100% !important;
    }
    .portal-tab-card::before,
    .page-header::after { width: 52px; }
}

/* ============================================================
   v11 restore compact menu frames
   Recreates the rounded menu/toolbar frames while avoiding the
   long full-width separator lines. The only separator remains the
   short accent rule under page titles.
   ============================================================ */

/* Keep the page title separator as one short "minus" line. */
.page-header {
    position: relative;
    border-bottom: 0 !important;
}
.page-header::after {
    content: '' !important;
    display: block !important;
    width: 58px !important;
    height: 2px !important;
    margin-top: 12px !important;
    border-radius: 999px !important;
    background: var(--accent) !important;
    opacity: .55 !important;
}

/* Restore the visual frame around page controls without adding long dividers. */
.portal-toolbar-card,
.portal-tab-card {
    background: var(--bg-card) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow-sm) !important;
    position: relative !important;
}
.portal-toolbar-card::before,
.portal-toolbar-card::after,
.portal-tab-card::before,
.portal-tab-card::after {
    display: none !important;
    content: none !important;
}

.portal-toolbar-card {
    padding: 14px 16px !important;
    margin-bottom: 12px !important;
}
.portal-tab-card {
    display: inline-flex !important;
    width: auto !important;
    max-width: 100% !important;
    padding: 6px !important;
    margin-bottom: 18px !important;
}
.portal-tab-card > div {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    flex-wrap: wrap !important;
}

/* Dashboard / Methodology tabs stay inside the compact frame. */
.dash-tab {
    border-bottom: 0 !important;
    border-radius: 999px !important;
    padding: 8px 14px !important;
    line-height: 1.1 !important;
    color: var(--text-muted) !important;
    text-decoration: none !important;
}
.dash-tab.active {
    color: var(--accent) !important;
    background: var(--accent-soft) !important;
    box-shadow: inset 0 0 0 1px var(--border-strong) !important;
}
.dash-tab:hover {
    color: var(--accent) !important;
    background: var(--bg-card-hover) !important;
}

/* Make framed controls mobile-friendly. */
@media (max-width: 767.98px) {
    .portal-toolbar-card,
    .portal-tab-card {
        width: 100% !important;
        padding: 10px !important;
    }
    .portal-tab-card > div {
        width: 100% !important;
    }
    .dash-tab {
        flex: 1 1 auto !important;
        justify-content: center !important;
        text-align: center !important;
    }
}
