/* ==========================================================================
   Vigil design system
   --------------------------------------------------------------------------
   Hand-written, self-hosted, no build step. The Content-Security-Policy for
   this product allows no external origins and no inline styles, so everything
   the browser paints comes from this file.

   Structure:
     1. Tokens (light + dark)
     2. Reset and typography
     3. Layout shells
     4. Controls: buttons, fields, toggles
     5. Surfaces: cards, panels, tables, tiles
     6. Status: badges, meters, gauges
     7. Overlays: modals, toasts, drawers
     8. Feature blocks: uploader, secret reveal, timeline, health
     9. Motion and responsive
   ========================================================================== */

/* 1. Tokens ------------------------------------------------------------- */

:root {
  --ink-900: #0b1220;
  --ink-800: #131c2e;
  --ink-700: #1e293b;
  --ink-600: #334155;
  --ink-500: #475569;
  --ink-400: #64748b;
  --ink-300: #94a3b8;
  --ink-200: #cbd5e1;
  --ink-100: #e2e8f0;
  --ink-50:  #f1f5f9;
  --paper:   #ffffff;

  --bg:            #f4f6fa;
  --bg-raised:     #ffffff;
  --bg-sunken:     #eef1f7;
  --bg-inset:      #f8fafc;
  --border:        #e2e8f0;
  --border-strong: #cbd5e1;

  --text:        #0f172a;
  --text-soft:   #475569;
  --text-mute:   #6b7a90;
  --text-invert: #ffffff;

  --accent:        #2f52d9;
  --accent-hover:  #2643b8;
  --accent-soft:   #eaeeff;
  --accent-border: #c3cdf7;
  --accent-text:   #22378f;

  --ok:        #15803d;
  --ok-soft:   #e8f6ec;
  --ok-border: #b7e2c4;

  --warn:        #b45309;
  --warn-soft:   #fdf2e3;
  --warn-border: #f0d6ab;

  --danger:        #b4232a;
  --danger-hover:  #96181f;
  --danger-soft:   #fdecec;
  --danger-border: #f2c4c4;

  --info:        #0e7490;
  --info-soft:   #e6f5f9;
  --info-border: #b6dfea;

  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow:    0 2px 8px rgba(15, 23, 42, .08);
  --shadow-lg: 0 12px 34px rgba(15, 23, 42, .16);
  --shadow-xl: 0 24px 60px rgba(15, 23, 42, .24);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
          Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono",
          Menlo, monospace;

  --sidebar-w: 244px;
  --header-h: 60px;
  --gutter: 26px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:            #0b1220;
    --bg-raised:     #141d30;
    --bg-sunken:     #080e19;
    --bg-inset:      #18233a;
    --border:        #26324a;
    --border-strong: #37455f;

    --text:      #e8edf7;
    --text-soft: #a9b6cd;
    --text-mute: #8494ae;

    --accent:        #6a8bff;
    --accent-hover:  #86a1ff;
    --accent-soft:   #1a2648;
    --accent-border: #33447c;
    --accent-text:   #b9c8ff;

    --ok:        #4ade80;
    --ok-soft:   #10281a;
    --ok-border: #1f4d33;

    --warn:        #fbbf5a;
    --warn-soft:   #2b2011;
    --warn-border: #574122;

    --danger:        #ff7b7b;
    --danger-hover:  #ff9b9b;
    --danger-soft:   #2c1416;
    --danger-border: #5a2529;

    --info:        #4fd1e0;
    --info-soft:   #0d2830;
    --info-border: #1d4c58;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow:    0 2px 10px rgba(0, 0, 0, .45);
    --shadow-lg: 0 14px 38px rgba(0, 0, 0, .55);
    --shadow-xl: 0 26px 64px rgba(0, 0, 0, .65);

    color-scheme: dark;
  }
}

