@import url("https://fonts.googleapis.com/css2?family=Libre+Franklin:wght@400;500;600;700&family=Roboto+Condensed:wght@400;600;700&family=Roboto+Slab:wght@400;600&display=swap");

/* NevoScope components. Every value comes from tokens.css (var(--…)); nothing here re-declares a token. */

.ns-root, .ns-root * { box-sizing: border-box; }
.ns-root { font-family: var(--font-sans); font-size: 14px; line-height: 20px; color: var(--ink); background: var(--surface-page); -webkit-font-smoothing: antialiased; }
.ns-num { font-variant-numeric: tabular-nums; }
.ns-muted { color: var(--ink-muted); }
.ns-icon { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ns-icon--sm { width: 14px; height: 14px; }
:where(.ns-root) a { color: var(--link); text-decoration: none; }
:where(.ns-root) a:hover { text-decoration: underline; }
:where(.ns-root) :focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

/* ---------- App shell ---------- */
.ns-app { display: grid; grid-template-columns: var(--sidebar-width) 1fr; min-height: 100%; background: var(--surface-page); }
.ns-sidebar { background: var(--surface-sidebar); color: var(--ink-sidebar); display: flex; flex-direction: column; padding: var(--space-4) var(--space-3); gap: var(--space-1); }
.ns-sidebar__brand { font-family: var(--font-display); font-weight: 700; font-size: 20px; line-height: 24px; letter-spacing: 0.01em; padding: var(--space-2) var(--space-3) var(--space-4); display: flex; align-items: center; gap: var(--space-2); }
.ns-sidebar__brand-mark { width: 10px; height: 10px; border-radius: var(--radius-pill); background: var(--nevo-teal); box-shadow: 14px 0 0 var(--nevo-violet); margin-right: 14px; }
.ns-sidebar__section { font-family: var(--font-display); font-weight: 600; font-size: 12px; line-height: 16px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-sidebar-muted); padding: var(--space-4) var(--space-3) var(--space-1); }
.ns-nav-item { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-3); border-radius: var(--radius-md); color: var(--ink-sidebar); font-weight: 500; text-decoration: none; }
.ns-nav-item:hover { background: var(--surface-sidebar-active); text-decoration: none; }
.ns-nav-item.is-active { background: var(--surface-sidebar-active); font-weight: 600; }
.ns-nav-item.is-active .ns-icon { color: var(--nevo-teal); }
.ns-nav-item__count { margin-left: auto; font-size: 12px; color: var(--ink-sidebar-muted); font-variant-numeric: tabular-nums; }
.ns-sidebar__foot { margin-top: auto; padding: var(--space-3); font-size: 12px; line-height: 16px; color: var(--ink-sidebar-muted); }

.ns-main { display: flex; flex-direction: column; min-width: 0; }
.ns-topbar { height: var(--topbar-height); display: flex; align-items: center; gap: var(--space-4); padding: 0 var(--space-6); background: var(--surface-card); border-bottom: 1px solid var(--border); }
.ns-topbar__spacer { flex: 1; }
.ns-tenant { display: inline-flex; align-items: center; gap: var(--space-2); height: var(--control-height); padding: 0 var(--space-3); border: 1px solid var(--border-control); border-radius: var(--radius-md); background: var(--surface-card); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; }
.ns-tenant__role { font-weight: 400; color: var(--ink-muted); font-size: 12px; }
.ns-avatar { width: 32px; height: 32px; border-radius: var(--radius-pill); background: var(--surface-accent-subtle); color: var(--ink); display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: 13px; }
.ns-content { padding: var(--space-6); display: flex; flex-direction: column; gap: var(--space-4); max-width: var(--content-max); width: 100%; }
.ns-page-header { display: flex; align-items: flex-end; gap: var(--space-4); margin-bottom: var(--space-2); }
.ns-page-header__title { font-family: var(--font-display); font-size: 28px; line-height: 34px; font-weight: 700; margin: 0; }
.ns-page-header__sub { color: var(--ink-muted); margin: 2px 0 0; }
.ns-grid { display: grid; gap: var(--space-4); }
.ns-grid--tiles { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.ns-grid--2-1 { grid-template-columns: 2fr 1fr; }
.ns-grid--1-1 { grid-template-columns: 1fr 1fr; }

/* ---------- Button ---------- */
.ns-btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); height: var(--control-height); padding: 0 var(--space-4); border-radius: var(--radius-md); border: 1px solid transparent; font-family: var(--font-sans); font-size: 14px; line-height: 20px; font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none; }
.ns-btn--primary { background: var(--accent); color: var(--on-accent); }
.ns-btn--primary:hover { background: var(--accent-hover); }
.ns-btn--secondary { background: var(--surface-card); color: var(--ink); border-color: var(--border-control); }
.ns-btn--secondary:hover { background: var(--surface-sunken); }
.ns-btn--ghost { background: transparent; color: var(--link); }
.ns-btn--ghost:hover { background: var(--surface-accent-subtle); }
.ns-btn--danger { background: var(--surface-card); color: var(--status-unapproved-text); border-color: var(--status-unapproved-mark); }
.ns-btn--danger:hover { background: var(--status-unapproved-bg); }
.ns-btn--sm { height: 32px; padding: 0 var(--space-3); font-size: 13px; }
.ns-btn[disabled], .ns-btn.is-disabled { opacity: 0.45; cursor: not-allowed; }

