/* ============================================================================
   PricePilot AI — A!thera Partners design system
   Built in Session 1. Single stylesheet for the whole app.

   Structure:
     1.  Brand tokens (verbatim from athera-branding / formats-html.md)
     2.  Reset + base document
     3.  Type-scale classes (verbatim from the skill)
     4.  Layout primitives (container, section padding)
     5.  Inline wordmark + emblem
     6.  App shell: header bar + footer disclaimer
     7.  Hero / cover section
     8.  Section opener (number + eyebrow + title + intro + blue rule)
     9.  Buttons (primary / secondary)
     10. Cards (light + dark)
     11. Tables
     12. Forms + focus states
     13. Status pills (recommendation actions) + risk flags
     14. Utilities

   Brand rules enforced here: Cormorant Light headlines (never bold serif),
   DM Sans body 15–18px / line-height >= 1.6, one accent per surface, links use
   Blue Deep (#2A8FB0), visible 2px Blue Deep focus, no text shadows, no
   gradients on text or data. Palette is the A!thera palette only — no new colors.
   ============================================================================ */

/* ----------------------------------------------------------------------------
   1. Brand tokens — paste verbatim, 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;

  /* App-specific spacing scale (8 → 120) and radii — derived, not new colors */
  --pp-space-1: 8px;
  --pp-space-2: 16px;
  --pp-space-3: 24px;
  --pp-space-4: 32px;
  --pp-space-5: 48px;
  --pp-space-6: 64px;
  --pp-space-7: 80px;
  --pp-space-8: 120px;
  --pp-radius: 4px;
  --pp-radius-sm: 2px;
  --pp-content-max: 1200px;
  --pp-header-h: 68px;
}

/* ----------------------------------------------------------------------------
   2. Reset + base document
   ---------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  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;
  -moz-osx-font-smoothing: grayscale;
}

/* Headlines are Cormorant Garamond Light — never bold serif. */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--athera-display);
  font-weight: 300;
  color: var(--athera-charcoal);
  letter-spacing: -0.01em;
  margin: 0 0 var(--pp-space-3);
}

p {
  margin: 0 0 var(--pp-space-3);
}

/* Links / interactive text use Blue Deep — A! Blue fails contrast for text. */
a {
  color: var(--athera-blue-deep);
  text-decoration: none;
  transition: color 0.2s ease;
}
a:hover {
  color: var(--athera-charcoal);
  text-decoration: underline;
  text-underline-offset: 3px;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

hr {
  border: none;
  border-top: 1px solid var(--athera-line);
  margin: var(--pp-space-5) 0;
}

/* ----------------------------------------------------------------------------
   3. Type-scale classes — verbatim from formats-html.md
   ---------------------------------------------------------------------------- */
.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); }

/* ----------------------------------------------------------------------------
   4. Layout primitives
   ---------------------------------------------------------------------------- */
.athera-container {
  width: 100%;
  max-width: var(--pp-content-max);
  margin: 0 auto;
  padding-left: 48px;
  padding-right: 48px;
}

.athera-section {
  padding-top: var(--pp-space-7);
  padding-bottom: var(--pp-space-7);
}

.athera-blue-rule {
  width: 48px;
  height: 1px;
  background: var(--athera-blue);
  border: none;
  margin: var(--pp-space-3) 0;
}

@media (max-width: 720px) {
  .athera-container { padding-left: 24px; padding-right: 24px; }
  .athera-section { padding-top: var(--pp-space-5); padding-bottom: var(--pp-space-5); }
}

/* ----------------------------------------------------------------------------
   5. Inline wordmark (A! blue, "thera" charcoal, "Partners" smaller/lighter)
   ---------------------------------------------------------------------------- */