/* 2. Reset and typography ------------------------------------------------ */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { margin: 0; font-weight: 640; line-height: 1.25; letter-spacing: -.012em; }
h1 { font-size: 21px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
h4 { font-size: 13px; }
p  { margin: 0 0 12px; }
p:last-child { margin-bottom: 0; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

small, .small { font-size: 12.5px; }
.mute  { color: var(--text-mute); }
.soft  { color: var(--text-soft); }
.mono  { font-family: var(--mono); font-size: .93em; }
.nowrap { white-space: nowrap; }
.break  { word-break: break-word; overflow-wrap: anywhere; }
.center { text-align: center; }
.right  { text-align: right; }
.strong { font-weight: 620; }
.upper {
  text-transform: uppercase;
  letter-spacing: .09em;
  font-size: 11px;
  font-weight: 660;
}

.stack     { display: flex; flex-direction: column; gap: 12px; }
.stack-sm  { display: flex; flex-direction: column; gap: 7px; }
.stack-lg  { display: flex; flex-direction: column; gap: 22px; }
.row       { display: flex; align-items: center; gap: 10px; }
.row-wrap  { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-top   { display: flex; align-items: flex-start; gap: 10px; }
.spread    { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.grow      { flex: 1 1 auto; min-width: 0; }
.hidden    { display: none !important; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection { background: var(--accent-soft); color: var(--accent-text); }

/* 3. Layout shells ------------------------------------------------------- */

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
}

.auth-brand {
  background:
    radial-gradient(1100px 620px at 12% -10%, #24408f 0%, transparent 62%),
    radial-gradient(900px 700px at 95% 110%, #14224a 0%, transparent 58%),
    var(--ink-900);
  color: #fff;
  padding: 54px 58px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.auth-brand__mark {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  font-size: 13px;
}
.auth-brand__mark svg { width: 30px; height: 30px; }

.auth-brand__lede { max-width: 30rem; }
.auth-brand__lede h1 { font-size: 32px; line-height: 1.18; margin-bottom: 16px; }
.auth-brand__lede p  { color: rgba(255, 255, 255, .74); font-size: 15px; }

.auth-points { list-style: none; margin: 30px 0 0; padding: 0; display: grid; gap: 14px; }
.auth-points li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  color: rgba(255, 255, 255, .82);
  font-size: 13.5px;
}
.auth-points svg { width: 18px; height: 18px; flex: none; margin-top: 1px; opacity: .8; }

.auth-brand__foot { color: rgba(255, 255, 255, .45); font-size: 12px; }

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 30px;
  background: var(--bg-raised);
}
.auth-card { width: 100%; max-width: 380px; }
.auth-card > header { margin-bottom: 26px; }
.auth-card > header p { color: var(--text-mute); margin-top: 6px; }

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--ink-900);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 19px 20px;
  font-weight: 700;
  letter-spacing: .15em;
  text-transform: uppercase;
  font-size: 12.5px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.sidebar__brand svg { width: 25px; height: 25px; flex: none; }

.sidebar__nav { padding: 14px 11px; display: flex; flex-direction: column; gap: 2px; flex: 1; }

.sidebar__group {
  padding: 16px 9px 6px;
  font-size: 10.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .38);
  font-weight: 640;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, .74);
  font-size: 13.5px;
  font-weight: 520;
  cursor: pointer;
  border: 0;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  transition: background .13s ease, color .13s ease;
}
.nav-item:hover { background: rgba(255, 255, 255, .07); color: #fff; text-decoration: none; }
.nav-item.is-active { background: rgba(255, 255, 255, .13); color: #fff; }
.nav-item svg { width: 17px; height: 17px; flex: none; opacity: .85; }
.nav-item__badge {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  min-width: 19px;
  height: 19px;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 680;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.nav-item__badge.is-warn { background: var(--warn); }

.sidebar__foot {
  padding: 13px 16px;
  border-top: 1px solid rgba(255, 255, 255, .08);
  font-size: 11.5px;
  color: rgba(255, 255, 255, .45);
}

.app-main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 var(--gutter);
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar h1 { font-size: 16.5px; }

.avatar {
  width: 31px;
  height: 31px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 680;
  font-size: 12px;
  flex: none;
  border: 1px solid var(--accent-border);
}

.app-content { padding: var(--gutter); flex: 1; max-width: 1360px; width: 100%; }

.page-head { margin-bottom: 20px; }
.page-head p { color: var(--text-mute); margin-top: 5px; max-width: 62ch; }

.public-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 42px 18px;
  background:
    radial-gradient(900px 460px at 50% -12%, var(--accent-soft) 0%, transparent 68%),
    var(--bg);
}
.public-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--text-soft);
  margin-bottom: 26px;
}
.public-brand svg { width: 24px; height: 24px; }
.public-card { width: 100%; max-width: 500px; }
.public-foot { margin-top: 26px; font-size: 12px; color: var(--text-mute); text-align: center; }

/* 4. Controls ------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 580;
  line-height: 1.2;
  cursor: pointer;
  background: var(--bg-raised);
  color: var(--text);
  border-color: var(--border-strong);
  transition: background .13s ease, border-color .13s ease, transform .06s ease, opacity .13s;
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover { background: var(--bg-inset); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-busy { opacity: .55; cursor: not-allowed; pointer-events: none; }
.btn svg { width: 16px; height: 16px; flex: none; }

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

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

.btn--ok { background: var(--ok); color: #fff; border-color: var(--ok); }
.btn--ok:hover { filter: brightness(1.08); }

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

.btn--quiet { background: transparent; border-color: var(--border); color: var(--text-soft); }
.btn--quiet:hover { background: var(--bg-inset); color: var(--text); }

.btn--sm { padding: 6px 11px; font-size: 12.5px; }
.btn--sm svg { width: 14px; height: 14px; }
.btn--lg { padding: 12px 22px; font-size: 15px; }
.btn--block { width: 100%; }
.btn--icon { padding: 7px; }

.btn-group { display: inline-flex; gap: 7px; flex-wrap: wrap; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 12.5px; font-weight: 600; color: var(--text-soft); }
.field__hint { font-size: 12px; color: var(--text-mute); }
.field__error { font-size: 12px; color: var(--danger); font-weight: 550; }

.input, .select, .textarea {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-raised);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.4;
  transition: border-color .13s ease, box-shadow .13s ease;
}
.input::placeholder, .textarea::placeholder { color: var(--text-mute); opacity: .8; }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input[aria-invalid="true"] { border-color: var(--danger); }
.input:disabled, .select:disabled, .textarea:disabled {
  background: var(--bg-sunken);
  color: var(--text-mute);
  cursor: not-allowed;
}
.textarea { resize: vertical; min-height: 76px; }
.input--mono { font-family: var(--mono); letter-spacing: .02em; }

.select {
  appearance: none;
  padding-right: 32px;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 15px;
}

.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  cursor: pointer;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  transition: border-color .13s ease, background .13s ease;
}
.check:hover { border-color: var(--border-strong); }
.check input { margin: 2px 0 0; accent-color: var(--accent); width: 15px; height: 15px; flex: none; }
.check__label { font-size: 13px; font-weight: 560; }
.check__hint { font-size: 12px; color: var(--text-mute); margin-top: 2px; }
.check.is-on { border-color: var(--accent-border); background: var(--accent-soft); }

.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 8px; }
.choice {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  padding: 11px 12px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: var(--text);
  transition: border-color .13s, background .13s, box-shadow .13s;
}
.choice:hover { border-color: var(--accent-border); }
.choice__title { font-size: 13px; font-weight: 620; display: block; }
.choice__sub { font-size: 11.5px; color: var(--text-mute); display: block; margin-top: 2px; }
.choice.is-on {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.choice.is-on .choice__sub { color: var(--accent-text); }

/* 5. Surfaces ------------------------------------------------------------ */

.card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card__head {
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card__head p { color: var(--text-mute); font-size: 12.5px; margin: 3px 0 0; }
.card__body { padding: 18px; }
.card__body--tight { padding: 12px; }
.card__body--flush { padding: 0; }
.card__foot {
  padding: 13px 18px;
  border-top: 1px solid var(--border);
  background: var(--bg-inset);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.grid { display: grid; gap: 16px; }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(196px, 1fr)); }

.tile {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 15px 17px;
  box-shadow: var(--shadow-sm);
}
.tile__label {
  font-size: 11px;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--text-mute);
  font-weight: 640;
}
.tile__value {
  font-size: 26px;
  font-weight: 660;
  letter-spacing: -.02em;
  margin-top: 5px;
  font-variant-numeric: tabular-nums;
}
.tile__sub { font-size: 12px; color: var(--text-mute); margin-top: 3px; }
.tile--accent { border-color: var(--accent-border); background: var(--accent-soft); }
.tile--accent .tile__value { color: var(--accent-text); }
.tile--warn { border-color: var(--warn-border); background: var(--warn-soft); }
.tile--warn .tile__value { color: var(--warn); }

.table-wrap { overflow-x: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.data th {
  text-align: left;
  font-size: 11px;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-mute);
  font-weight: 660;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-inset);
  white-space: nowrap;
  position: sticky;
  top: 0;
}
table.data td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: var(--bg-inset); }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.actions { text-align: right; white-space: nowrap; }

