/* FlameGuard's base styles (main.jsx import order), copied verbatim. Do not hand-edit: re-run scripts/sync-flameguard.js. */

/* ---- COPIED FROM FlameGuard: flameguard-frontend/src/styles/design-tokens.css (source sha256 88737b2a10ef) ---- */
/* ============================================================
   FlameGuard Design Tokens
   Single source of truth — all values from the Figma design system.
   ============================================================ */


:root {
  /* ── Colors ─────────────────────────────────────────────── */
  --color-primary:        #1E3A5F;
  --color-primary-light:  #2D5F8A;
  --color-primary-faded:  #E8EEF4;
  --color-accent:         #D97706;
  --color-accent-hover:   #B45309;

  --color-bg:             #F8F7F4;
  --color-surface:        #FFFFFF;
  --color-border:         #E2E8F0;
  --color-border-light:   #F1F5F9;

  --color-text-primary:   #1A1A2E;
  --color-text-secondary: #556070; /* darkened from #64748B for >=4.5:1 contrast */
  --color-text-muted:     #5E6B7E; /* darkened from #94A3B8 (~2.5:1) for >=4.5:1 contrast */

  --color-success:        #16A34A;
  --color-warning:        #D97706;
  --color-error:          #DC2626;
  --color-info:           #2D5F8A;

  /* Risk levels — 3x3 (PAS 79) bands */
  --color-risk-trivial:      #16A34A;
  --color-risk-tolerable:    #16A34A;
  --color-risk-moderate:     #D97706;
  --color-risk-substantial:  #DC2626;
  --color-risk-intolerable:  #991B1B;

  /* Risk levels — 5x5 bands (see data/riskMatrices.js) */
  --color-risk-very_low:     #16A34A;
  --color-risk-low:          #16A34A;
  --color-risk-medium:       #D97706;
  --color-risk-high:         #DC2626;
  --color-risk-very_high:    #DC2626;
  --color-risk-extreme:      #991B1B;

  /* ── Typography ─────────────────────────────────────────── */
  --font-family:          'Plus Jakarta Sans', sans-serif;

  --font-size-h1:         28px;
  --font-size-h2:         22px;
  --font-size-h3:         18px;
  --font-size-body:       15px;
  --font-size-small:      13px;
  --font-size-caption:    12px;

  --font-weight-regular:  400;
  --font-weight-medium:   500;
  --font-weight-semibold: 600;
  --font-weight-bold:     700;

  --line-height-tight:    1.2;
  --line-height-normal:   1.5;
  --line-height-relaxed:  1.7;

  /* ── Spacing (8px base grid) ────────────────────────────── */
  --space-1:   4px;
  --space-2:   8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-8:  32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* ── Border Radius ──────────────────────────────────────── */
  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg: 12px;

  /* ── Shadows ────────────────────────────────────────────── */
  --shadow-xs:  0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm:  0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md:  0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-lg:  0 10px 15px rgba(0, 0, 0, 0.1);

  /* ── Transitions ────────────────────────────────────────── */
  --transition-fast:   150ms ease;
  --transition-normal: 250ms ease;

  /* ── Z-index scale ──────────────────────────────────────── */
  --z-dropdown:  100;
  --z-sticky:    200;
  --z-overlay:   300;
  --z-modal:     400;
  --z-toast:     500;
}

/* ---- COPIED FROM FlameGuard: flameguard-frontend/src/styles/global.css (source sha256 927bc6c09d64) ---- */
/* ============================================================
   FlameGuard Global Styles
   Reset, base typography, and utility classes.
   Depends on design-tokens.css being loaded first.
   ============================================================ */

