/* Nocturne — design-system tokens and component classes. This file is the source of truth for the system's look; retune it here and see readme.md. */
/* Inter is self-hosted (OFL licence, from Google Fonts): no third-party request, and the CSP can keep
   font-src 'self'. Variable font: one file per subset covers weights 400-700. To update, re-download the
   files from the Google Fonts CSS and regenerate these rules. */
/* cyrillic-ext */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('fonts/inter-cyrillic-ext.woff2') format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

/* cyrillic */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('fonts/inter-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

/* greek-ext */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('fonts/inter-greek-ext.woff2') format('woff2');
  unicode-range: U+1F00-1FFF;
}

/* greek */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('fonts/inter-greek.woff2') format('woff2');
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}

/* vietnamese */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('fonts/inter-vietnamese.woff2') format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

/* latin-ext */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('fonts/inter-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* latin */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('fonts/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* ── Meridian theme — VantagePoint 365 ──────────────────────────────────
     Blue-graphite ground with an electric-teal accent. Dark-first. Surfaces
     step up in three elevation levels; text steps down in three emphasis
     levels. All original token names are preserved so the component classes
     below and the app's inline styles keep resolving. */

  /* Grounds & surfaces */
  --color-bg: #0b0f14;         /* app background */
  --color-surface: #121821;    /* sidebar, cards, base panels */
  --color-surface-2: #1a2230;  /* menus, drawers, modals */
  --color-surface-3: #232e3f;  /* hover, popovers, raised chips */

  /* Text emphasis levels */
  --color-text: #e8edf2;
  --color-text-2: #9aa7b8;
  --color-text-3: #5c6a7d;
  --color-divider: color-mix(in srgb, #e8edf2 10%, transparent);

  /* Accent — electric teal. --color-accent = step 500. */
  --color-accent: #14d8c4;
  --color-accent-100: #e6fffb;
  --color-accent-200: #b8fbf0;
  --color-accent-300: #7ff0df;
  --color-accent-400: #3ee4cd;
  --color-accent-500: #14d8c4;
  --color-accent-600: #0fb0a2;
  --color-accent-700: #0c8a80;
  --color-accent-800: #0b6560;
  --color-accent-900: #0a4341;

  /* Accent-2 — info blue, mirror ramp. */
  --color-accent-2: #4da3ff;
  --color-accent-2-100: #eaf4ff;
  --color-accent-2-200: #c9e2ff;
  --color-accent-2-300: #9fccff;
  --color-accent-2-400: #74b5ff;
  --color-accent-2-500: #4da3ff;
  --color-accent-2-600: #2f7fdb;
  --color-accent-2-700: #235fa6;
  --color-accent-2-800: #184573;
  --color-accent-2-900: #0e3a66;

  /* Neutrals — cool slate on one lightness scale. */
  --color-neutral-100: #f2f5f9;
  --color-neutral-200: #dde4ec;
  --color-neutral-300: #c2ccd9;
  --color-neutral-400: #a0adbf;
  --color-neutral-500: #7d8ba0;
  --color-neutral-600: #5e6c81;
  --color-neutral-700: #465264;
  --color-neutral-800: #303a49;
  --color-neutral-900: #1b222d;

  /* Semantic roles (each with a low-alpha ground tint for filled badges). */
  --color-success: #2fd47f;  --color-success-bg: #0d2e20;
  --color-warn:    #f5b545;  --color-warn-bg:    #33270e;
  --color-danger:  #ff5d6c;  --color-danger-bg:  #351318;
  --color-info:    #4da3ff;  --color-info-bg:    #10263f;

  /* Categorical chart palette — 8 hues + a muted track for "remainder"
     donut segments. IMPORTANT: keep in sync with the CHART constant in
     "M365 Auditing Portal.dc.html" (search: "keep in sync with styles.css"). */
  --chart-1: #14d8c4;
  --chart-2: #4da3ff;
  --chart-3: #a78bfa;
  --chart-4: #f5b545;
  --chart-5: #ff5d6c;
  --chart-6: #2fd47f;
  --chart-7: #f472b6;
  --chart-8: #8896a8;
  --chart-track: #2a3546;

  /* Deck section-divider ground (deck-scale fills only, not interface). */
  --color-section: #12313a;
  --color-section-glow: #1a4a55;
  --color-section-ghost: #276b76;

  --font-heading: "Inter", system-ui, sans-serif;
  --font-heading-weight: 600;
  --font-body: "Inter", system-ui, sans-serif;

  /* Type scale */
  --text-xs: 11px;
  --text-sm: 12.5px;
  --text-base: 14px;
  --text-lg: 16px;
  --text-xl: 20px;
  --text-2xl: 26px;

  /* Spacing — rounded scale. --space-5 is newly defined (the app references
     it at the modals/drawers; it was previously undefined and fell back to
     nothing). */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  /* Elevation — hairline edge + ambient depth on the dark ground. */
  --shadow-sm: 0 0 0 1px rgba(232,237,242,0.06), 0 1px 2px rgba(0,0,0,0.4);
  --shadow-md: 0 0 0 1px rgba(232,237,242,0.08), 0 8px 24px rgba(0,0,0,0.5);
  --shadow-lg: 0 0 0 1px rgba(232,237,242,0.10), 0 20px 48px rgba(0,0,0,0.6);
  --glow-accent: 0 0 0 1px color-mix(in srgb, var(--color-accent) 35%, transparent),
                 0 8px 28px color-mix(in srgb, var(--color-accent) 18%, transparent);
}

/* ── Light theme override ─────────────────────────────────────────────────
   Dark (Meridian) is the default and defined on bare :root above. Toggling
   light mode stamps data-theme="light" on <html> (see app.js: toggleTheme);
   this block redefines only the tokens that actually change — surfaces,
   text, divider, shadows, and (critically) the full neutral ramp — so every
   component class and inline var(--...) reference in the app repaints
   automatically with no per-element changes. Accent/chart/semantic hues are
   kept as-is: they're already tuned to read on both a near-black and a
   near-white ground.

   The neutral-100..900 ramp is used all over the app as secondary/muted TEXT
   (labels, sub-stats, footer captions) and was originally tuned one-directional
   for dark mode: neutral-200 (#dde4ec, near-white) reads fine as text on a
   near-black surface, but is nearly invisible as text on a near-white one.
   Flipped end-for-end here so every existing var(--color-neutral-N) reference
   still gets "a legible, appropriately-muted text color for this theme" —
   neutral-900 (darkest) takes neutral-100's dark-mode role and vice versa. */
:root[data-theme="light"] {
  /* Revised 2026-08-27: the original bg/surface/surface-2/surface-3 quartet
     sat within ~15 units of lightness of each other (#eef1f5..#fdfdfe), so
     cards, chips, and secondary buttons had no real elevation to read
     against — everything washed into one flat white. This pass gives the
     canvas a cooler, slightly deeper grey so cards (pure white) actually
     pop off it, and spreads surface-2/3 further apart so menus and chips
     are each a distinguishable step, not a rounding error. */
  --color-bg: #e7ebf1;
  --color-surface: #ffffff;
  --color-surface-2: #eef1f6;
  --color-surface-3: #e1e6ee;

  --color-text: #10161f;
  --color-text-2: #454f5f;
  --color-text-3: #6b7688;
  --color-divider: color-mix(in srgb, #10161f 16%, transparent);

  --color-neutral-100: #1b222d;  /* mirrors dark mode's 900 */
  --color-neutral-200: #303a49;  /* mirrors 800 */
  --color-neutral-300: #465264;  /* mirrors 700 */
  --color-neutral-400: #5e6c81;  /* mirrors 600 */
  --color-neutral-500: #64748b;  /* midpoint, darkened slightly from dark-mode's #7d8ba0 for AA contrast on a light ground */
  --color-neutral-600: #a0adbf;  /* mirrors 400 */
  --color-neutral-700: #c2ccd9;  /* mirrors 300 */
  --color-neutral-800: #dde4ec;  /* mirrors 200 */
  --color-neutral-900: #f2f5f9;  /* mirrors 100 */

  /* Status tags (.tag-good/.tag-warn/.tag-bad) pair var(--color-success/warn/danger) as TEXT
     against var(--color-*-bg) as background. The dark-mode hues (bright green/amber/red on a
     near-black tint) read fine there, but transplanted onto a pale tint they're washed out —
     darkened here specifically for text-on-light-tint contrast; -bg tints lightened to match. */
  --color-success: #158f56;  --color-success-bg: #e3f8ed;
  --color-warn:    #a8660a;  --color-warn-bg:    #fdf2df;
  --color-danger:  #d92d3f;  --color-danger-bg:  #fde6e8;
  --color-info:    #2266d1;  --color-info-bg:    #e6f1ff;

  /* Donut "remainder" segment — dark slate reads as an intentional neutral track on a near-black
     card; the same dark slate on a pale card looks like a stray dark blob, so lightened to match. */
  --chart-track: #dde3ec;

  --shadow-sm: 0 0 0 1px rgba(16,23,32,0.06), 0 1px 2px rgba(16,23,32,0.06);
  --shadow-md: 0 0 0 1px rgba(16,23,32,0.07), 0 8px 24px rgba(16,23,32,0.10);
  --shadow-lg: 0 0 0 1px rgba(16,23,32,0.08), 0 20px 48px rgba(16,23,32,0.14);
}

/* Secondary buttons are transparent-fill by design (see .btn-secondary below) — on dark mode's
   near-black ground the divider-colored border alone still reads as a control. On light mode's
   white cards, a border with no fill was part of the same washed-out problem the tokens above
   fix: restoring a visible resting state here, same color role (surface-2) the buttons already
   use on hover, just always-on in this theme. Dark mode is untouched. */
:root[data-theme="light"] .btn-secondary { background: var(--color-surface-2); }

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
}
h1, h2, h3, h4 { font-family: var(--font-heading); font-weight: var(--font-heading-weight); }

.lighten{mix-blend-mode:lighten;background-color:transparent}

/* ══════════════════════════════════════════════════════════════════════════
   Components — built with the tokens above. Plain CSS
   on plain HTML: no JavaScript, no build step. Each class is documented in
   readme.md and demonstrated in foundations/ and components/.
   ══════════════════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-size: 15px; line-height: 1.55; font-weight: 400; }
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  line-height: 1.12; letter-spacing: -0.015em; margin: 0 0 var(--space-2);
}
h1 { font-size: 42px; }
h2 { font-size: 32px; }
h3 { font-size: 25px; }
h4 { font-size: 20px; }
h5 { font-size: 16px; }
h6 { font-size: 13px; }
h6 { letter-spacing: 0.08em; text-transform: uppercase; }
p { margin: 0 0 var(--space-3); }
a { color: var(--color-accent); text-underline-offset: 3px; }
img { display: block; max-width: 100%; }
figure { margin: 0; }
figcaption {
  font-size: 11px; margin-top: var(--space-1);
  color: color-mix(in srgb, var(--color-text) 55%, transparent);
}
.text-muted { color: color-mix(in srgb, var(--color-text) 55%, transparent); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--color-accent) 30%, transparent); }

/* — rules — */
/* Rules fade to transparent at both ends instead of stopping cleanly — a
   Nocturne signature. The ramp is 48px an end (one deck baseline unit),
   painted from the same divider token. Freestanding rules fade; box
   outlines, in-control separators, and short accent marks stay solid. */
.hr {
  height: 1px; border: 0; margin: var(--space-4) 0;
  background: linear-gradient(to right,
    transparent, var(--color-divider) 48px,
    var(--color-divider) calc(100% - 48px), transparent);
}

/* — buttons — */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  cursor: pointer; text-decoration: none;
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  font-size: 14px; line-height: 1.2; color: var(--color-text); /* matches the .input's 14px —
     the pair sits side by side in sign-up rows */
  background: transparent; border: 1px solid transparent;
  padding: var(--space-2) calc(var(--space-3) * 1.2);
  border-radius: var(--radius-md);
}
.btn svg { display: block; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { color: var(--color-accent); border-color: var(--color-accent); }
.btn-primary:hover { background: color-mix(in srgb, var(--color-accent) 12%, transparent); }
.btn-primary:active { background: color-mix(in srgb, var(--color-accent) 22%, transparent); }
.btn-secondary { border-color: var(--color-divider); }
.btn-secondary:hover { background: color-mix(in srgb, var(--color-text) 7%, transparent); }
.btn-secondary:active { background: color-mix(in srgb, var(--color-text) 14%, transparent); }
.btn-ghost { color: var(--color-accent); padding-inline: var(--space-1); }
.btn-ghost:hover { background: color-mix(in srgb, var(--color-accent) 10%, transparent); }
.btn-ghost:active { background: color-mix(in srgb, var(--color-accent) 18%, transparent); }
.btn-icon { width: 36px; height: 36px; padding: 0; }
.btn-block { width: 100%; margin-top: var(--space-2); }

/* — forms — */
.field > label {
  display: block; font-size: 12px; margin-bottom: 5px;
  color: color-mix(in srgb, var(--color-text) 70%, transparent);
}
.input {
  width: 100%; min-height: 36px; padding: 6px 10px; font: inherit;
  font-size: 14px; color: var(--color-text); caret-color: var(--color-accent);
  background: var(--color-surface);
  border: 1px solid var(--color-divider); border-radius: var(--radius-md);
}
.input:hover { border-color: color-mix(in srgb, var(--color-text) 45%, transparent); }
.input:focus-visible { border-color: var(--color-accent); outline-offset: 0; }
textarea.input { min-height: 90px; resize: vertical; }
.radio { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.radio input, .seg-opt input {
  position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none;
}
.radio .dot {
  width: 16px; height: 16px; flex: none; border-radius: 50%;
  border: 1.5px solid var(--color-divider);
}
.radio:hover .dot { border-color: var(--color-accent); }
.radio input:checked + .dot {
  border-color: var(--color-accent); background: var(--color-accent);
  box-shadow: inset 0 0 0 4px var(--color-bg);
}
.radio input:focus-visible + .dot { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.seg {
  display: inline-flex; overflow: hidden;
  border: 1px solid var(--color-divider); border-radius: var(--radius-md);
}
.seg-opt {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; font-size: 13px; cursor: pointer;
}
.seg-opt + .seg-opt { border-left: 1px solid var(--color-divider); }
.seg-opt:has(input:checked) { color: var(--color-accent); box-shadow: inset 0 0 0 1px var(--color-accent); }
.seg-opt:not(:has(input:checked)):hover { background: color-mix(in srgb, var(--color-text) 7%, transparent); }
.seg-opt:has(input:focus-visible) { outline: 2px solid var(--color-accent); outline-offset: -2px; }

/* — cards — */
.card {
  display: flex; flex-direction: column; gap: var(--space-2);
  padding: var(--space-3); border-radius: var(--radius-md); background: var(--color-surface);
}
.card-kicker { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--color-accent); }
.card-title {
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  font-size: 17px; line-height: 1.2;
}
.card-body { margin: 0; font-size: 13px; opacity: 0.8; flex: 1; }
.card-meta {
  display: flex; align-items: center; gap: 6px; font-size: 11px;
  color: color-mix(in srgb, var(--color-text) 50%, transparent);
}
.elev-sm { box-shadow: var(--shadow-sm); }
.elev-md { box-shadow: var(--shadow-md); }
.elev-lg { box-shadow: var(--shadow-lg); }

/* — tags — */
.tag {
  display: inline-flex; align-items: center; font-size: 11px;
  letter-spacing: 0.02em; padding: 3px 10px;
  border-radius: calc(var(--radius-md) * 0.75);
}
.tag-accent { background: var(--color-accent-800); color: var(--color-accent-100); }
.tag-accent-2 { background: var(--color-accent-2-800); color: var(--color-accent-2-100); }
.tag-neutral { background: var(--color-neutral-800); color: var(--color-neutral-100); }
.tag-outline { border: 1px solid var(--color-accent); color: var(--color-accent); }
/* Semantic status badges (used by the audit tables/drawers). */
.tag-good { background: var(--color-success-bg); color: var(--color-success); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--color-success) 30%, transparent); }
.tag-warn { background: var(--color-warn-bg); color: var(--color-warn); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--color-warn) 30%, transparent); }
.tag-bad { background: var(--color-danger-bg); color: var(--color-danger); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--color-danger) 30%, transparent); }

