:root {
  --bg: #f6f7f9; --panel: #ffffff; --panel-2: #f1f3f6; --border: #e3e6eb; --text: #14171c; --muted: #5d6573;
  --brand: #2563eb; --brand-ink: #ffffff; --ok: #15803d; --ok-bg: #e7f6ec; --warn: #b45309; --warn-bg: #fdf3e1;
  --bad: #b91c1c; --bad-bg: #fde8e8; --info-bg: #e8effd; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --radius: 10px; --sidebar: #0f172a; --sidebar-text: #cbd5e1; --sidebar-active: #1e293b;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0f16; --panel: #121822; --panel-2: #18202c; --border: #253041; --text: #e6e9ee; --muted: #93a0b4;
    --ok: #4ade80; --ok-bg: #12301f; --warn: #fbbf24; --warn-bg: #33270e; --bad: #f87171; --bad-bg: #3a1717; --info-bg: #172443;
    --shadow: none; --sidebar: #070a10; --sidebar-active: #151c28; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
code, .mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12.5px; }

/* layout */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar { background: var(--sidebar); color: var(--sidebar-text); padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; color: #fff; font-weight: 700; }
.logo { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: var(--brand); color: #fff; font-size: 12px; font-weight: 800; flex: none; }
.brand small { display: block; font-weight: 400; color: var(--sidebar-text); font-size: 11px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--sidebar-text); font-weight: 500; }
.nav a:hover { background: var(--sidebar-active); text-decoration: none; color: #fff; }
.nav a.active { background: var(--sidebar-active); color: #fff; box-shadow: inset 3px 0 0 var(--brand); }
.nav .sep { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #64748b; padding: 14px 10px 4px; }
.sidebar .me { margin-top: auto; padding: 10px; border-top: 1px solid #1e293b; font-size: 12px; }
.sidebar .me .row { margin-top: 8px; }
.sidebar .me button { flex: 1; justify-content: center; }
main { padding: 24px 28px 48px; min-width: 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: 2px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g21 { grid-template-columns: 2fr 1fr; }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); } .g21, .g3 { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; }
  .sidebar .me, .nav .sep { display: none; }
  .nav { display: flex; flex-wrap: wrap; }
  main { padding: 16px; }
  .g4, .g2 { grid-template-columns: 1fr; }
}

/* components */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > h2 { padding: 16px 18px 0; }
.kpi .label { color: var(--muted); font-size: 12px; font-weight: 500; }
.kpi .value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; }
.kpi .hint { font-size: 12px; color: var(--muted); }
.btn { appearance: none; border: 1px solid var(--border); background: var(--panel); color: var(--text); padding: 7px 12px; border-radius: 8px; font: inherit; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { background: var(--panel-2); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
input, select, textarea { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; }
textarea { width: 100%; min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
label.field { display: grid; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
label.field input, label.field select { width: 100%; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; background: var(--panel-2); }
tr:last-child td { border-bottom: 0; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover { background: var(--panel-2); }
.table-wrap { overflow-x: auto; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; background: var(--panel-2); color: var(--muted); }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.info { background: var(--info-bg); color: var(--brand); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.active { color: var(--text); border-color: var(--brand); }
.tabs a:hover { text-decoration: none; color: var(--text); }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: var(--panel); padding: 5px 11px; font: inherit; font-size: 12.5px; color: var(--muted); cursor: pointer; border-right: 1px solid var(--border); }
.seg button:last-child { border-right: 0; }
.seg button.on[data-v="off"] { background: var(--panel-2); color: var(--text); font-weight: 600; }
.seg button.on[data-v="allow"], .seg button.on[data-v="on"] { background: var(--ok-bg); color: var(--ok); font-weight: 600; }
.seg button.on[data-v="warn"], .seg button.on[data-v="redact"] { background: var(--warn-bg); color: var(--warn); font-weight: 600; }
.seg button.on[data-v="block"] { background: var(--bad-bg); color: var(--bad); font-weight: 600; }
.seg button.on[data-v="inherit"] { background: var(--info-bg); color: var(--brand); font-weight: 600; }
.seg button:disabled { cursor: default; }
.bar { height: 8px; background: var(--panel-2); border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 99px; }
.list { display: grid; gap: 10px; }
.rec { border-left: 3px solid var(--border); padding: 6px 0 6px 12px; }
.rec.high { border-color: var(--bad); } .rec.medium { border-color: var(--warn); } .rec.low { border-color: var(--ok); }
.empty { padding: 28px; text-align: center; color: var(--muted); }
.risk { font-weight: 700; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .axis { fill: var(--muted); font-size: 10px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.keybox { display: flex; gap: 8px; align-items: center; background: var(--panel-2); border: 1px dashed var(--border); border-radius: 8px; padding: 8px 10px; }
.keybox code { flex: 1; overflow-wrap: anywhere; }
pre.block { background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 12px; overflow-x: auto; margin: 8px 0; font-size: 12.5px; }
.toast { position: fixed; bottom: 20px; right: 20px; background: #0f172a; color: #fff; padding: 10px 16px; border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.25); z-index: 50; animation: up .2s ease; }
.toast.err { background: #991b1b; }
@keyframes up { from { transform: translateY(8px); opacity: 0; } }
dialog { border: 1px solid var(--border); border-radius: 12px; background: var(--panel); color: var(--text); padding: 20px; width: min(480px, 92vw); box-shadow: 0 20px 50px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(15,23,42,.5); }
dialog form { display: grid; gap: 12px; }
.sticky-save { position: sticky; bottom: 0; background: var(--bg); padding: 12px 0; display: flex; gap: 10px; justify-content: flex-end; border-top: 1px solid var(--border); margin-top: 16px; }
.help { font-size: 12px; color: var(--muted); }

/* AI Guardrail product brand (independent of the MSP's white-label color) */
:root { --gr-navy: #0b1530; --gr-teal: #3eb0c5; --gr-teal-dark: #177d91; --gr-pink: #de6391; --gr-berry: #981d44; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(900px 420px at 15% -10%, rgba(62,176,197,.18), transparent), radial-gradient(900px 420px at 85% 110%, rgba(222,99,145,.14), transparent), var(--bg); }
.login .card { width: min(400px, 100%); padding: 0 28px 28px; display: grid; gap: 14px; overflow: hidden; }
/* The logo's navy wordmark needs a light surface, so it sits on a white band in both themes. */
.login-hero { background: #fff; margin: 0 -28px; padding: 24px 0 18px; display: grid; place-items: center; border-bottom: 3px solid; border-image: linear-gradient(90deg, var(--gr-teal) 0 50%, var(--gr-pink) 50% 100%) 1; }
.login-hero img { display: block; width: 180px; height: auto; }
.login .tagline { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.login .btn.primary { background: var(--gr-teal-dark); border-color: var(--gr-teal-dark); }

/* sidebar product attribution */
.powered { display: flex; align-items: center; gap: 8px; margin-top: auto; padding: 10px; font-size: 11.5px; color: #94a3b8; }
.powered img { background: #fff; border-radius: 5px; padding: 2px; flex: none; }
.powered b { color: #e2e8f0; font-weight: 600; }
.powered + .me { margin-top: 0; }
.error { color: var(--bad); font-size: 13px; min-height: 18px; }

/* ---------- MSP accounts: sign-up, trial banner, onboarding, platform admin */
.signup { width: min(460px, 100%); }
.signup-title { font-size: 20px; margin: 4px 0 0; text-align: center; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--muted); }
.check input { margin-top: 3px; }
.trial-banner { margin: -8px 0 20px; padding: 10px 14px; border-radius: 10px; font-size: 13px; background: color-mix(in srgb, var(--brand) 10%, var(--panel)); border: 1px solid color-mix(in srgb, var(--brand) 30%, var(--border)); }
.trial-banner a { font-weight: 600; }
.welcome .step-card { position: relative; display: block; padding-left: 64px; color: inherit; text-decoration: none; transition: border-color .15s, transform .15s; }
.welcome .step-card:hover { border-color: var(--brand); transform: translateY(-1px); }
.welcome .step-card h2 { margin: 0 0 6px; }
.welcome .step-card p { margin: 0; }
.step-n { position: absolute; left: 20px; top: 18px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; background: var(--brand); }
.brand-mark { border-radius: 8px; background: #fff; padding: 2px; flex: none; }
.field .small { font-weight: 400; }

/* ---------- client policies (default + exceptions) */
.policy-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .policy-layout { grid-template-columns: 1fr; } }
.policy-list { position: sticky; top: 16px; }
.policy-list-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.policy-list-head h2 { margin: 0; }
.policy-item { display: grid; gap: 2px; padding: 10px 16px; color: inherit; text-decoration: none; border-left: 3px solid transparent; border-bottom: 1px solid var(--border); }
.policy-item:hover { background: var(--panel-2); }
.policy-item.active { border-left-color: var(--brand); background: color-mix(in srgb, var(--brand) 8%, var(--panel)); }
.policy-list-foot { padding: 12px 16px 16px; margin: 0; }
.policy-main { display: grid; gap: 16px; min-width: 0; }
.policy-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.policy-head h2 { margin: 0 0 2px; }
.kw-head { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 12px 0 6px; }
.agents { display: flex; flex-wrap: wrap; gap: 4px; }
.agent-chip { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.agent-chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); opacity: .5; }
.agent-chip.on i { background: #16a34a; opacity: 1; }
.agent-chip.stale { opacity: .6; }
.agent-chip .ver { font-weight: 400; opacity: .8; }
.agent-chip.old { outline: 1px solid #d97706; }
.ver-card { margin-bottom: 12px; }
.ver-card h2 { margin-bottom: 8px; }
.ver-row { display: grid; grid-template-columns: 130px 1fr auto; gap: 10px; align-items: center; padding: 6px 0; border-top: 1px solid var(--border); }
@media (max-width: 700px) { .ver-row { grid-template-columns: 1fr; gap: 4px; } }
.dev-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.bulk-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; padding: 12px 16px; }
.pol-pick { max-width: 200px; }

/* ---------- MSP logos */
.brand.has-logo { flex-direction: column; align-items: flex-start; gap: 8px; }
.chip { display: inline-flex; align-items: center; justify-content: center; background: #fff; border-radius: 8px; padding: 6px 10px; }
.brand.has-logo .chip { max-width: 100%; }
.brand.has-logo .chip img { display: block; max-width: 180px; max-height: 40px; width: auto; height: auto; }
.logo-previews { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.logo-swatch { display: grid; place-items: center; gap: 10px; min-height: 120px; padding: 16px; border-radius: 10px; border: 1px solid var(--border); text-align: center; }
.logo-swatch.light { background: #fff; color: #5d6573; }
.logo-swatch.dark { background: #0f172a; color: #cbd5e1; }
.logo-swatch img { max-width: 220px; max-height: 60px; width: auto; height: auto; }
.logo-swatch .chip img { max-width: 180px; max-height: 40px; }
.report-logo { max-width: 160px; max-height: 48px; width: auto; height: auto; }

/* ---------- deploy agent */
.snippet { position: relative; }
.snippet pre { white-space: pre-wrap; word-break: break-all; padding-right: 72px; }
.snippet [data-copy] { position: absolute; top: 8px; right: 8px; }
.deploy-cards h3 { font-size: 14px; margin: 14px 0 6px; }
code.hash, .card code { overflow-wrap: anywhere; }

/* ---------- two-step verification */
.mfa-card { width: min(440px, 100%); }
.mfa-steps { margin: 0; padding-left: 18px; color: var(--muted); line-height: 1.6; }
.mfa-qr { display: grid; place-items: center; }
.mfa-qr img { background: #fff; padding: 8px; border-radius: 10px; border: 1px solid var(--border); }
.mfa-keyline { text-align: center; }
.mfa-keyline code { letter-spacing: .04em; overflow-wrap: anywhere; }
.recovery-codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 12px; padding: 12px; border: 1px dashed var(--border); border-radius: 10px; background: var(--panel-2); }
.recovery-codes code { font-size: 14px; letter-spacing: .05em; text-align: center; }
.account-dlg { width: min(560px, 94vw); }

/* ---------- support sessions */
.support-banner { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: -8px 0 20px; padding: 10px 14px; border-radius: 10px; font-size: 13px; color: #fff; background: #b4235a; border: 1px solid #981d44; }
.support-banner .btn { background: #fff; color: #981d44; border-color: #fff; }
