/* ==========================================================================
   Horus — Netway Networks portal stylesheet

   Built on the tokens from the netwaynet.com site stylesheet so the portal
   and the public site stay in step. Change a token there, mirror it here.

   Palette sampled from the Horus logo: charcoal #3A3A3A, orange #EA7C1B.

   THE TWO ORANGES ARE NOT INTERCHANGEABLE:
     --orange      #EA7C1B  FILL ONLY. Buttons, bars, chips, rules.
                            Carries --ink-strong text only (5.8:1).
                            As text on white it is 2.8:1 — fails AA.
     --orange-ink  #A85A09  TEXT ONLY. Orange words on white (5.1:1).

   Note: the logo charcoal on logo orange is 4.0:1, just under AA, so
   buttons use --ink-strong rather than --ink.

   Contents
     01  Tokens
     02  Reset & base
     03  Header / navigation
     04  Layout & cards
     05  Buttons
     06  Forms
     07  Notices
     08  Tables & data
     09  Dashboard tools
     10  Analysis results
     11  Run strip (animated progress)
     12  Vendor settings
     13  Sign in
     14  Footer
     15  Responsive / motion / print
   ========================================================================== */


/* 01 — TOKENS ============================================================= */
:root {
  /* Brand palette — mirrors style.css on the public site */
  --white:        #ffffff;
  --surface:      #ffffff;
  --surface-alt:  #f7f7f8;
  --surface-sunk: #fafafb;

  --ink:        #3a3a3a;   /* logo charcoal — headings and body    */
  --ink-strong: #1f1f1f;   /* text on orange fills, 5.8:1          */
  --ink-panel:  #232323;   /* dark surfaces (sign-in panel)        */

  --line:        #e3e5e8;
  --line-soft:   #edeef0;
  --line-strong: #8a9096;

  --orange:      #ea7c1b;  /* logo orange — FILLS only             */
  --orange-deep: #d96e12;  /* gradient foot                        */
  --orange-ink:  #a85a09;  /* orange AS TEXT on white, 5.1:1       */
  --orange-tint: #fdf3e8;

  --ok:   #15803d;
  --warn: #b45309;
  --err:  #b91c1c;

  --text:     #3a3a3a;
  --text-mid: #55575a;
  --text-dim: #6e7073;

  --on-ink:      #ffffff;
  --on-ink-mid:  #c9cdd2;
  --on-ink-dim:  #9aa0a6;
  --on-ink-line: rgba(255, 255, 255, .14);

  /* Verdict ramp — reuses the site's semantic colours */
  --risk-high:    var(--err);
  --risk-medium:  var(--warn);
  --risk-low:     #a16207;
  --risk-clean:   var(--ok);
  --risk-unknown: var(--text-dim);

  /* Type */
  --font-display: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  --font-body:    'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  --font-mono:    'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* Space & shape */
  --wrap:   1180px;
  --gutter: 20px;
  --r-sm:   8px;
  --r-md:   12px;
  --r-lg:   18px;
  --r-pill: 999px;

  --shadow:    0 10px 30px -12px rgba(12, 12, 13, .14);
  --shadow-lg: 0 24px 60px -20px rgba(12, 12, 13, .18);

  --ease: cubic-bezier(.16, .84, .44, 1);
  --header-h: 68px;
}


/* 02 — RESET & BASE ======================================================= */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--surface-alt);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; }

/* An <svg> with no width/height defaults to 300x150px and will wreck any flex
   row it sits in. Inline icons always carry explicit attributes, but this is
   the safety net for anything added later. */
svg:not([width]):not([height]) { width: 1em; height: 1em; }

a { color: var(--orange-ink); text-decoration: none; transition: color .18s var(--ease); }
a:hover { color: var(--orange-deep); }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -.02em;
  color: var(--ink);
  margin: 0;
}
p { margin: 0; }

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

::selection { background: var(--orange); color: var(--ink-strong); }

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono);
  font-size: .74rem; font-weight: 500;
  letter-spacing: .16em; text-transform: uppercase;
  color: var(--orange-ink);
  margin-bottom: 12px;
}

.mono { font-family: var(--font-mono); font-size: .84rem; word-break: break-all; }
.hint { font-size: .82rem; color: var(--text-dim); margin: 4px 0 0; }
.lede { color: var(--text-mid); max-width: 68ch; margin: 0; }


/* 03 — HEADER / NAV ======================================================= */
/*
   Layout contract for the top bar:
     [brand] [divider] [tagline]   [nav ......... flexes]   [account]
   Everything is `flex: none` except the nav, so a long name or a wide logo
   can never push the account block onto a second row. Inline SVGs are given
   explicit dimensions here AND in the markup — an <svg> with neither defaults
   to 300x150px, which is what breaks a flex header.
*/
.topbar {
  position: sticky; top: 0; z-index: 100;
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: var(--header-h);
  padding: 0 var(--gutter);
  background: rgba(255, 255, 255, .95);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar svg { flex: none; }

/* brand lockup */
.brand { display: flex; align-items: center; gap: 12px; flex: none; }
.brand-logo { height: 26px; width: auto; flex: none; }
.brand-text {
  display: block;
  padding-left: 12px;
  border-left: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: .58rem;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-dim);
  white-space: nowrap;
}

/* navigation takes the slack */
.topnav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1 1 auto;
  min-width: 0;
  margin-left: 8px;
}
.topnav a {
  position: relative;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  font-size: .9rem;
  font-weight: 500;
  white-space: nowrap;
  color: var(--text-mid);
  transition: color .18s var(--ease), background .18s var(--ease);
}
.topnav a::after {
  content: '';
  position: absolute; left: 12px; right: 12px; bottom: 4px;
  height: 1.5px;
  background: var(--orange);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .22s var(--ease);
}
.topnav a:hover { color: var(--ink); background: var(--surface-alt); }
.topnav a.active { color: var(--orange-ink); font-weight: 600; }
.topnav a.active::after { transform: scaleX(1); }

/* account menu */
.account-menu { position: relative; flex: none; }
.account-menu > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 10px 5px 5px;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  cursor: pointer;
  list-style: none;                /* Firefox */
  white-space: nowrap;
  transition: background .18s var(--ease), border-color .18s var(--ease);
}
.account-menu > summary::-webkit-details-marker { display: none; }   /* Safari */
.account-menu > summary::marker { content: ''; }
.account-menu > summary:hover { background: var(--surface-alt); border-color: var(--line); }
.account-menu[open] > summary { background: var(--surface-alt); border-color: var(--line); }
.account-menu > summary:focus-visible { outline: 2px solid var(--orange-ink); outline-offset: 2px; }

.account-initials {
  display: grid; place-items: center;
  width: 32px; height: 32px;
  flex: none;
  border-radius: 50%;
  background: var(--orange);
  color: var(--ink-strong);
  font-family: var(--font-mono);
  font-size: .72rem;
  font-weight: 700;
  line-height: 1;
}
.account-who { display: flex; flex-direction: column; gap: 1px; line-height: 1.15; text-align: left; }
.account-name { font-size: .84rem; font-weight: 600; color: var(--ink); }
.account-role {
  font-family: var(--font-mono);
  font-size: .58rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.account-caret {
  width: 14px; height: 14px;
  flex: none;
  color: var(--text-dim);
  transition: transform .2s var(--ease);
}
.account-menu[open] .account-caret { transform: rotate(180deg); }

.account-panel {
  position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 292px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  z-index: 200;
}
.account-panel-head {
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px 12px 12px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--line-soft);
}
.account-panel-head strong { font-size: .9rem; color: var(--ink); }
.account-panel-head span { font-size: .78rem; color: var(--text-dim); word-break: break-all; }
.account-panel-head .pill { align-self: flex-start; margin-top: 5px; }

.account-panel a {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  font-size: .88rem;
  white-space: nowrap;
  color: var(--text-mid);
}
.account-panel a:hover { background: var(--surface-alt); color: var(--ink); }
.account-panel a.is-divided {
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
  border-radius: 0;
  color: var(--orange-ink);
}

/* 04 — LAYOUT & CARDS ===================================================== */
.shell {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding: 38px var(--gutter) 60px;
}

.page-head { margin-bottom: 28px; }
.page-head h1 { font-size: clamp(1.8rem, 5vw, 2.4rem); margin-bottom: 8px; }
h2 { font-size: 1.2rem; margin-bottom: 14px; }
h3 { font-size: .98rem; margin-bottom: 6px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 26px 24px;
  box-shadow: var(--shadow);
  margin-bottom: 22px;
}

.grid { display: grid; gap: 20px; }
.grid-2, .grid-3 { grid-template-columns: 1fr; }


/* 05 — BUTTONS ============================================================ */
.btn {
  --btn-pad: 13px 24px;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: var(--btn-pad);
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  font-family: var(--font-body);
  font-size: .94rem; font-weight: 600; line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: transform .18s var(--ease), background .18s var(--ease),
              border-color .18s var(--ease), box-shadow .18s var(--ease), color .18s var(--ease);
}
.btn:active { transform: translateY(1px); }

/* --ink-strong on orange = 5.8:1. Never white — that is 2.8:1. */
.btn-primary {
  background: linear-gradient(180deg, var(--orange) 0%, var(--orange-deep) 100%);
  color: var(--ink-strong);
  box-shadow: 0 8px 20px -8px rgba(234, 124, 27, .55);
}
.btn-primary:hover {
  color: var(--ink-strong);
  box-shadow: 0 12px 26px -8px rgba(234, 124, 27, .7);
  transform: translateY(-2px);
}

.btn-secondary {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--ink);
}
.btn-secondary:hover {
  border-color: var(--orange);
  background: var(--orange-tint);
  color: var(--orange-ink);
  transform: translateY(-2px);
}

.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }


/* 06 — FORMS ============================================================== */
.field { margin-bottom: 18px; }
label {
  display: block;
  font-size: .8rem; font-weight: 600;
  color: var(--ink);
  margin-bottom: 7px;
}

input[type="text"], input[type="password"], input[type="email"],
input[type="tel"], input[type="url"], input[type="number"],
input[type="file"], select, textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--white);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;                  /* 16px stops iOS zooming on focus */
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
textarea { font-family: var(--font-mono); font-size: 14px; min-height: 130px; resize: vertical; }

select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7075' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 17px;
  padding-right: 40px;
  cursor: pointer;
}

input::placeholder, textarea::placeholder { color: var(--text-dim); opacity: .8; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px var(--orange-tint);
}

/* tabs */
.tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.tab {
  position: relative;
  background: none; border: 0;
  padding: 10px 0;
  font-family: var(--font-body);
  font-size: .9rem; font-weight: 500;
  color: var(--text-mid);
  cursor: pointer;
}
.tab::after {
  content: '';
  position: absolute; bottom: -1px; left: 0;
  width: 0; height: 2px;
  background: var(--orange);
  transition: width .22s var(--ease);
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--orange-ink); font-weight: 600; }
.tab[aria-selected="true"]::after { width: 100%; }

.label-note {
  font-family: var(--font-mono);
  font-size: .6rem;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-left: 6px;
}

/* endpoints are data, not prose — set them in mono so a stray character shows */
.input-mono { font-family: var(--font-mono); font-size: 14px; }

.checkline {
  display: flex; align-items: center; gap: 9px;
  margin: 10px 0 0;
  font-size: .84rem; font-weight: 400;
  color: var(--text-mid);
}
.checkline input { width: auto; }