.athera-wordmark {
  font-family: var(--athera-display);
  font-size: 32px;
  font-weight: 300;
  color: var(--athera-charcoal);
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.athera-wordmark .athera-wordmark-a { color: var(--athera-blue); }
.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;
}
/* On dark surfaces "thera" turns white. */
.athera-wordmark--on-dark { color: #fff; }
.athera-wordmark--on-dark .athera-wordmark-partners { color: rgba(255, 255, 255, 0.55); }

/* Emblem (standalone A!) for small marks / footer */
.athera-emblem {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--pp-radius);
  background: var(--athera-navy);
  font-family: var(--athera-display);
  font-weight: 300;
  font-size: 20px;
  line-height: 1;
  color: var(--athera-blue);
}

/* ----------------------------------------------------------------------------
   6. App shell — top header bar + footer disclaimer
   ---------------------------------------------------------------------------- */
.pp-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--pp-header-h);
  background: var(--athera-off-white);
  border-bottom: 1px solid var(--athera-line);
}
.pp-header__inner {
  height: 100%;
  max-width: var(--pp-content-max);
  margin: 0 auto;
  padding: 0 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--pp-space-3);
}
.pp-header .athera-wordmark { font-size: 26px; }
.pp-header__right {
  display: flex;
  align-items: center;
  gap: var(--pp-space-4);
}
.pp-header__section {
  color: var(--athera-grey);
  /* uses .athera-label typography via class in markup */
}

/* Primary in-app navigation (optional row of links/tabs) */
.pp-nav {
  display: flex;
  align-items: center;
  gap: var(--pp-space-3);
}
.pp-nav__link {
  font-family: var(--athera-sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--athera-grey);
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
}
.pp-nav__link:hover { color: var(--athera-charcoal); text-decoration: none; }
.pp-nav__link.is-active {
  color: var(--athera-charcoal);
  border-bottom-color: var(--athera-blue);
}

.pp-main {
  min-height: calc(100vh - var(--pp-header-h));
}

.pp-footer {
  border-top: 1px solid var(--athera-line);
  background: var(--athera-surface);
  padding: var(--pp-space-5) 0;
  margin-top: var(--pp-space-7);
}
.pp-footer__inner {
  max-width: var(--pp-content-max);
  margin: 0 auto;
  padding: 0 48px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--pp-space-4);
  flex-wrap: wrap;
}
.pp-footer__disclaimer {
  max-width: 640px;
  font-family: var(--athera-sans);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.6;
  color: var(--athera-grey);
}
.pp-footer__meta {
  display: flex;
  align-items: center;
  gap: var(--pp-space-2);
}

@media (max-width: 720px) {
  .pp-header__inner,
  .pp-footer__inner { padding-left: 24px; padding-right: 24px; }
  .pp-header .athera-wordmark { font-size: 22px; }
  .pp-header__right { gap: var(--pp-space-3); }
}
/* On the narrowest screens the section label yields so the wordmark and the
   always-reachable Audit-trail link never overflow the sticky header. */
@media (max-width: 560px) {
  .pp-header__section { display: none; }
}

/* ----------------------------------------------------------------------------
   7. Hero / cover section
   ---------------------------------------------------------------------------- */
.athera-hero {
  min-height: 78vh;
  background: var(--athera-navy);
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 40px 64px;
  color: #fff;
}
.athera-hero-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 40px;
  border-bottom: 1px solid var(--athera-line-dark);
}
.athera-hero-body {
  padding: 80px 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.athera-hero-body .athera-blue-rule { margin: 0 0 48px; }
.athera-hero-foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding-top: 40px;
  border-top: 1px solid var(--athera-line-dark);
}
.athera-tagline {
  margin-top: 32px;
  font-family: var(--athera-sans);
  font-size: 13px;
  font-weight: 300;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
}
@media (max-width: 720px) {
  .athera-hero { padding: 24px; min-height: 70vh; }
  .athera-hero-body { padding: 48px 0; }
}

/* ----------------------------------------------------------------------------
   8. Section opener (number + eyebrow + title + intro + thin blue rule)
   ---------------------------------------------------------------------------- */
