/* Dato: warm white, black text, one cobalt accent. Tokens are listed in DESIGN.md. */
:root {
  --bg: #FAF8F4;
  --panel: #FFFFFF;
  --panel-2: #F3F0EA;
  --line: #E3DED4;
  --line-strong: #CFC9BC;
  --text: #111111;
  --muted: #5E5A52;
  --cobalt: #2F5BFF;
  --cobalt-dark: #2347D6;
  --cobalt-dim: #EEF1FF;
  --cobalt-line: #C9D2FF;
  --green: #1E6B3A; --green-bg: #E8F4EC; --green-line: #BFE0CB;
  --amber: #7A4F00; --amber-bg: #FFF3D6; --amber-line: #E8C877;
  --red: #A3231B; --red-bg: #FDECEA; --red-line: #F0B7B2;
  --mono: "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.55;
  min-height: 100vh;
}
a { color: var(--cobalt); }
.bg-grid { display: none; } /* the first design's grid; kept in the HTML, hidden here */

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 28px;
  background: rgba(250, 248, 244, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 10px; background: var(--cobalt); color: #fff; font-weight: 800; font-size: 19px; }
.brand-name { font-weight: 800; font-size: 19px; letter-spacing: -0.01em; }
.brand-tag { font-size: 12.5px; color: var(--muted); }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav-link {
  color: var(--muted); text-decoration: none; font-size: 14.5px; font-weight: 600;
  padding: 8px 13px; border-radius: 9px; transition: background 0.2s, color 0.2s;
}
.nav-link:hover { color: var(--text); background: var(--panel-2); }
.nav-link.active { color: var(--text); background: var(--panel-2); box-shadow: inset 0 -2px 0 var(--cobalt); }
.nav-cta { border: 1px solid var(--line-strong); }

.safety-strip {
  display: flex; align-items: center; gap: 9px;
  font-size: 13px; color: var(--muted);
  padding: 8px 28px; border-bottom: 1px solid var(--line);
  background: var(--panel-2);
}
.pulse-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 0 0 rgba(30, 107, 58, 0.4); animation: pulse 2.4s infinite; flex: none;
}
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(30, 107, 58, 0); } 100% { box-shadow: 0 0 0 0 rgba(30, 107, 58, 0); } }

.main { max-width: 1180px; margin: 0 auto; padding: 34px 28px 60px; }
.view { display: none; }
.view.active { display: block; animation: rise 0.25s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

.view-head h1 { font-size: 32px; margin: 0 0 8px; letter-spacing: -0.02em; line-height: 1.15; }
.lede { color: var(--muted); font-size: 16.5px; max-width: 760px; margin: 0 0 26px; line-height: 1.6; }

/* Panels */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; margin-bottom: 18px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; flex-wrap: wrap; }
.panel-title { font-weight: 700; font-size: 15px; }
.local-badge { font-size: 12px; font-weight: 650; color: var(--green); border: 1px solid var(--green-line); background: var(--green-bg); padding: 3px 10px; border-radius: 20px; }
.toolbar { display: flex; gap: 8px; align-items: center; }

/* Buttons */
.btn {
  font: inherit; font-size: 14.5px; font-weight: 650; cursor: pointer;
  border-radius: 10px; padding: 10px 16px; border: 1px solid transparent;
  transition: background 0.2s, border-color 0.2s, color 0.2s; display: inline-flex; align-items: center; gap: 7px;
}
.btn-primary { background: var(--cobalt); color: #fff; }
.btn-primary:hover { background: var(--cobalt-dark); }
.btn-secondary { background: var(--panel); color: var(--text); border-color: var(--line-strong); }
.btn-secondary:hover:not(:disabled) { border-color: var(--text); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line-strong); }
.btn-ghost:hover { border-color: var(--text); }
.btn-ghost.danger:hover { color: var(--red); border-color: var(--red); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; background: var(--panel-2); color: var(--muted); }