/* 07 — NOTICES ============================================================ */
.notice {
  padding: 13px 16px;
  border-radius: var(--r-sm);
  border: 1px solid;
  margin-bottom: 22px;
  font-size: .9rem;
}
.notice-error   { background: #fef2f2; border-color: #fecaca; color: var(--err); }
.notice-success { background: #f0fdf4; border-color: #bbf7d0; color: var(--ok); }
.notice-info    { background: var(--orange-tint); border-color: #fed7aa; color: var(--orange-ink); }


/* 08 — TABLES & DATA ====================================================== */
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: .66rem; letter-spacing: .13em; text-transform: uppercase;
  font-weight: 500;
  color: var(--text-dim);
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
table.data td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
  color: var(--text-mid);
}
table.data td strong { color: var(--ink); }
table.data tr:last-child td { border-bottom: 0; }

.pill {
  display: inline-block;
  padding: 3px 11px;
  border-radius: var(--r-pill);
  font-family: var(--font-mono);
  font-size: .66rem; font-weight: 500;
  letter-spacing: .06em;
  white-space: nowrap;
  color: var(--white);
}
.pill-high    { background: var(--risk-high); }
.pill-medium  { background: var(--risk-medium); }
.pill-low     { background: var(--risk-low); }
.pill-clean   { background: var(--risk-clean); }
.pill-unknown { background: var(--risk-unknown); }
/* orange fill takes ink text, per the palette rule */
.pill-accent  { background: var(--orange); color: var(--ink-strong); }
.pill-ghost   { background: var(--surface-alt); color: var(--text-dim); border: 1px solid var(--line); }


/* 09 — DASHBOARD TOOLS ==================================================== */
.tool-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }

.tool {
  position: relative;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  overflow: hidden;
  padding: 30px 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow);
  font-family: var(--font-display);
  font-size: 1.22rem; font-weight: 600;
  letter-spacing: -.02em;
  color: var(--ink);
  transition: transform .18s var(--ease), box-shadow .18s var(--ease);
}
/* orange rule that wipes in on hover — the same gesture as .partner on the site */
.tool::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--orange), var(--orange-deep));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .3s var(--ease);
}
.tool::after { content: '→'; color: var(--orange); font-weight: 400; }
.tool:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); color: var(--ink); }
.tool:hover::before { transform: scaleX(1); }

.tool.disabled {
  color: var(--text-dim);
  box-shadow: none;
  background: var(--surface-sunk);
  pointer-events: none;
}
.tool.disabled::after { content: ''; }


/* 10 — ANALYSIS RESULTS =================================================== */
.result {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--risk-unknown);
  border-radius: var(--r-md);
  margin-bottom: 12px;
  overflow: hidden;
}
.result.risk-high   { border-left-color: var(--risk-high); }
.result.risk-medium { border-left-color: var(--risk-medium); }
.result.risk-low    { border-left-color: var(--risk-low); }
.result.risk-clean  { border-left-color: var(--risk-clean); }

.result-head {
  display: flex; align-items: center; gap: 14px;
  width: 100%;
  padding: 16px 20px;
  background: none;
  border: 0;
  text-align: left;
  font-family: var(--font-body);
  cursor: pointer;
}
.result-head:hover { background: var(--surface-sunk); }
.result-url { flex: 1; min-width: 0; }
.result-url strong { display: block; font-size: .9rem; color: var(--ink); }
.result-url span { display: block; font-size: .78rem; color: var(--text-dim); }
.result-body { padding: 6px 20px 20px; border-top: 1px solid var(--line-soft); }
.result-body[hidden] { display: none; }

.detail-grid { display: grid; grid-template-columns: 1fr; gap: 24px; margin-top: 16px; }
.detail-grid h4 {
  margin: 0 0 10px;
  font-family: var(--font-mono);
  font-size: .66rem; font-weight: 500;
  letter-spacing: .13em; text-transform: uppercase;
  color: var(--orange-ink);
}

.kv { margin: 0; font-size: .86rem; }
.kv div { display: flex; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.kv div:last-child { border-bottom: 0; }
.kv dt { color: var(--text-dim); min-width: 118px; flex: none; }
.kv dd { margin: 0; flex: 1; color: var(--text-mid); word-break: break-word; }

.findings {
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
  font-size: .88rem;
  color: var(--text-mid);
}
.findings li { position: relative; padding-left: 20px; }
.findings li::before {
  content: '';
  position: absolute; left: 0; top: .55em;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--orange-tint);
  border: 1.5px solid var(--orange);
}


/* 11 — RUN STRIP (animated progress) ====================================== */
.runstrip {
  display: flex; align-items: center; gap: 16px;
  margin-top: 22px;
  padding: 16px 18px;
  background: var(--surface-sunk);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}

.runicon { flex: none; width: 44px; height: 44px; }
.radar { width: 44px; height: 44px; overflow: visible; }

.radar-ring { fill: none; stroke: var(--orange); stroke-width: 1.5; opacity: .3; transform-origin: 22px 22px; }
.radar-core { fill: var(--orange); }
.radar-sweep { fill: var(--orange); opacity: .25; transform-origin: 22px 22px; }
.radar-check {
  fill: none; stroke: var(--ok);
  stroke-width: 3; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 30; stroke-dashoffset: 30;
  opacity: 0;
}

[data-state="running"] .radar-sweep { animation: radar-spin 1.6s linear infinite; }
[data-state="running"] .radar-ring   { animation: radar-pulse 2.2s ease-out infinite; }
[data-state="running"] .radar-ring-2 { animation-delay: 1.1s; }
[data-state="running"] .radar-core   { animation: radar-blink 1.6s ease-in-out infinite; }

[data-state="done"] .radar-sweep { opacity: 0; }
[data-state="done"] .radar-ring  { stroke: var(--ok); opacity: .3; }
[data-state="done"] .radar-core  { opacity: 0; }
[data-state="done"] .radar-check { opacity: 1; animation: draw-check .45s var(--ease) forwards; }

[data-state="error"] .radar-ring  { stroke: var(--err); }
[data-state="error"] .radar-core  { fill: var(--err); }
[data-state="error"] .radar-sweep { opacity: 0; }

@keyframes radar-spin  { to { transform: rotate(360deg); } }
@keyframes radar-blink { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
@keyframes radar-pulse {
  0%   { transform: scale(.55); opacity: .5; }
  100% { transform: scale(1.15); opacity: 0; }
}
@keyframes draw-check { to { stroke-dashoffset: 0; } }

.runtext { flex: 1; min-width: 0; }
.runtext strong {
  display: block;
  font-family: var(--font-display);
  font-size: .98rem;
  color: var(--ink);
}
.runtext .hint {
  display: block;
  margin: 2px 0 0;
  font-family: var(--font-mono);
  font-size: .72rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.runcount { flex: none; text-align: right; }
.runcount span:first-child {
  display: block;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--ink);
}
.runcount .hint { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.progress {
  height: 6px;
  margin-top: 12px;
  background: var(--line-soft);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.progress span {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--orange), var(--orange-deep));
  border-radius: var(--r-pill);
  transition: width .3s var(--ease);
}
.progress.is-active span {
  background-image: linear-gradient(
    115deg,
    rgba(255, 255, 255, 0) 25%,
    rgba(255, 255, 255, .5) 50%,
    rgba(255, 255, 255, 0) 75%
  );
  background-size: 200% 100%;
  background-color: var(--orange);
  animation: sheen 1.1s linear infinite;
}
@keyframes sheen { to { background-position: -200% 0; } }

.tally {
  display: flex; flex-wrap: wrap; gap: 18px;
  margin-top: 14px;
  font-family: var(--font-mono);
  font-size: .74rem;
}
.tally-item { display: inline-flex; align-items: center; gap: 7px; color: var(--text-dim); }
.tally-item i { width: 8px; height: 8px; border-radius: 50%; }
.tally-item b { color: var(--ink); font-variant-numeric: tabular-nums; }
.tally-item.is-zero { opacity: .38; }
.tally-item[data-risk="high"] i    { background: var(--risk-high); }
.tally-item[data-risk="medium"] i  { background: var(--risk-medium); }
.tally-item[data-risk="low"] i     { background: var(--risk-low); }
.tally-item[data-risk="clean"] i   { background: var(--risk-clean); }
.tally-item[data-risk="unknown"] i { background: var(--risk-unknown); }

.dots { display: inline-flex; gap: 3px; align-items: center; }
.dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--orange); animation: dot-bounce 1s ease-in-out infinite; }
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot-bounce { 0%, 60%, 100% { opacity: .25; } 30% { opacity: 1; } }


/* vendor risk score bar */
.score { display: flex; align-items: center; gap: 9px; margin: 6px 0 2px; }
.score-bar {
  flex: 1; max-width: 120px; height: 5px;
  background: var(--line-soft);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.score-bar span { display: block; height: 100%; border-radius: var(--r-pill); }
.score-high   { background: var(--risk-high); }
.score-medium { background: var(--risk-medium); }
.score-low    { background: var(--risk-low); }
.score-clean  { background: var(--risk-clean); }
.score-val {
  font-family: var(--font-mono);
  font-size: .72rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-mid);
}


/* 11b — TARGET ENTRY ====================================================== */
/* The single-URL field is the primary action of the product, so it is sized
   as one: 60px tall, monospaced, with the submit button fused to it. */

.target-label {
  display: block;
  font-family: var(--font-mono);
  font-size: .68rem;
  font-weight: 500;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.target-input {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 6px 6px 16px;
  background: var(--white);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-md);
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.target-input:focus-within {
  border-color: var(--orange);
  box-shadow: 0 0 0 4px var(--orange-tint);
}

.target-glyph { flex: none; width: 22px; height: 22px; color: var(--text-dim); }
.target-glyph svg { width: 22px; height: 22px; }
.target-input:focus-within .target-glyph { color: var(--orange-ink); }

/* the field itself: mono, large, borderless — the wrapper carries the chrome */
.target-input input {
  flex: 1;
  min-width: 0;
  height: 48px;
  padding: 0;
  border: 0;
  background: none;
  font-family: var(--font-mono);
  font-size: 1.02rem;
  letter-spacing: -.01em;
  color: var(--ink);
}
.target-input input:focus { outline: none; box-shadow: none; }
.target-input input::placeholder {
  font-size: .88rem;
  letter-spacing: 0;
  color: var(--text-dim);
  opacity: .75;
}

.target-clear {
  flex: none;
  display: grid; place-items: center;
  width: 30px; height: 30px;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 50%;
  color: var(--text-dim);
  cursor: pointer;
}
.target-clear svg { width: 16px; height: 16px; }
.target-clear:hover { background: var(--surface-alt); color: var(--ink); }

.target-go { flex: none; height: 48px; padding-inline: 26px; }

.target-note { margin-top: 12px; font-size: .84rem; color: var(--text-dim); }
.target-note code {
  font-family: var(--font-mono);
  font-size: .82em;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
}
.target-note.is-valid { color: var(--ok); }
.target-note.is-invalid { color: var(--err); }

/* drop zone */
.dropzone {
  position: relative;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface-sunk);
  transition: border-color .18s var(--ease), background .18s var(--ease);
}
.dropzone:hover,
.dropzone.is-dragging { border-color: var(--orange); background: var(--orange-tint); }
.dropzone.is-loaded { border-style: solid; border-color: var(--ok); background: #f4fbf6; }

.dropzone-input {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  opacity: 0;
  cursor: pointer;
}
.dropzone-body {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 38px 24px;
  text-align: center;
  pointer-events: none;
}
.dropzone-icon { width: 30px; height: 30px; color: var(--text-dim); }
.dropzone.is-loaded .dropzone-icon { color: var(--ok); }
.dropzone-body strong { font-size: .96rem; color: var(--ink); }
.dropzone-body span { font-size: .82rem; color: var(--text-dim); }
.dropzone-body .mono { font-size: .82rem; color: var(--text-mid); }

.paste-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px;
  margin-top: 26px;
}
.paste-head .target-label { margin-bottom: 0; }
.counter {
  font-family: var(--font-mono);
  font-size: .72rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.counter.is-over { color: var(--err); }

.paste-area {
  margin-top: 10px;
  min-height: 190px;
  font-size: 14px;
  line-height: 1.7;
}

@media (max-width: 620px) {
  .target-input { flex-wrap: wrap; padding: 12px; }
  .target-input input { width: 100%; flex-basis: 100%; height: 42px; }
  .target-go { width: 100%; }
  .target-glyph { display: none; }
}


/* 12 — VENDOR SETTINGS ==================================================== */
.vendor-head { display: flex; align-items: flex-start; gap: 16px; }
.vendor-title { flex: 1; min-width: 0; }
.vendor-title h2 { margin: 0 0 4px; font-size: 1.05rem; }
.vendor-title .hint { margin: 0; max-width: 70ch; }
.vendor-fields { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line-soft); }
.vendor.is-off .vendor-fields { opacity: .45; }

