/* ════════════════════════════════════════════════════════════════════════════
   Strondex App — Direction 2B "Corporate Dark"
   Matches the public marketing site identity for one-product visual consistency.
   ──────────────────────────────────────────────────────────────────────────
   Fonts: DM Sans (display/headings), Inter (body), JetBrains Mono (numerics).
   Loaded via Google Fonts <link> in base.html.
   ════════════════════════════════════════════════════════════════════════════ */

/* ── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Surfaces */
  --bg:          #0F172A;   /* page */
  --bg-alt:      #111827;   /* nav / sticky bars */
  --bg-card:     #1E293B;   /* cards & panels */
  --bg-inset:    #0F172A;   /* inputs on dark */
  --bg-hover:    #243449;   /* subtle hover surface */
  --border:      #334155;   /* subtle slate card borders */
  --border-soft: #2A3850;

  /* Accent */
  --blue:        #3B82F6;
  --blue-hover:  #2563EB;
  --amber:       #F59E0B;

  /* Text */
  --text:        #F8FAFC;   /* headings / high-emphasis on dark */
  --text-body:   #CBD5E1;   /* body */
  --text-sub:    #94A3B8;   /* muted */

  /* Semantic */
  --success:     #22C55E;
  --success-dim: #4ADE80;
  --success-bg:  #0F2A1C;
  --success-bd:  #1C5237;
  --danger:      #EF4444;
  --danger-dim:  #F87171;
  --danger-bg:   #2A1212;
  --danger-bd:   #5B2424;
  --warn:        #F59E0B;
  --warn-bg:     #2A1F08;
  --warn-bd:     #5A4212;

  /* Geometry */
  --radius:      12px;
  --radius-sm:   8px;
  --radius-pill: 999px;
  --shadow:      0 1px 2px rgba(0,0,0,0.3), 0 8px 24px rgba(0,0,0,0.35);
  --shadow-lift: 0 1px 2px rgba(0,0,0,0.3), 0 16px 40px rgba(0,0,0,0.45);

  --font-display: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body:    "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}

html { font-size: 16px; }
body {
  font-family: var(--font-body);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(59,130,246,0.07), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text-body);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--font-display); color: var(--text); line-height: 1.25; }

a { color: var(--blue); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--blue-hover); text-decoration: underline; }

/* ── Nav ──────────────────────────────────────────────────────────────────── */
.nav {
  background: rgba(17,24,39,0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav__brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
.nav__brand:hover { text-decoration: none; opacity: 0.9; }
.nav__logo { display: block; height: 28px; width: auto; }
.nav__right { display: flex; align-items: center; gap: 1.25rem; }
.nav__email { font-size: 0.8rem; color: var(--text-sub); font-family: var(--font-mono); }
.nav__link {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-sub);
  transition: color 0.15s;
}
.nav__link:hover { color: var(--text); text-decoration: none; }

/* ── Main / Footer ────────────────────────────────────────────────────────── */
.main { flex: 1; padding: 2.5rem 1.5rem; max-width: 1100px; margin: 0 auto; width: 100%; }
.footer {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-sub);
  padding: 1.75rem 1.5rem;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

/* ── Alerts / flash ───────────────────────────────────────────────────────── */
.alert {
  padding: 0.8rem 1.1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
  border: 1px solid transparent;
}
.alert--success { background: var(--success-bg); color: var(--success-dim); border-color: var(--success-bd); }
.alert--error   { background: var(--danger-bg);  color: var(--danger-dim);  border-color: var(--danger-bd); }
.alert--info    { background: rgba(59,130,246,0.1); color: #93C5FD; border-color: rgba(59,130,246,0.4); }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 0.6rem 1.3rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, transform 0.1s, box-shadow 0.15s;
}
.btn--primary {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 4px 14px rgba(59,130,246,0.3);
}
.btn--primary:hover {
  background: var(--blue-hover);
  text-decoration: none;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(59,130,246,0.4);
}
.btn--ghost {
  background: transparent;
  color: var(--text-body);
  border: 1px solid var(--border);
}
.btn--ghost:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; border-color: #44546e; }
.btn--full { width: 100%; text-align: center; display: block; }
.btn--sm { padding: 0.4rem 0.9rem; font-size: 0.8rem; }

/* ── Auth card ────────────────────────────────────────────────────────────── */
.auth-card {
  max-width: 420px;
  margin: 3.5rem auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.25rem;
  box-shadow: var(--shadow);
}
.auth-card__title { font-size: 1.4rem; font-weight: 700; margin-bottom: 1.5rem; }
.auth-card__sub { font-size: 0.85rem; color: var(--text-sub); margin-top: 1rem; text-align: center; }
.auth-card__sub a { color: var(--blue); }

/* ── Form fields ──────────────────────────────────────────────────────────── */
.field { margin-bottom: 1.1rem; }
.field__label {
  display: block;
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--text-body);
}
.field__input {
  width: 100%;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.9rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field__input::placeholder { color: var(--text-sub); }
.field__input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.2);
}
.field__error { font-size: 0.78rem; color: var(--danger-dim); margin-top: 0.3rem; }