/* ── Reset ────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-regular);
  line-height: var(--line-height-normal);
  color: var(--color-text-primary);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Base Elements ────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
  color: var(--color-text-primary);
}

h1 { font-size: var(--font-size-h1); }
h2 { font-size: var(--font-size-h2); }
h3 { font-size: var(--font-size-h3); }

p {
  line-height: var(--line-height-relaxed);
}

a {
  color: var(--color-primary-light);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-primary);
}

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  background: none;
}

input,
textarea,
select {
  font-family: inherit;
  font-size: inherit;
}

img,
svg {
  display: block;
  max-width: 100%;
}

ul, ol {
  list-style: none;
}

code {
  font-family: 'SF Mono', 'Fira Code', 'Fira Mono', Menlo, Consolas, monospace;
}

/* ── Focus Styles (a11y) ──────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--color-primary-light);
  outline-offset: 2px;
}

/* ── Safe Area (iPhone notch / Dynamic Island) ────────────── */
@supports (padding: env(safe-area-inset-top)) {
  .safe-top    { padding-top:    env(safe-area-inset-top); }
  .safe-bottom { padding-bottom: env(safe-area-inset-bottom); }
}

/* ── Reduced Motion ───────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── Utility Classes ──────────────────────────────────────── */

/* Screen-reader only */
.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;
}

/* Text truncation */
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Text helpers */
.text-secondary { color: var(--color-text-secondary); }
.text-muted     { color: var(--color-text-muted); }
.text-success   { color: var(--color-success); }
.text-warning   { color: var(--color-warning); }
.text-error     { color: var(--color-error); }
.text-small     { font-size: var(--font-size-small); }
.text-caption   { font-size: var(--font-size-caption); }
.font-medium    { font-weight: var(--font-weight-medium); }
.font-semibold  { font-weight: var(--font-weight-semibold); }

/* Layout */
.flex        { display: flex; }
.flex-col    { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1  { gap: var(--space-1); }
.gap-2  { gap: var(--space-2); }
.gap-3  { gap: var(--space-3); }
.gap-4  { gap: var(--space-4); }
.gap-6  { gap: var(--space-6); }

/* Loading spinner (kept from original) */
.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 200px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---- COPIED FROM FlameGuard: flameguard-frontend/src/styles/components.css (source sha256 d3256cd8dc17) ---- */
/* ============================================================
   FlameGuard Shared Components
   Reusable component classes built on design tokens.
   ============================================================ */

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 10px 20px;
  border: 1.5px solid transparent;
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
  cursor: pointer;
  transition: all var(--transition-fast);
  min-height: 44px;
  white-space: nowrap;
}

.btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--color-accent);
  color: #FFFFFF;
  border-color: var(--color-accent);
}

.btn-primary:hover:not(:disabled) {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-primary);
  border-color: var(--color-border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--color-primary-faded);
  border-color: var(--color-primary-light);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
  border-color: transparent;
  padding: 10px 12px;
}

.btn-ghost:hover:not(:disabled) {
  background: var(--color-border-light);
  color: var(--color-text-primary);
}

.btn-destructive {
  background: var(--color-error);
  color: #FFFFFF;
  border-color: var(--color-error);
}

.btn-destructive:hover:not(:disabled) {
  background: #B91C1C;
  border-color: #B91C1C;
}

/* Size variants */
.btn-sm {
  padding: 6px 14px;
  font-size: var(--font-size-small);
  min-height: 36px;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 16px;
  min-height: 52px;
}

/* ── Badges ───────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px 10px;
  border-radius: 100px;
  font-size: var(--font-size-caption);
  font-weight: var(--font-weight-semibold);
  line-height: 1.4;
  white-space: nowrap;
}

/* Lifecycle pills (STATUS column) share one width so the column reads as a
   clean stack. Sized to the widest case, which is a label plus a two-digit
   comment count ("Requested 12" = 111px), so a busy thread never breaks the
   alignment. Risk pills keep their natural width and are excluded. */
.badge-status {
  min-width: 111px;
  justify-content: center;
}

.badge-success {
  background: #DCFCE7;
  color: #15803D;
}

.badge-warning {
  background: #FEF3C7;
  color: #92400E;
}

.badge-error {
  background: #FEE2E2;
  color: #991B1B;
}

.badge-info {
  background: var(--color-primary-faded);
  color: var(--color-primary);
}

.badge-neutral {
  background: var(--color-border-light);
  color: var(--color-text-secondary);
}

/* Darkest risk band (INTOLERABLE) — filled, since the tint scale tops out at badge-error */
.badge-intolerable {
  background: #991B1B;
  color: #fff;
}