/* Console */
.console-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 900px) { .console-grid { grid-template-columns: 1fr; } }
.prompt-input {
  width: 100%; min-height: 220px; resize: vertical;
  background: #fff; color: var(--text);
  border: 1px solid var(--line-strong); border-radius: 12px;
  font-family: var(--mono); font-size: 13.5px; line-height: 1.6;
  padding: 14px; outline: none;
}
.prompt-input:focus { border-color: var(--cobalt); box-shadow: 0 0 0 3px var(--cobalt-line); }
.attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--muted);
  font-size: 13px; padding: 5px 10px; border-radius: 20px;
}
.chip-x { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 15px; padding: 0 2px; }
.chip-x:hover { color: var(--red); }
.console-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }

.scan-result { min-height: 220px; }
.empty-state { color: var(--muted); font-size: 14.5px; padding: 34px 10px; text-align: center; }

/* Verdicts */
.verdict { border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; border: 1px solid; }
.verdict-title { font-weight: 750; font-size: 15px; margin-bottom: 3px; }
.verdict-sub { font-size: 13.5px; line-height: 1.5; }
.verdict-allow { background: var(--green-bg); border-color: var(--green-line); color: var(--green); }
.verdict-warn { background: var(--amber-bg); border-color: var(--amber-line); color: var(--amber); }
.verdict-redact { background: var(--cobalt-dim); border-color: var(--cobalt-line); color: var(--cobalt-dark); }
.verdict-block { background: var(--red-bg); border-color: var(--red-line); color: var(--red); }

