/* ============================================================
   THEMES — variables only. Selectors below read these vars so
   flipping data-theme on <html> reskins the whole app.
============================================================ */
:root {
  /* dark (default) */
  --bg: #0b1020;
  --bg-2: #111935;
  --panel: #161f3d;
  --panel-2: #1b2750;
  --border: #2a3866;
  --text: #e8ecff;
  --muted: #9aa6d1;
  --accent: #4cc2ff;
  --accent-2: #7a5cff;
  --good: #2ecc71;
  --bad: #ff5d6c;
  --warn: #ffb347;
  --shadow: 0 8px 30px rgba(0,0,0,0.35);
  --overlay: rgba(5,8,20,0.92);
  --modal-overlay: rgba(5,8,20,0.7);
  --topbar-bg: rgba(11,16,32,0.7);
  --btn-hover: #243066;
  --on-accent: #0b1020;
  --hero-gradient: linear-gradient(135deg, rgba(122,92,255,0.18), rgba(76,194,255,0.08));
  --bg-glow-1: rgba(122,92,255,0.18);
  --bg-glow-2: rgba(76,194,255,0.15);
  /* semantic badge / pill / status colors (light-on-dark in dark mode) */
  --safe-bg: rgba(46,204,113,0.18);
  --safe-border: rgba(46,204,113,0.5);
  --safe-text: #b9ffd2;
  --bad-bg: rgba(255,93,108,0.16);
  --bad-border: rgba(255,93,108,0.5);
  --bad-text: #ffd1d6;
  --warn-text: #ffd9a8;
  --info-bg: rgba(76,194,255,0.18);
  --info-text: #b3ddff;
  --crit-bg: rgba(255,93,108,0.35);
  --crit-text: #fff;
  --done-text: #b9ffd2;
}

:root[data-theme="light"] {
  --bg: #f6f8fc;
  --bg-2: #eef2f9;
  --panel: #ffffff;
  --panel-2: #f0f3fa;
  --border: #dbe2ee;
  --text: #1a1f2c;
  --muted: #5b6478;
  --accent: #1f6fd4;
  --accent-2: #6a4af0;
  --good: #1f9d5b;
  --bad: #d4334a;
  --warn: #c97a16;
  --shadow: 0 6px 24px rgba(20,32,80,0.08);
  --overlay: rgba(232,236,246,0.88);
  --modal-overlay: rgba(20,28,55,0.35);
  --topbar-bg: rgba(246,248,252,0.85);
  --btn-hover: #e1e8f2;
  --on-accent: #ffffff;
  --hero-gradient: linear-gradient(135deg, rgba(106,74,240,0.10), rgba(31,111,212,0.06));
  --bg-glow-1: rgba(106,74,240,0.10);
  --bg-glow-2: rgba(31,111,212,0.08);
  /* semantic badge / pill / status colors — dark-on-light for readability */
  --safe-bg: rgba(31,157,91,0.10);
  --safe-border: rgba(31,157,91,0.35);
  --safe-text: #145c35;
  --bad-bg: rgba(212,51,74,0.10);
  --bad-border: rgba(212,51,74,0.35);
  --bad-text: #8c1627;
  --warn-text: #6b3e00;
  --info-bg: rgba(31,111,212,0.10);
  --info-text: #1a4a8a;
  --crit-bg: rgba(212,51,74,0.18);
  --crit-text: #6b0e1c;
  --done-text: #145c35;
}

/* System mode: when the user picks "System", we set data-theme="system"
   and the prefers-color-scheme media query decides which palette to use. */