/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card-padded {
  padding: var(--space-6);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--color-border-light);
}

.card-body {
  padding: var(--space-4) var(--space-6);
}

/* ── Table ────────────────────────────────────────────────── */
.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  padding: var(--space-3) var(--space-4);
  font-size: var(--font-size-caption);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-secondary);
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1.5px solid var(--color-border);
  background: var(--color-border-light);
}

.table td {
  padding: var(--space-3) var(--space-4);
  font-size: var(--font-size-small);
  color: var(--color-text-primary);
  border-bottom: 1px solid var(--color-border-light);
  vertical-align: middle;
}

.table-row:hover {
  background: var(--color-border-light);
}

.table-header {
  background: var(--color-border-light);
}

/* ── Inputs ───────────────────────────────────────────────── */
.input {
  width: 100%;
  padding: 10px var(--space-4);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: var(--font-size-body);
  color: var(--color-text-primary);
  background: var(--color-surface);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  min-height: 44px;
}

.input::placeholder {
  color: var(--color-text-muted);
}

.input:focus {
  border-color: var(--color-primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.1);
}

.input-error {
  border-color: var(--color-error);
}

.input-error:focus {
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.select {
  width: 100%;
  padding: 10px var(--space-10) 10px var(--space-4);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: var(--font-size-body);
  color: var(--color-text-primary);
  background: var(--color-surface);
  appearance: none;
  cursor: pointer;
  min-height: 44px;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2364748B' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  transition: border-color var(--transition-fast);
}

.select:focus {
  border-color: var(--color-primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.1);
}

/* iOS Safari zooms the page when a focused field is under 16px — keep
   fields at 16px on small screens (AuthPages already does the same). */
@media (max-width: 768px) {
  .input,
  .select {
    font-size: 16px;
  }
}

/* Field label */
.field-label {
  display: block;
  font-size: var(--font-size-small);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-1);
}

.field-error {
  font-size: var(--font-size-caption);
  color: var(--color-error);
  margin-top: var(--space-1);
}

/* ── Search Bar ───────────────────────────────────────────── */
.search-bar {
  position: relative;
}

.search-bar .input {
  padding-left: 40px;
}

.search-bar-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--color-text-muted);
  pointer-events: none;
}

/* ── Divider ──────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--color-border-light);
  border: none;
  margin: var(--space-6) 0;
}

/* ── Empty State ──────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-12) var(--space-6);
  color: var(--color-text-muted);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: var(--space-4);
  stroke: var(--color-text-muted);
}

.empty-state p {
  font-size: var(--font-size-body);
  margin-bottom: var(--space-4);
}

/* ---- COPIED FROM FlameGuard: flameguard-frontend/src/index.css (source sha256 78d62622fde1) ---- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* --- New Design System Tokens --- */
  --color-primary: #1E3A5F;
  --color-accent: #D97706;
  --color-bg: #F8F7F4;
  --color-surface: #FFFFFF;
  --color-text: #1E293B;
  --color-text-muted: #5E6B7E; /* darkened from #94A3B8 for >=4.5:1 contrast (kept in sync with design-tokens.css) */
  --color-border: #E2E8F0;
  --color-success: #16A34A;
  --color-warning: #D97706;
  --color-error: #DC2626;
  --color-info: #2563EB;

  /* --- Legacy Aliases (backward compat) --- */
  --primary-color: var(--color-primary);
  --secondary-color: var(--color-info);
  --success-color: var(--color-success);
  --warning-color: var(--color-warning);
  --error-color: var(--color-error);
  --bg-color: var(--color-bg);
  --text-color: var(--color-text);
  --border-color: var(--color-border);
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
}

code {
  font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace;
}

button {
  cursor: pointer;
  font-family: inherit;
}

input, textarea, select {
  font-family: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Safe area insets for iPhone notch/Dynamic Island */
@supports (padding: env(safe-area-inset-top)) {
  .header {
    padding-top: env(safe-area-inset-top);
  }
  .wizard-bottom-nav,
  .section-nav-footer {
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Loading spinner */
.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 200px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border-color);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