.kv { display: grid; grid-template-columns: minmax(120px, auto) 1fr; gap: 8px 18px; font-size: 13px; }
.kv dt { color: var(--text-mute); }
.kv dd { margin: 0; font-weight: 560; word-break: break-word; }

.empty {
  text-align: center;
  padding: 44px 22px;
  color: var(--text-mute);
}
.empty svg { width: 38px; height: 38px; opacity: .38; margin-bottom: 12px; }
.empty h3 { color: var(--text-soft); margin-bottom: 5px; }
.empty p { max-width: 42ch; margin-inline: auto; font-size: 13px; }

.divider { height: 1px; background: var(--border); border: 0; margin: 18px 0; }

.notice {
  display: flex;
  gap: 11px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-inset);
  font-size: 13px;
  line-height: 1.5;
}
.notice svg { width: 17px; height: 17px; flex: none; margin-top: 1px; }
.notice--info   { background: var(--info-soft); border-color: var(--info-border); color: var(--info); }
.notice--ok     { background: var(--ok-soft); border-color: var(--ok-border); color: var(--ok); }
.notice--warn   { background: var(--warn-soft); border-color: var(--warn-border); color: var(--warn); }
.notice--danger { background: var(--danger-soft); border-color: var(--danger-border); color: var(--danger); }
.notice strong { display: block; margin-bottom: 2px; }