@media (prefers-color-scheme: light) {
  :root[data-theme="system"] {
    --bg: #f6f8fc;
    --bg-2: #eef2f9;
    --panel: #ffffff;
    --panel-2: #f0f3fa;
    --border: #dbe2ee;
    --text: #1a1f2c;
    --muted: #5b6478;
    --accent: #1f6fd4;
    --accent-2: #6a4af0;
    --good: #1f9d5b;
    --bad: #d4334a;
    --warn: #c97a16;
    --shadow: 0 6px 24px rgba(20,32,80,0.08);
    --overlay: rgba(232,236,246,0.88);
    --modal-overlay: rgba(20,28,55,0.35);
    --topbar-bg: rgba(246,248,252,0.85);
    --btn-hover: #e1e8f2;
    --on-accent: #ffffff;
    --hero-gradient: linear-gradient(135deg, rgba(106,74,240,0.10), rgba(31,111,212,0.06));
    --bg-glow-1: rgba(106,74,240,0.10);
    --bg-glow-2: rgba(31,111,212,0.08);
    --safe-bg: rgba(31,157,91,0.10);
    --safe-border: rgba(31,157,91,0.35);
    --safe-text: #145c35;
    --bad-bg: rgba(212,51,74,0.10);
    --bad-border: rgba(212,51,74,0.35);
    --bad-text: #8c1627;
    --warn-text: #6b3e00;
    --info-bg: rgba(31,111,212,0.10);
    --info-text: #1a4a8a;
    --crit-bg: rgba(212,51,74,0.18);
    --crit-text: #6b0e1c;
    --done-text: #145c35;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background:
    radial-gradient(1200px 600px at 10% -10%, var(--bg-glow-1), transparent 60%),
    radial-gradient(900px 500px at 110% 10%, var(--bg-glow-2), transparent 60%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background-color .2s, color .2s;
}

a { color: var(--accent); }
code { background: var(--panel-2); padding: 1px 6px; border-radius: 4px; font-size: 13px; }

/* ============================================================
   SIGN-IN OVERLAY
============================================================ */
.signin-back {
  position: fixed; inset: 0;
  background: var(--overlay);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
  backdrop-filter: blur(6px);
}
.signin-back.open { display: flex; }
.signin-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 32px;
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow);
}
.signin-brand { display: flex; align-items: center; gap: 14px; }
.signin-brand h1 { margin: 0; font-size: 22px; }
.signin-card form { display: grid; gap: 12px; margin-top: 18px; }
.signin-card label { display: block; font-size: 13px; color: var(--muted); }
.signin-card input,
.signin-card select {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 8px;
  margin-top: 4px;
  font-size: 14px;
  font-family: inherit;
}
.signin-card input:focus,
.signin-card select:focus { outline: 2px solid var(--accent); }
.signin-card .tiny { font-size: 11px; margin-top: 8px; }

/* ============================================================
   TOPBAR
============================================================ */
.topbar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px 28px 0;
  border-bottom: 1px solid var(--border);
  background: var(--topbar-bg);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.brand h1 { margin: 0; font-size: 22px; letter-spacing: 0.5px; }
.brand .tagline {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.2px;
}
.logo {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center;
  font-size: 24px;
  box-shadow: var(--shadow);
}
.logo.big { width: 56px; height: 56px; font-size: 30px; }

.user-chip {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 8px 6px 6px;
}
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center;
  font-weight: 700;
  color: var(--on-accent);
  font-size: 13px;
}
.user-meta { font-size: 12px; line-height: 1.2; }
.user-name { color: var(--text); font-weight: 600; }
.user-role { color: var(--muted); }

.tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.tab {
  background: transparent;
  border: 0;
  color: var(--muted);
  padding: 10px 14px;
  font-size: 14px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ============================================================
   MAIN
============================================================ */
main { max-width: 1100px; margin: 0 auto; padding: 28px; }
.view { display: none; }
.view.active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

h2 { margin-top: 0; font-size: 28px; letter-spacing: 0.3px; }
.muted { color: var(--muted); }
.tiny { font-size: 12px; }

/* HOME */
.hero {
  padding: 36px;
  border-radius: 18px;
  background: var(--hero-gradient);
  border: 1px solid var(--border);
  margin-bottom: 24px;
}
.hero h2 { font-size: 34px; margin: 0 0 10px; }
.hero p { color: var(--muted); max-width: 720px; line-height: 1.55; }
.cta-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
}
.stat-num { font-size: 28px; font-weight: 700; color: var(--accent); }
.stat-label { color: var(--muted); font-size: 13px; margin-top: 4px; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
  box-shadow: var(--shadow);
}
.card.warn {
  border-color: rgba(255,179,71,0.4);
  background: linear-gradient(135deg, rgba(255,179,71,0.12), transparent 60%), var(--panel);
}
.card h3 { margin-top: 0; }
.card ol, .card ul { color: var(--muted); line-height: 1.6; }
.card ol strong, .card ul strong { color: var(--text); }