.switch { display: inline-flex; margin-top: 3px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track {
  position: relative;
  width: 44px; height: 25px;
  background: var(--line);
  border-radius: var(--r-pill);
  transition: background .18s var(--ease);
}
.switch-thumb {
  position: absolute; top: 3px; left: 3px;
  width: 19px; height: 19px;
  background: var(--white);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(12, 12, 13, .3);
  transition: transform .18s var(--ease);
}
.switch input:checked + .switch-track { background: var(--orange); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(19px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--orange-ink); outline-offset: 3px; }

.vendor-strip { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.vendor-chip {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 8px 14px;
  background: var(--surface-sunk);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  font-size: .84rem; font-weight: 600;
  color: var(--ink);
}


/* debug toggle on a vendor card */
.debugline {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin: 16px 0 0;
  padding: 13px 15px;
  background: var(--surface-sunk);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-strong);
  border-radius: var(--r-sm);
  font-weight: 400;
  cursor: pointer;
  transition: border-color .18s var(--ease), background .18s var(--ease);
}
.debugline:hover { border-color: var(--line-strong); }
.debugline.is-on {
  border-left-color: var(--warn);
  background: #fffaf0;
}
.debugline input { width: auto; margin-top: 3px; flex: none; }
.debugline-text { font-size: .82rem; color: var(--text-dim); line-height: 1.55; }
.debugline-text strong {
  display: block;
  font-size: .88rem;
  color: var(--ink);
  margin-bottom: 2px;
}
.debugline-text code {
  font-family: var(--font-mono);
  font-size: .92em;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0 4px;
}

/* rendered ANSI log */
.ansi {
  margin: 0;
  padding: 18px;
  max-height: 70vh;
  overflow: auto;
  background: var(--ink-panel);
  border-radius: var(--r-sm);
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.55;
  color: #d6d8da;
  white-space: pre;
  tab-size: 4;
}
.ansi .ansi-red    { color: #ff6b6b; font-weight: 600; }
.ansi .ansi-green  { color: #62d387; font-weight: 600; }
.ansi .ansi-yellow { color: #f3c969; font-weight: 600; }
.ansi .ansi-blue   { color: #62c8e0; font-weight: 600; }
.ansi .ansi-grey   { color: #9aa0a6; }
.ansi .ansi-bold   { color: #ffffff; font-weight: 700; }


/* 13 — SIGN IN ============================================================ */
.auth-wrap { min-height: 100dvh; display: grid; grid-template-columns: 1fr; }

/* The sign-in panel runs on ink so the logo artwork — which is drawn on a
   dark ground — sits in its own environment rather than on a white box. */
.auth-visual {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 56px var(--gutter);
  background:
    radial-gradient(720px 520px at 50% 40%, rgba(234, 124, 27, .18), transparent 64%),
    radial-gradient(520px 420px at 6% 98%, rgba(234, 124, 27, .08), transparent 60%),
    var(--ink-panel);
  color: var(--on-ink);
}

/* the light wordmark: charcoal letters recoloured white, orange node kept */
.auth-logo {
  width: min(400px, 78vw);
  height: auto;
  margin: 0 auto;
}
.auth-maker {
  margin: 18px auto 0;
  text-align: center;
  font-family: var(--font-mono);
  font-size: .76rem;
  font-weight: 500;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--on-ink-dim);
}
.wordmark-lede {
  max-width: 34ch;
  margin-inline: auto;
  text-align: center;
  font-size: 1.02rem;
  line-height: 1.6;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.auth-visual .rule {
  width: 64px; height: 3px;
  background: linear-gradient(90deg, var(--orange), var(--orange-deep));
  margin: 30px auto 22px;
  border-radius: var(--r-pill);
}
.auth-visual p { color: var(--on-ink-mid); }

.auth-panel { display: flex; align-items: center; justify-content: center; padding: 40px var(--gutter) 56px; }
.auth-form {
  width: 100%; max-width: 400px;
  padding: 30px 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
}
.auth-form h2 { font-size: 1.4rem; margin-bottom: 4px; }
.auth-form .btn { width: 100%; margin-top: 4px; }


/* 14 — FOOTER ============================================================= */
.pagefoot {
  display: flex; flex-wrap: wrap; gap: 10px;
  justify-content: space-between; align-items: center;
  max-width: var(--wrap);
  margin-inline: auto;
  padding: 20px var(--gutter) 34px;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: .72rem;
  color: var(--text-dim);
}
body.is-anonymous .pagefoot { display: none; }


/* 15 — RESPONSIVE ========================================================= */
@media (min-width: 560px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 768px) {
  :root { --gutter: 28px; }
  .tool-grid   { grid-template-columns: repeat(2, 1fr); }
  .detail-grid { grid-template-columns: repeat(2, 1fr); }
  .auth-form   { padding: 36px 32px; }
}

@media (min-width: 992px) {
  :root { --gutter: 32px; --header-h: 76px; }
  .grid-3      { grid-template-columns: repeat(3, 1fr); }
  .tool-grid   { grid-template-columns: repeat(3, 1fr); }
  .detail-grid { grid-template-columns: repeat(3, 1fr); }
  .auth-wrap   { grid-template-columns: 1fr .8fr; }
  .auth-visual { padding: 72px 56px; }
}

@media (max-width: 991px) {
  /* Nav drops to its own row; brand and account stay on the first line. */
  .topbar { flex-wrap: wrap; gap: 10px 16px; padding: 10px var(--gutter); }
  .topnav {
    order: 3;
    width: 100%;
    margin-left: 0;
    gap: 2px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .topnav::-webkit-scrollbar { display: none; }
  .account-menu { margin-left: auto; }
  .account-panel { right: 0; left: auto; }
  .runstrip { flex-wrap: wrap; }
}

@media (max-width: 560px) {
  .brand-text { display: none; }           /* the wordmark already says it */
  .account-who { display: none; }          /* initials alone identify the user */
  .account-menu > summary { padding: 4px; }
  .account-panel { position: fixed; left: var(--gutter); right: var(--gutter); min-width: 0; }
}

@media (hover: none) {
  .tool:hover, .btn:hover { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .radar-check { stroke-dashoffset: 0; opacity: 1; }
  .progress.is-active span { background-image: none; }
}

@media print {
  .topbar, .pagefoot, .btn-row, .runstrip, .progress { display: none; }
  body { background: #fff; }
  .card, .result { border-color: #ccc; box-shadow: none; }
  .result-body[hidden] { display: block !important; }
}

/* =====================================================================
   Multi-factor authentication
   ===================================================================== */

/* the six-digit field: wide, spaced, unmistakably a code entry */
.otp-input {
  font-family: var(--font-mono);
  font-size: 1.9rem;
  font-weight: 600;
  letter-spacing: .42em;
  text-indent: .42em;          /* keeps the glyphs optically centred */
  text-align: center;
  padding: 14px 12px;
}
.otp-input::placeholder {
  color: var(--line);
  letter-spacing: .42em;
}

/* enrolment layout */
.enrol { display: grid; grid-template-columns: 1fr; gap: 28px; }
.enrol-qr {
  display: flex;
  align-items: flex-start;
  justify-content: center;
}
.enrol-qr svg {
  width: 220px;
  height: 220px;
  padding: 12px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.qr-missing {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 220px;
  padding: 40px 20px;
  text-align: center;
  background: var(--surface-sunk);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-md);
  font-size: .84rem;
  color: var(--text-dim);
}
.qr-missing strong { color: var(--ink); }

.steps { margin: 0 0 22px; padding: 0; list-style: none; counter-reset: step; }
.steps li {
  position: relative;
  counter-increment: step;
  padding: 0 0 16px 38px;
  font-size: .86rem;
  color: var(--text-dim);
}
.steps li::before {
  content: counter(step);
  position: absolute; left: 0; top: -1px;
  display: grid; place-items: center;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--orange);
  color: var(--ink-strong);
  font-family: var(--font-mono);
  font-size: .72rem;
  font-weight: 600;
}
.steps li strong { display: block; color: var(--ink); font-size: .94rem; margin-bottom: 1px; }

.setup-key {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 14px;
  background: var(--surface-sunk);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}
.setup-key-label {
  font-family: var(--font-mono);
  font-size: .64rem; letter-spacing: .13em; text-transform: uppercase;
  color: var(--text-dim);
}
.setup-key code { flex: 1; font-size: .92rem; letter-spacing: .06em; color: var(--ink); }

/* status */
.mfa-status { display: flex; align-items: center; gap: 14px; }
.mfa-badge {
  display: grid; place-items: center;
  min-width: 46px; padding: 5px 12px;
  border-radius: var(--r-pill);
  font-family: var(--font-mono);
  font-size: .68rem; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase;
}
.mfa-badge.is-on  { background: #eaf7ef; color: var(--ok); }
.mfa-badge.is-off { background: var(--surface-alt); color: var(--text-dim); }

/* recovery codes */
.recovery-card { border-left: 3px solid var(--orange); }
.recovery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  margin: 0; padding: 16px;
  list-style: none;
  background: var(--surface-sunk);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}
.recovery-grid li {
  padding: 7px 10px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: .92rem;
  letter-spacing: .05em;
  text-align: center;
  color: var(--ink);
}

@media (min-width: 768px) {
  .enrol { grid-template-columns: 260px 1fr; gap: 34px; }
  .enrol-qr { justify-content: flex-start; }
}

@media print {
  .recovery-grid { break-inside: avoid; }
  .recovery-card .btn-row { display: none; }
}


/* directory connection test */
.testlist { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.testlist li {
  position: relative;
  padding: 12px 14px 12px 42px;
  background: var(--surface-sunk);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-strong);
  border-radius: var(--r-sm);
  font-size: .88rem;
}
.testlist li::before {
  position: absolute; left: 14px; top: 12px;
  font-family: var(--font-mono);
  font-weight: 700;
}
.testlist li.is-ok   { border-left-color: var(--ok); }
.testlist li.is-fail { border-left-color: var(--err); }
.testlist li.is-ok::before   { content: '✓'; color: var(--ok); }
.testlist li.is-fail::before { content: '✗'; color: var(--err); }
.testlist strong { display: block; color: var(--ink); margin-bottom: 2px; }
.testlist .mono { display: block; font-size: .78rem; color: var(--text-dim); line-height: 1.5; }


/* credential field with reveal / copy */
.reveal { display: flex; gap: 8px; align-items: stretch; flex-wrap: wrap; }
.reveal input { flex: 1; min-width: 200px; }
.reveal .btn { min-height: 0; padding: 10px 16px; font-size: .84rem; }

.credential-card { border-left: 3px solid var(--orange); }

.policy-note.is-ok      { color: var(--ok); }
.policy-note.is-missing { color: var(--warn); }

/* a button that reads as a link, for inline table actions */
.linkbutton {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-size: .74rem;
  color: var(--orange-ink);
  text-decoration: underline;
  cursor: pointer;
}
.linkbutton:hover { color: var(--orange-deep); }


/* =====================================================================
   Threat modelling
   ===================================================================== */

.spread { display: flex; gap: 18px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }

.statgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-bottom: 22px; }
@media (min-width: 760px) { .statgrid { grid-template-columns: repeat(5, 1fr); } }
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-strong);
  border-radius: var(--r-md);
  padding: 15px 17px;
}
.stat b { display: block; font-family: var(--font-display); font-size: 1.7rem; line-height: 1.1; color: var(--ink); }
.stat span {
  font-family: var(--font-mono); font-size: .6rem;
  letter-spacing: .11em; text-transform: uppercase; color: var(--text-dim);
}
.stat.is-accent { border-left-color: var(--orange); }
.stat.is-critical { border-left-color: var(--err); }
.stat.is-critical b { color: var(--err); }

/* tabs rendered as links */
a.tab { text-decoration: none; }
a.tab.is-active { color: var(--orange-ink); font-weight: 600; }
a.tab.is-active::after { transform: scaleX(1); width: 100%; }

.tm-split { grid-template-columns: 1fr; }
@media (min-width: 1000px) { .tm-split { grid-template-columns: minmax(0,1fr) 340px; } }

/* grammar composer */
.grammar { background: var(--surface-sunk); border: 1px solid var(--line); border-radius: var(--r-md); padding: 20px; }
.grammar-line { display: grid; gap: 14px; }
@media (min-width: 860px) { .grammar-line { grid-template-columns: 1fr 1fr; } }
.connector {
  font-family: var(--font-mono); font-size: .66rem;
  letter-spacing: .13em; text-transform: uppercase;
  color: var(--orange-ink); margin: 14px 0 8px;
}
.grammar .field { margin-bottom: 0; }

.statement {
  margin-top: 18px; padding: 16px 18px;
  background: var(--white);
  border: 1px solid var(--line);
  border-left: 3px solid var(--orange);
  border-radius: var(--r-sm);
  font-size: 1rem; line-height: 1.65;
}
.statement em {
  font-style: normal;
  background: var(--orange-tint); color: var(--orange-ink);
  padding: 1px 5px; border-radius: 4px;
}
.statement .ph { color: var(--text-dim); opacity: .6; font-style: italic; }

.meter { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.meter-bar { flex: 1; max-width: 220px; height: 5px; background: var(--line-soft); border-radius: var(--r-pill); overflow: hidden; }
.meter-bar span { display: block; height: 100%; background: var(--orange); border-radius: var(--r-pill); transition: width .3s var(--ease); }
.meter b { font-family: var(--font-mono); font-size: .72rem; color: var(--text-mid); }

/* selectable chips */
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  margin: 0; padding: 6px 12px;
  border: 1px solid var(--line-strong); border-radius: var(--r-pill);
  background: var(--white);
  font-size: .78rem; font-weight: 400; color: var(--text-mid);
  cursor: pointer; user-select: none;
}
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip.on { background: var(--orange-tint); border-color: var(--orange); color: var(--orange-ink); font-weight: 600; }
.chip.is-suggested { border-style: dashed; border-color: var(--orange); color: var(--orange-ink); }
.chip small { font-family: var(--font-mono); font-size: .62rem; opacity: .75; }

/* threat rows */
.tlist { display: grid; gap: 10px; }
.threat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--risk-medium);
  border-radius: var(--r-md);
  overflow: hidden;
}
.threat.pr-critical { border-left-color: var(--err); }
.threat.pr-high { border-left-color: #c2410c; }
.threat.pr-medium { border-left-color: var(--warn); }
.threat.pr-low { border-left-color: #a16207; }
.threat-head {
  display: flex; align-items: flex-start; gap: 14px;
  width: 100%; padding: 14px 18px;
  background: none; border: 0; text-align: left;
  font-family: var(--font-body); cursor: pointer;
}
.threat-head:hover { background: var(--surface-sunk); }
.tnum { font-family: var(--font-mono); font-size: .72rem; color: var(--text-dim); padding-top: 3px; flex: none; }
.tbody-wrap { flex: 1; min-width: 0; }
.tstatement { display: block; font-size: .9rem; color: var(--ink); margin-bottom: 6px; }
.tmeta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.threat-detail { padding: 4px 18px 18px; border-top: 1px solid var(--line-soft); }
.threat-detail[hidden] { display: none; }
.detail-label {
  margin: 16px 0 0;
  font-family: var(--font-mono); font-size: .66rem;
  letter-spacing: .13em; text-transform: uppercase; color: var(--orange-ink);
}
.pill-critical { background: var(--err); }
.pill-high { background: #c2410c; }
.pill-medium { background: var(--warn); }
.pill-low { background: #a16207; }

.mitline {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 9px 12px; margin-top: 8px;
  background: var(--surface-sunk);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: .85rem;
}
.mitline.is-missing { border-style: dashed; border-color: var(--err); color: var(--err); }

.vendor-tag {
  display: inline-flex; align-items: center;
  font-family: var(--font-mono); font-size: .62rem;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--orange-ink); background: var(--orange-tint);
  border-radius: var(--r-pill); padding: 2px 9px;
}

/* library */
.libgrid { display: grid; gap: 10px; }
.lib {
  display: flex; gap: 14px; align-items: flex-start;
  margin: 0; padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  font-weight: 400; cursor: pointer;
  transition: border-color .18s var(--ease), background .18s var(--ease);
}
.lib:hover { border-color: var(--line-strong); }
.lib.sel { border-color: var(--orange); background: var(--orange-tint); }
.lib input { flex: none; width: 16px; height: 16px; margin-top: 3px; accent-color: var(--orange); }
.lib-main { flex: 1; min-width: 0; }
.lib-title { display: block; font-weight: 600; color: var(--ink); font-size: .92rem; margin-bottom: 3px; }
.lib-state { display: block; font-size: .82rem; color: var(--text-mid); margin-bottom: 8px; }
.usecount { font-family: var(--font-mono); font-size: .66rem; color: var(--text-dim); }

.assignbar {
  position: sticky; bottom: 16px;
  display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  margin-top: 16px; padding: 14px 18px;
  background: var(--ink-panel); color: #fff;
  border-radius: var(--r-md); box-shadow: var(--shadow-lg);
}
.assignbar b { font-family: var(--font-mono); font-size: .8rem; }
.assignbar .btn-secondary { border-color: rgba(255,255,255,.35); color: #fff; }
.assignbar[hidden] { display: none; }

/* insights */
.bars { display: grid; gap: 9px; }
.bar { display: grid; grid-template-columns: 130px 1fr 34px; gap: 10px; align-items: center; font-size: .82rem; }
.bar-track { height: 8px; background: var(--line-soft); border-radius: var(--r-pill); overflow: hidden; }
.bar-track span { display: block; height: 100%; border-radius: var(--r-pill); }
.bar b { font-family: var(--font-mono); font-size: .74rem; text-align: right; color: var(--text-mid); }

.finding {
  display: flex; gap: 11px;
  padding: 11px 14px; margin-bottom: 8px;
  background: var(--surface-sunk);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-strong);
  border-radius: var(--r-sm);
  font-size: .86rem;
}
.finding::before { font-family: var(--font-mono); font-weight: 700; }
.f-error { border-left-color: var(--err); } .f-error::before { content: '!'; color: var(--err); }
.f-warn  { border-left-color: var(--warn); } .f-warn::before  { content: '!'; color: var(--warn); }
.f-info  { border-left-color: var(--orange); } .f-info::before { content: 'i'; color: var(--orange-ink); }
.f-ok    { border-left-color: var(--ok); } .f-ok::before    { content: '✓'; color: var(--ok); }

/* assumptions and inline adders */
.assumption {
  display: flex; gap: 10px; align-items: flex-start; justify-content: space-between;
  padding: 10px 12px; margin-bottom: 8px;
  background: var(--surface-sunk);
  border: 1px solid var(--line);
  border-left: 3px solid var(--orange);
  border-radius: var(--r-sm);
  font-size: .85rem;
}
.inline-add { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 16px; }
.inline-add input[type="text"] { flex: 1; min-width: 160px; }

.linkgrid { display: grid; gap: 6px; max-height: 260px; overflow-y: auto; padding: 10px; background: var(--surface-sunk); border: 1px solid var(--line); border-radius: var(--r-sm); }
.linkrow { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; font-size: .82rem; margin: 0; cursor: pointer; }
.linkrow input { width: auto; margin-top: 3px; accent-color: var(--orange); }

.empty-state {
  display: flex; flex-direction: column; gap: 6px;
  padding: 34px; text-align: center;
  border: 1px dashed var(--line-strong); border-radius: var(--r-md);
  color: var(--text-dim); font-size: .88rem;
}
.empty-state strong { color: var(--ink); font-size: .95rem; }

.promote { display: inline-block; position: relative; }
.promote > summary { list-style: none; }
.promote > summary::-webkit-details-marker { display: none; }
.promote-form {
  position: absolute; z-index: 50; top: calc(100% + 8px); left: 0;
  width: 320px; padding: 16px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--shadow-lg);
}

/* =====================================================================
   Dashboard widgets
   ===================================================================== */

.widgets { display: grid; grid-template-columns: 1fr; gap: 16px; margin-bottom: 24px; }
@media (min-width: 700px) { .widgets { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1050px) {
  .widgets { grid-template-columns: 1.4fr 1fr 1fr 1fr; }
  .widget-lead { grid-row: span 1; }
}

.widget {
  display: flex; flex-direction: column;
  padding: 20px 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  color: var(--ink);
  text-decoration: none;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), border-color .18s var(--ease);
}
.widget:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--line-strong); color: var(--ink); }

.widget-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.widget-label {
  font-family: var(--font-mono); font-size: .62rem;
  letter-spacing: .13em; text-transform: uppercase; color: var(--text-dim);
}
.widget-figure {
  font-family: var(--font-display); font-size: 2.6rem; font-weight: 600;
  line-height: 1; letter-spacing: -.03em; color: var(--ink);
}
.widget-sub { font-size: .86rem; color: var(--text-mid); margin-top: 6px; }
.widget-foot { font-size: .78rem; color: var(--text-dim); margin-top: auto; padding-top: 12px; }

.widget-bar {
  height: 6px; margin-top: 14px;
  background: var(--line-soft); border-radius: var(--r-pill); overflow: hidden;
}
.widget-bar span {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--orange), var(--orange-deep));
  border-radius: var(--r-pill);
}
.widget-lead .widget-figure { font-size: 3.2rem; }
.widget-lead.is-alert { border-left: 3px solid var(--err); }
.widget-lead.is-alert .widget-figure { color: var(--err); }

.attention-row { display: flex; align-items: flex-start; gap: 14px; padding: 14px 18px; text-decoration: none; }
.attention-row:hover { background: var(--surface-sunk); color: var(--ink); }

/* =====================================================================
   Tenant switcher
   ===================================================================== */

.tenant-menu { position: relative; flex: none; }
.tenant-menu > summary {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface-alt);
  font-size: .82rem; font-weight: 600; color: var(--ink);
  cursor: pointer; list-style: none; white-space: nowrap;
}
.tenant-menu > summary::-webkit-details-marker { display: none; }
.tenant-menu > summary::marker { content: ''; }
.tenant-menu > summary:hover { border-color: var(--orange); color: var(--orange-ink); }
.tenant-menu > summary svg:first-child { color: var(--orange); }
.tenant-menu[open] .account-caret { transform: rotate(180deg); }
.tenant-menu .account-panel { min-width: 260px; max-height: 380px; overflow-y: auto; }

@media (max-width: 700px) { .tenant-menu > summary span { display: none; } }

/* =====================================================================
   Documentation space
   ===================================================================== */

.wiki-layout { grid-template-columns: 1fr; }
@media (min-width: 900px) { .wiki-layout { grid-template-columns: 260px minmax(0, 1fr); } }

.wiki-nav { position: sticky; top: 92px; align-self: start; padding: 18px; }
.wiki-tree { display: grid; gap: 2px; }
.wiki-link {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px;
  border-radius: var(--r-sm);
  font-size: .86rem; color: var(--text-mid);
}
.wiki-link span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wiki-link i { font-style: normal; color: var(--warn); font-weight: 700; }
.wiki-link b {
  font-family: var(--font-mono); font-size: .6rem; font-weight: 500;
  color: var(--text-dim); background: var(--surface-alt);
  border-radius: var(--r-pill); padding: 1px 6px;
}
.wiki-link:hover { background: var(--surface-alt); color: var(--ink); }
.wiki-link.is-current { background: var(--orange-tint); color: var(--orange-ink); font-weight: 600; }

.wiki-body { font-size: .95rem; line-height: 1.7; color: var(--text-mid); }
.wiki-body h2, .wiki-body h3, .wiki-body h4 { margin: 24px 0 8px; color: var(--ink); }
.wiki-body h2 { font-size: 1.25rem; }
.wiki-body h3 { font-size: 1.05rem; }
.wiki-body h4 { font-size: .95rem; }
.wiki-body p { margin: 0 0 12px; }
.wiki-body ul { margin: 0 0 14px 20px; padding: 0; }
.wiki-body li { margin-bottom: 5px; }
.wiki-body code {
  font-family: var(--font-mono); font-size: .86em;
  background: var(--surface-alt); border: 1px solid var(--line);
  border-radius: 4px; padding: 1px 5px;
}
.wiki-body pre.wiki-code {
  margin: 0 0 14px; padding: 14px 16px;
  background: var(--ink-panel); color: #d6d8da;
  border-radius: var(--r-sm); overflow-x: auto;
  font-family: var(--font-mono); font-size: .82rem; line-height: 1.55;
}
.wiki-body pre.wiki-code code { background: none; border: 0; padding: 0; color: inherit; }
.wiki-body blockquote {
  margin: 0 0 14px; padding: 10px 16px;
  border-left: 3px solid var(--orange);
  background: var(--surface-sunk);
  color: var(--text-mid);
}
.wiki-body hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }

.editor-toolbar {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 8px 10px; margin-bottom: -1px;
  background: var(--surface-alt);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm) var(--r-sm) 0 0;
}
.editor-toolbar button {
  min-width: 32px; padding: 5px 9px;
  background: var(--white); border: 1px solid var(--line);
  border-radius: 4px; font-size: .78rem; color: var(--text-mid); cursor: pointer;
}
.editor-toolbar button:hover { border-color: var(--orange); color: var(--orange-ink); }
.editor-toolbar + textarea { border-radius: 0 0 var(--r-sm) var(--r-sm); }