/* ---------- Status badge ---------- */
.ns-status { display: inline-flex; align-items: center; gap: var(--space-1); padding: 2px var(--space-2); border-radius: var(--radius-sm); font-family: var(--font-sans); font-size: 12px; line-height: 16px; font-weight: 600; white-space: nowrap; }
.ns-status .ns-icon { width: 12px; height: 12px; stroke-width: 2.5; }
.ns-status--approved   { background: var(--status-approved-bg);   color: var(--status-approved-text); }
.ns-status--restricted { background: var(--status-restricted-bg); color: var(--status-restricted-text); }
.ns-status--review     { background: var(--status-review-bg);     color: var(--status-review-text); }
.ns-status--wrongtier  { background: var(--status-wrongtier-bg);  color: var(--status-wrongtier-text); }
.ns-status--unapproved { background: var(--status-unapproved-bg); color: var(--status-unapproved-text); }
.ns-status--unverified { background: var(--status-unverified-bg); color: var(--status-unverified-text); }

/* ---------- Risk rating ---------- */
.ns-risk { display: inline-flex; align-items: center; gap: var(--space-2); font-size: 13px; line-height: 18px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.ns-risk__meter { display: inline-flex; gap: 2px; align-items: flex-end; }
.ns-risk__meter i { display: block; width: 4px; border-radius: 1px; background: var(--chart-grid); }
.ns-risk__meter i:nth-child(1) { height: 6px; } .ns-risk__meter i:nth-child(2) { height: 9px; } .ns-risk__meter i:nth-child(3) { height: 12px; } .ns-risk__meter i:nth-child(4) { height: 15px; }
.ns-risk--low      .ns-risk__meter i:nth-child(-n+1) { background: var(--risk-low); }
.ns-risk--medium   .ns-risk__meter i:nth-child(-n+2) { background: var(--risk-medium); }
.ns-risk--high     .ns-risk__meter i:nth-child(-n+3) { background: var(--risk-high); }
.ns-risk--critical .ns-risk__meter i:nth-child(-n+4) { background: var(--risk-critical); }
.ns-risk--lg { font-family: var(--font-display); font-size: 20px; line-height: 26px; font-weight: 700; gap: var(--space-3); }
.ns-risk--lg .ns-risk__meter { gap: 3px; }
.ns-risk--lg .ns-risk__meter i { width: 8px; }
.ns-risk--lg .ns-risk__meter i:nth-child(1) { height: 10px; } .ns-risk--lg .ns-risk__meter i:nth-child(2) { height: 16px; } .ns-risk--lg .ns-risk__meter i:nth-child(3) { height: 22px; } .ns-risk--lg .ns-risk__meter i:nth-child(4) { height: 28px; }

/* ---------- Card ---------- */
.ns-card { background: var(--surface-card); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); min-width: 0; display: flex; flex-direction: column; }
.ns-card__header { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4) var(--space-5) 0; }
.ns-card__title { font-family: var(--font-display); font-size: 20px; line-height: 26px; font-weight: 700; margin: 0; }
.ns-card__actions { margin-left: auto; display: flex; gap: var(--space-2); align-items: center; }
.ns-card__body { padding: var(--space-4) var(--space-5) var(--space-5); }
.ns-card__body--flush { padding: var(--space-3) 0 0; }
.ns-takeaway { font-family: var(--font-slab); font-size: 15px; line-height: 22px; font-weight: 400; color: var(--ink); margin: var(--space-1) var(--space-5) 0; }

/* ---------- Stat tile ---------- */
.ns-stat { background: var(--surface-card); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.ns-stat__label { font-family: var(--font-display); font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-muted); }
.ns-stat__value { font-family: var(--font-display); font-size: 34px; line-height: 38px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); }
.ns-stat__value small { font-size: 18px; font-weight: 600; color: var(--ink-muted); margin-left: 2px; }
.ns-stat__delta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; font-size: 12px; line-height: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ns-stat__delta--good { color: var(--text-positive); }
.ns-stat__delta--bad { color: var(--text-negative); }
.ns-stat__delta--flat { color: var(--ink-muted); }
.ns-stat__delta span { font-weight: 400; color: var(--ink-muted); margin-left: var(--space-1); white-space: nowrap; }
.ns-grid--tiles .ns-stat__label { min-height: 32px; }
.ns-stat--alert { border-color: var(--status-unapproved-mark); }