/* BUTTONS */
.btn {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: transform .08s, background .15s, border-color .15s;
  font-family: inherit;
}
.btn:hover { background: var(--btn-hover); transform: translateY(-1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border: 0; color: var(--on-accent); font-weight: 700; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.safe { background: var(--safe-bg); border-color: var(--safe-border); color: var(--safe-text); }
.btn.bad  { background: var(--bad-bg);  border-color: var(--bad-border);  color: var(--bad-text);  }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; }
.btn.tiny { padding: 4px 8px; font-size: 12px; }

/* THREAT LIBRARY */
.threat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  margin-top: 18px;
}
.threat {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  cursor: pointer;
  transition: transform .12s, border-color .15s;
}
.threat:hover { transform: translateY(-2px); border-color: var(--accent); }
.threat .icon {
  font-size: 26px; width: 46px; height: 46px;
  border-radius: 10px; background: var(--panel-2);
  display: grid; place-items: center; margin-bottom: 12px;
}
.threat h3 { margin: 0 0 4px; font-size: 18px; }
.threat .short { color: var(--muted); font-size: 13px; line-height: 1.5; }
.threat .severity {
  display: inline-block; margin-top: 10px;
  font-size: 11px; text-transform: uppercase; letter-spacing: 1px;
  padding: 3px 8px; border-radius: 999px;
  background: var(--panel-2); color: var(--muted);
}
.threat .severity.high     { background: var(--bad-bg);  color: var(--bad-text);  }
.threat .severity.critical { background: var(--crit-bg); color: var(--crit-text); }
.threat .severity.medium   { background: rgba(255,179,71,0.14); color: var(--warn-text); }

/* MODAL */
.modal-back {
  position: fixed; inset: 0;
  background: var(--modal-overlay);
  display: none; align-items: center; justify-content: center;
  padding: 20px; z-index: 50;
  animation: fade .15s;
}
.modal-back.open { display: flex; }
.modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  max-width: 720px; width: 100%;
  max-height: 86vh; overflow: auto;
  padding: 28px;
  box-shadow: var(--shadow);
}
.modal h3 { margin-top: 0; font-size: 22px; }
.modal h4 { color: var(--accent); margin-bottom: 6px; }
.modal ul { color: var(--muted); line-height: 1.6; }
.modal .close {
  float: right;
  background: transparent; border: 0;
  color: var(--muted); font-size: 22px; cursor: pointer;
}
.modal .dental-callout {
  margin-top: 14px;
  background: rgba(76,194,255,0.08);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 12px 14px;
  color: var(--muted);
  line-height: 1.5;
}
.modal .dental-callout strong { color: var(--accent); }

/* RED FLAGS */
.flag-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  margin: 18px 0 24px;
}
.flag {
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--warn);
  border-radius: 12px;
  padding: 16px;
}
.flag h4 { margin: 0 0 6px; }
.flag p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }

/* INBOX SIMULATOR */
.sim-shell {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
  margin-top: 18px;
}
.sim-meta {
  display: flex; justify-content: space-between;
  color: var(--muted); font-size: 13px;
  margin-bottom: 12px;
}
.email-frame {
  background: #f5f6fb;
  color: #1a1f2c;
  border-radius: 10px;
  padding: 22px;
  font-family: Georgia, 'Times New Roman', serif;
  line-height: 1.55;
  min-height: 280px;
}
.email-frame .hdr {
  border-bottom: 1px solid #d8dbe5;
  padding-bottom: 10px;
  margin-bottom: 14px;
  font-family: system-ui, sans-serif;
  font-size: 13px;
}
.email-frame .hdr .row { display: flex; gap: 8px; }
.email-frame .hdr .lbl { color: #5b6478; width: 70px; flex: none; }
.email-frame .hdr .val { color: #1a1f2c; word-break: break-all; }
.email-frame .subject {
  font-family: system-ui, sans-serif;
  font-size: 18px; font-weight: 600; margin-bottom: 8px;
}
.email-frame .body { font-family: system-ui, sans-serif; font-size: 14px; white-space: pre-wrap; }
.email-frame .body a { color: #1a55b3; text-decoration: underline; }
.email-frame .attach {
  margin-top: 14px;
  display: inline-flex; align-items: center; gap: 8px;
  background: #e9ecf4; padding: 6px 10px;
  border-radius: 6px;
  font-family: system-ui, sans-serif; font-size: 13px;
}
.email-frame .qr-stub {
  display: inline-block;
  margin: 14px 0;
  padding: 12px;
  background: white;
  border: 1px solid #d8dbe5;
}

.sim-controls {
  display: flex; gap: 10px; justify-content: center; margin-top: 16px;
  flex-wrap: wrap;
}
.sim-controls .btn { padding: 12px 22px; font-size: 15px; }
.feedback {
  margin-top: 14px;
  padding: 14px;
  border-radius: 10px;
  display: none;
  line-height: 1.55;
}
.feedback.show { display: block; }
.feedback.correct { background: rgba(46,204,113,0.12); border: 1px solid rgba(46,204,113,0.4); }
.feedback.wrong { background: rgba(255,93,108,0.12); border: 1px solid rgba(255,93,108,0.4); }
.feedback h4 { margin: 0 0 6px; }
.feedback ul { margin: 6px 0 0 18px; color: var(--muted); }
.feedback ul li { margin-bottom: 4px; }
.sim-nav { display: flex; justify-content: space-between; margin-top: 14px; }

.tag {
  display: inline-block; padding: 2px 8px;
  font-size: 12px; border-radius: 999px; margin: 0 2px;
}
.tag.safe { background: var(--safe-bg); color: var(--safe-text); }
.tag.bad  { background: var(--bad-bg);  color: var(--bad-text);  }

/* REPORT MODAL */
.report-modal { max-width: 760px; }
.report-modal pre {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 280px;
  overflow: auto;
}
.report-modal .steps li { margin-bottom: 6px; }
.report-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }

/* ============================================================
   MOBILE QR — phone mockup
============================================================ */
.mobile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 22px;
  margin-top: 12px;
}
.phone-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.phone-card h3 { margin: 0 0 14px; text-align: center; font-size: 17px; }
.phone {
  width: 260px;
  height: 520px;
  background: #0a0a14;
  border-radius: 38px;
  padding: 12px;
  position: relative;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5), inset 0 0 0 2px #1d1d2c;
}
.phone .notch {
  position: absolute;
  top: 16px; left: 50%;
  transform: translateX(-50%);
  width: 90px; height: 22px;
  background: #0a0a14;
  border-radius: 0 0 16px 16px;
  z-index: 2;
}
.phone-screen {
  background: #fff;
  border-radius: 28px;
  height: 100%;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}
