/* ============================================================================
   A!thera Partners — design system
   Tokens, type scale, and components are taken verbatim from the A!thera brand
   (references/formats-html.md, references/visual-system.md). The risk badges and
   chips at the foot of this file are RiskTriage-specific, built from A!thera
   tokens — no rainbow red/amber/green, and colour is always paired with a text
   label so meaning never depends on colour alone.
   Fonts are also linked in each page <head>; the @import keeps this stylesheet
   self-contained.
   ============================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;1,300;1,400&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;1,9..40,300&family=DM+Mono:wght@300;400&display=swap');

/* --- CSS variables (A!thera tokens — do not redefine the values) ----------- */
:root {
  /* Primary palette */
  --athera-blue: #5FB8D6;
  --athera-blue-light: #A8D9EC;
  --athera-blue-deep: #2A8FB0;
  --athera-charcoal: #374151;
  --athera-charcoal-light: #4B5563;
  --athera-grey: #6B7280;
  --athera-grey-light: #9CA3AF;
  --athera-navy: #0F172A;
  --athera-navy-mid: #1E2B42;

  /* Surfaces */
  --athera-white: #FFFFFF;
  --athera-off-white: #F8F7F4;
  --athera-surface: #F1EEE8;

  /* Extended palette */
  --athera-amber: #C8955A;
  --athera-amber-light: #E8C49A;
  --athera-steel: #8AA5BE;
  --athera-mist: #D4DFE8;

  /* Lines */
  --athera-line: rgba(55, 65, 81, 0.12);
  --athera-line-light: rgba(55, 65, 81, 0.06);
  --athera-line-dark: rgba(255, 255, 255, 0.08);
  --athera-line-dark-light: rgba(255, 255, 255, 0.06);

  /* Typography */
  --athera-display: 'Cormorant Garamond', Georgia, serif;
  --athera-sans: 'DM Sans', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  --athera-mono: 'DM Mono', 'Consolas', 'Monaco', monospace;

  /* Risk priority — derived from A!thera tokens, NOT traffic-light colours.
     HIGH = deep warm amber, MEDIUM = steel, LOW = muted grey/blue.
     Always rendered with the text label (HIGH / MEDIUM / LOW). */
  --risk-high-ink: #7A4A1E;
  --risk-high-dot: #A66A2E;
  --risk-high-bg: rgba(200, 149, 90, 0.16);
  --risk-high-border: rgba(200, 149, 90, 0.55);

  --risk-medium-ink: #3E5366;
  --risk-medium-dot: #6E8BA6;
  --risk-medium-bg: rgba(138, 165, 190, 0.16);
  --risk-medium-border: rgba(138, 165, 190, 0.60);

  --risk-low-ink: #5B6470;
  --risk-low-dot: #9CA3AF;
  --risk-low-bg: rgba(107, 114, 128, 0.10);
  --risk-low-border: rgba(107, 114, 128, 0.32);
}

/* --- Base ------------------------------------------------------------------ */
* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--athera-off-white);
  color: var(--athera-charcoal);
  font-family: var(--athera-sans);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--athera-blue-deep); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Visible, on-brand focus state (accessibility) */
a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--athera-blue-deep);
  outline-offset: 2px;
}

/* --- Type scale (A!thera) -------------------------------------------------- */
.athera-display-xl { font-family: var(--athera-display); font-size: clamp(64px, 9vw, 120px); font-weight: 300; line-height: 0.95; letter-spacing: -0.02em; }
.athera-display-lg { font-family: var(--athera-display); font-size: clamp(40px, 6vw, 72px); font-weight: 300; line-height: 1; letter-spacing: -0.015em; }
.athera-display-md { font-family: var(--athera-display); font-size: clamp(28px, 4vw, 48px); font-weight: 400; line-height: 1.1; letter-spacing: -0.01em; }
.athera-display-sm { font-family: var(--athera-display); font-size: clamp(20px, 3vw, 32px); font-weight: 400; line-height: 1.2; }

.athera-body-lg { font-family: var(--athera-sans); font-size: 18px; font-weight: 300; line-height: 1.7; color: var(--athera-charcoal-light); }
.athera-body { font-family: var(--athera-sans); font-size: 15px; font-weight: 400; line-height: 1.65; color: var(--athera-charcoal); }
.athera-body-sm { font-family: var(--athera-sans); font-size: 13px; font-weight: 400; line-height: 1.55; color: var(--athera-grey); }

.athera-label { font-family: var(--athera-sans); font-size: 10px; font-weight: 500; letter-spacing: 0.2em; text-transform: uppercase; color: var(--athera-grey); }
.athera-label-blue { font-family: var(--athera-sans); font-size: 10px; font-weight: 500; letter-spacing: 0.2em; text-transform: uppercase; color: var(--athera-blue-deep); }
.athera-mono { font-family: var(--athera-mono); font-size: 11px; font-weight: 400; line-height: 1.6; color: var(--athera-grey-light); }

/* --- Signature: the thin blue rule ----------------------------------------- */
.athera-blue-rule { width: 48px; height: 1px; background: var(--athera-blue); border: 0; }