/* ---------- Data table ---------- */
.ns-table { width: 100%; border-collapse: collapse; font-size: 13px; line-height: 18px; }
.ns-table th { font-family: var(--font-display); font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-muted); text-align: left; background: var(--surface-sunken); padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--border); white-space: nowrap; }
.ns-table td { padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--border); vertical-align: middle; }
.ns-table tr:last-child td { border-bottom: 0; }
.ns-table tbody tr:hover td { background: var(--surface-sunken); }
.ns-table tr.is-selected td { background: var(--surface-accent-subtle); }
.ns-table th:first-child, .ns-table td:first-child { padding-left: var(--space-5); }
.ns-table th:last-child, .ns-table td:last-child { padding-right: var(--space-5); }
.ns-table .is-num { text-align: right; font-variant-numeric: tabular-nums; }
.ns-tool { display: flex; flex-direction: column; }
.ns-tool__name { font-weight: 600; font-size: 14px; line-height: 20px; }
.ns-tool__meta { color: var(--ink-muted); font-size: 12px; line-height: 16px; }
.ns-new { font-family: var(--font-display); font-size: 11px; line-height: 14px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--status-review-text); background: var(--status-review-bg); border-radius: var(--radius-sm); padding: 1px 5px; margin-left: var(--space-1); vertical-align: 1px; }

/* ---------- Charts ---------- */
.ns-chart { display: block; width: 100%; height: auto; overflow: visible; font-family: var(--font-sans); }
.ns-chart text { fill: var(--ink-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.ns-chart .grid { stroke: var(--chart-grid); stroke-width: 1; }
.ns-chart .gap { stroke: var(--surface-card); stroke-width: 2; }
.ns-fill-approved   { fill: var(--status-approved-mark);   background: var(--status-approved-mark); }
.ns-fill-restricted { fill: var(--status-restricted-mark); background: var(--status-restricted-mark); }
.ns-fill-review     { fill: var(--status-review-mark);     background: var(--status-review-mark); }
.ns-fill-wrongtier  { fill: var(--status-wrongtier-mark);  background: var(--status-wrongtier-mark); }
.ns-fill-unapproved { fill: var(--status-unapproved-mark); background: var(--status-unapproved-mark); }
.ns-fill-unverified { fill: var(--status-unverified-mark); background: var(--status-unverified-mark); }
.ns-fill-primary    { fill: var(--chart-primary);          background: var(--chart-primary); }
.ns-fill-previous   { fill: var(--chart-previous);         background: var(--chart-previous); }
.ns-hbars + .ns-legend, .ns-chart + .ns-legend { margin-top: var(--space-3); }
.ns-legend { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-4); font-size: 12px; line-height: 16px; color: var(--ink-muted); margin: 0; padding: 0; list-style: none; }
.ns-legend li { display: inline-flex; align-items: center; gap: 6px; }
.ns-legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

/* Horizontal category bars */
.ns-hbars { display: grid; grid-template-columns: max-content 1fr max-content; gap: var(--space-2) var(--space-3); align-items: center; font-size: 13px; line-height: 18px; }
.ns-hbars__label { color: var(--ink); }
.ns-hbars__track { height: 12px; border-radius: var(--radius-sm); background: var(--surface-sunken); overflow: hidden; display: flex; }
.ns-hbars__bar { height: 100%; }
.ns-hbars__bar + .ns-hbars__bar { border-left: 2px solid var(--surface-card); }
.ns-hbars__value { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
.ns-hbars__value span { font-weight: 400; color: var(--ink-muted); }

/* ---------- PII chips ---------- */
.ns-pii-list { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.ns-pii { display: inline-flex; align-items: center; gap: var(--space-1); padding: 1px var(--space-2); border-radius: var(--radius-sm); background: var(--status-unverified-bg); color: var(--status-unverified-text); font-size: 12px; line-height: 18px; font-weight: 500; white-space: nowrap; }
.ns-pii b { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); }
.ns-pii--high-weight { background: var(--status-unapproved-bg); color: var(--status-unapproved-text); }
.ns-pii--high-weight b { color: var(--status-unapproved-text); }
.ns-bulk { display: inline-flex; align-items: center; gap: var(--space-1); font-family: var(--font-display); font-weight: 700; font-size: 11px; line-height: 14px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--on-accent); background: var(--status-unapproved-text); border-radius: var(--radius-sm); padding: 2px 6px; }
[data-theme="dark"] .ns-bulk { color: var(--nevo-navy); }

/* ---------- Segmented control ---------- */
.ns-seg { display: inline-flex; padding: 2px; gap: 2px; border: 1px solid var(--border-control); border-radius: var(--radius-md); background: var(--surface-card); }
.ns-seg button { height: 30px; padding: 0 var(--space-3); border: 0; border-radius: 4px; background: transparent; color: var(--ink-muted); font: 600 13px/18px var(--font-sans); cursor: pointer; }
.ns-seg button:hover { color: var(--ink); }
.ns-seg button[aria-pressed="true"] { background: var(--surface-accent-subtle); color: var(--ink); }

/* ---------- Callout ---------- */
.ns-callout { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-3) var(--space-4); border-radius: var(--radius-lg); font-size: 14px; line-height: 20px; }
.ns-callout .ns-icon { margin-top: 2px; }
.ns-callout__title { font-weight: 600; display: block; }
.ns-callout__actions { margin-left: auto; display: flex; gap: var(--space-2); align-self: center; }
.ns-callout--info    { background: var(--status-restricted-bg); color: var(--status-restricted-text); }
.ns-callout--warning { background: var(--status-wrongtier-bg);  color: var(--status-wrongtier-text); }
.ns-callout--danger  { background: var(--status-unapproved-bg); color: var(--status-unapproved-text); }
.ns-callout--neutral { background: var(--surface-sunken); color: var(--ink); }