.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 20px 4px;
  font-size: 11px;
  font-weight: 600;
  color: #1a1f2c;
  font-family: system-ui, sans-serif;
}
.status-bar .icons { letter-spacing: 2px; }
.mail-header {
  padding: 4px 16px 8px;
  border-bottom: 1px solid #e5e8f1;
  font-family: system-ui, sans-serif;
  font-size: 13px;
  color: #1a55b3;
  font-weight: 600;
}
.mail-body {
  padding: 14px 16px;
  font-family: system-ui, sans-serif;
  color: #1a1f2c;
  font-size: 12.5px;
  line-height: 1.5;
  overflow-y: auto;
  flex: 1;
}
.mail-body .m-from { font-weight: 600; }
.mail-body .m-from .addr { color: #5b6478; font-weight: 400; word-break: break-all; }
.mail-body .m-meta { color: #5b6478; font-size: 11px; margin-bottom: 8px; }
.mail-body .m-subj { font-size: 14px; font-weight: 600; margin: 6px 0 8px; }
.mail-body p { margin: 6px 0; }
.mail-body .qr-wrap {
  display: flex; justify-content: center;
  margin: 10px 0;
  padding: 10px;
  background: #f6f7fa;
  border-radius: 6px;
}
.mail-body .qr-wrap svg {
  shape-rendering: crispEdges;
  width: 130px;
  height: 130px;
  display: block;
}
.phone-card .callouts {
  margin-top: 14px;
  list-style: none;
  padding: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  width: 100%;
}
.phone-card .callouts li {
  background: var(--panel-2);
  border-left: 3px solid var(--bad);
  padding: 8px 10px;
  border-radius: 6px;
  margin-bottom: 6px;
}

/* ============================================================
   INCIDENT RESPONSE
============================================================ */
.incident-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin-top: 18px;
}
.incident {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  border-top: 3px solid var(--warn);
}
.incident.high { border-top-color: var(--bad); }
.incident.critical {
  border-top-color: var(--bad);
  background: linear-gradient(180deg, rgba(255,93,108,0.08), transparent 60%), var(--panel);
}
.incident h3 { margin: 0 0 8px; font-size: 17px; }
.incident ol {
  color: var(--muted);
  margin: 0;
  padding-left: 18px;
  line-height: 1.55;
  font-size: 13.5px;
}
.incident ol li { margin-bottom: 6px; }
.severity-pill {
  display: inline-block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  margin-bottom: 8px;
}
.severity-pill.high     { background: var(--bad-bg);  color: var(--bad-text);  }
.severity-pill.critical { background: var(--crit-bg); color: var(--crit-text); }
.severity-pill.medium   { background: rgba(255,179,71,0.14); color: var(--warn-text); }

/* QUIZ */
.quiz-shell {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  margin-top: 18px;
}
.q-meta { color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.q-prompt { font-size: 17px; margin-bottom: 16px; line-height: 1.5; }
.q-choices { display: grid; gap: 8px; }
.q-choice {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  text-align: left;
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
  transition: background .12s, border-color .12s;
}
.q-choice:hover { background: var(--btn-hover); }
.q-choice.correct { background: rgba(46,204,113,0.18); border-color: rgba(46,204,113,0.5); }
.q-choice.wrong { background: rgba(255,93,108,0.18); border-color: rgba(255,93,108,0.5); }
.q-explain {
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--panel-2);
  border-radius: 10px;
  color: var(--muted);
  display: none;
  line-height: 1.55;
}
.q-explain.show { display: block; }
.q-nav { margin-top: 16px; display: flex; justify-content: flex-end; gap: 10px; }

.quiz-result { text-align: center; padding: 16px 0; }
.quiz-result .big { font-size: 48px; font-weight: 700; color: var(--accent); }
.quiz-result .grade { font-size: 18px; margin-top: 4px; }

/* PROGRESS */
.progress-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin: 18px 0;
}
.progress-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
}
.progress-card .label { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 1px; }
.progress-card .value { font-size: 32px; font-weight: 700; color: var(--accent); margin-top: 6px; }

