/* CyberOps GRC design system (p76): light + dark themes (Bootstrap 5.3 data-bs-theme), Quara blue→purple brand,
   Inter (Latin) and IBM Plex Sans Arabic, pro cards and tables. Self-hosted fonts in static/fonts. */
@font-face { font-family: "Inter"; font-weight: 400; font-display: swap; src: url("fonts/inter-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 500; font-display: swap; src: url("fonts/inter-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 600; font-display: swap; src: url("fonts/inter-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 700; font-display: swap; src: url("fonts/inter-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 400; font-display: swap; src: url("fonts/ibm-plex-sans-arabic-arabic-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 600; font-display: swap; src: url("fonts/ibm-plex-sans-arabic-arabic-600-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 700; font-display: swap; src: url("fonts/ibm-plex-sans-arabic-arabic-700-normal.woff2") format("woff2"); }

:root, [data-bs-theme=light] {
  --brand1: #2F5BFF; --brand2: #7B3FE4; --brand-grad: linear-gradient(135deg, #2F5BFF, #7B3FE4);
  --navy: #0E1526; --navy-2: #1B2640; --accent: #2F5BFF;
  --surface: #F4F6FB; --card: #FFFFFF; --border: #E3E7F0; --soft: #EEF1F8; --head: #F7F8FC; --hover: #F3F6FF;
  --text: #0E1526; --muted: #535D72;
  --crit: #C42B2B; --critbg: #FDECEC; --high: #B4500A; --highbg: #FFF1E6; --med: #8A6A00; --medbg: #FFF7D6;
  --ok: #14794A; --okbg: #E6F6EE; --info: #2F5BFF; --infobg: #EAF0FF;
  --shadow: 0 1px 2px rgba(14,21,38,.05), 0 8px 24px rgba(14,21,38,.06);
  --side-bg: linear-gradient(180deg, #0B1330 0%, #121B3D 100%); --side-text: #C9D2E8; --side-muted: #8D98B6;
  --bs-body-bg: #F4F6FB; --bs-body-color: #0E1526; --bs-border-color: #E3E7F0; --bs-secondary-color: #535D72;
  --bs-primary: #2F5BFF; --bs-primary-rgb: 47, 91, 255; --bs-link-color: #2F5BFF; --bs-link-color-rgb: 47, 91, 255;
  --bs-link-hover-color: #2346CC; --bs-link-hover-color-rgb: 35, 70, 204;
}
[data-bs-theme=dark] {
  --navy: #E8ECF5; --navy-2: #1B2640; --accent: #7D97FF;
  --surface: #0A0F1E; --card: #111A2E; --border: #22304D; --soft: #17223A; --head: #141F36; --hover: #18254A;
  --text: #E8ECF5; --muted: #A3AEC4;
  --crit: #FF8A8A; --critbg: #3A1620; --high: #FFB37A; --highbg: #3A2414; --med: #F2D266; --medbg: #332B10;
  --ok: #6EE2A6; --okbg: #103325; --info: #8FA8FF; --infobg: #18244A;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px rgba(0,0,0,.35);
  --side-bg: linear-gradient(180deg, #070B17 0%, #0D1428 100%);
  --bs-body-bg: #0A0F1E; --bs-body-color: #E8ECF5; --bs-border-color: #22304D; --bs-secondary-color: #A3AEC4;
  --bs-tertiary-bg: #141F36; --bs-secondary-bg: #17223A;
  --bs-primary: #5B7CFF; --bs-primary-rgb: 91, 124, 255; --bs-link-color: #8FA8FF; --bs-link-color-rgb: 143, 168, 255;
  --bs-link-hover-color: #B3C3FF; --bs-link-hover-color-rgb: 179, 195, 255;
  color-scheme: dark;
}

body { background: var(--surface); color: var(--text); font-family: "Inter", "IBM Plex Sans Arabic", "Segoe UI", Tahoma, Arial, sans-serif; font-size: 14.5px; -webkit-font-smoothing: antialiased; }
[dir=rtl] body { font-family: "IBM Plex Sans Arabic", "Inter", "Segoe UI", Tahoma, Arial, sans-serif; }
h1, h2, h3, h4, h5, h6, .page-title, .kpi .kpi-value, .cc-num { font-family: Inter, "IBM Plex Sans Arabic", sans-serif; letter-spacing: -.011em; }
[dir=rtl] h1, [dir=rtl] h2, [dir=rtl] h3, [dir=rtl] h4, [dir=rtl] h5, [dir=rtl] h6, [dir=rtl] .page-title { font-family: "IBM Plex Sans Arabic", Inter, sans-serif; letter-spacing: 0; }
a { color: var(--bs-link-color); }
.text-muted { color: var(--muted) !important; }

/* ---------- side menu ---------- */
.sidebar { width: 250px; flex-shrink: 0; min-height: 100vh; background: var(--side-bg); color: var(--side-text); padding: 16px 12px; position: sticky; top: 0; max-height: 100vh; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #2A355A transparent; }
.offcanvas .sidebar { width: auto; min-height: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 16px; border-bottom: 1px solid rgba(255,255,255,.08); margin-bottom: 8px; }
.brand-badge { background: var(--brand-grad); color: #fff; font: 700 13px/1 Inter, "IBM Plex Sans Arabic", sans-serif; letter-spacing: 2.5px; padding: 9px 11px; border-radius: 10px; box-shadow: 0 6px 16px rgba(47,91,255,.35); }
.brand-mark { font: 700 17px/1.15 Inter, "IBM Plex Sans Arabic", sans-serif; color: #fff; }
.brand-org { font-size: 11.5px; color: var(--side-muted); }
.nav-section { font-size: 12px; color: var(--side-muted); margin: 16px 10px 6px; font-weight: 600; }
.nav-link-item { display: block; padding: 8px 12px; border-radius: 10px; color: var(--side-text); text-decoration: none; font-size: 14px; font-weight: 500; transition: background .15s, color .15s; }
.nav-link-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-link-item.active { background: var(--brand-grad); color: #fff; box-shadow: 0 6px 16px rgba(47,91,255,.3); }

/* ---------- top bar ---------- */
.topbar { background: color-mix(in srgb, var(--card) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); padding: 10px 22px; position: sticky; top: 0; z-index: 1020; gap: 12px; }
.cmdk { display: flex; align-items: center; gap: 10px; min-width: 240px; max-width: 460px; flex: 1 1 280px; min-height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--soft); color: var(--muted); font-size: 14px; text-align: start; cursor: pointer; }
.cmdk:hover { border-color: var(--brand1); }
.cmdk kbd { margin-inline-start: auto; font: 600 11px Inter, sans-serif; color: var(--muted); background: var(--card); border: 1px solid var(--border); border-radius: 6px; padding: 3px 6px; }
.btn-brand { background: var(--brand-grad); border: 0; color: #fff; font-weight: 600; }
.btn-brand:hover, .btn-brand:focus { color: #fff; filter: brightness(1.08); }
.theme-seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--soft); border: 1px solid var(--border); }
.theme-seg button { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 11px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font: 600 12.5px Inter, "IBM Plex Sans Arabic", sans-serif; cursor: pointer; }
.theme-seg button[aria-checked=true] { background: var(--card); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.12), 0 2px 8px rgba(0,0,0,.08); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--infobg); color: var(--info); font-weight: 700; font-size: 13px; }

/* ---------- surfaces ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); color: var(--text); }
.card-header { background: transparent; font-weight: 600; border-bottom: 1px solid var(--border); padding: 14px 18px; }
.card-header:first-child { border-radius: 16px 16px 0 0; }
.list-group-item { background: transparent; color: var(--text); border-color: var(--border); }
.list-group-item-action:hover { background: var(--hover); }
.kpi { padding: 16px 18px; }
.kpi .kpi-label { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.kpi .kpi-value { font-size: 30px; font-weight: 700; color: var(--text); line-height: 1.15; }
.kpi .kpi-sub { font-size: 12px; color: var(--muted); }
.kpi.alert-kpi .kpi-value { color: var(--crit); }
.page-title { font-size: 22px; font-weight: 600; color: var(--text); margin-bottom: 0; letter-spacing: -.015em; line-height: 1.25; }
.progress { height: 8px; background: var(--soft); border-radius: 99px; }
.progress-bar { border-radius: 99px; }
.ai-box { white-space: pre-wrap; background: var(--infobg); border: 1px solid var(--border); border-radius: 12px; padding: 14px; line-height: 1.8; color: var(--text); }
.detail-dl dt { color: var(--muted); font-weight: 500; font-size: 13px; }
.detail-dl dd { margin-bottom: 10px; }
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--side-bg); }
.form-control, .form-select { font-size: 14px; border-radius: 10px; border-color: var(--border); }
.form-control:focus, .form-select:focus { border-color: var(--brand1); box-shadow: 0 0 0 3px rgba(47,91,255,.18); }
.btn { border-radius: 10px; font-weight: 500; }
.btn-primary { background: var(--brand1); border-color: var(--brand1); }
.dropdown-menu { border-radius: 14px; border-color: var(--border); box-shadow: var(--shadow); }
select[multiple] { min-height: 140px; }
.alert { border-radius: 14px; }

/* soft status pills: every Bootstrap badge colour, readable in both themes */
.badge { font-weight: 600; border-radius: 99px; padding: .42em .75em; }
.badge.bg-danger, .badge.text-bg-danger { background: var(--critbg) !important; color: var(--crit) !important; }
.badge.bg-warning, .badge.text-bg-warning { background: var(--medbg) !important; color: var(--med) !important; }
.badge.bg-success, .badge.text-bg-success { background: var(--okbg) !important; color: var(--ok) !important; }
.badge.bg-info, .badge.text-bg-info, .badge.bg-primary, .badge.text-bg-primary { background: var(--infobg) !important; color: var(--info) !important; }
.badge.bg-secondary, .badge.text-bg-secondary, .badge.bg-light, .badge.text-bg-light { background: var(--soft) !important; color: var(--muted) !important; }
.badge.bg-dark, .badge.text-bg-dark { background: var(--text) !important; color: var(--surface) !important; }

/* ---------- pro tables ---------- */
.table { font-size: 13.5px; margin-bottom: 0; --bs-table-bg: transparent; --bs-table-color: var(--text); --bs-table-hover-bg: var(--hover); --bs-table-hover-color: var(--text); border-color: var(--border); }
.table > :not(caption) > * > * { padding: .8rem .9rem; border-bottom-color: var(--border); }
.table thead th { background: var(--head); color: var(--muted); font-weight: 600; font-size: 12.5px; white-space: nowrap; }

.table td a.row-link { color: var(--info); text-decoration: none; font-weight: 600; }
.table td a.row-link:hover { text-decoration: underline; }
.table-pro { max-height: 72vh; overflow: auto; border-radius: 16px; }
.table-pro thead tr:first-child th { position: sticky; top: 0; z-index: 2; }
.table-pro thead tr.col-filters th { position: sticky; top: 41px; z-index: 2; background: var(--card); }
.density-compact .table > :not(caption) > * > * { padding: .35rem .6rem; }
.density-compact .table { font-size: 13px; }
.col-filters .form-select, .col-filters .form-control { font-size: 12.5px; min-height: 30px; padding-top: 2px; padding-bottom: 2px; }
.list-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.nav-tabs { border-bottom-color: var(--border); }
.nav-tabs .nav-link { border: 0; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 600; }
.nav-tabs .nav-link.active { background: transparent; color: var(--text); border-bottom-color: var(--brand1); }
.nav-pills .nav-link { border-radius: 99px; color: var(--muted); }
.nav-pills .nav-link.active { background: var(--text); color: var(--surface); }
.pagination .page-link { border-radius: 10px; margin: 0 2px; border-color: var(--border); background: var(--card); color: var(--text); }

/* risk heat map */
.heatmap td { width: 52px; height: 42px; text-align: center; font-weight: 700; color: #fff; border: 3px solid var(--card); border-radius: 8px; }
.heatmap .lv-low { background: #1E9E5A; } .heatmap .lv-medium { background: #E3B505; color: #2A2200; }
.heatmap .lv-high { background: #D9480F; } .heatmap .lv-critical { background: #C42B2B; }
.heatmap .axis { background: transparent; color: var(--muted); font-weight: 500; font-size: 12px; }

/* ---------- command center (dashboard) ---------- */
.cc-hero { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.cc-greet { font-size: 13px; color: var(--muted); font-weight: 500; }
.cc-title { font-size: 26px; font-weight: 600; margin: 2px 0 2px; letter-spacing: -.02em; }
.cc-sub { font-size: 14px; color: var(--muted); }
.cc-rings { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.cc-ring-card { display: flex; align-items: center; gap: 14px; padding: 14px; border: 1px solid var(--border); border-radius: 14px; text-decoration: none; color: var(--text); transition: border-color .15s, transform .15s; }
.cc-ring-card:hover { border-color: var(--brand1); transform: translateY(-1px); color: var(--text); }
.cc-ring { width: 84px; height: 84px; flex: none; border-radius: 50%; display: grid; place-items: center; }
.cc-ring > span { width: 64px; height: 64px; border-radius: 50%; background: var(--card); display: grid; place-items: center; font: 700 17px/1 Inter, "IBM Plex Sans Arabic", sans-serif; }
.cc-count { display: flex; align-items: center; gap: 12px; background: var(--soft); border-radius: 12px; padding: 10px 14px; }
.cc-count b { font: 700 24px/1 Inter, "IBM Plex Sans Arabic", sans-serif; }
.cc-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.cc-kpi { background: var(--card); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); padding: 16px 18px; display: flex; flex-direction: column; gap: 9px; text-decoration: none; color: var(--text); transition: border-color .15s, transform .15s; }
.cc-kpi:hover { border-color: var(--brand1); transform: translateY(-2px); color: var(--text); }
.cc-kpi .cc-num { font-size: 36px; font-weight: 700; line-height: 1; }
.cc-tag { font-size: 12px; font-weight: 700; padding: 4px 9px; border-radius: 99px; white-space: nowrap; }
.cc-tag.crit { color: var(--crit); background: var(--critbg); } .cc-tag.high { color: var(--high); background: var(--highbg); }
.cc-tag.med { color: var(--med); background: var(--medbg); } .cc-tag.ok { color: var(--ok); background: var(--okbg); }
.cc-tag.info { color: var(--info); background: var(--infobg); }
.cc-bar { height: 6px; border-radius: 99px; background: var(--soft); overflow: hidden; }
.cc-bar > span { display: block; height: 100%; border-radius: 99px; }
.fill-crit { background: var(--crit); } .fill-high { background: var(--high); } .fill-med { background: var(--med); }
.fill-ok { background: var(--ok); } .fill-info { background: var(--info); }
.cc-action { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid var(--border); }
.cc-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.cc-ai { border-radius: 16px; padding: 20px 22px; color: #fff; background: linear-gradient(150deg, #1E3FD9 0%, #5B2DB8 100%); box-shadow: var(--shadow); }
.cc-ai .form-control { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.35); color: #fff; }
.cc-ai .form-control::placeholder { color: #DCE2FF; }
.cc-ai .cc-prompt { display: block; width: 100%; text-align: start; min-height: 42px; border-radius: 10px; border: 1px solid rgba(255,255,255,.28); background: transparent; color: #fff; font-size: 13px; font-weight: 500; padding: 8px 12px; margin-top: 8px; }
.cc-ai .cc-prompt:hover { background: rgba(255,255,255,.1); }
.cc-stat { background: var(--soft); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--text); }
.cc-stat b { font: 700 22px/1 Inter, "IBM Plex Sans Arabic", sans-serif; }

/* command palette (Ctrl K) */
.cmdk-list { max-height: 55vh; overflow: auto; }
.cmdk-item { display: flex; justify-content: space-between; gap: 10px; padding: 10px 14px; border-radius: 10px; color: var(--text); text-decoration: none; }
.cmdk-item.on, .cmdk-item:hover { background: var(--hover); color: var(--text); }
.modal-content { background: var(--card); color: var(--text); border-radius: 16px; border-color: var(--border); }

@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  body { background: #fff; }
  .card { break-inside: avoid; box-shadow: none; }
}
.main-wrap { min-width: 0; }
/* fixed side menu on large screens (RTL and LTR) */
@media (min-width: 992px) {
  nav.sidebar { position: fixed; top: 0; bottom: 0; inset-inline-start: 0; max-height: none; }
  .main-wrap { margin-inline-start: 250px; }
}
@media print { .main-wrap { margin: 0 !important; } }

/* clickable dashboard items */
a.kpi-link { text-decoration: none; color: inherit; display: block; }
a.kpi-link .card { transition: box-shadow .15s, transform .15s, border-color .15s; }
a.kpi-link:hover .card { border-color: var(--brand1); transform: translateY(-2px); }
.heatmap a.cell-link { display: block; color: inherit; text-decoration: none; line-height: 36px; }
.heatmap td:has(a.cell-link):hover { outline: 3px solid var(--text); outline-offset: -3px; cursor: pointer; }
.list-group-item-action strong { color: var(--text); }

/* links the user has no access to (core/linkguard.py) */
[data-noaccess] { cursor: not-allowed; opacity: .6; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ===================== p77: one look for every page, safe in both themes ===================== */
.crumb { font-size: 12.5px; color: var(--muted); font-weight: 500; margin-bottom: 6px; }
.crumb span { opacity: .55; margin: 0 6px; }
.page-sub { color: var(--muted); font-size: 13.5px; max-width: 920px; }
hr { border-color: var(--border); opacity: 1; }
pre, code { color: var(--text); }
pre { background: var(--soft); border-radius: 10px; padding: 12px; }

/* legacy Bootstrap utilities that are fixed-light → follow the theme */
.bg-light:not(.badge), .bg-white:not(.badge) { background-color: var(--soft) !important; color: var(--text); }
.text-dark:not(.badge) { color: var(--text) !important; }
.text-danger { color: var(--crit) !important; }
.text-warning, .text-warning-emphasis { color: var(--high) !important; }
.text-success { color: var(--ok) !important; }
.text-primary, .text-info { color: var(--info) !important; }
.text-muted, .text-secondary, .text-body-secondary { color: var(--muted) !important; }
.border-primary { border-color: var(--brand1) !important; }
.bg-success-subtle { background-color: var(--okbg) !important; }
.bg-warning-subtle { background-color: var(--medbg) !important; }
.bg-danger-subtle { background-color: var(--critbg) !important; }
.bg-primary-subtle, .bg-info-subtle { background-color: var(--infobg) !important; }

/* buttons */
.btn-primary { --bs-btn-bg: var(--brand1); --bs-btn-border-color: var(--brand1); --bs-btn-hover-bg: #2346CC; --bs-btn-hover-border-color: #2346CC; --bs-btn-active-bg: #1E3DB3; --bs-btn-active-border-color: #1E3DB3; --bs-btn-disabled-bg: var(--brand1); --bs-btn-disabled-border-color: var(--brand1); }
.btn-light, .btn-outline-secondary, .btn-outline-light, .btn-secondary {
  --bs-btn-bg: var(--card); --bs-btn-color: var(--text); --bs-btn-border-color: var(--border);
  --bs-btn-hover-bg: var(--hover); --bs-btn-hover-color: var(--text); --bs-btn-hover-border-color: var(--border);
  --bs-btn-active-bg: var(--soft); --bs-btn-active-color: var(--text); --bs-btn-active-border-color: var(--brand1);
  --bs-btn-disabled-bg: var(--card); --bs-btn-disabled-color: var(--muted); --bs-btn-disabled-border-color: var(--border); }
.btn-outline-light { --bs-btn-color: var(--muted); }
.btn-dark { --bs-btn-bg: var(--text); --bs-btn-color: var(--surface); --bs-btn-border-color: var(--text); --bs-btn-hover-bg: var(--text); --bs-btn-hover-color: var(--surface); --bs-btn-active-bg: var(--text); --bs-btn-active-color: var(--surface); }
.btn-outline-primary { --bs-btn-color: var(--info); --bs-btn-border-color: color-mix(in srgb, var(--info) 45%, transparent); --bs-btn-hover-bg: var(--infobg); --bs-btn-hover-color: var(--info); --bs-btn-hover-border-color: var(--info); --bs-btn-active-bg: var(--brand1); --bs-btn-active-color: #fff; --bs-btn-active-border-color: var(--brand1); }
.btn-outline-success { --bs-btn-color: var(--ok); --bs-btn-border-color: color-mix(in srgb, var(--ok) 45%, transparent); --bs-btn-hover-bg: var(--okbg); --bs-btn-hover-color: var(--ok); --bs-btn-hover-border-color: var(--ok); --bs-btn-active-bg: var(--okbg); --bs-btn-active-color: var(--ok); --bs-btn-active-border-color: var(--ok); }
.btn-outline-danger { --bs-btn-color: var(--crit); --bs-btn-border-color: color-mix(in srgb, var(--crit) 45%, transparent); --bs-btn-hover-bg: var(--critbg); --bs-btn-hover-color: var(--crit); --bs-btn-hover-border-color: var(--crit); }
.btn-success { --bs-btn-bg: #14794A; --bs-btn-border-color: #14794A; --bs-btn-hover-bg: #0F6239; --bs-btn-hover-border-color: #0F6239; }
.btn-link { --bs-btn-color: var(--info); --bs-btn-hover-color: var(--info); }
.btn-group > .btn.active { background: var(--soft); color: var(--text); border-color: var(--brand1); }

/* forms */
.form-control, .form-select { background-color: var(--card); color: var(--text); }
.form-control::placeholder { color: var(--muted); opacity: .8; }
.form-control:disabled, .form-select:disabled, .form-control[readonly] { background-color: var(--soft); }
.input-group-text { background: var(--soft); border-color: var(--border); color: var(--muted); border-radius: 10px; }
.form-check-input { background-color: var(--card); border-color: color-mix(in srgb, var(--muted) 55%, transparent); }
.form-check-input:checked { background-color: var(--brand1); border-color: var(--brand1); }
.form-text, .helptext { color: var(--muted); }
.invalid-feedback, .errorlist { color: var(--crit); }

/* alerts: soft tint + coloured edge, readable in both themes */
.alert { color: var(--text); border: 1px solid var(--border); border-inline-start-width: 4px; background: var(--card); }
.alert-info, .alert-primary { background: var(--infobg); border-color: color-mix(in srgb, var(--info) 30%, transparent); border-inline-start-color: var(--info); }
.alert-warning { background: var(--medbg); border-color: color-mix(in srgb, var(--med) 30%, transparent); border-inline-start-color: var(--high); }
.alert-danger, .alert-error { background: var(--critbg); border-color: color-mix(in srgb, var(--crit) 30%, transparent); border-inline-start-color: var(--crit); }
.alert-success { background: var(--okbg); border-color: color-mix(in srgb, var(--ok) 30%, transparent); border-inline-start-color: var(--ok); }
.alert-light, .alert-secondary { background: var(--soft); border-inline-start-color: var(--muted); }
.alert .alert-link, .alert a { color: inherit; font-weight: 600; }

/* tables: light header class + state rows become a coloured edge with a faint tint, not a solid fill */
.table-light { --bs-table-bg: var(--head); --bs-table-color: var(--muted); --bs-table-border-color: var(--border); }
.table > :not(caption) > tr.table-danger, .table > :not(caption) > tr.table-warning, .table > :not(caption) > tr.table-success,
.table > :not(caption) > tr.table-info, .table > :not(caption) > tr.table-secondary, .table > :not(caption) > tr.table-primary,
.table tr.row-late, .table tr.row-soon {
  --bs-table-color: var(--text); --bs-table-border-color: var(--border); --bs-table-hover-color: var(--text); --bs-table-hover-bg: var(--hover); }
.table tr.table-danger, .table tr.row-late { --bs-table-bg: color-mix(in srgb, var(--critbg) 45%, transparent); }
.table tr.table-warning, .table tr.row-soon { --bs-table-bg: color-mix(in srgb, var(--medbg) 45%, transparent); }
.table tr.table-success { --bs-table-bg: color-mix(in srgb, var(--okbg) 45%, transparent); }
.table tr.table-info, .table tr.table-primary { --bs-table-bg: color-mix(in srgb, var(--infobg) 45%, transparent); }
.table tr.table-secondary { --bs-table-bg: var(--soft); }
.table tr.table-danger > :first-child, .table tr.row-late > :first-child { border-inline-start: 3px solid var(--crit); }
.table tr.table-warning > :first-child, .table tr.row-soon > :first-child { border-inline-start: 3px solid var(--high); }
.table tr.table-success > :first-child { border-inline-start: 3px solid var(--ok); }
.table-sm > :not(caption) > * > * { padding: .5rem .65rem; }
.table-bordered > :not(caption) > * > * { border-color: var(--border); }
.table-striped > tbody > tr:nth-of-type(odd) > * { --bs-table-bg-type: var(--head); --bs-table-color-type: var(--text); }
.card > .table-responsive:first-child, .card > .table:first-child { border-radius: 16px; }
.table-card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); overflow: auto; }
.table-card.table-pro { max-height: 72vh; }

/* severity pills (critical / high / medium / low) with a dot */
.badge.sev { display: inline-flex; align-items: center; gap: 6px; }
.badge.sev::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.tone-crit { background: var(--critbg) !important; color: var(--crit) !important; }
.badge.tone-high { background: var(--highbg) !important; color: var(--high) !important; }
.badge.tone-med { background: var(--medbg) !important; color: var(--med) !important; }
.badge.tone-low { background: var(--okbg) !important; color: var(--ok) !important; }

/* KPI cards on every page: same tile as the command center, accent edge */
.card.kpi { position: relative; overflow: hidden; }
.card.kpi::before { content: ""; position: absolute; inset-block: 14px; inset-inline-start: 0; width: 3px; border-radius: 3px; background: var(--brand-grad); }
.card.kpi.alert-kpi::before { background: var(--crit); }
.card.kpi.border-primary { box-shadow: 0 0 0 2px var(--brand1), var(--shadow); }
.stat-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.stat-tile { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 11px 14px; display: flex; flex-direction: column; gap: 3px; box-shadow: var(--shadow); text-decoration: none; color: var(--text); }
a.stat-tile:hover { border-color: var(--brand1); color: var(--text); }
.stat-tile span { font-size: 12px; font-weight: 600; color: var(--muted); }
.stat-tile b { font: 700 24px/1.1 Inter, "IBM Plex Sans Arabic", sans-serif; }
.stat-tile.t-danger b { color: var(--crit); } .stat-tile.t-warning b { color: var(--high); } .stat-tile.t-success b { color: var(--ok); }
.stat-tile.t-primary b, .stat-tile.t-info b { color: var(--info); } .stat-tile.t-secondary b { color: var(--muted); }
.stat-tile.on { border-color: var(--brand1); box-shadow: 0 0 0 2px var(--brand1); }

/* SLA / deadline countdown pill */
.due { display: inline-flex; flex-direction: column; gap: 5px; min-width: 92px; }
.due b { font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.due i { display: block; height: 4px; border-radius: 99px; background: var(--soft); overflow: hidden; }
.due i s { display: block; height: 100%; border-radius: 99px; background: currentColor; text-decoration: none; }
.due-late { color: var(--crit); } .due-soon { color: var(--high); } .due-ok { color: var(--ok); }

/* chips used as filters (types, months, tags) */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 99px; border: 1px solid var(--border); background: var(--card); color: var(--text); font-size: 12.5px; font-weight: 600; text-decoration: none; }
.chip:hover { border-color: var(--brand1); color: var(--text); }
.chip.on { background: var(--text); color: var(--surface); border-color: var(--text); }
.chip .n { color: var(--muted); font-weight: 600; } .chip.on .n { color: inherit; opacity: .75; }
.chip.late { border-color: color-mix(in srgb, var(--crit) 40%, transparent); }
.chip .n-late { color: var(--crit); }

/* floating bars: review counter + bulk actions */
.float-bar { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 1050; display: flex; align-items: center; gap: 10px; padding: 9px 12px 9px 18px; border-radius: 99px; background: var(--text); color: var(--surface); box-shadow: 0 10px 30px rgba(0,0,0,.25); font-size: 13.5px; }
.float-bar .big { font: 700 20px/1 Inter, "IBM Plex Sans Arabic", sans-serif; }
.float-bar.pulse { background: var(--brand1); color: #fff; }
.float-bar .form-select { width: auto; min-width: 150px; background-color: transparent; color: inherit; border-color: color-mix(in srgb, var(--surface) 35%, transparent); font-size: 13px; }
.float-bar .form-select option { color: var(--text); background: var(--card); }
.float-bar .btn { border-radius: 99px; }
.float-bar .btn-ghost { color: inherit; border: 1px solid color-mix(in srgb, var(--surface) 35%, transparent); background: transparent; }
.float-bar .btn-ghost:hover { background: color-mix(in srgb, var(--surface) 12%, transparent); color: inherit; }
.bulk-col { width: 38px; }

/* unified compliance map: quarter board */
.qboard { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; }
.qcol { background: var(--card); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.qcol.now { box-shadow: 0 0 0 2px var(--brand1), var(--shadow); }
.qcol-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); font-weight: 700; }
.qcol-body { padding: 12px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.qblock { border: 1px solid var(--border); border-inline-start: 4px solid var(--muted); border-radius: 12px; padding: 10px 12px; background: var(--card); }
.qblock.st-green { border-inline-start-color: var(--ok); } .qblock.st-orange { border-inline-start-color: var(--high); }
.qblock.st-red { border-inline-start-color: var(--crit); background: color-mix(in srgb, var(--critbg) 35%, var(--card)); }
.qblock.shared { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand1) 55%, transparent); }
.qblock .qpct { font: 700 16px/1 Inter, "IBM Plex Sans Arabic", sans-serif; }
.qblock.st-green .qpct { color: var(--ok); } .qblock.st-orange .qpct { color: var(--high); } .qblock.st-red .qpct { color: var(--crit); } .qblock.st-grey .qpct { color: var(--muted); }
.qblock .progress { height: 5px; margin: 8px 0 6px; }
.qblock.st-green .progress-bar { background: var(--ok); } .qblock.st-orange .progress-bar { background: var(--high); }
.qblock.st-red .progress-bar { background: var(--crit); } .qblock.st-grey .progress-bar { background: var(--muted); }
.qtags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.qtags span { font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 99px; background: var(--soft); color: var(--muted); }
.qmeta { font-size: 12px; color: var(--muted); }
.qdeadline { margin-top: auto; display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 12px; background: var(--medbg); color: var(--text); text-decoration: none; font-size: 12.5px; font-weight: 600; }
.qdeadline:hover { color: var(--text); outline: 2px solid var(--high); }
.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-inline-end: 6px; vertical-align: middle; }

/* numbers line up in tables and tiles */
.stat-tile b, .kpi-value, .cc-ring > span, .due b, .count-pill, .float-bar .big { font-variant-numeric: tabular-nums; }

/* page header used by lists and hand-built pages */
.list-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.count-pill { display: inline-block; vertical-align: middle; margin-inline-start: 6px; padding: 2px 9px; border-radius: 99px; background: var(--soft); color: var(--muted); font-size: 13px; font-weight: 600; letter-spacing: 0; }
.rev-meter { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.rev-meter b { color: var(--ok); }
.rev-meter a { color: var(--muted); text-decoration: none; border-bottom: 1px dashed var(--border); }
.rev-meter a.on, .rev-meter a:hover { color: var(--text); border-bottom-color: var(--brand1); }

/* segmented tabs (status tabs, SIEM views) */
.seg-tabs { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: 12px; background: var(--soft); border: 1px solid var(--border); }
.seg-tabs a { padding: 6px 12px; border-radius: 9px; color: var(--muted); font-size: 13px; font-weight: 600; text-decoration: none; display: inline-flex; gap: 6px; align-items: center; }
.seg-tabs a span { font-size: 11.5px; padding: 1px 7px; border-radius: 99px; background: var(--card); color: var(--muted); }
.seg-tabs a:hover { color: var(--text); }
.seg-tabs a.on { background: var(--card); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 2px 8px rgba(0,0,0,.06); }
.seg-tabs a.on span { background: var(--infobg); color: var(--info); }

/* filter bar */
.fbar { background: var(--card); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); padding: 10px 12px; }
.fbar-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.fbar-main { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; flex: 1 1 340px; }
.fbar-search { flex: 1 1 260px; display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--muted); margin: 0; }
.fbar-search:focus-within { border-color: var(--brand1); box-shadow: 0 0 0 3px rgba(47,91,255,.18); }
.fbar-search input { border: 0; outline: 0; background: transparent; color: var(--text); flex: 1; min-width: 0; font-size: 14px; }
.fbar-search kbd { font: 600 11px Inter, sans-serif; color: var(--muted); background: var(--card); border: 1px solid var(--border); border-radius: 6px; padding: 2px 6px; }
.fbar .btn-sm { height: 34px; display: inline-flex; align-items: center; gap: 6px; }
.fbar .btn.active { background: var(--infobg); color: var(--info); border-color: color-mix(in srgb, var(--info) 40%, transparent); }
.fbar-n { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--brand1); color: #fff; font-size: 11px; font-weight: 700; }
.fbar-panel { min-width: 300px; max-width: min(640px, 92vw); padding: 14px; background: var(--card); color: var(--text); }
.fbar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.fbar-views { min-width: 280px; }
.fbar-views .dropdown-item { color: var(--text); font-size: 13.5px; padding: 6px 10px; }
.fbar-views .dropdown-item:hover { background: var(--hover); }
.fbar-views .dropdown-item.active { background: var(--infobg); color: var(--info); }
.fbar-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); }
.chip.on-soft { background: var(--infobg); color: var(--info); border-color: transparent; }
.chip.on-soft span { opacity: .7; font-size: 14px; line-height: 1; }
.chip.on-soft:hover { border-color: var(--info); }
.dropdown-menu { background: var(--card); color: var(--text); }

/* month timeline: click a bar to filter that month */
.tl { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; align-items: end; height: 74px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); }
.tl-bar { display: flex; flex-direction: column; align-items: stretch; justify-content: flex-end; height: 100%; text-decoration: none; }
.tl-bar s { display: block; border-radius: 6px 6px 2px 2px; background: color-mix(in srgb, var(--brand1) 35%, var(--soft)); transition: background .15s; min-height: 2px; }
.tl-bar span { font-size: 10.5px; color: var(--muted); text-align: center; margin-top: 4px; white-space: nowrap; overflow: hidden; }
.tl-bar:hover s { background: var(--brand1); }
.tl-bar.on s { background: var(--brand-grad); }
.tl-bar.on span { color: var(--text); font-weight: 700; }
.tl-bar.zero s { background: var(--soft); }

/* review mark ✓ is a round tick, bulk selection is a square box */
.form-check-input.rev { border-radius: 50%; }
.table tr.row-picked { --bs-table-bg: color-mix(in srgb, var(--infobg) 70%, transparent); }

/* SIEM coverage header */
.cov-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 1199px) { .cov-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cov-grid > * { grid-column: span 1 !important; } }
.cov-card { grid-column: span 2; display: flex; align-items: center; gap: 14px; background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow); }
.cov-label { font-weight: 600; }
.cov-sub { font-size: 12.5px; color: var(--muted); }
.mini-meter { display: flex; flex-direction: column; gap: 4px; min-width: 60px; }
.mini-meter b { font-size: 12.5px; }
.mini-meter i { display: block; height: 4px; border-radius: 99px; background: var(--soft); overflow: hidden; }
.mini-meter i s { display: block; height: 100%; background: var(--ok); }
.siem-assets thead th { width: 1%; white-space: normal; vertical-align: bottom; line-height: 1.2; }
/* coloured cells that need dark text in both themes (risk matrix, legends) */
.bg-warning.text-dark:not(.badge), .bg-info.text-dark:not(.badge), .bg-warning:not(.badge) .text-dark { color: #2A2200 !important; }
.bg-light.border, .bg-light .border { border-color: var(--border) !important; }
.list-group-item.active { background: var(--infobg); color: var(--info); border-color: var(--border); }
.offcanvas { background: var(--card); color: var(--text); }
.card-footer { background: transparent; border-top-color: var(--border); }
.accordion { --bs-accordion-bg: var(--card); --bs-accordion-color: var(--text); --bs-accordion-border-color: var(--border); --bs-accordion-btn-color: var(--text); --bs-accordion-active-bg: var(--soft); --bs-accordion-active-color: var(--text); }
.tooltip-inner { background: var(--text); color: var(--surface); }
/* forms: grouped sections and a save bar that stays in reach on long forms */
.form-sec { border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px 16px; }
.form-sec > legend { float: none; width: auto; padding: 0 8px; margin-bottom: 6px; font-size: 14px; font-weight: 600; }
.form-actions { position: sticky; bottom: 0; z-index: 5; background: var(--card); padding: 12px 0 4px; border-top: 1px solid var(--border); }
.table thead th::first-letter, .stat-tile span::first-letter, .kpi-label::first-letter, .card-header::first-letter { text-transform: uppercase; }
.btn-outline-warning { --bs-btn-color: var(--high); --bs-btn-border-color: color-mix(in srgb, var(--high) 45%, transparent); --bs-btn-hover-bg: var(--highbg); --bs-btn-hover-color: var(--high); --bs-btn-hover-border-color: var(--high); }

/* p80: progress bars + milestone progress panel */
.pbar { display: inline-flex; flex-direction: column; gap: 4px; min-width: 70px; }
.pbar b { font-size: 12.5px; font-weight: 700; }
.pbar i { display: block; height: 4px; border-radius: 99px; background: var(--soft); overflow: hidden; }
.pbar i s { display: block; height: 100%; border-radius: 99px; background: currentColor; text-decoration: none; }
.pbar-ok { color: var(--ok); } .pbar-info { color: var(--info); } .pbar-high { color: var(--high); } .pbar-muted { color: var(--muted); }
.pbar-lg { min-width: 140px; color: var(--info); } .pbar-lg i { height: 6px; }
.ms-list { display: flex; flex-direction: column; gap: 10px; }
.ms-row { border: 1px solid var(--border); border-inline-start: 4px solid var(--info); border-radius: 10px; padding: 12px 14px; background: var(--card); }
.ms-row.ms-done { border-inline-start-color: var(--ok); }
.ms-row.ms-late { border-inline-start-color: var(--crit); }
.ms-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ms-num { width: 26px; height: 26px; border-radius: 50%; background: var(--soft); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12.5px; }
.ms-title { flex: 1 1 260px; display: flex; flex-direction: column; }
.ms-title a { font-weight: 600; color: var(--text); text-decoration: none; }
.ms-pct { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.ms-pct .form-range { width: 160px; }
.ms-pct output { font-weight: 700; min-width: 42px; }
.ms-note { display: flex; gap: 8px; align-items: flex-start; margin-top: 10px; }
.ms-note textarea { flex: 1; }
.ms-note-ro { margin-top: 8px; color: var(--muted); font-size: 13px; }

/* p81: theme switch on the login page (labels always visible) */
.login-theme { border-top: 1px solid var(--border); }
.login-theme .theme-seg span { display: inline !important; }