/* 6. Status -------------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 620;
  border: 1px solid var(--border);
  background: var(--bg-inset);
  color: var(--text-soft);
  white-space: nowrap;
}
.badge--ok     { background: var(--ok-soft); border-color: var(--ok-border); color: var(--ok); }
.badge--warn   { background: var(--warn-soft); border-color: var(--warn-border); color: var(--warn); }
.badge--danger { background: var(--danger-soft); border-color: var(--danger-border); color: var(--danger); }
.badge--info   { background: var(--info-soft); border-color: var(--info-border); color: var(--info); }
.badge--accent { background: var(--accent-soft); border-color: var(--accent-border); color: var(--accent-text); }

.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }

.meter {
  height: 7px;
  background: var(--bg-sunken);
  border-radius: 999px;
  overflow: hidden;
}
.meter__fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 999px;
  transition: width .5s cubic-bezier(.22, .8, .3, 1);
}
.meter__fill.is-warn   { background: var(--warn); }
.meter__fill.is-danger { background: var(--danger); }
.meter--lg { height: 10px; }

.gauge { display: flex; align-items: center; gap: 14px; }
.gauge__ring { width: 74px; height: 74px; flex: none; }
.gauge__ring circle { fill: none; stroke-width: 8; }
.gauge__track { stroke: var(--bg-sunken); }
.gauge__value {
  stroke: var(--accent);
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
  transition: stroke-dashoffset .6s cubic-bezier(.22, .8, .3, 1);
}
.gauge__value.is-warn   { stroke: var(--warn); }
.gauge__value.is-danger { stroke: var(--danger); }
.gauge__pct {
  font-size: 20px;
  font-weight: 660;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}

.spark { width: 100%; height: 40px; display: block; }
.spark path { fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linejoin: round; }
.spark .spark__area { fill: var(--accent-soft); stroke: none; }

/* 7. Overlays ------------------------------------------------------------ */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 14, 25, .58);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
  animation: fade .16s ease;
}
.modal {
  background: var(--bg-raised);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 60px);
  display: flex;
  flex-direction: column;
  animation: rise .2s cubic-bezier(.22, .8, .3, 1);
  border: 1px solid var(--border);
}
.modal--wide { max-width: 760px; }
.modal__head {
  padding: 17px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}