/* ============================================================
   TEAM TRACKER
============================================================ */
.settings-grid {
  display: grid;
  grid-template-columns: 1.3fr 1.7fr 1.3fr 0.8fr 1fr;
  gap: 12px;
}
@media (max-width: 900px) {
  .settings-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 500px) {
  .settings-grid { grid-template-columns: 1fr; }
}
.settings-grid label { display: block; font-size: 13px; color: var(--muted); }
.settings-grid input {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 8px;
  margin-top: 4px;
  font-size: 14px;
  font-family: inherit;
}
.roster-form {
  display: grid;
  grid-template-columns: 1.5fr 1.5fr 1fr auto;
  gap: 8px;
}
.roster-form input,
.roster-form select {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
}
@media (max-width: 700px) {
  .roster-form { grid-template-columns: 1fr; }
}

.roster-wrap { overflow-x: auto; margin-top: 12px; }
.roster-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.roster-table th, .roster-table td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
}
.roster-table th { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; }
.roster-table td .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.status {
  display: inline-block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  white-space: nowrap;
}
.status.completed   { background: var(--safe-bg);  color: var(--safe-text); }
.status.in_progress { background: var(--info-bg);  color: var(--info-text); }
.status.overdue     { background: var(--bad-bg);   color: var(--bad-text);  }
.status.not_started { background: var(--panel-2); color: var(--muted); }

/* ============================================================
   FOOTER
============================================================ */
footer {
  max-width: 1100px;
  margin: 30px auto;
  padding: 0 28px 30px;
  color: var(--muted);
  text-align: center;
}

/* ============================================================
   ROLE-REQUIRED BADGES + BEYOND-EMAIL EXTRAS
============================================================ */
.req-pill {
  display: inline-block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--info-bg);
  color: var(--info-text);
  margin-left: 6px;
  vertical-align: middle;
}
.threat .req-pill { margin-left: 0; margin-top: 8px; }
.threat .read-pill {
  display: inline-block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--safe-bg);
  color: var(--safe-text);
  margin-left: 6px;
  vertical-align: middle;
}

/* Recert status colors (extend tracker statuses) */
.status.due_soon { background: rgba(255,179,71,0.14); color: var(--warn-text); }
.status.expired  { background: var(--crit-bg);        color: var(--crit-text); }

/* My Progress completion criteria checkmarks */
#completionCriteria li.done { color: var(--done-text); }
#completionCriteria li.done::marker { content: "✓ "; }
#completionCriteria li.todo::marker { content: "○ "; }

/* ============================================================
   DEMO / GUEST BANNER
============================================================ */
.demo-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(90deg, rgba(255,179,71,0.18), rgba(255,179,71,0.08));
  border-bottom: 1px solid rgba(255,179,71,0.35);
  padding: 8px 28px;
  font-size: 13px;
  color: var(--warn-text);
  flex-wrap: wrap;
}
.demo-banner strong { color: var(--text); }
.demo-banner .btn { margin-left: auto; white-space: nowrap; }

/* Sign-in card divider between form and guest button */
.signin-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  margin: 4px 0;
}
.signin-divider::before,
.signin-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ============================================================
   HOME PROGRESS CARD