.wiki-preview {
  margin-top: 18px; padding: 18px 20px;
  background: var(--surface-sunk);
  border: 1px solid var(--line);
  border-left: 3px solid var(--orange);
  border-radius: var(--r-sm);
  font-size: .92rem; line-height: 1.7; color: var(--text-mid);
}
.wiki-preview:empty { display: none; }
.wiki-preview h2, .wiki-preview h3 { color: var(--ink); margin: 16px 0 6px; font-size: 1.05rem; }
.wiki-preview code { font-family: var(--font-mono); font-size: .86em; background: var(--white); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }
.wiki-preview pre.wiki-code { background: var(--ink-panel); color: #d6d8da; padding: 12px 14px; border-radius: var(--r-sm); overflow-x: auto; }

.fileline {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px; margin-top: 8px;
  background: var(--surface-sunk);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: .86rem;
}
.filemeta { display: flex; flex-direction: column; gap: 2px; }
.dropzone-form { padding: 18px; background: var(--surface-sunk); border: 1px dashed var(--line-strong); border-radius: var(--r-md); }

/* =====================================================================
   Overview launcher
   ===================================================================== */

.launch-grid { grid-template-columns: 1fr; margin-bottom: 24px; }
@media (min-width: 700px) { .launch-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1050px) { .launch-grid { grid-template-columns: repeat(4, 1fr); } }

.launch {
  position: relative;
  display: flex; flex-direction: column; gap: 4px;
  overflow: hidden;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  color: var(--ink); text-decoration: none;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease);
}
.launch::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--orange), var(--orange-deep));
  transform: scaleX(0); transform-origin: left;
  transition: transform .3s var(--ease);
}
.launch:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); color: var(--ink); }
.launch:hover::before { transform: scaleX(1); }
.launch-group {
  font-family: var(--font-mono); font-size: .6rem;
  letter-spacing: .13em; text-transform: uppercase; color: var(--orange-ink);
}
.launch strong { font-family: var(--font-display); font-size: 1.15rem; letter-spacing: -.02em; }
.launch-note { font-size: .82rem; color: var(--text-dim); line-height: 1.5; margin-top: 2px; }