.athera-section-opener {
  max-width: 720px;
}
.athera-section-opener .section-number {
  display: block;
  margin-bottom: var(--pp-space-2);
}
.athera-section-opener .athera-label,
.athera-section-opener .athera-label-blue {
  display: block;
}
.athera-section-opener h2,
.athera-section-opener .athera-display-md {
  margin-top: var(--pp-space-3);
  margin-bottom: 0;
}
.athera-section-opener .athera-body-lg {
  max-width: 520px;
  margin-top: var(--pp-space-3);
}
.athera-section-opener .athera-blue-rule {
  margin-top: var(--pp-space-3);
}

/* ----------------------------------------------------------------------------
   9. Buttons
   ---------------------------------------------------------------------------- */
.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: var(--pp-radius-sm);
  cursor: pointer;
  transition: background 0.2s ease;
}
.athera-button-primary:hover { background: var(--athera-blue-deep); color: var(--athera-navy); text-decoration: none; }

.athera-button-secondary {
  display: inline-block;
  padding: 12px 24px;
  background: transparent;
  color: var(--athera-charcoal);
  border: 1px solid var(--athera-line);
  border-radius: var(--pp-radius-sm);
  font-family: var(--athera-sans);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.athera-button-secondary:hover { background: var(--athera-off-white); border-color: var(--athera-grey-light); color: var(--athera-charcoal); text-decoration: none; }

.athera-button-primary[disabled],
.athera-button-secondary[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ----------------------------------------------------------------------------
   10. Cards
   ---------------------------------------------------------------------------- */
.athera-card {
  background: var(--athera-white);
  border: 1px solid var(--athera-line);
  border-radius: var(--pp-radius);
  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: var(--pp-radius);
  padding: 32px;
}
.athera-card-dark h1,
.athera-card-dark h2,
.athera-card-dark h3 { color: #fff; }

/* ----------------------------------------------------------------------------
   11. Tables
   ---------------------------------------------------------------------------- */
.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);
  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);
}
.athera-table tbody tr:hover { background: var(--athera-off-white); }
/* Numeric columns read cleaner in mono */
.athera-table .num { font-family: var(--athera-mono); font-size: 12px; text-align: right; color: var(--athera-charcoal); }

/* ----------------------------------------------------------------------------
   12. Forms + focus states
   ---------------------------------------------------------------------------- */
.pp-field { margin-bottom: var(--pp-space-3); }
.pp-field__label {
  display: block;
  margin-bottom: var(--pp-space-1);
  font-family: var(--athera-sans);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--athera-grey);
}
.pp-input,
.pp-select,
.pp-textarea {
  width: 100%;
  padding: 10px 14px;
  font-family: var(--athera-sans);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--athera-charcoal);
  background: var(--athera-white);
  border: 1px solid var(--athera-line);
  border-radius: var(--pp-radius-sm);
  transition: border-color 0.2s ease;
}
.pp-input::placeholder,
.pp-textarea::placeholder { color: var(--athera-grey); }
.pp-input:hover,
.pp-select:hover,
.pp-textarea:hover { border-color: var(--athera-grey-light); }
.pp-textarea { min-height: 96px; resize: vertical; }

/* Visible focus everywhere — 2px Blue Deep outline, 2px offset. */
:focus-visible {
  outline: 2px solid var(--athera-blue-deep);
  outline-offset: 2px;
}
.pp-input:focus-visible,
.pp-select:focus-visible,
.pp-textarea:focus-visible {
  outline: 2px solid var(--athera-blue-deep);
  outline-offset: 0;
  border-color: var(--athera-blue-deep);
}

/* ----------------------------------------------------------------------------
   13. Status pills (recommendation actions) + risk flags
   One accent per surface; palette tokens only (tints are opacity variants).
   ---------------------------------------------------------------------------- */