/* ---------- Form fields ---------- */
.ns-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ns-field__label { font-size: 13px; line-height: 18px; font-weight: 600; color: var(--ink); }
.ns-field__help { font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.ns-input, .ns-select { height: var(--control-height); padding: 0 var(--space-3); border: 1px solid var(--border-control); border-radius: var(--radius-md); background: var(--surface-card); color: var(--ink); font: 400 14px/20px var(--font-sans); width: 100%; }
.ns-select { appearance: none; padding-right: 32px; background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%); background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.ns-input::placeholder { color: var(--ink-muted); }
.ns-input.is-invalid { border-color: var(--status-unapproved-mark); }
.ns-field__error { font-size: 12px; line-height: 16px; color: var(--status-unapproved-text); }
.ns-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.ns-chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 var(--space-3); border: 1px solid var(--border-control); border-radius: var(--radius-md); background: var(--surface-card); color: var(--ink); font: 500 13px/18px var(--font-sans); cursor: pointer; }
.ns-chip[aria-pressed="true"] { background: var(--surface-accent-subtle); border-color: var(--accent); }
.ns-chip[aria-pressed="true"]::before { content: ""; width: 8px; height: 8px; border-radius: var(--radius-pill); background: var(--accent); }

/* ---------- Coverage meter ---------- */
.ns-coverage { display: flex; flex-direction: column; gap: var(--space-2); }
.ns-coverage__row { display: flex; align-items: baseline; gap: var(--space-2); }
.ns-coverage__pct { font-family: var(--font-display); font-weight: 700; font-size: 20px; line-height: 26px; font-variant-numeric: tabular-nums; }
.ns-coverage__track { height: 8px; border-radius: var(--radius-pill); background: var(--surface-sunken); display: flex; overflow: hidden; }
.ns-coverage__track > i { display: block; height: 100%; }
.ns-coverage__track > i + i { border-left: 2px solid var(--surface-card); }

/* ---------- Report page (PDF, A4 at 96dpi). Always render inside data-theme="light". ---------- */
.ns-report { width: 794px; min-height: 1123px; background: var(--surface-card); color: var(--ink); padding: var(--space-12); display: flex; flex-direction: column; gap: var(--space-6); font-family: var(--font-sans); }
.ns-report__head { display: flex; align-items: center; justify-content: space-between; padding-bottom: var(--space-4); border-bottom: 2px solid var(--ink); }
.ns-report__brand { font-family: var(--font-display); font-weight: 700; font-size: 18px; }
.ns-report__meta { font-size: 12px; line-height: 16px; color: var(--ink-muted); text-align: right; }
.ns-report__kicker { font-family: var(--font-display); font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-muted); }
.ns-report h1 { font-family: var(--font-display); font-size: 40px; line-height: 44px; font-weight: 700; margin: 0; }
.ns-report h2 { font-family: var(--font-display); font-size: 20px; line-height: 26px; font-weight: 700; margin: 0 0 var(--space-2); }
.ns-report__foot { margin-top: auto; display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-muted); border-top: 1px solid var(--border); padding-top: var(--space-3); }