/* =====================================================================
   Roles and permissions
   ===================================================================== */

.rbac-layout { grid-template-columns: 1fr; }
@media (min-width: 950px) { .rbac-layout { grid-template-columns: 300px minmax(0, 1fr); } }

.rolelist { display: grid; gap: 4px; margin-top: 12px; }
.roleitem {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 11px 13px;
  border: 1px solid transparent; border-radius: var(--r-sm);
  color: var(--text-mid);
}
.roleitem-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.roleitem-main strong { font-size: .88rem; color: var(--ink); }
.roleitem-main span { font-family: var(--font-mono); font-size: .64rem; color: var(--text-dim); }
.roleitem:hover { background: var(--surface-alt); }
.roleitem.is-current { background: var(--orange-tint); border-color: var(--orange); }
.roleitem.is-current strong { color: var(--orange-ink); }

.permgroup { margin-bottom: 22px; }
.permgroup-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding-bottom: 6px; margin-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.permgroup-head h3 {
  margin: 0;
  font-family: var(--font-mono); font-size: .66rem;
  letter-spacing: .13em; text-transform: uppercase; color: var(--orange-ink);
}
.permrow {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 8px 10px; margin: 0;
  border-radius: var(--r-sm);
  font-weight: 400; cursor: pointer;
}
.permrow:hover { background: var(--surface-sunk); }
.permrow input { width: auto; margin-top: 3px; flex: none; accent-color: var(--orange); }
.permrow > span { display: flex; flex-direction: column; gap: 1px; }
.permrow strong { font-size: .86rem; color: var(--ink); font-weight: 500; }
.permrow .mono { font-size: .66rem; color: var(--text-dim); }

/* =====================================================================
   File repository
   ===================================================================== */

.repo-layout { grid-template-columns: 1fr; }
@media (min-width: 950px) { .repo-layout { grid-template-columns: 270px minmax(0, 1fr); } }
.repo-nav { position: sticky; top: 92px; align-self: start; padding: 18px; }

.crumbs {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-bottom: 18px;
  font-family: var(--font-mono); font-size: .74rem;
  color: var(--text-dim);
}
.crumbs a { color: var(--text-mid); }
.crumbs a:hover { color: var(--orange-ink); }
.crumbs a:last-child { color: var(--ink); font-weight: 600; }

.foldergrid { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 14px; }
@media (min-width: 620px) { .foldergrid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1150px) { .foldergrid { grid-template-columns: repeat(3, 1fr); } }

.foldercard {
  display: flex; flex-direction: column; gap: 3px;
  padding: 16px 18px;
  background: var(--surface-sunk);
  border: 1px solid var(--line);
  border-left: 3px solid var(--orange);
  border-radius: var(--r-md);
  color: var(--ink); text-decoration: none;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease);
}
.foldercard:hover { transform: translateY(-2px); box-shadow: var(--shadow); color: var(--ink); }
.foldercard strong { font-size: .95rem; }
.foldercard span { font-size: .78rem; color: var(--text-dim); }
.foldercard .pill { align-self: flex-start; margin-top: 5px; }

.newfolder > summary { list-style: none; display: inline-flex; }
.newfolder > summary::-webkit-details-marker { display: none; }

/* =====================================================================
   Knowledge base additions
   ===================================================================== */

.toc {
  margin-bottom: 22px; padding: 14px 16px;
  background: var(--surface-sunk);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}
.toc > summary {
  font-family: var(--font-mono); font-size: .66rem;
  letter-spacing: .13em; text-transform: uppercase;
  color: var(--orange-ink); cursor: pointer;
}
.toc nav { display: grid; gap: 2px; margin-top: 10px; }
.toc nav a { font-size: .84rem; color: var(--text-mid); padding: 3px 0; }
.toc nav a:hover { color: var(--orange-ink); }

.wiki-body h2 .anchor, .wiki-body h3 .anchor, .wiki-body h4 .anchor {
  opacity: 0; font-weight: 400; color: var(--orange); text-decoration: none;
  font-size: .8em; margin-left: 6px; transition: opacity .15s var(--ease);
}
.wiki-body h2:hover .anchor, .wiki-body h3:hover .anchor, .wiki-body h4:hover .anchor { opacity: 1; }

.wiki-table-wrap { overflow-x: auto; margin: 0 0 16px; }
.wiki-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.wiki-table th {
  background: var(--surface-alt); text-align: left;
  font-family: var(--font-mono); font-size: .64rem;
  letter-spacing: .1em; text-transform: uppercase; color: var(--text-dim);
  padding: 9px 11px; border-bottom: 1px solid var(--line);
}
.wiki-table td { padding: 9px 11px; border-bottom: 1px solid var(--line-soft); }

.wiki-internal { color: var(--orange-ink); border-bottom: 1px solid var(--orange-tint); }
.wiki-missing {
  color: var(--err); border-bottom: 1px dashed var(--err); cursor: help;
}

.revisions { margin-top: 22px; }
.revisions > summary {
  font-family: var(--font-mono); font-size: .68rem;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-dim); cursor: pointer;
}
.revisions > summary:hover { color: var(--orange-ink); }

/* =====================================================================
   Monitoring dashboard
   ===================================================================== */

.dashboard { margin-bottom: 30px; }
.dashboard-intro { margin-bottom: 18px; }
.dashboard-foot { margin-top: 14px; text-align: right; }

.widgetgrid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 760px)  { .widgetgrid { grid-template-columns: repeat(6, 1fr); } }

.dwidget {
  grid-column: span 6;
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
@media (min-width: 760px) {
  .dwidget.is-third { grid-column: span 2; }
  .dwidget.is-half  { grid-column: span 3; }
  .dwidget.is-full  { grid-column: span 6; }
}

.dwidget-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--line-soft);
}
.dwidget-head h2 { margin: 0; font-size: .98rem; }
.dwidget-head .hint { margin: 2px 0 0; }
.dwidget-body { padding: 16px 18px 18px; flex: 1; }
.dwidget-body .data td, .dwidget-body .data th { padding: 8px 6px; }
.widget-table { font-size: .84rem; }

.widget-ok {
  display: flex; flex-direction: column; gap: 3px;
  padding: 18px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--r-sm);
  font-size: .86rem; color: var(--text-mid);
}
.widget-ok strong { color: var(--ok); }
.widget-text { font-size: .88rem; color: var(--text-mid); line-height: 1.65; }

/* charts */
.chart { display: block; width: 100%; height: auto; overflow: visible; }
.ch-line { fill: none; stroke: var(--orange); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ch-grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 4; }
.ch-axis { font-family: var(--font-mono); font-size: 9px; fill: var(--text-dim); }
.chart-empty {
  padding: 26px; text-align: center;
  border: 1px dashed var(--line-strong); border-radius: var(--r-sm);
  color: var(--text-dim); font-size: .84rem;
}
.spark { display: block; margin: 8px 0; }
.spark .ch-line { stroke-width: 1.6; }

.gauge { display: block; margin: 0 auto; }
.ch-gauge-track { fill: none; stroke: var(--line-soft); stroke-width: 12; stroke-linecap: round; }
.ch-gauge-value { fill: none; stroke-width: 12; stroke-linecap: round; }
.ch-gauge-text {
  font-family: var(--font-display); font-size: 22px; font-weight: 600;
  fill: var(--ink); text-anchor: middle;
}
.ch-gauge-units { font-family: var(--font-mono); font-size: 11px; fill: var(--text-dim); }

.bignumber { display: flex; flex-direction: column; gap: 2px; }
.bignumber b {
  font-family: var(--font-display); font-size: 2.3rem; font-weight: 600;
  line-height: 1.1; letter-spacing: -.03em; color: var(--ink);
}

.hostbar { display: flex; align-items: center; gap: 12px; }
.hostbar-track {
  flex: 1; height: 10px; background: var(--err);
  border-radius: var(--r-pill); overflow: hidden;
}
.hostbar-track span { display: block; height: 100%; background: var(--ok); border-radius: var(--r-pill); }
.hostbar b { font-family: var(--font-mono); font-size: .78rem; color: var(--text-mid); white-space: nowrap; }