.pp-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-family: var(--athera-sans);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  line-height: 1;
  border-radius: 999px;
  border: 1px solid var(--athera-line);
  color: var(--athera-charcoal);
  background: transparent;
  white-space: nowrap;
}
/* A tiny dot carries the state alongside the text (never color alone). */
.pp-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 auto;
}

/* Decision / approval states */
.pp-pill--approved {
  color: var(--athera-blue-deep);
  border-color: rgba(42, 143, 176, 0.35);
  background: rgba(95, 184, 214, 0.10);
}
.pp-pill--pending {
  color: var(--athera-grey);
  border-color: var(--athera-line);
  background: rgba(107, 114, 128, 0.06);
}
.pp-pill--revised {
  color: var(--athera-amber);
  border-color: rgba(200, 149, 90, 0.40);
  background: rgba(200, 149, 90, 0.10);
}
.pp-pill--rejected {
  color: var(--athera-charcoal);
  border-color: var(--athera-line);
  background: var(--athera-surface);
}

/* Recommendation action labels (increase / decrease / hold / promote) —
   neutral by default, single blue accent reserved for the primary action. */
.pp-pill--action { color: var(--athera-charcoal); border-color: var(--athera-line); }
.pp-pill--action-primary {
  color: var(--athera-blue-deep);
  border-color: rgba(42, 143, 176, 0.35);
  background: rgba(95, 184, 214, 0.10);
}

/* Risk flags — amber signals a governance / trust concern; steel is informational. */
.pp-flag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-family: var(--athera-sans);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  line-height: 1;
  border-radius: var(--pp-radius-sm);
  border: 1px solid var(--athera-line);
  color: var(--athera-grey);
  background: transparent;
  white-space: nowrap;
}
.pp-flag--risk {
  color: var(--athera-amber);
  border-color: rgba(200, 149, 90, 0.40);
  background: rgba(200, 149, 90, 0.10);
}
.pp-flag--info {
  color: var(--athera-charcoal-light);
  border-color: rgba(138, 165, 190, 0.45);
  background: rgba(138, 165, 190, 0.12);
}
.pp-flag--clear {
  color: var(--athera-blue-deep);
  border-color: rgba(42, 143, 176, 0.30);
  background: rgba(95, 184, 214, 0.08);
}

/* Confidence indicator (text + fill; not color alone) */
.pp-confidence {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--athera-mono);
  font-size: 11px;
  color: var(--athera-grey);
}
.pp-confidence__track {
  width: 72px;
  height: 4px;
  border-radius: 999px;
  background: var(--athera-mist);
  overflow: hidden;
}
.pp-confidence__fill {
  height: 100%;
  background: var(--athera-blue);
}

/* ----------------------------------------------------------------------------
   14. Utilities
   ---------------------------------------------------------------------------- */
.pp-grid { display: grid; gap: var(--pp-space-4); }
.pp-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pp-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pp-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) {
  .pp-grid--3, .pp-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .pp-grid--2, .pp-grid--3, .pp-grid--4 { grid-template-columns: 1fr; }
}

.pp-stack > * + * { margin-top: var(--pp-space-3); }
.pp-row { display: flex; align-items: center; gap: var(--pp-space-2); }
.pp-row--between { justify-content: space-between; }
.pp-row--wrap { flex-wrap: wrap; }

.pp-muted { color: var(--athera-grey); }
.pp-strong { font-weight: 500; color: var(--athera-charcoal); }
.pp-metric {
  font-family: var(--athera-display);
  font-weight: 300;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1;
  color: var(--athera-charcoal);
  letter-spacing: -0.01em;
}
.pp-metric-unit { font-family: var(--athera-sans); font-size: 13px; color: var(--athera-grey); }

.pp-text-center { text-align: center; }
.pp-hidden { display: none !important; }
.pp-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;
}

/* Respect reduced-motion — the brand is calm anyway. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
  }
}