/* — navigation — */
.nav {
  display: flex; align-items: center; gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-bottom: none;
}
.nav-brand {
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  font-size: 18px; margin-right: auto;
}
.nav a { color: inherit; text-decoration: none; font-size: 14px; }
.nav a:hover, .nav a[aria-current='page'] { color: var(--color-accent); }

/* — tables — */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  color: color-mix(in srgb, var(--color-text) 60%, transparent);
  padding: var(--space-2); border-bottom: 1px solid transparent; /* keeps layout; the row paints the fading rule */
}
.table td {
  padding: var(--space-2);
  border-bottom: 1px solid transparent;
}
/* Row rules as row-level strips so the end-fade spans the row, not each cell. */
.table thead tr {
  background: linear-gradient(to right,
    transparent, var(--color-divider) 48px,
    var(--color-divider) calc(100% - 48px), transparent) no-repeat bottom / 100% 1px;
}
.table tbody tr {
  background: linear-gradient(to right,
    transparent, color-mix(in srgb, var(--color-text) 8%, transparent) 48px,
    color-mix(in srgb, var(--color-text) 8%, transparent) calc(100% - 48px), transparent) no-repeat bottom / 100% 1px;
}
.table tbody tr:hover {
  /* the hover tint layers over the row rule, which keeps painting */
  background:
    linear-gradient(color-mix(in srgb, var(--color-text) 4%, transparent),
                    color-mix(in srgb, var(--color-text) 4%, transparent)) no-repeat 0 0 / 100% 100%,
    linear-gradient(to right,
      transparent, color-mix(in srgb, var(--color-text) 8%, transparent) 48px,
      color-mix(in srgb, var(--color-text) 8%, transparent) calc(100% - 48px), transparent) no-repeat bottom / 100% 1px;
}

/* — dialog — */
.dialog-backdrop {
  position: fixed; inset: 0; display: grid; place-items: center;
  padding: var(--space-4);
  background: color-mix(in srgb, var(--color-neutral-900) 50%, transparent);
}
.dialog {
  width: min(440px, 100%); display: flex; flex-direction: column; gap: var(--space-3);
  padding: var(--space-4); border-radius: var(--radius-lg);
  background: var(--color-surface); box-shadow: var(--shadow-lg);
}
.dialog-title {
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  font-size: 20px;
}
.dialog-body { font-size: 14px; opacity: 0.85; }
.dialog-actions { display: flex; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-2); }