.servicegrid { display: grid; gap: 8px; }
.service {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: var(--surface-sunk);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: .86rem;
}
.service-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--text-dim); }
.service.is-up .service-dot { background: var(--ok); }
.service.is-down .service-dot { background: var(--err); }
.service-name { flex: 1; color: var(--ink); }
.service-state { font-family: var(--font-mono); font-size: .68rem; color: var(--text-dim); text-transform: uppercase; }
.service.is-down .service-state { color: var(--err); }

/* dashboard builder */
.widgetpicker { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 18px; }
@media (min-width: 700px)  { .widgetpicker { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1050px) { .widgetpicker { grid-template-columns: repeat(4, 1fr); } }
.widgettype {
  display: flex; flex-direction: column; gap: 3px;
  padding: 14px 16px;
  background: var(--surface-sunk);
  border: 1px solid var(--line);
  border-left: 3px solid var(--orange);
  border-radius: var(--r-sm);
  color: var(--ink); text-decoration: none;
}
.widgettype:hover { background: var(--orange-tint); color: var(--ink); }
.widgettype strong { font-size: .88rem; }
.widgettype span { font-size: .76rem; color: var(--text-dim); line-height: 1.45; }

.itempicker { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.itemresults { display: grid; gap: 4px; max-height: 320px; overflow-y: auto; margin-top: 10px; }
.itemrow {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 11px; margin: 0;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  font-weight: 400; cursor: pointer;
}
.itemrow:hover { background: var(--surface-sunk); }
.itemrow input { width: auto; margin-top: 3px; flex: none; accent-color: var(--orange); }
.itemrow strong { display: block; font-size: .85rem; color: var(--ink); font-weight: 500; }
.chosen-items { display: flex; flex-wrap: wrap; gap: 7px; min-height: 34px; align-items: center; }

.grouplist {
  display: grid; gap: 4px; max-height: 300px; overflow-y: auto;
  padding: 12px; background: var(--surface-sunk);
  border: 1px solid var(--line); border-radius: var(--r-sm);
}
.grouprow { display: flex; align-items: center; gap: 10px; margin: 0; font-weight: 400; font-size: .85rem; cursor: pointer; }
.grouprow input { width: auto; accent-color: var(--orange); }

/* =====================================================================
   Forms: pinned commit bar
   ===================================================================== */

.card.is-editing { border-left: 3px solid var(--orange); }

/* The primary action stays reachable on a long form instead of sitting
   below the fold, which is how a "missing" save button usually happens. */
.formbar {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  margin: 22px -24px -24px;
  padding: 16px 24px;
  background: linear-gradient(180deg, rgba(255,255,255,.75), var(--surface) 40%);
  border-top: 1px solid var(--line);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* =====================================================================
   Navigation sections
   ===================================================================== */

.navsection { margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--line-soft); }
.navsection a { padding-left: 32px; }
.navsection a::before, .navsection a::after { left: 18px; }
.navsection:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.navsection-label {
  display: block; padding: 4px 12px 2px;
  font-family: var(--font-mono); font-size: .58rem;
  letter-spacing: .14em; text-transform: uppercase; color: var(--orange-ink);
}

/* =====================================================================
   Customer access layout
   ===================================================================== */

.access-layout { grid-template-columns: 1fr; }
@media (min-width: 950px) { .access-layout { grid-template-columns: 280px minmax(0, 1fr); } }
.access-nav { position: sticky; top: 92px; align-self: start; padding: 18px; max-height: calc(100vh - 120px); overflow-y: auto; }

/* Host group picker rows */
.grouprow-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grouprow-count {
  flex: none;
  font-family: var(--font-mono); font-size: .64rem;
  color: var(--text-dim); background: var(--surface-alt);
  border: 1px solid var(--line); border-radius: var(--r-pill);
  padding: 1px 8px;
}
.grouplist .grouprow { padding: 5px 4px; border-radius: var(--r-sm); }
.grouplist .grouprow:hover { background: var(--white); }

/* Hover-opened menus need a bridge over the gap between summary and panel,
   or the pointer "leaves" the group while travelling between them. */

.fieldset {
  margin: 0 0 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-sunk);
}
.fieldset legend {
  padding: 0 8px;
  font-family: var(--font-mono); font-size: .62rem;
  letter-spacing: .13em; text-transform: uppercase; color: var(--orange-ink);
}
.fieldset .field:last-child { margin-bottom: 0; }

/* =====================================================================
   Manual
   ===================================================================== */

.manual-button {
  display: inline-flex; align-items: center; gap: 7px;
  flex: none;
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface);
  font-size: .82rem; font-weight: 600;
  color: var(--text-mid); white-space: nowrap;
  transition: border-color .18s var(--ease), color .18s var(--ease), background .18s var(--ease);
}
.manual-button:hover { border-color: var(--orange); color: var(--orange-ink); background: var(--orange-tint); }
.manual-button svg { color: var(--orange); }
@media (max-width: 860px) { .manual-button span { display: none; } }

.manual-layout { grid-template-columns: 1fr; }
@media (min-width: 950px) { .manual-layout { grid-template-columns: 275px minmax(0, 1fr); } }
.manual-nav {
  position: sticky; top: 92px; align-self: start;
  padding: 18px; max-height: calc(100vh - 120px); overflow-y: auto;
}
.manual-section { margin-bottom: 14px; }
.manual-section-label {
  display: block; padding: 4px 12px 6px;
  font-family: var(--font-mono); font-size: .58rem;
  letter-spacing: .14em; text-transform: uppercase; color: var(--orange-ink);
}

.manual-body { font-size: .95rem; }
.manual-body h2 { margin-top: 30px; padding-bottom: 6px; border-bottom: 1px solid var(--line-soft); }
.manual-body table { margin-bottom: 18px; }

.manual-cards { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 14px; }
@media (min-width: 700px) { .manual-cards { grid-template-columns: repeat(2, 1fr); } }
.manual-card {
  display: flex; flex-direction: column; gap: 3px;
  padding: 15px 17px;
  background: var(--surface-sunk);
  border: 1px solid var(--line);
  border-left: 3px solid var(--orange);
  border-radius: var(--r-sm);
  color: var(--ink);
}
.manual-card:hover { background: var(--orange-tint); color: var(--ink); }
.manual-card strong { font-size: .9rem; }
.manual-card span { font-size: .79rem; color: var(--text-dim); line-height: 1.5; }
.manual-card .pill { align-self: flex-start; margin-top: 6px; }

.searchhit {
  display: flex; flex-direction: column; gap: 3px;
  padding: 14px 16px; margin-top: 10px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  color: var(--text-mid);
}
.searchhit:hover { border-color: var(--orange); background: var(--surface-sunk); color: var(--text-mid); }
.searchhit strong { font-size: .92rem; color: var(--ink); }

/* Accepted file types picker */
.typegrid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 700px)  { .typegrid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1050px) { .typegrid { grid-template-columns: repeat(3, 1fr); } }
.typegroup {
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}
.typegroup-label {
  display: block; margin-bottom: 8px;
  font-family: var(--font-mono); font-size: .58rem;
  letter-spacing: .13em; text-transform: uppercase; color: var(--orange-ink);
}

/* Row actions: one primary control plus an overflow menu */
.rowactions { white-space: nowrap; }
.rowactions > form { display: inline; }
.rowmenu { position: relative; display: inline-block; margin-left: 6px; vertical-align: middle; }
.rowmenu > summary {
  display: grid; place-items: center;
  width: 30px; height: 30px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  color: var(--text-dim); cursor: pointer; list-style: none;
}
.rowmenu > summary::-webkit-details-marker { display: none; }
.rowmenu > summary::marker { content: ''; }
.rowmenu > summary:hover { border-color: var(--orange); color: var(--orange-ink); }
.rowmenu[open] > summary { border-color: var(--orange); color: var(--orange-ink); background: var(--orange-tint); }
.rowmenu-panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 60;
  min-width: 180px; padding: 5px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--shadow-lg);
  text-align: left;
}
.rowmenu-panel a,
.rowmenu-panel button {
  display: block; width: 100%;
  padding: 8px 11px;
  background: none; border: 0; border-radius: var(--r-sm);
  font-family: var(--font-body); font-size: .84rem; text-align: left;
  color: var(--text-mid); cursor: pointer; white-space: nowrap;
}
.rowmenu-panel a:hover,
.rowmenu-panel button:hover { background: var(--surface-alt); color: var(--ink); }
.rowmenu-panel .is-danger { color: var(--err); }
.rowmenu-panel .is-danger:hover { background: #fef2f2; }

/* Collapsed fetch summary */
.fetchresult {
  margin-bottom: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--ok);
  border-radius: var(--r-md);
  overflow: hidden;
}
.fetchresult > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  flex-wrap: wrap;
  padding: 13px 18px;
  cursor: pointer; list-style: none;
}
.fetchresult > summary::-webkit-details-marker { display: none; }
.fetchresult > summary::marker { content: ''; }
.fetchresult > summary:hover { background: var(--surface-sunk); }
.fetchresult-title { font-size: .9rem; color: var(--ink); }
.fetchresult-counts { font-family: var(--font-mono); font-size: .74rem; color: var(--text-dim); }
.fetchresult-body { padding: 4px 18px 18px; border-top: 1px solid var(--line-soft); }

/* =====================================================================
   Left sidebar navigation
   ===================================================================== */

:root { --sidebar-w: 276px; }

.skiplink {
  position: absolute; left: -9999px; top: 0; z-index: 400;
  padding: 10px 16px; background: var(--ink-panel); color: #fff;
  border-radius: 0 0 var(--r-sm) 0;
}
.skiplink:focus { left: 0; color: #fff; }

/*
   The sidebar is black. Text and icons are neutral greys; the brand orange is
   kept for what matters — the current page, an open group and hover — so the
   accent points at where you are instead of tinting the whole rail.
*/
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 200;
  display: flex; flex-direction: column;
  width: var(--sidebar-w);
  color: #c9c9cc;
  background: #000;
  border-right: 1px solid #1c1c1f;
}
/* A thin orange edge at the top of the rail, fading out. */
.sidebar::after {
  content: '';
  position: absolute; top: 0; right: 0; bottom: 0; width: 1px;
  background: linear-gradient(180deg, var(--orange) 0%, rgba(234,124,27,.2) 18%, rgba(234,124,27,0) 45%);
  pointer-events: none;
}