.modal__head p { color: var(--text-mute); font-size: 12.5px; margin: 4px 0 0; }
.modal__body { padding: 20px; overflow-y: auto; flex: 1; }
.modal__foot {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  background: var(--bg-inset);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.toasts {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  z-index: 200;
  max-width: 400px;
}
.toast {
  background: var(--ink-900);
  color: #fff;
  padding: 12px 15px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  animation: slide-in .22s cubic-bezier(.22, .8, .3, 1);
  border-left: 3px solid var(--accent);
}
.toast--ok     { border-left-color: #4ade80; }
.toast--danger { border-left-color: #ff7b7b; }
.toast--warn   { border-left-color: #fbbf5a; }
.toast svg { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.toast__close {
  background: none;
  border: 0;
  color: rgba(255, 255, 255, .55);
  cursor: pointer;
  padding: 0 0 0 6px;
  font-size: 16px;
  line-height: 1;
}
.toast__close:hover { color: #fff; }

.tabs {
  display: flex;
  gap: 3px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
  overflow-x: auto;
}
.tab {
  padding: 9px 14px;
  border: 0;
  background: none;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 560;
  color: var(--text-mute);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--accent); border-bottom-color: var(--accent); }

/* 8. Feature blocks ------------------------------------------------------ */

.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 38px 22px;
  text-align: center;
  background: var(--bg-inset);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone:hover { border-color: var(--accent-border); background: var(--accent-soft); }
.dropzone.is-over {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.dropzone svg { width: 34px; height: 34px; color: var(--accent); opacity: .82; margin-bottom: 10px; }
.dropzone__title { font-weight: 620; font-size: 14.5px; }
.dropzone__hint { font-size: 12.5px; color: var(--text-mute); margin-top: 4px; }

.file-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-raised);
}
.file-chip__icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.file-chip__icon svg { width: 19px; height: 19px; }
.file-chip__name { font-weight: 600; word-break: break-all; }
.file-chip__meta { font-size: 12px; color: var(--text-mute); }

.progress-shell { margin-top: 14px; }
.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-mute);
  margin-bottom: 6px;
  font-variant-numeric: tabular-nums;
}

.secret {
  background: var(--ink-900);
  border-radius: var(--radius);
  padding: 15px 16px;
  color: #e8edf7;
  position: relative;
}
.secret__label {
  font-size: 10.5px;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .5);
  font-weight: 640;
  margin-bottom: 8px;
}
.secret__value {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.7;
  word-break: break-all;
  user-select: all;
}
.secret__value--big {
  font-size: 19px;
  letter-spacing: .1em;
  text-align: center;
  font-weight: 680;
}
.secret__actions { margin-top: 11px; display: flex; gap: 7px; }
.secret .btn {
  background: rgba(255, 255, 255, .1);
  border-color: rgba(255, 255, 255, .16);
  color: #fff;
}
.secret .btn:hover { background: rgba(255, 255, 255, .18); }

.steps { display: flex; gap: 0; margin-bottom: 26px; }
.step { flex: 1; text-align: center; position: relative; padding-top: 30px; }
.step::before {
  content: "";
  position: absolute;
  top: 11px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--border);
}
.step:first-child::before { left: 50%; }
.step:last-child::before { right: 50%; }
.step__dot {
  position: absolute;
  top: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: var(--bg-raised);
  border: 2px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}
.step__dot svg { width: 10px; height: 10px; color: #fff; }
.step__label { font-size: 11.5px; color: var(--text-mute); font-weight: 560; }
.step.is-done .step__dot { background: var(--ok); border-color: var(--ok); }
.step.is-done::before { background: var(--ok); }
.step.is-current .step__dot {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.step.is-current .step__label { color: var(--accent-text); font-weight: 640; }

.otp-input {
  font-family: var(--mono);
  font-size: 26px;
  letter-spacing: .38em;
  text-align: center;
  padding: 14px 12px;
  text-indent: .38em;
  font-weight: 640;
}

/* Preview surfaces. Images and text are rendered directly — an <img> cannot
   execute anything, and text goes through textContent — so only PDFs need a
   frame. */
.preview-frame {
  width: 100%;
  height: 62vh;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-inset);
}
.preview-image {
  display: block;
  max-width: 100%;
  max-height: 62vh;
  margin: 0 auto;
  border-radius: var(--radius-sm);
  background: var(--bg-inset);
}
.preview-text {
  max-height: 62vh;
  overflow: auto;
  margin: 0;
  padding: 12px 14px;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  display: flex;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.timeline li:last-child { border-bottom: 0; }
.timeline__when {
  font-size: 11.5px;
  color: var(--text-mute);
  flex: none;
  width: 140px;
  font-variant-numeric: tabular-nums;
}
.timeline__what { flex: 1; min-width: 0; }
.timeline__who { color: var(--text-mute); font-size: 12px; }

.request-card {
  border: 1px solid var(--border);
  border-left: 3px solid var(--warn);
  border-radius: var(--radius);
  padding: 14px 16px;
  background: var(--bg-raised);
}
.request-card.is-expected { border-left-color: var(--ok); }
.request-card__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px 18px;
  margin: 12px 0;
  font-size: 12.5px;
}
.request-card__grid dt { color: var(--text-mute); font-size: 11px; }
.request-card__grid dd { margin: 1px 0 0; font-weight: 560; word-break: break-word; }

.health-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.health-card { padding: 17px; }
.health-card__title {
  font-size: 11px;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--text-mute);
  font-weight: 650;
  margin-bottom: 13px;
}
.health-row {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  padding: 5px 0;
  border-bottom: 1px dashed var(--border);
}
.health-row:last-child { border-bottom: 0; }
.health-row span:last-child { font-weight: 600; font-variant-numeric: tabular-nums; }