/* Findings */
.findings { display: flex; flex-direction: column; gap: 12px; }
.finding-group { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--bg); }
.finding-cat { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: 14px; margin-bottom: 9px; }
.finding-cat .count { color: var(--muted); font-weight: 600; }
.cat-dot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; flex: none; }
.cat-secrets, .cat-bg-secrets { background: var(--red); }
.cat-pii, .cat-bg-pii { background: #C98A12; }
.cat-financial, .cat-bg-financial { background: var(--cobalt); }
.cat-source, .cat-bg-source { background: var(--green); }
.cat-contract, .cat-bg-contract { background: #6B6558; }
.finding { display: flex; align-items: center; gap: 10px; padding: 7px 9px; border-radius: 8px; font-size: 13.5px; }
.finding:hover { background: var(--panel-2); }
.finding-label { flex: 1; }
.sev { font-size: 11px; font-weight: 700; letter-spacing: 0.5px; padding: 2px 7px; border-radius: 5px; flex: none; border: 1px solid var(--line-strong); }
.sev-critical { background: var(--red-bg); color: var(--red); border-color: var(--red-line); }
.sev-high { background: var(--amber-bg); color: var(--amber); border-color: var(--amber-line); }
.sev-medium { background: var(--cobalt-dim); color: var(--cobalt-dark); border-color: var(--cobalt-line); }
.sev-low { background: var(--panel-2); color: var(--muted); }
.masked { font-family: var(--mono); font-size: 12px; color: var(--muted); background: var(--panel-2); padding: 3px 8px; border-radius: 6px; }

.policy-tag { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 14px; margin-left: auto; border: 1px solid var(--line-strong); }
.policy-allow { background: var(--green-bg); color: var(--green); border-color: var(--green-line); }
.policy-warn { background: var(--amber-bg); color: var(--amber); border-color: var(--amber-line); }
.policy-redact { background: var(--cobalt-dim); color: var(--cobalt-dark); border-color: var(--cobalt-line); }
.policy-block { background: var(--red-bg); color: var(--red); border-color: var(--red-line); }

.redacted-box { margin-top: 16px; border: 1px solid var(--cobalt-line); border-radius: 12px; padding: 14px; background: var(--cobalt-dim); }
.redacted-head { font-weight: 650; font-size: 13.5px; color: var(--cobalt-dark); margin-bottom: 8px; }
.redacted-text {
  font-family: var(--mono); font-size: 12.5px; line-height: 1.6; white-space: pre-wrap; word-break: break-word;
  background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 12px; max-height: 260px; overflow: auto; margin: 0 0 10px;
}

/* Policies */
.policy-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 15px 4px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.policy-row:last-child { border-bottom: none; }
.policy-info { display: flex; align-items: center; gap: 12px; }
.policy-name { font-weight: 650; font-size: 15px; }
.policy-desc { color: var(--muted); font-size: 13px; margin-top: 2px; }
.segmented { display: flex; border: 1px solid var(--line-strong); border-radius: 10px; overflow: hidden; background: #fff; }
.seg-btn { font: inherit; font-size: 13.5px; font-weight: 650; background: transparent; color: var(--muted); border: none; padding: 8px 15px; cursor: pointer; border-right: 1px solid var(--line); }
.seg-btn:last-child { border-right: none; }
.seg-btn:hover { color: var(--text); background: var(--panel-2); }
.seg-btn.active { background: var(--text); color: #fff; }

/* Log table */
.log-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.log-table th { text-align: left; color: var(--muted); font-size: 12px; font-weight: 650; padding: 9px 10px; border-bottom: 1px solid var(--line); }
.log-table td { padding: 10px; border-bottom: 1px solid var(--line); }
.log-table tr:hover td { background: var(--panel-2); }
.mono { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.action-tag { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 12px; border: 1px solid var(--line-strong); }
.action-block { background: var(--red-bg); color: var(--red); border-color: var(--red-line); }
.action-warn { background: var(--amber-bg); color: var(--amber); border-color: var(--amber-line); }
.action-redact { background: var(--cobalt-dim); color: var(--cobalt-dark); border-color: var(--cobalt-line); }
.action-allowed-clean, .action-allow { background: var(--green-bg); color: var(--green); border-color: var(--green-line); }
.action-sent-send, .action-sent-redacted { background: var(--panel-2); color: var(--text); }
.select { font: inherit; font-size: 14px; background: #fff; color: var(--text); border: 1px solid var(--line-strong); border-radius: 9px; padding: 8px 10px; }

/* Dashboard */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
@media (max-width: 800px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
.stat-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; }
.stat-num { font-size: 30px; font-weight: 750; letter-spacing: -0.02em; }
.stat-label { color: var(--muted); font-size: 13px; margin-top: 2px; }
.stat-block .stat-num { color: var(--red); }
.stat-redact .stat-num { color: var(--cobalt-dark); }
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 900px) { .dash-grid { grid-template-columns: 1fr; } }
.bars { display: flex; flex-direction: column; gap: 12px; padding: 4px 0; }
.bar-row { display: flex; align-items: center; gap: 12px; font-size: 13.5px; }
.bar-label { width: 210px; display: flex; align-items: center; gap: 8px; color: var(--muted); flex: none; }
.bar-track { flex: 1; height: 10px; background: var(--panel-2); border-radius: 6px; overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 6px; transition: width 0.4s ease; }
.bar-num { width: 30px; text-align: right; font-weight: 700; flex: none; }
.donut-wrap { display: flex; align-items: center; gap: 22px; padding: 8px 4px; flex-wrap: wrap; }
.donut { width: 130px; height: 130px; border-radius: 50%; position: relative; flex: none; }
.donut::after { content: ""; position: absolute; inset: 24px; background: var(--panel); border-radius: 50%; }
.legend { display: flex; flex-direction: column; gap: 9px; font-size: 14px; color: var(--muted); }
.legend-item { display: flex; align-items: center; gap: 8px; }
.legend-item b { color: var(--text); }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; }
.week-bars { display: flex; align-items: flex-end; gap: 10px; height: 130px; padding: 8px 4px 0; }
.day-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.day-bar { width: 100%; max-width: 34px; background: var(--cobalt); border-radius: 6px 6px 2px 2px; min-height: 3px; }
.day-label { font-size: 12px; color: var(--muted); }
.posture { display: flex; flex-wrap: wrap; gap: 7px; }
.posture .policy-tag { margin-left: 0; }
.posture-note { color: var(--muted); font-size: 14px; margin-top: 14px; }

/* Assessment */
.progress { height: 5px; background: var(--panel-2); border-radius: 4px; overflow: hidden; margin-bottom: 20px; }
.progress-fill { height: 100%; width: 0; background: var(--cobalt); transition: width 0.4s ease; }
.assess-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 26px 28px; }
.assess-kicker { color: var(--muted); font-size: 13px; font-weight: 650; margin-bottom: 8px; }
.assess-card h3 { margin: 0 0 10px; font-size: 23px; letter-spacing: -0.01em; }
.assess-card p { color: var(--muted); line-height: 1.6; font-size: 15px; }
.assess-card p b, .assess-card li b { color: var(--text); }
.assess-list { color: var(--muted); line-height: 1.8; font-size: 15px; margin: 0 0 20px; padding-left: 20px; }
.assess-task { font-style: italic; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 18px 0; }
@media (max-width: 700px) { .compare { grid-template-columns: 1fr; } }
.compare-col { border-radius: 13px; padding: 18px; text-align: center; border: 1px solid; }
.compare-danger { background: var(--red-bg); border-color: var(--red-line); }
.compare-safe { background: var(--green-bg); border-color: var(--green-line); }
.compare-head { font-size: 13px; font-weight: 650; color: var(--muted); }
.compare-big { font-size: 42px; font-weight: 750; margin: 6px 0 2px; }
.compare-danger .compare-big { color: var(--red); }
.compare-safe .compare-big { color: var(--green); }
.compare-sub { font-size: 13px; color: var(--muted); }
.prompt-preview { margin: 16px 0; }
.prompt-preview-head { font-size: 13px; font-weight: 650; color: var(--muted); margin-bottom: 7px; }
.prompt-preview pre {
  font-family: var(--mono); font-size: 12.5px; line-height: 1.6; white-space: pre-wrap; word-break: break-word;
  background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 13px; max-height: 240px; overflow: auto; margin: 0;
}
.assess-lesson { background: var(--cobalt-dim); border: 1px solid var(--cobalt-line); border-radius: 10px; padding: 12px 14px; font-size: 14.5px !important; color: var(--text) !important; }
.assess-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 18px; }
.chips .chip b { color: var(--text); }
.recommendations { margin-top: 20px; border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; background: var(--bg); }
.rec-head { font-weight: 700; font-size: 14px; margin-bottom: 8px; }
.recommendations ol { margin: 0; padding-left: 20px; color: var(--muted); line-height: 1.8; font-size: 14.5px; }
.recommendations li b { color: var(--text); }

.footer {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 22px 28px; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 13px;
}

/* States: invalid input, armed confirm, reset */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.form-error { margin: 10px 0 0; padding: 10px 12px; font-size: 14px; color: var(--red); background: var(--red-bg); border: 1px solid var(--red-line); border-radius: 10px; }
.form-error[hidden], .dash-empty[hidden] { display: none; }
.prompt-input.invalid { border-color: var(--red); }
.btn.armed { color: var(--red); border-color: var(--red); background: var(--red-bg); }
.reset-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 18px; }
.reset-note { color: var(--muted); font-size: 13.5px; }

/* Install tab */
a.btn { display: inline-block; text-decoration: none; }
.install-steps { color: var(--muted); font-size: 14.5px; line-height: 1.7; padding-left: 20px; margin: 18px 0 0; }
.install-steps b, .install-steps code { color: var(--text); }
code { font-family: var(--mono); font-size: 0.9em; background: var(--panel-2); padding: 1px 6px; border-radius: 6px; }
.install-sample {
  background: #fff; color: var(--text); border: 1px solid var(--line); border-radius: 12px;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.6; padding: 14px;
  white-space: pre-wrap; word-break: break-all; margin: 12px 0;
}

/* Phone */
.table-scroll { overflow-x: auto; }
.toolbar { flex-wrap: wrap; }
@media (max-width: 720px) {
  .topbar { flex-direction: column; align-items: flex-start; padding: 12px 16px; }
  .main { padding: 24px 16px 48px; }
  .safety-strip { padding: 8px 16px; }
  .footer { padding: 20px 16px; }
  .view-head h1 { font-size: 25px; }
  .segmented { width: 100%; }
  .seg-btn { flex: 1; padding: 10px 6px; }
  .console-actions { flex-wrap: wrap; }
  .panel { padding: 16px; }
  .bar-label { width: 120px; }
}

/* ---- Keyboard access: visible focus, skip link, reduced motion ---- */
:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 2px; }
.seg-btn:focus-visible { outline-offset: -3px; } /* the segmented control clips its edges */
.prompt-input:focus-visible { outline: none; } /* keeps its own cobalt border and ring */
.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 100;
  background: var(--cobalt); color: #fff; font-weight: 700; padding: 9px 14px; border-radius: 9px;
}
.skip-link:focus { top: 12px; }
.main:focus { outline: none; } /* the skip link focuses it; no ring around the whole page */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