/* ── Page header ──────────────────────────────────────────────────────────── */
.page-header { margin-bottom: 2.25rem; }
.page-header__title { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; }
.page-header__sub { color: var(--text-sub); margin-top: 0.4rem; }

/* ── Product grid (dashboard) ─────────────────────────────────────────────── */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}
.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  box-shadow: var(--shadow);
  transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s;
}
.product-card:hover {
  border-color: rgba(59,130,246,0.5);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lift);
}
.product-card--locked { opacity: 0.7; }
.product-card--locked:hover { transform: none; border-color: var(--border); box-shadow: var(--shadow); }
.product-card__header { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.product-card__name { font-size: 1.1rem; font-weight: 700; letter-spacing: -0.01em; }
.product-card__tagline { font-size: 0.85rem; color: var(--text-sub); flex: 1; }
.product-card__actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.product-card__actions .btn { flex: 1; text-align: center; min-width: 120px; }
.product-card__price {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--blue);
}
.product-card__price--locked { color: var(--text-sub); }
.product-card__locked-msg { font-size: 0.82rem; color: var(--text-sub); }

/* ── Category chips (consistent 2B pill badges) ───────────────────────────── */
.severity-badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.28rem 0.7rem;
  border-radius: var(--radius-pill);
  background: rgba(59,130,246,0.12);
  color: #93C5FD;
  border: 1px solid rgba(59,130,246,0.3);
}
/* All category chips share the unified 2B accent palette — no clashing colors.
   Aliases kept so existing slug-based classes render identically. */
.severity-badge--cyber-insurance,
.severity-badge--m365-hardening,
.severity-badge--aws-hardening,
.severity-badge--azure-hardening,
.severity-badge--soc2-readiness,
.severity-badge--pci-dss {
  background: rgba(59,130,246,0.12);
  color: #93C5FD;
  border-color: rgba(59,130,246,0.3);
}

/* ── Purchased badge (success) ────────────────────────────────────────────── */
.product-card__badge {
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--success-dim);
  background: var(--success-bg);
  border: 1px solid var(--success-bd);
  padding: 0.28rem 0.7rem;
  border-radius: var(--radius-pill);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ── "Best value" / highlight badge (amber, reserved) ─────────────────────── */
.badge--highlight {
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 700;
  color: #0F172A;
  background: var(--amber);
  padding: 0.28rem 0.7rem;
  border-radius: var(--radius-pill);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ── Progress bar ─────────────────────────────────────────────────────────── */
.progress-bar {
  height: 8px;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.progress-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), #60A5FA);
  border-radius: var(--radius-pill);
  transition: width 0.4s ease;
}
.progress-bar__label {
  font-size: 0.78rem;
  color: var(--text-sub);
  margin-top: 0.45rem;
}
.progress-bar__label strong,
.progress-bar__label { font-family: var(--font-body); }

/* ── Sticky progress (checklist page) ────────────────────────────────────── */
.sticky-progress {
  position: sticky;
  top: 60px;
  z-index: 90;
  background: rgba(17,24,39,0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 0;
  margin-bottom: 1.75rem;
}
.sticky-progress__bar {
  height: 5px;
  background: var(--bg-inset);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-bottom: 0.6rem;
}
.sticky-progress__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), #60A5FA);
  transition: width 0.4s ease;
}
.sticky-progress__stats {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-size: 0.8rem;
  flex-wrap: wrap;
}
.sticky-progress__stats > span:first-child { font-family: var(--font-mono); color: var(--text-body); }
.stat { font-weight: 600; font-family: var(--font-display); }
.stat--pass     { color: var(--success-dim); }
.stat--fail     { color: var(--danger-dim); }
.stat--critical { color: var(--danger); }
.stat--good     { color: var(--success-dim); }
.save-indicator {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--text-sub);
  min-width: 80px;
  text-align: right;
  font-family: var(--font-mono);
}

/* ── Checklist header ─────────────────────────────────────────────────────── */
.checklist-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  gap: 1rem;
}
.checklist-header__left { display: flex; flex-direction: column; gap: 0.4rem; }
.checklist-header__back { font-size: 0.82rem; color: var(--text-sub); }
.checklist-header__back:hover { color: var(--blue); }
.checklist-header__title { font-size: 1.55rem; font-weight: 700; letter-spacing: -0.02em; }
.checklist-header__actions { flex-shrink: 0; }