.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-sunken) 25%,
    var(--bg-inset) 37%,
    var(--bg-sunken) 63%
  );
  background-size: 400% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
  border-radius: var(--radius-sm);
  height: 15px;
}
/* Height variants exist as classes rather than inline styles because the CSP
   for this product sets `style-src 'self'` with no 'unsafe-inline', which
   blocks style attributes in markup. Anything genuinely dynamic (meter widths,
   gauge arcs) is set through CSSOM from JS, which CSP does not govern. */
.skeleton--md { height: 22px; }
.skeleton--lg { height: 64px; }
.skeleton--xl { height: 128px; }
.skeleton--text { height: 13px; width: 70%; }
.skeleton--title { height: 19px; width: 45%; }

.spinner {
  width: 15px;
  height: 15px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .65s linear infinite;
  display: inline-block;
  flex: none;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-mute);
}

.filters {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 16px;
}
.filters .input, .filters .select { width: auto; min-width: 158px; }

/* 8b. Data-loss prevention and data-flow visibility ---------------------- */

/* Severity is the organising idea of the whole DLP surface, so it gets one
   colour scale used everywhere: chips, bars, flow links, table rows. Consistent
   meaning across every view is what lets someone scan a page instead of
   reading it. */
:root {
  --sev-critical: #b4232a;
  --sev-critical-soft: #fdecec;
  --sev-high: #b45309;
  --sev-high-soft: #fdf2e3;
  --sev-medium: #0e7490;
  --sev-medium-soft: #e6f5f9;
  --sev-low: #64748b;
  --sev-low-soft: #f1f5f9;
}

@media (prefers-color-scheme: dark) {
  :root {
    --sev-critical: #ff7b7b;
    --sev-critical-soft: #2c1416;
    --sev-high: #fbbf5a;
    --sev-high-soft: #2b2011;
    --sev-medium: #4fd1e0;
    --sev-medium-soft: #0d2830;
    --sev-low: #8494ae;
    --sev-low-soft: #18233a;
  }
}

.sev {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 660;
  white-space: nowrap;
  border: 1px solid transparent;
}
.sev--critical { color: var(--sev-critical); background: var(--sev-critical-soft); border-color: var(--sev-critical); }
.sev--high     { color: var(--sev-high);     background: var(--sev-high-soft);     border-color: var(--sev-high); }
.sev--medium   { color: var(--sev-medium);   background: var(--sev-medium-soft);   border-color: var(--sev-medium); }
.sev--low      { color: var(--sev-low);      background: var(--sev-low-soft);      border-color: var(--border-strong); }

.sev-bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--bg-sunken); }
.sev-bar__part { height: 100%; min-width: 2px; }
.sev-bar__part--critical { background: var(--sev-critical); }
.sev-bar__part--high     { background: var(--sev-high); }
.sev-bar__part--medium   { background: var(--sev-medium); }
.sev-bar__part--low      { background: var(--sev-low); }

.sev-legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 11.5px; color: var(--text-mute); }
.sev-legend span { display: inline-flex; align-items: center; gap: 5px; }
.sev-legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }

/* Category ranking: a label, a proportional bar, a count. Reads top to bottom
   as "what kind of data, and how much of it". */
.rank { display: grid; gap: 9px; }
.rank__row { display: grid; grid-template-columns: minmax(140px, 1.1fr) 3fr auto; gap: 12px; align-items: center; }
.rank__label { font-size: 12.5px; font-weight: 560; }
.rank__track { height: 9px; background: var(--bg-sunken); border-radius: 999px; overflow: hidden; }
.rank__fill { height: 100%; border-radius: 999px; transition: width .5s cubic-bezier(.22,.8,.3,1); }
.rank__value { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--text-mute); min-width: 78px; text-align: right; }