/* --- Buttons (A!thera) ----------------------------------------------------- */
.athera-button-primary {
  display: inline-block;
  padding: 12px 24px;
  background: var(--athera-blue);
  color: var(--athera-navy);
  font-family: var(--athera-sans);
  font-size: 12px; font-weight: 500;
  letter-spacing: 0.06em; text-transform: uppercase;
  border: none; border-radius: 2px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.athera-button-secondary {
  display: inline-block;
  padding: 12px 24px;
  background: transparent;
  color: var(--athera-charcoal);
  border: 1px solid var(--athera-line);
  border-radius: 2px;
  font-family: var(--athera-sans);
  font-size: 12px; font-weight: 400;
  letter-spacing: 0.06em; text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s ease;
}
.athera-button-primary:hover { background: var(--athera-blue-deep); }
.athera-button-secondary:hover { background: var(--athera-off-white); }
.athera-button-primary:disabled,
.athera-button-secondary:disabled { opacity: 0.45; cursor: not-allowed; }

/* --- Cards (A!thera) ------------------------------------------------------- */
.athera-card {
  background: var(--athera-white);
  border: 1px solid var(--athera-line);
  border-radius: 4px;
  padding: 32px;
}
.athera-card-dark {
  background: var(--athera-navy);
  color: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--athera-line-dark);
  border-radius: 4px;
  padding: 32px;
}

/* --- Tables (A!thera) ------------------------------------------------------ */
.athera-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--athera-sans);
  font-size: 13px;
}
.athera-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 10px; font-weight: 500;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--athera-grey-light);
  border-bottom: 1px solid var(--athera-line);
}
.athera-table td {
  padding: 12px 16px;
  color: var(--athera-charcoal);
  border-bottom: 1px solid var(--athera-line-light);
}

/* --- Inline wordmark (A!thera) --------------------------------------------- */
.athera-wordmark {
  font-family: var(--athera-display);
  font-size: 32px;
  font-weight: 300;
  color: var(--athera-charcoal);
  letter-spacing: -0.01em;
}
.athera-wordmark-partners {
  font-family: var(--athera-sans);
  font-size: 0.5em;
  font-weight: 400;
  color: var(--athera-grey);
  letter-spacing: 0.08em;
  margin-left: 4px;
  vertical-align: super;
}
.athera-wordmark .accent { color: var(--athera-blue); }

/* ============================================================================
   RiskTriage components — built from A!thera tokens
   ============================================================================ */

/* --- Risk badges -----------------------------------------------------------
   Colour is always paired with the HIGH / MEDIUM / LOW text label. The dot
   gives a second, redundant cue; the label carries the meaning on its own. */
.risk-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 10px 3px 9px;
  border: 1px solid transparent;
  border-radius: 2px;
  font-family: var(--athera-sans);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
  line-height: 1;
}
.risk-badge::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 1px;
  background: currentColor;
  opacity: 0.9;
  flex: 0 0 auto;
}
.risk-badge--high { color: var(--risk-high-ink); background: var(--risk-high-bg); border-color: var(--risk-high-border); }
.risk-badge--high::before { background: var(--risk-high-dot); }
.risk-badge--medium { color: var(--risk-medium-ink); background: var(--risk-medium-bg); border-color: var(--risk-medium-border); }
.risk-badge--medium::before { background: var(--risk-medium-dot); }
.risk-badge--low { color: var(--risk-low-ink); background: var(--risk-low-bg); border-color: var(--risk-low-border); }
.risk-badge--low::before { background: var(--risk-low-dot); }

/* --- AI-draft chip + label -------------------------------------------------
   Marks every AI output as a draft that requires analyst review. */
.ai-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border: 1px solid rgba(42, 143, 176, 0.35);
  border-radius: 2px;
  background: rgba(95, 184, 214, 0.12);
  color: var(--athera-blue-deep);
  font-family: var(--athera-sans);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
  line-height: 1;
}
.ai-chip::before {
  content: "AI";
  font-family: var(--athera-mono);
  font-size: 9px;
  letter-spacing: 0.05em;
  padding: 1px 4px;
  border-radius: 1px;
  background: var(--athera-blue-deep);
  color: #fff;
}

/* the longer banner returned by shared.js → aiDraftLabel() */
.ai-draft-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--athera-sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--athera-blue-deep);
}
.ai-draft-label::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--athera-blue);
  flex: 0 0 auto;
}
.ai-draft-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border: 1px solid rgba(42, 143, 176, 0.30);
  border-left: 2px solid var(--athera-blue);
  border-radius: 3px;
  background: rgba(95, 184, 214, 0.08);
  color: var(--athera-charcoal);
  font-family: var(--athera-sans);
  font-size: 13px;
}

/* --- Evidence-citation chip ------------------------------------------------
   For evidence_ref values (TXN-0007, customer.risk_rating, alert.trigger_rule).
   DM Mono per the brand's technical-metadata rule. */
.athera-cite {
  font-family: var(--athera-mono);
  font-size: 11px;
  line-height: 1.4;
  color: var(--athera-charcoal-light);
  background: var(--athera-surface);
  border: 1px solid var(--athera-line);
  border-radius: 2px;
  padding: 1px 6px;
  white-space: nowrap;
}
.athera-cite--link { cursor: pointer; }
.athera-cite--link:hover { color: var(--athera-blue-deep); border-color: var(--athera-blue-light); }