============================================================ */
.home-progress-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 22px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}
@media (max-width: 700px) {
  .home-progress-card { grid-template-columns: 1fr; }
}
.hp-left { text-align: center; min-width: 80px; }
.hp-pct  { font-size: 36px; font-weight: 700; color: var(--accent); line-height: 1; }
.hp-label{ font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin-top: 4px; }
.hp-bars { display: flex; flex-direction: column; gap: 8px; }
.hp-row  { display: grid; grid-template-columns: 130px 1fr auto; align-items: center; gap: 8px; }
@media (max-width: 500px) { .hp-row { grid-template-columns: 1fr auto; } .hp-name { display: none; } }
.hp-name { font-size: 12px; color: var(--muted); white-space: nowrap; }
.hp-frac { font-size: 11px; color: var(--muted); white-space: nowrap; text-align: right; }
.hp-bar  { grid-column: 1 / -1; height: 7px; background: var(--panel-2); border-radius: 999px; overflow: hidden; }
.hp-bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 999px; transition: width .4s ease; }
.hp-cta  { white-space: nowrap; align-self: center; }

/* ============================================================
   THEME TOGGLE (segmented control in the topbar)
============================================================ */
.theme-toggle {
  display: inline-flex;
  gap: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  align-items: center;
}
.theme-toggle button {
  background: transparent;
  border: 0;
  color: var(--muted);
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: inherit;
  line-height: 1;
}
.theme-toggle button:hover { color: var(--text); }
.theme-toggle button.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--on-accent);
}
.theme-toggle .ico { font-size: 13px; }
.theme-toggle .lbl { font-size: 11px; letter-spacing: 0.5px; }

/* Allow the toggle to live in the brand row at the very right */
.brand .theme-toggle { margin-left: auto; }
.user-chip + .theme-toggle,
.theme-toggle + .user-chip { margin-left: 8px; }

/* Smaller variant for the sign-in card corner */
.signin-card .theme-toggle {
  position: absolute;
  top: 14px; right: 14px;
}
.signin-card { position: relative; }

/* ============================================================
   HOME — industry breakdown, breach impact, attack vectors
============================================================ */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 28px 0 12px;
  gap: 10px;
  flex-wrap: wrap;
}
.section-head h3 { margin: 0; font-size: 20px; }
.section-head .src { color: var(--muted); font-size: 11px; }

.industry-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.industry {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.industry .ind-head { display: flex; align-items: center; gap: 10px; }
.industry .ind-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--panel-2);
  display: grid; place-items: center;
  font-size: 18px;
}
.industry .ind-name { font-size: 14px; font-weight: 600; }
.industry .ind-stat { font-size: 26px; font-weight: 700; color: var(--accent); line-height: 1; }
.industry .ind-label { color: var(--muted); font-size: 12px; line-height: 1.4; }
.industry .ind-notes {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.industry .ind-notes li {
  position: relative;
  padding-left: 14px;
}
.industry .ind-notes li::before {
  content: "•";
  color: var(--accent);
  position: absolute; left: 2px; top: -1px;
}

.impact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 6px;
}
.impact {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
}
.impact .imp-num { font-size: 22px; font-weight: 700; color: var(--bad); }
.impact .imp-label { color: var(--text); font-size: 13px; font-weight: 600; margin-top: 4px; }
.impact .imp-note { color: var(--muted); font-size: 12px; margin-top: 4px; line-height: 1.45; }

.vector-list { list-style: none; padding: 0; margin: 6px 0 0; }
.vector {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border);
}
.vector:last-child { border-bottom: 0; }
.vector .v-name { font-weight: 600; color: var(--text); font-size: 14px; }
.vector .v-pct { font-weight: 700; color: var(--accent); font-size: 14px; text-align: right; white-space: nowrap; }
.vector .v-bar {
  grid-column: 1 / -1;
  height: 8px;
  background: var(--panel-2);
  border-radius: 999px;
  overflow: hidden;
}
.vector .v-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 999px;
  transition: width .4s ease;
}
.vector .v-note { grid-column: 1 / -1; color: var(--muted); font-size: 12px; line-height: 1.45; }

/* RESPONSIVE */
@media (max-width: 600px) {
  .topbar { padding: 16px 16px 0; }
  main { padding: 18px; }
  .hero { padding: 22px; }
  .hero h2 { font-size: 24px; }
  h2 { font-size: 22px; }
  .user-chip { margin-left: 0; }
  .theme-toggle .lbl { display: none; } /* icon-only on small screens */
}