/* The flow diagram. Two columns of nodes with weighted links between them —
   the shape of "who sends what to where" at a glance. Deliberately capped to a
   readable number of flows; beyond that the table below is the better tool. */
.flow { width: 100%; display: block; overflow: visible; }
.flow__link { fill: none; opacity: .42; transition: opacity .15s ease, stroke-width .15s ease; }
.flow__link:hover { opacity: .95; }
.flow__link--critical { stroke: var(--sev-critical); }
.flow__link--high     { stroke: var(--sev-high); }
.flow__link--medium   { stroke: var(--sev-medium); }
.flow__link--low      { stroke: var(--sev-low); }
.flow__link--none     { stroke: var(--border-strong); }
.flow__node { fill: var(--bg-raised); stroke: var(--border-strong); }
.flow__node--external { stroke: var(--sev-high); }
.flow__text { font-family: var(--font); font-size: 11px; fill: var(--text); }
.flow__sub { font-family: var(--font); font-size: 9.5px; fill: var(--text-mute); }
.flow__axis {
  font-family: var(--font);
  font-size: 10px;
  fill: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: .1em;
  font-weight: 640;
}

.chip-row { display: flex; flex-wrap: wrap; gap: 5px; }
.chip {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  color: var(--text-soft);
  white-space: nowrap;
}

/* An identity document we recognised but could not read. It sits in the column
   that otherwise says "Nothing", so it has to be visibly not-nothing: this is
   the row most likely to be a real leak. */
.chip--warn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--warn-bg, rgba(217, 119, 6, 0.12));
  border-color: var(--warn-border, rgba(217, 119, 6, 0.4));
  color: var(--warn-text, #92400e);
  font-weight: 600;
}
.chip--warn svg { width: 12px; height: 12px; }

:root:not([data-theme="light"]) .chip--warn {
  --warn-bg: rgba(251, 191, 36, 0.14);
  --warn-border: rgba(251, 191, 36, 0.38);
  --warn-text: #fcd34d;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .chip--warn {
    --warn-bg: rgba(251, 191, 36, 0.14);
    --warn-border: rgba(251, 191, 36, 0.38);
    --warn-text: #fcd34d;
  }
}
:root[data-theme="dark"] .chip--warn {
  --warn-bg: rgba(251, 191, 36, 0.14);
  --warn-border: rgba(251, 191, 36, 0.38);
  --warn-text: #fcd34d;
}

/* Department exposure grid. Colour encodes the share of files carrying
   personal data, so an outlier department is visible without reading numbers. */
.heat { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.heat__cell {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: var(--bg-raised);
}
.heat__name { font-weight: 620; font-size: 13px; }
.heat__value { font-size: 22px; font-weight: 660; margin-top: 4px; font-variant-numeric: tabular-nums; }
.heat__sub { font-size: 11.5px; color: var(--text-mute); margin-top: 2px; }

.finding-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: start;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}
.finding-row:last-child { border-bottom: 0; }

.rule-pattern {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  word-break: break-all;
}

.gap-notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--warn-soft);
  border: 1px solid var(--warn-border);
  color: var(--warn);
  font-size: 12.5px;
}

/* 9. Motion and responsive ----------------------------------------------- */

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes slide-in { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { from { background-position: 100% 50%; } to { background-position: 0 50%; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }

.is-pulsing { animation: pulse 1.7s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

@media (max-width: 1020px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
}

@media (max-width: 880px) {
  :root { --gutter: 16px; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    transform: translateX(-100%);
    transition: transform .22s cubic-bezier(.22, .8, .3, 1);
    z-index: 60;
    box-shadow: var(--shadow-xl);
  }
  .sidebar.is-open { transform: none; }
  .sidebar-scrim {
    position: fixed;
    inset: 0;
    background: rgba(8, 14, 25, .5);
    z-index: 50;
  }
  .topbar__menu { display: inline-flex !important; }
  .timeline__when { width: auto; }
  .timeline li { flex-direction: column; gap: 3px; }
}

.topbar__menu { display: none; }

@media print {
  .sidebar, .topbar, .toasts, .btn { display: none !important; }
  .app-shell { grid-template-columns: 1fr; }
  body { background: #fff; }
}