/* ── Sections ─────────────────────────────────────────────────────────────── */
.section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.4rem;
  cursor: pointer;
  list-style: none;
  user-select: none;
  gap: 1rem;
  transition: background 0.15s;
}
.section__header:hover { background: var(--bg-hover); }
.section__header::-webkit-details-marker { display: none; }
.section__title { font-family: var(--font-display); font-weight: 700; font-size: 1rem; color: var(--text); }
.section__count { font-family: var(--font-mono); font-size: 0.76rem; color: var(--text-sub); flex-shrink: 0; }
.section__body { padding: 0 1.4rem 1.4rem; display: flex; flex-direction: column; gap: 0.85rem; }

/* ── Controls ─────────────────────────────────────────────────────────────── */
.control {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.95rem 1.1rem;
  background: var(--bg-inset);
  transition: border-color 0.15s, background 0.15s;
}
.control.is-pass    { border-color: var(--success-bd); background: var(--success-bg); }
.control.is-fail    { border-color: var(--danger-bd);  background: var(--danger-bg); }
.control.is-partial { border-color: var(--warn-bd);    background: var(--warn-bg); }
.control.is-na      { opacity: 0.55; }

.control__meta { display: flex; align-items: center; gap: 0.55rem; margin-bottom: 0.5rem; flex-wrap: wrap; }
.control__id   { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-sub); }
.control__category { font-size: 0.72rem; color: var(--text-sub); }
.control__text { font-size: 0.9rem; line-height: 1.55; color: var(--text-body); margin-bottom: 0.7rem; }

.control__inputs { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.control__status {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.82rem;
  padding: 0.4rem 0.65rem;
  cursor: pointer;
  min-width: 140px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.control__status:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(59,130,246,0.2); }
.control__notes {
  flex: 1;
  min-width: 200px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.82rem;
  padding: 0.4rem 0.65rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.control__notes::placeholder { color: var(--text-sub); }
.control__notes:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(59,130,246,0.2); }

/* ── Verify / fix note (collapsible) ──────────────────────────────────────── */
.control__vf {
  margin: 0 0 0.7rem;
  border-left: 3px solid var(--blue);
  border-radius: var(--radius-sm);
  background: rgba(59,130,246,0.08);
}
.control__vf-summary {
  list-style: none;
  cursor: pointer;
  padding: 0.45rem 0.75rem;
  font-family: var(--font-display);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #93C5FD;
}
.control__vf-summary::-webkit-details-marker { display: none; }
.control__vf-summary::before {
  content: "▸ ";
  display: inline-block;
  color: var(--blue);
}
.control__vf[open] .control__vf-summary::before { content: "▾ "; }
.control__vf-summary:hover { color: var(--text); }
.control__vf-body {
  padding: 0 0.75rem 0.6rem;
  font-size: 0.84rem;
  line-height: 1.55;
  color: var(--text-body);
}

/* ── Severity badges (control-level) ──────────────────────────────────────── */
.severity {
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.18rem 0.5rem;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
}
.severity--critical { background: var(--danger-bg); color: var(--danger-dim); border-color: var(--danger-bd); }
.severity--high     { background: var(--warn-bg);   color: var(--amber);      border-color: var(--warn-bd); }
.severity--medium   { background: rgba(59,130,246,0.12); color: #93C5FD; border-color: rgba(59,130,246,0.3); }
.severity--low      { background: var(--bg-card);   color: var(--text-sub);   border-color: var(--border); }

/* ── Checklist footer ─────────────────────────────────────────────────────── */
.checklist-footer {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 2.5rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--border);
}

/* ── Empty state ──────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 4rem 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 2.25rem;
}
.empty-state__title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--text);
}
.empty-state__body {
  color: var(--text-sub);
  margin-bottom: 1.5rem;
  max-width: 48ch;
  margin-left: auto;
  margin-right: auto;
}

/* ── Save error state ─────────────────────────────────────────────────────── */
.control--save-error {
  border-left: 3px solid var(--danger);
  padding-left: 0.85rem;
}

/* ── Screen-reader utility ────────────────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Details/summary chevron ──────────────────────────────────────────────── */
.section__header::after {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--text-sub);
  border-bottom: 2px solid var(--text-sub);
  transform: rotate(45deg);
  transition: transform 0.2s ease;
  flex-shrink: 0;
  margin-left: 8px;
}
details[open] .section__header::after {
  transform: rotate(-135deg);
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .main { padding: 1.25rem 1rem; }
  .product-grid { grid-template-columns: 1fr; }
  .checklist-header { flex-direction: column; }
  .sticky-progress__stats { gap: 0.65rem; }
  .control__inputs { flex-direction: column; align-items: stretch; }
  .control__status, .control__notes { min-width: unset; width: 100%; }
}

/* ── Reduced motion ───────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