.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px;
  border-bottom: 1px solid #1c1c1f;
}
.sidebar-brand a { display: flex; align-items: center; gap: 11px; flex: 1; min-width: 0; color: inherit; }
.sidebar-mark {
  width: 36px; height: 36px; border-radius: 10px; flex: none;
  background: #fff; padding: 5px;
  box-shadow: 0 0 0 1px rgba(234,124,27,.35), 0 6px 18px -8px rgba(234,124,27,.7);
}
.sidebar-word { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.sidebar-word strong {
  font-family: var(--font-display); font-size: 1.05rem;
  letter-spacing: -.02em; color: #fff;
}
.sidebar-word span {
  font-family: var(--font-mono); font-size: .54rem;
  letter-spacing: .12em; text-transform: uppercase; color: #8b8b90;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.sidebar-close {
  display: none;
  background: none; border: 0; color: #8b8b90; cursor: pointer; padding: 6px;
}

.sidebar-nav { flex: 1; overflow-y: auto; padding: 14px 12px; scrollbar-width: thin; }
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: #2a2a2e; border-radius: 3px; }

/* Top-level rows: Overview, each group summary, Manual */
.navitem,
.navgroup > summary {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 12px; margin-bottom: 3px;
  border-radius: 10px;
  font-size: .92rem; font-weight: 500;
  color: #b8b8bc; cursor: pointer;
  list-style: none;
  transition: background .16s var(--ease), color .16s var(--ease);
}
.navgroup > summary::-webkit-details-marker { display: none; }
.navgroup > summary::marker { content: ''; }
.navitem svg,
.navgroup > summary svg:first-child { flex: none; color: #7d7d82; transition: color .16s var(--ease); }
.navitem span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.navitem:hover,
.navgroup > summary:hover { background: #141416; color: #fff; }
.navitem:hover svg,
.navgroup > summary:hover svg:first-child { color: var(--orange); }

.navitem.is-current {
  background: linear-gradient(90deg, rgba(234,124,27,.26), rgba(234,124,27,.08));
  color: #fff; font-weight: 600;
  box-shadow: inset 2px 0 0 var(--orange);
}
.navitem.is-current svg { color: var(--orange); }

.navgroup[open] > summary { color: #fff; font-weight: 600; background: #111113; }
.navgroup[open] > summary svg:first-child { color: var(--orange); }
.navgroup.is-active > summary { color: #fff; }

.navgroup-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.navgroup-caret { transition: transform .22s var(--ease); color: #7d7d82; }
.navgroup[open] .navgroup-caret { transform: rotate(180deg); }

/* Children, with the connector rail from the reference design */
.navchildren { position: relative; padding: 4px 0 8px 26px; }
.navchildren::before {
  content: '';
  position: absolute; left: 21px; top: 2px; bottom: 14px;
  width: 1px;
  background: #26262a;
}

.navchild {
  position: relative;
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; margin-bottom: 2px;
  border-radius: 9px;
  font-size: .88rem; color: #a3a3a8;
  transition: background .16s var(--ease), color .16s var(--ease);
}
.navchild span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.navchild::before {
  content: '';
  position: absolute; left: -5px; top: 50%;
  width: 9px; height: 1px; background: #2e2e33;
}
.navchild:hover { background: #141416; color: #fff; }
.navchild.is-current {
  background: linear-gradient(90deg, rgba(234,124,27,.3), rgba(234,124,27,.07));
  color: #fff; font-weight: 600;
}
.navchild.is-current::before { background: var(--orange); }

/* Item icons: grey at rest, orange on the page you are on. */
.navicon { flex: none; color: #75757a; transition: color .16s var(--ease); }
.navchild:hover .navicon,
.navsub > summary:hover .navicon { color: #d6d6da; }
.navchild.is-current .navicon,
.navsub[open] > summary .navicon { color: var(--orange); }

.navchild-arrow { opacity: 0; color: #7d7d82; transition: opacity .16s var(--ease); }
.navchild.is-current .navchild-arrow { opacity: 1; color: var(--orange); }
.navchild:hover .navchild-arrow { opacity: .7; }

/* Third level: "Threat modelling" and the like — a row that opens its own list */
.navsub { margin-bottom: 2px; }
.navsub > summary {
  position: relative;
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px;
  border-radius: 9px;
  font-size: .88rem; color: #a3a3a8;
  cursor: pointer; list-style: none;
  transition: background .16s var(--ease), color .16s var(--ease);
}
.navsub > summary::-webkit-details-marker { display: none; }
.navsub > summary::marker { content: ''; }
.navsub > summary::before {
  content: '';
  position: absolute; left: -5px; top: 50%;
  width: 9px; height: 1px; background: #2e2e33;
}
.navsub > summary:hover { background: #141416; color: #fff; }
.navsub[open] > summary { color: #fff; font-weight: 600; }
.navsub[open] > summary::before { background: var(--orange); }
.navsub-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.navsub-caret { flex: none; color: #7d7d82; transition: transform .22s var(--ease); }
.navsub[open] .navsub-caret { transform: rotate(180deg); color: var(--orange); }

.navsub-items { position: relative; padding: 2px 0 6px 18px; }
.navsub-items::before {
  content: '';
  position: absolute; left: 6px; top: 0; bottom: 10px;
  width: 1px; background: #26262a;
}

.navchildren .navsection-label {
  display: block; padding: 9px 12px 4px;
  font-family: var(--font-mono); font-size: .56rem;
  letter-spacing: .14em; text-transform: uppercase; color: #7d7d82;
}
.navchild.is-nested { padding-left: 20px; }
.navchild.is-nested::before { left: -5px; width: 17px; }

.sidebar-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 13px 18px;
  border-top: 1px solid #1c1c1f;
  font-size: .68rem; color: #7d7d82;
}

/* Page area sits beside the sidebar */
.shell-wrap { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.shell-wrap > .shell { flex: 1; }

.sidebar-toggle {
  display: none;
  background: none; border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 7px; color: var(--text-mid); cursor: pointer;
}
.sidebar-toggle:hover { border-color: var(--orange); color: var(--orange-ink); }

.topbar-title {
  font-family: var(--font-display); font-size: 1rem; font-weight: 600;
  color: var(--ink); letter-spacing: -.01em; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.topbar-spacer { flex: 1 1 auto; min-width: 0; }

.sidebar-scrim {
  position: fixed; inset: 0; z-index: 190;
  background: rgba(15,15,16,.5);
  backdrop-filter: blur(2px);
}

/* Off-canvas below the desktop breakpoint */
@media (max-width: 1100px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform .24s var(--ease);
    box-shadow: 24px 0 60px -30px rgba(0,0,0,.6);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  .sidebar-close { display: block; }
  .shell-wrap { margin-left: 0; }
  .sidebar-toggle { display: grid; place-items: center; }
}
@media (min-width: 1101px) { .sidebar-scrim { display: none; } }

@media (prefers-reduced-motion: reduce) {
  .sidebar { transition: none; }
}


/* ===================================================================
   Posture Check
   =================================================================== */
.pc-areas {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.pc-areas .card { margin-bottom: 0; }
.pc-areacard h3 { margin: 0; font-size: .98rem; }
.pc-areacard .hint { margin: 8px 0 0; }
.pc-areacard.is-exposed  { border-top: 3px solid var(--risk-high); }
.pc-areacard.is-partial  { border-top: 3px solid var(--risk-medium); }
.pc-areacard.is-protected { border-top: 3px solid var(--risk-clean); }

.pc-finding {
  padding: 14px 0;
  border-bottom: 1px solid var(--line-soft);
}
.pc-finding:last-child { border-bottom: 0; }
.pc-finding p { margin: 6px 0 0; }
.pc-rec {
  margin-top: 8px !important;
  padding: 8px 12px;
  background: var(--orange-tint);
  border-radius: var(--r-sm);
  font-size: .92rem;
}

.pc-checks { margin: 0 0 10px; }
.pc-checks summary {
  cursor: pointer;
  font-weight: 600;
  padding: 8px 0;
  color: var(--ink);
}

.pc-list { margin: 0 0 6px 18px; padding: 0; }
.pc-list li { margin-bottom: 8px; line-height: 1.5; }

.pc-arealist, .pc-summary {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.pc-arealist li {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  transition: border-color .2s var(--ease), background .2s var(--ease);
}
.pc-arealist li.is-done { border-color: var(--risk-clean); background: #f3faf5; }
.pc-summary li {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto;
  gap: 4px 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}
.pc-summary li .hint { grid-column: 1 / -1; margin: 0; }
#pc-bar span { transition: width .3s var(--ease); }

/* ===================================================================
   Public self-check (website visitors)
   =================================================================== */
.sc-body { background: var(--surface-alt); min-height: 100dvh; display: flex; flex-direction: column; }
.sc-top {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px var(--gutter); background: var(--ink); color: #fff;
}
.sc-brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none;
  font-family: var(--font-display); font-weight: 600; letter-spacing: .02em; }
.sc-back { color: var(--on-ink-mid); font-size: .9rem; }
.sc-back:hover { color: #fff; }
.sc-main { flex: 1; width: 100%; max-width: 900px; margin: 0 auto; padding: 36px var(--gutter) 48px; }
.sc-foot { display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: center; padding: 18px var(--gutter) 26px;
  font-size: .8rem; color: var(--text-mid); }
.sc-hero h1 { margin: 6px 0 10px; }
.sc-points { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin: 22px 0 26px; }
.sc-point { background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 16px; }
.sc-point strong { display: block; color: var(--ink); margin-bottom: 4px; }
.sc-point span { font-size: .88rem; color: var(--text-mid); line-height: 1.45; }
.sc-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }
.field-error { color: var(--err); font-size: .85rem; margin-top: 4px; }
.sc-done { text-align: center; padding: 10px 0 4px; }
.sc-done .sc-mail { font-size: 2.2rem; line-height: 1; margin-bottom: 8px; color: var(--orange); }
/* Public pages: a short form needs no floating button bar. */
.sc-main .formbar { position: static; backdrop-filter: none; -webkit-backdrop-filter: none; background: transparent; }

/* ------------------------------------------------------------------
   Two-choice switch (Email → Send with), and the fields it swaps
   ------------------------------------------------------------------ */
.segmented { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.segmented legend { font-size: .82rem; font-weight: 600; color: var(--ink-2, #44474b); margin-bottom: 8px; padding: 0; }
.segmented label {
  display: flex; align-items: flex-start; gap: 10px; cursor: pointer;
  padding: 12px 14px; border: 1px solid var(--line, #e3e4e6); border-radius: 10px; background: #fff;
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
.segmented label:hover { border-color: #c9cacd; }
.segmented input { width: auto; margin-top: 3px; accent-color: var(--orange); }
.segmented span { display: flex; flex-direction: column; gap: 2px; }
.segmented small { color: var(--muted, #6e7073); font-size: .8rem; }
.segmented label:has(input:checked) { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(234,124,27,.14); }

.mailform:has(#mt_smtp:checked) .mail-graph,
.mailform:has(#mt_graph:checked) .mail-smtp { display: none; }
.mailform .field .hint { display: block; margin-top: 4px; font-size: .78rem; }


/* =====================================================================
   Accounts (admin/users.php) — redesign
   Append to portal.css. Everything is scoped under .accounts-page except
   the confirm dialog, which admin.js appends to <body> and which any page
   using data-confirm can reuse.
   Uses only existing tokens from section 01.
   ===================================================================== */

/* .btn-sm is used across the portal (users.php, monitoring.php) but is not
   defined in portal.css. Scoped here; consider promoting it to section 05. */
.accounts-page .btn-sm {
  --btn-pad: 8px 16px;
  min-height: 36px;
  font-size: .84rem;
}
.accounts-page .btn-danger {
  background: transparent;
  border-color: #fecaca;
  color: var(--err);
}
.accounts-page .btn-danger:hover {
  background: #fef2f2;
  border-color: var(--err);
  color: var(--err);
  transform: translateY(-2px);
}

/* ---- Page head: title left, primary action right ---------------------- */
.accounts-page .page-head .spread { align-items: flex-end; }

/* ---- Toolbar: search + filters + count -------------------------------- */
.acct-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px;
  margin: 0 0 16px;
}
.acct-search { position: relative; flex: 1 1 260px; max-width: 380px; }
.acct-search svg {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  color: var(--text-dim); pointer-events: none;
}
.acct-toolbar input[type="search"] {
  width: 100%;
  padding: 9px 14px 9px 38px;
  background: var(--white);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  font-family: var(--font-body); font-size: .9rem; color: var(--ink);
}
.acct-toolbar input[type="search"]:focus {
  outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px var(--orange-tint);
}
.acct-toolbar select {
  width: auto; min-width: 0;
  padding: 9px 36px 9px 14px;
  border-radius: var(--r-pill);
  font-size: .86rem;
  background-position: right 10px center;
}
.acct-count {
  margin-left: auto;
  font-size: .82rem; color: var(--text-dim); white-space: nowrap;
}
.acct-count strong { color: var(--ink); font-weight: 600; }

/* JS hides the no-JS "Apply" button; .btn's display would otherwise win. */
.acct-toolbar [hidden] { display: none !important; }

/* ---- Accounts table ---------------------------------------------------- */
/* Fixed layout: every column but Account has a fixed width, so the identity
   column absorbs the slack and nothing else is squeezed. No overflow wrapper:
   overflow-x:auto would also clip the row menus vertically. */
.accounts-page table.acct-table { table-layout: fixed; }
.acct-table col.c-account  { width: auto; }
.acct-table col.c-customer { width: 150px; }
.acct-table col.c-role     { width: 116px; }
.acct-table col.c-signin   { width: 158px; }
.acct-table col.c-status   { width: 96px; }
.acct-table col.c-last     { width: 128px; }
.acct-table col.c-actions  { width: 118px; }

/* Sentence-case, readable headers in place of 10.5px uppercase mono. */
.accounts-page table.data th {
  font-family: var(--font-body);
  font-size: .78rem; font-weight: 600;
  letter-spacing: 0; text-transform: none;
  color: var(--text-mid);
  white-space: nowrap;
  background: var(--surface-sunk);
}
.accounts-page table.data th:first-child { border-top-left-radius: var(--r-sm); }
.accounts-page table.data th:last-child  { border-top-right-radius: var(--r-sm); }
.acct-table td { vertical-align: middle; }
.acct-table th.is-actions, .acct-table td.is-actions { text-align: right; }
.acct-table tbody tr { transition: background .16s var(--ease); }
.acct-table tbody tr:hover { background: var(--surface-sunk); }
.acct-table tbody tr.is-selected {
  background: var(--orange-tint);
  box-shadow: inset 3px 0 0 var(--orange);
}

/* Identity cell: avatar, name, email, handle. Nothing breaks mid-word. */
.acct-id { display: flex; align-items: center; gap: 12px; min-width: 0; }
.acct-id-text { min-width: 0; line-height: 1.35; }
.acct-avatar {
  flex: none;
  display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--surface-alt); border: 1px solid var(--line);
  font-family: var(--font-display); font-size: .8rem; font-weight: 600;
  color: var(--ink); letter-spacing: .02em;
}
.acct-avatar.is-lg { width: 48px; height: 48px; font-size: 1rem; }
.acct-name {
  display: inline-flex; align-items: center; gap: 8px; max-width: 100%;
  font-weight: 600; color: var(--ink);
  text-decoration: none;
}
.acct-name > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.acct-name:hover > span { color: var(--orange-ink); text-decoration: underline; }
.acct-email,
.acct-handle {
  display: block;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  word-break: normal;
}
.acct-email  { font-family: var(--font-mono); font-size: .8rem; color: var(--text-mid); }
.acct-handle { font-size: .76rem; color: var(--text-dim); }

/* Secondary line under a value in any cell. */
.acct-meta {
  display: block; margin-top: 3px;
  font-size: .76rem; line-height: 1.35; color: var(--text-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.acct-meta.is-warn { color: var(--warn); }
.acct-inline { display: inline-flex; align-items: center; gap: 6px; flex-wrap: nowrap; }
.accounts-page .mfa-badge { display: inline-grid; min-width: 40px; padding: 3px 9px; font-size: .62rem; white-space: nowrap; }

/* Timestamps and IPs: tabular, never wrapped. */
.acct-when {
  display: block; white-space: nowrap;
  font-variant-numeric: tabular-nums; color: var(--text-mid);
}
.acct-ip {
  display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-family: var(--font-mono); font-size: .74rem; color: var(--text-dim);
}

.accounts-page .pill-pending {
  background: #fff7ed; color: var(--warn); border: 1px solid #fed7aa;
}

/* Actions: one visible button + overflow menu, always on one line. */
.acct-table .rowactions { display: inline-flex; align-items: center; justify-content: flex-end; gap: 6px; }
.accounts-page .rowmenu { margin-left: 0; }
.accounts-page .rowmenu > summary { width: 36px; height: 36px; border-color: var(--line-strong); border-radius: var(--r-pill); color: var(--ink); }
.accounts-page .rowmenu-panel { min-width: 220px; }
.accounts-page .rowmenu-panel form { margin: 0; }
.accounts-page .rowmenu-panel a,
.accounts-page .rowmenu-panel button { color: var(--ink); }
.accounts-page .rowmenu-panel a:focus-visible,
.accounts-page .rowmenu-panel button:focus-visible { outline-offset: -2px; background: var(--surface-alt); }
.rowmenu-sep { height: 1px; margin: 5px 6px; background: var(--line-soft); }
.rowmenu-note {
  display: block; padding: 6px 11px 2px;
  font-size: .72rem; color: var(--text-dim); white-space: normal;
}

/* Filtered-out rows stay hidden even where rows are display:grid (≤880px). */
.acct-table tr[hidden] { display: none !important; }

/* Empty state row (no matches). */
.acct-table tr.acct-empty td { padding: 22px 12px; }
.acct-table tr.acct-empty:hover { background: none; }

/* ---- Account panel (?edit=ID) ----------------------------------------- */
.acct-panel { scroll-margin-top: calc(var(--header-h) + 16px); }
.acct-panel-head {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-bottom: 6px;
}
.acct-panel-head h2 { margin: 0; outline: none; }
.acct-panel-head .acct-id-text { flex: 1; min-width: 220px; }
.acct-panel-head .pill { vertical-align: middle; }
.acct-panel-pills { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }

/* Tabs rendered as links (?edit=ID&tab=…), so they work without JS. */
.accounts-page .tabs { margin: 18px 0 22px; }
.accounts-page a.tab { text-decoration: none; }
.accounts-page a.tab[aria-current="page"] { color: var(--orange-ink); font-weight: 600; }
.accounts-page a.tab[aria-current="page"]::after { width: 100%; }

.acct-form-grid { display: grid; gap: 18px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .acct-form-grid { grid-template-columns: 1fr 1fr; } }
.acct-form-grid .fieldset { margin: 0; background: var(--surface); }
.accounts-page .fieldset legend { font-size: .66rem; }

.accounts-page .field .hint { line-height: 1.45; }
.accounts-page .field-lock { color: var(--text-dim); font-size: .76rem; font-weight: 400; margin-left: 6px; }
.accounts-page input[disabled], .accounts-page select[disabled] {
  background: var(--surface-alt); color: var(--text-mid); cursor: not-allowed;
}

.accounts-page .field-label {
  display: block; margin-bottom: 7px;
  font-size: .8rem; font-weight: 600; color: var(--ink);
}
.accounts-page .field.is-last { margin-bottom: 0; }
.acct-pair { display: grid; gap: 0 16px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .acct-pair { grid-template-columns: 1fr 1fr; } }
.acct-intro { margin: -6px 0 18px; }

/* Status as two radio chips — clearer than a select for a binary state. */
.accounts-page .segmented { display: inline-flex; padding: 3px; gap: 3px; border: 1px solid var(--line-strong); border-radius: var(--r-pill); background: var(--surface); }
.accounts-page .segmented input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.accounts-page .segmented label {
  margin: 0; padding: 7px 16px;
  border-radius: var(--r-pill);
  font-size: .84rem; font-weight: 500; color: var(--text-mid);
  cursor: pointer;
}
.accounts-page .segmented input:checked + label { background: var(--ink); color: var(--white); }
.accounts-page .segmented input:focus-visible + label { outline: 2px solid var(--orange-ink); outline-offset: 2px; }
.accounts-page .segmented input:disabled + label { cursor: not-allowed; opacity: .6; }

.acct-formactions {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  margin-top: 20px; padding-top: 18px;
  border-top: 1px solid var(--line-soft);
}
.acct-formactions .hint { margin: 0 0 0 auto; }

/* Security actions under the details form (separate POST forms). */
.acct-security { margin-top: 26px; }
.acct-security h3 { font-size: .98rem; margin-bottom: 4px; }
.acct-actionrow {
  display: grid; gap: 10px 20px; align-items: center;
  grid-template-columns: 1fr;
  padding: 16px 0;
  border-top: 1px solid var(--line-soft);
}
@media (min-width: 760px) { .acct-actionrow { grid-template-columns: minmax(0, 1fr) auto; } }
.acct-actionrow:first-of-type { border-top: 0; }
.acct-actionrow strong { display: block; color: var(--ink); font-size: .92rem; }
.acct-actionrow .hint { margin: 2px 0 0; }
.acct-actionrow .btn-row { justify-content: flex-end; gap: 8px; }
.acct-actionrow .checkline { margin-top: 8px; }

/* Checkbox with a title line and an explanation under it. */
.checkblock {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 10px;
  margin: 12px 0 0; font-weight: 400; cursor: pointer;
}
.checkblock input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--orange); }
.checkblock-title { font-size: .88rem; font-weight: 600; color: var(--ink); }
.checkblock-text  { grid-column: 2; font-size: .8rem; line-height: 1.45; color: var(--text-dim); }
.checkblock-text .mono { word-break: normal; font-size: .78rem; color: var(--text-mid); }

/* Create card */
.acct-create .acct-form-grid { margin-bottom: 0; }
@media (min-width: 900px) { .acct-create .fieldset.is-wide { grid-column: 1 / -1; } }

/* ---- Responsive -------------------------------------------------------- */
.acct-table .acct-also { display: none; }
/* Below ~1370px (sidebar + 1180px shell) fold Customer into the identity cell. */
@media (max-width: 1371px) {
  .acct-table col.c-customer, .acct-table .is-customer { display: none; }
  .acct-table .acct-also { display: block; }
}

/* Tablet and phone: one card per account, labelled values. */
@media (max-width: 880px) {
  .acct-toolbar .acct-search { max-width: none; flex-basis: 100%; }
  .acct-count { margin-left: 0; width: 100%; }
  .accounts-page table.acct-table { table-layout: auto; }
  .acct-table colgroup { display: none; }
  .acct-table .acct-also { display: none; }
  .acct-table td.is-customer { display: block; }
  .acct-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .acct-table, .acct-table tbody, .acct-table tr, .acct-table td { display: block; width: 100%; }
  .acct-table tbody tr {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px;
    padding: 14px 4px; border-bottom: 1px solid var(--line-soft);
  }
  .accounts-page table.acct-table td { padding: 0; border: 0; }
  .acct-table td.is-account, .acct-table td.is-actions,
  .acct-table tr.acct-empty td { grid-column: 1 / -1; }
  .acct-table td.is-actions { text-align: left; }
  .acct-table td[data-label]::before {
    content: attr(data-label);
    display: block; margin-bottom: 2px;
    font-size: .7rem; font-weight: 600; color: var(--text-dim);
  }
  .acct-table .rowactions { justify-content: flex-start; }
  .accounts-page .rowmenu-panel { right: auto; left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .acct-table tbody tr { transition: none; }
}

/* ---- Confirmation dialog (built by admin.js for [data-confirm]) -------- */
dialog.confirm-dialog {
  width: min(440px, calc(100vw - 32px));
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  color: var(--text);
  font-family: var(--font-body);
}
dialog.confirm-dialog::backdrop { background: rgba(15, 15, 16, .45); backdrop-filter: blur(2px); }
dialog.confirm-dialog h2 { font-size: 1.1rem; margin-bottom: 8px; }
dialog.confirm-dialog p { font-size: .9rem; color: var(--text-mid); line-height: 1.5; }
dialog.confirm-dialog .btn-row { justify-content: flex-end; margin-top: 22px; gap: 10px; }
dialog.confirm-dialog .btn { min-height: 40px; --btn-pad: 10px 20px; }
dialog.confirm-dialog.is-danger .btn-confirm {
  background: var(--err); color: var(--white); box-shadow: none;
}
dialog.confirm-dialog.is-danger .btn-confirm:hover { background: #991b1b; color: var(--white); }

/* ---- 1.15.1: shared helpers ------------------------------------------ */
.btn-sm { --btn-pad: 8px 16px; min-height: 36px; font-size: .84rem; }
.inline-unit { display: flex; align-items: center; gap: 10px; }
.hint.is-error { color: var(--err); font-weight: 600; }
.security-settings .fieldset .checkline { margin: 6px 0; }
.btn-danger { background: transparent; border-color: #fecaca; color: var(--err); }
.btn-danger:hover { background: #fef2f2; border-color: var(--err); color: var(--err); }
