/* =========================================================================
   ContractorMargin.com — Shared Stylesheet
   Phase 1 — style.css
   Single source of truth for all 16 pages.
   ========================================================================= */

/* -------------------------------------------------------------------------
   Fonts
   ------------------------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Sans:wght@400;500;600;700&display=swap');

/* -------------------------------------------------------------------------
   Design Tokens — shared
   ------------------------------------------------------------------------- */
:root {
  /* Font families */
  --font-display: 'DM Serif Display', Georgia, serif;
  --font-body: 'DM Sans', 'Helvetica Neue', sans-serif;

  /* Fluid type scale */
  --text-xs:   clamp(0.75rem,  0.7rem  + 0.25vw, 0.875rem);
  --text-sm:   clamp(0.875rem, 0.8rem  + 0.35vw, 1rem);
  --text-base: clamp(1rem,     0.95rem + 0.25vw, 1.125rem);
  --text-lg:   clamp(1.125rem, 1rem    + 0.75vw, 1.5rem);
  --text-xl:   clamp(1.5rem,   1.2rem  + 1.25vw, 2.25rem);

  /* 4px spacing scale */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-7:  1.75rem;
  --space-8:  2rem;
  --space-9:  2.25rem;
  --space-10: 2.5rem;
  --space-11: 2.75rem;
  --space-12: 3rem;
  --space-14: 3.5rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-28: 7rem;
  --space-32: 8rem;

  /* Border radius */
  --radius-sm:   0.375rem;
  --radius-md:   0.5rem;
  --radius-lg:   0.75rem;
  --radius-xl:   1rem;
  --radius-full: 9999px;

  /* Transition */
  --transition: 180ms cubic-bezier(0.16, 1, 0.3, 1);

  /* Content widths */
  --content-default: 1100px;
  --content-narrow:  640px;
  --content-wide:    1280px;
}

/* -------------------------------------------------------------------------
   Light Mode
   ------------------------------------------------------------------------- */
:root,
[data-theme="light"] {
  --bg:               #f5f4ef;
  --surface:          #faf9f6;
  --surface-2:        #ffffff;
  --surface-offset:   #edebe5;
  --border:           #d8d5ce;
  --divider:          #e2dfd9;
  --text:             #0f0e0c;
  --text-muted:       #1a1815;
  --text-faint:       #3a3830;
  --text-inverse:     #faf9f6;
  --accent:           #8a3f00;
  --accent-hover:     #6b2f00;
  --accent-active:    #4e2000;
  --accent-hl:        #f0dcc8;
  --success:          #2e6b3a;
  --success-hl:       #d0e8d4;
  --success-text:     #1a4a22;
  --warning:          #7a5500;
  --warning-hl:       #f5e8c0;
  --error:            #8a2020;
  --error-hl:         #f5d0d0;
  --shadow-sm: 0 1px 2px oklch(0.2 0.02 60 / 0.06);
  --shadow-md: 0 4px 12px oklch(0.2 0.02 60 / 0.09);
  --shadow-lg: 0 12px 32px oklch(0.2 0.02 60 / 0.13);
}

/* -------------------------------------------------------------------------
   Dark Mode — DEFAULT
   ------------------------------------------------------------------------- */
[data-theme="dark"] {
  --bg:               #161512;
  --surface:          #1c1a17;
  --surface-2:        #222019;
  --surface-offset:   #2a2722;
  --border:           #3a3830;
  --divider:          #2e2c26;
  --text:             #e8e5df;
  --text-muted:       #8a8780;
  --text-faint:       #5a5850;
  --text-inverse:     #1c1a17;
  --accent:           #e8883a;
  --accent-hover:     #f5a060;
  --accent-active:    #c86820;
  --accent-hl:        #3a2a18;
  --success:          #4aaa5e;
  --success-hl:       #162010;
  --success-text:     #6acc7a;
  --warning:          #c8a030;
  --warning-hl:       #2a2208;
  --error:            #c85050;
  --error-hl:         #2a1010;
  --shadow-sm: 0 1px 3px oklch(0 0 0 / 0.25);
  --shadow-md: 0 4px 16px oklch(0 0 0 / 0.35);
  --shadow-lg: 0 12px 40px oklch(0 0 0 / 0.5);
}

/* System preference fallback — when no data-theme attribute is set */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg:               #161512;
    --surface:          #1c1a17;
    --surface-2:        #222019;
    --surface-offset:   #2a2722;
    --border:           #3a3830;
    --divider:          #2e2c26;
    --text:             #e8e5df;
    --text-muted:       #8a8780;
    --text-faint:       #5a5850;
    --text-inverse:     #1c1a17;
    --accent:           #e8883a;
    --accent-hover:     #f5a060;
    --accent-active:    #c86820;
    --accent-hl:        #3a2a18;
    --success:          #4aaa5e;
    --success-hl:       #162010;
    --success-text:     #6acc7a;
    --warning:          #c8a030;
    --warning-hl:       #2a2208;
    --error:            #c85050;
    --error-hl:         #2a1010;
    --shadow-sm: 0 1px 3px oklch(0 0 0 / 0.25);
    --shadow-md: 0 4px 16px oklch(0 0 0 / 0.35);
    --shadow-lg: 0 12px 40px oklch(0 0 0 / 0.5);
  }
}

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
  scroll-padding-top: 4rem;
}

body {
  min-height: 100dvh;
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

img,
svg {
  display: block;
  max-width: 100%;
}

button {
  cursor: pointer;
  background: none;
  border: none;
  font: inherit;
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

input,
select {
  font: inherit;
  color: inherit;
}

h1, h2, h3, h4, h5, h6 {
  text-wrap: balance;
  line-height: 1.15;
}

p, li {
  text-wrap: pretty;
  max-width: 72ch;
}

::selection {
  background: color-mix(in oklch, var(--accent) 25%, transparent);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

a,
button,
input,
select {
  transition:
    color var(--transition),
    background var(--transition),
    border-color var(--transition),
    box-shadow var(--transition);
}

input[type=number] {
  -moz-appearance: textfield;
}
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* -------------------------------------------------------------------------
   Utility Classes
   ------------------------------------------------------------------------- */
.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;
}

.tabular-nums {
  font-variant-numeric: tabular-nums;
}

.section-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

/* -------------------------------------------------------------------------
   1. NAV
   ------------------------------------------------------------------------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 52px;
  background: color-mix(in oklch, var(--bg) 72%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--divider);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  max-width: var(--content-wide);
  height: 100%;
  margin: 0 auto;
  padding: 0 var(--space-5);
}

.nav-logo {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1;
  white-space: nowrap;
}

.nav-logo .logo-accent {
  color: var(--accent);
  font-style: italic;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  height: 36px;
  padding: 0 var(--space-4);
  background: var(--surface-offset);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--text);
  font-size: var(--text-xs);
  font-weight: 500;
}

.back-btn::before {
  content: '';
  width: 14px;
  height: 14px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><path d='M15 18l-6-6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

.back-btn:hover {
  background: var(--surface-2);
  border-color: var(--accent);
  color: var(--accent);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.nav-lang {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  background: var(--surface-offset);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  gap: 2px;
}

.lang-btn {
  min-width: 38px;
  height: 28px;
  padding: 0 var(--space-3);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  border-radius: var(--radius-full);
  letter-spacing: 0.04em;
}

.lang-btn:hover {
  color: var(--text);
}

.lang-btn.active {
  background: var(--surface-2);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--surface-offset);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--text-muted);
}

.theme-toggle:hover {
  background: var(--surface-2);
  color: var(--accent);
  border-color: var(--accent);
}

.theme-toggle svg {
  width: 16px;
  height: 16px;
}

/* -------------------------------------------------------------------------
   2. PAGE HEADER
   ------------------------------------------------------------------------- */
.page-header {
  max-width: var(--content-default);
  margin: 0 auto;
  padding: var(--space-10) var(--space-6) var(--space-6);
}

.page-header-inner {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.trade-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
}

.trade-tag svg {
  width: 14px;
  height: 14px;
}

.page-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  color: var(--text);
  letter-spacing: -0.01em;
}

.page-subtitle {
  font-size: var(--text-sm);
  color: var(--text-muted);
  max-width: 55ch;
  line-height: 1.55;
}

.header-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  background: var(--surface-offset);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-muted);
}

.meta-chip svg {
  width: 12px;
  height: 12px;
  color: var(--accent);
}

/* -------------------------------------------------------------------------
   3. CALCULATOR LAYOUT
   ------------------------------------------------------------------------- */
.calc-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: var(--space-6);
  align-items: start;
  max-width: var(--content-default);
  margin: 0 auto;
  padding: var(--space-6);
}

/* -------------------------------------------------------------------------
   4. INPUTS PANEL
   ------------------------------------------------------------------------- */
.inputs-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  min-width: 0;
}

/* -------------------------------------------------------------------------
   5. COMPLEXITY TOGGLE
   ------------------------------------------------------------------------- */
.complexity-toggle {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.complexity-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
}

.complexity-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-1);
  padding: var(--space-3) var(--space-4);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: 500;
  text-align: left;
  line-height: 1.3;
}

.complexity-btn > span:first-child {
  font-weight: 600;
}

.complexity-btn > small,
.complexity-btn > .complexity-desc {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: 400;
}

.complexity-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.complexity-btn.active {
  background: var(--accent-hl);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.complexity-btn.active > small,
.complexity-btn.active > .complexity-desc {
  color: var(--accent);
  opacity: 0.85;
}

/* -------------------------------------------------------------------------
   6. INPUT SECTIONS
   ------------------------------------------------------------------------- */
.input-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.input-section-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--divider);
  background: var(--surface);
}

.section-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--surface-offset);
  color: var(--accent);
  border-radius: var(--radius-md);
  flex-shrink: 0;
}

.section-icon svg {
  width: 16px;
  height: 16px;
}

.section-title {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.005em;
  line-height: 1.3;
}

.section-desc {
  font-size: var(--text-xs);
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: 2px;
}

.input-section-header > div {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.input-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
  padding: var(--space-5);
}

.input-grid.single {
  grid-template-columns: 1fr;
}

.input-grid.triple {
  grid-template-columns: repeat(3, 1fr);
}

/* -------------------------------------------------------------------------
   7. FORM FIELDS
   ------------------------------------------------------------------------- */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
}

.field-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.field-hint {
  font-size: var(--text-xs);
  color: var(--text-faint);
  line-height: 1.45;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrap input,
.input-wrap select,
.field input,
.field select {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
}

.input-wrap input::placeholder,
.field input::placeholder {
  color: var(--text-faint);
}

.input-wrap input:hover,
.input-wrap select:hover,
.field input:hover,
.field select:hover {
  border-color: var(--text-faint);
}

.input-wrap input:focus,
.input-wrap select:focus,
.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 15%, transparent);
}

.input-prefix,
.input-suffix {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1;
}

.input-prefix {
  left: var(--space-3);
  color: var(--text-muted);
}

.input-suffix {
  right: var(--space-3);
  color: var(--text-faint);
  font-size: var(--text-xs);
}

.input-wrap:has(.input-prefix) input {
  padding-left: var(--space-6);
}

.input-wrap:has(.input-suffix) input {
  padding-right: var(--space-8);
}

/* Custom select chevron */
.field select,
.input-wrap select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: var(--space-8);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a8780' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  background-size: 14px 14px;
  cursor: pointer;
}

/* -------------------------------------------------------------------------
   8. RESULTS PANEL
   ------------------------------------------------------------------------- */
.results-panel {
  position: sticky;
  top: calc(52px + var(--space-6));
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}

/* -------------------------------------------------------------------------
   9. RESULTS CARD
   ------------------------------------------------------------------------- */
.results-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-5);
  background: var(--surface-offset);
  border-bottom: 1px solid var(--divider);
}

.results-header > span:first-child {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.results-live-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 2px var(--space-2);
  background: var(--accent-hl);
  color: var(--accent);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.results-live-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: var(--radius-full);
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.4; transform: scale(0.8); }
}

.results-primary {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-6) var(--space-5);
}

.primary-number {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.primary-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.primary-value {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  color: var(--text);
  line-height: 1;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.primary-value.profit {
  color: var(--success-text);
}

.primary-value.neutral {
  color: var(--text);
}

.primary-value.error {
  color: var(--error);
}

.primary-sub {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.4;
}

/* -------------------------------------------------------------------------
   10. SECONDARY GRID
   ------------------------------------------------------------------------- */
.results-secondary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  border-top: 1px solid var(--divider);
}

.secondary-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-4) var(--space-5);
}

.secondary-item:not(:last-child) {
  border-right: 1px solid var(--divider);
}

.secondary-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.secondary-value {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.secondary-value.green {
  color: var(--success);
}

.secondary-value.amber {
  color: var(--accent);
}

/* -------------------------------------------------------------------------
   11. REVENUE BAR
   ------------------------------------------------------------------------- */
.cost-bar-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-5);
  border-top: 1px solid var(--divider);
}

.cost-bar-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.cost-bar-track {
  display: flex;
  width: 100%;
  height: 10px;
  background: var(--surface-offset);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.cost-bar-segment {
  height: 100%;
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.cost-bar-segment.materials {
  background: var(--accent);
}

.cost-bar-segment.labor {
  background: color-mix(in oklch, var(--accent) 55%, var(--text-faint));
}

.cost-bar-segment.overhead {
  background: var(--text-faint);
}

.cost-bar-segment.profit {
  background: var(--success);
}

.cost-bar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: 500;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.legend-dot.materials { background: var(--accent); }
.legend-dot.labor     { background: color-mix(in oklch, var(--accent) 55%, var(--text-faint)); }
.legend-dot.overhead  { background: var(--text-faint); }
.legend-dot.profit    { background: var(--success); }

/* -------------------------------------------------------------------------
   12. BENCHMARK CARD
   ------------------------------------------------------------------------- */
.benchmark-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.benchmark-header {
  padding: var(--space-3) var(--space-5);
  border-bottom: 1px solid var(--divider);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  background: var(--surface-offset);
}

.benchmark-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-5);
}

.benchmark-status {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.benchmark-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.benchmark-icon svg {
  width: 18px;
  height: 18px;
}

.benchmark-icon.above {
  background: var(--success-hl);
  color: var(--success-text);
}

.benchmark-icon.at {
  background: var(--warning-hl);
  color: var(--warning);
}

.benchmark-icon.below {
  background: var(--error-hl);
  color: var(--error);
}

.benchmark-message {
  font-size: var(--text-sm);
  color: var(--text);
  line-height: 1.45;
  font-weight: 500;
}

.benchmark-message.below {
  color: var(--error);
}

.benchmark-range-row {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.benchmark-bar-wrap {
  position: relative;
  height: 10px;
  background: var(--surface-offset);
  border-radius: var(--radius-full);
  overflow: visible;
}

.benchmark-bar-range {
  position: absolute;
  top: 0;
  height: 100%;
  background: color-mix(in oklch, var(--success) 28%, transparent);
  border-radius: var(--radius-full);
}

.benchmark-bar-pointer {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  background: var(--accent);
  border: 2px solid var(--surface-2);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
  transform: translate(-50%, -50%);
  transition: left 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.benchmark-range-row > div:last-child {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-xs);
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

/* -------------------------------------------------------------------------
   13. DISCLAIMER
   ------------------------------------------------------------------------- */
.disclaimer-box {
  padding: var(--space-3) var(--space-4);
  background: var(--surface-offset);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  color: var(--text-faint);
  line-height: 1.5;
}

/* -------------------------------------------------------------------------
   14. RESET BUTTON
   ------------------------------------------------------------------------- */
.reset-btn {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  color: var(--text-faint);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.reset-btn:hover {
  border-color: var(--accent);
  border-style: dashed;
  color: var(--accent);
}

.reset-btn:focus-visible {
  border-style: solid;
}

/* -------------------------------------------------------------------------
   15. FOOTER
   ------------------------------------------------------------------------- */
.footer {
  border-top: 1px solid var(--divider);
  padding: var(--space-8) var(--space-6);
  margin-top: var(--space-16);
  background: var(--bg);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  max-width: var(--content-default);
  margin: 0 auto;
}

.footer-copy,
.footer-links {
  font-size: var(--text-xs);
  color: var(--text-faint);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
}

.footer-links a:hover {
  color: var(--accent);
}

.footer-disclaimer {
  max-width: 80ch;
  margin: var(--space-3) auto 0;
  padding: 0 var(--space-6);
  font-size: var(--text-xs);
  font-style: italic;
  color: var(--text-faint);
  line-height: 1.5;
  text-align: center;
}

/* -------------------------------------------------------------------------
   HOMEPAGE — Hero Section
   ------------------------------------------------------------------------- */
.hero-section {
  max-width: var(--content-default);
  margin: 0 auto;
  padding: var(--space-16) var(--space-6) var(--space-12);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.hero-eyebrow {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
}

.hero-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  color: var(--text);
  line-height: 1.1;
  letter-spacing: -0.015em;
  max-width: 22ch;
}

.hero-title .highlight {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--accent);
}

.hero-subtitle {
  font-size: var(--text-sm);
  color: var(--text-muted);
  max-width: 52ch;
  line-height: 1.6;
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-6);
  margin-top: var(--space-8);
}

.stat-tile {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
}

.stat-tile > span:first-child {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  color: var(--text);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.stat-tile > span:last-child {
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.stat-divider {
  width: 1px;
  height: 40px;
  background: var(--divider);
  flex-shrink: 0;
}

.hero-disclaimer {
  font-size: var(--text-xs);
  color: var(--text-faint);
  font-style: italic;
  margin-top: var(--space-4);
  max-width: 60ch;
  line-height: 1.5;
}

/* -------------------------------------------------------------------------
   HOMEPAGE — How Section
   ------------------------------------------------------------------------- */
.how-section {
  background: var(--surface-offset);
  border-top: 1px solid var(--divider);
  border-bottom: 1px solid var(--divider);
  padding: var(--space-12) var(--space-6);
}

.how-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-10);
  align-items: start;
  max-width: var(--content-default);
  margin: 0 auto;
}

.how-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: var(--space-3);
}

.how-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  color: var(--text);
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin-bottom: var(--space-4);
  max-width: 18ch;
}

.how-desc {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 48ch;
}

.how-features {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  list-style: none;
  padding: 0;
  margin: 0;
}

.how-feature-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  font-size: var(--text-sm);
  color: var(--text);
  line-height: 1.5;
  max-width: none;
}

.how-feature-item::before {
  content: '';
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  background-color: var(--success);
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><polyline points='20 6 9 17 4 12'/></svg>");
          mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><polyline points='20 6 9 17 4 12'/></svg>");
  -webkit-mask-repeat: no-repeat;
          mask-repeat: no-repeat;
  -webkit-mask-position: center;
          mask-position: center;
  -webkit-mask-size: contain;
          mask-size: contain;
}

/* -------------------------------------------------------------------------
   HOMEPAGE — Trade Grid
   ------------------------------------------------------------------------- */
.trade-grid-section {
  max-width: var(--content-default);
  margin: 0 auto;
  padding: var(--space-12) var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.trade-grid-heading {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  color: var(--text);
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.trade-grid-sub {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.55;
  max-width: 60ch;
  margin-top: calc(var(--space-2) * -1);
}

.trade-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-4);
  margin-top: var(--space-2);
}

.trade-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition:
    transform var(--transition),
    border-color var(--transition),
    box-shadow var(--transition),
    background var(--transition);
  min-height: 160px;
}

.trade-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--accent);
}

.trade-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--surface-offset);
  border-radius: var(--radius-md);
  color: var(--accent);
  flex-shrink: 0;
}

.trade-card-icon svg {
  width: 20px;
  height: 20px;
}

.trade-card-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.trade-card-meta {
  font-size: var(--text-xs);
  color: var(--text-muted);
  line-height: 1.45;
}

.trade-card-margin {
  margin-top: auto;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.02em;
}

/* -------------------------------------------------------------------------
   RESPONSIVE — 860px
   ------------------------------------------------------------------------- */
@media (max-width: 860px) {
  .calc-layout {
    grid-template-columns: 1fr;
  }

  .results-panel {
    position: static;
    top: auto;
  }

  .input-grid.triple {
    grid-template-columns: repeat(2, 1fr);
  }

  .how-inner {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }
}

/* -------------------------------------------------------------------------
   RESPONSIVE — 520px
   ------------------------------------------------------------------------- */
@media (max-width: 520px) {
  .calc-layout {
    padding: var(--space-4);
  }

  .input-grid,
  .input-grid.triple {
    grid-template-columns: 1fr;
  }

  .complexity-options {
    display: flex;
    flex-direction: column;
  }

  .page-header {
    padding: var(--space-6) var(--space-4) var(--space-4);
  }

  .hero-section {
    padding: var(--space-10) var(--space-4) var(--space-8);
  }

  .how-section {
    padding: var(--space-10) var(--space-4);
  }

  .trade-grid-section {
    padding: var(--space-10) var(--space-4);
  }

  .footer {
    padding: var(--space-6) var(--space-4);
  }

  /* Minimum touch targets */
  .back-btn,
  .reset-btn,
  .complexity-btn,
  .lang-btn,
  .theme-toggle,
  .input-wrap input,
  .input-wrap select,
  .field input,
  .field select {
    min-height: 44px;
  }

  .lang-btn {
    min-width: 44px;
  }

  .nav {
    height: auto;
    min-height: 52px;
  }

  .nav-inner {
    padding: var(--space-2) var(--space-4);
  }

  .stat-divider {
    display: none;
  }

  .hero-stats {
    gap: var(--space-4);
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* -------------------------------------------------------------------------
   End of style.css
   ------------------------------------------------------------------------- */

/* ─────────────────────────────────────────────────────────────
   SEO Content Sections (Phase 12)
   ───────────────────────────────────────────────────────────── */
.seo-section {
  padding-block: var(--space-16);
  border-top: 1px solid var(--border);
}

.seo-container {
  max-width: var(--content-default);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

.seo-section h2 {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text);
  margin-bottom: var(--space-4);
  line-height: 1.2;
}

.seo-section h3 {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text);
  margin-top: var(--space-8);
  margin-bottom: var(--space-3);
}

.seo-lead {
  font-size: var(--text-lg);
  color: var(--text-muted);
  max-width: 68ch;
  line-height: 1.6;
  margin-bottom: var(--space-6);
}

.seo-note {
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-style: italic;
  margin-top: var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: var(--surface-offset);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--accent);
}

.seo-steps {
  padding-left: var(--space-6);
  margin-bottom: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.seo-steps li {
  font-size: var(--text-base);
  color: var(--text);
  line-height: 1.55;
  max-width: 72ch;
}

.seo-steps li strong {
  color: var(--text);
}

/* FAQ */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  margin-top: var(--space-4);
}

.faq-list dt {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text);
  margin-bottom: var(--space-2);
}

.faq-list dd {
  font-size: var(--text-base);
  color: var(--text-muted);
  line-height: 1.65;
  max-width: 72ch;
  margin-left: 0;
}

/* About section extras */
.seo-about p {
  font-size: var(--text-base);
  color: var(--text-muted);
  line-height: 1.65;
  max-width: 72ch;
  margin-bottom: var(--space-3);
}

@media (max-width: 600px) {
  .seo-section {
    padding-block: var(--space-10);
  }
  .seo-container {
    padding-inline: var(--space-4);
  }
  .seo-section h2 {
    font-size: var(--text-lg);
  }
}



/* -------------------------------------------------------------------------
   PHASE 14 — Skip link (a11y)
   ------------------------------------------------------------------------- */
.skip-link {
  position: absolute;
  top: -200px;
  left: var(--space-4);
  z-index: 9999;
  padding: var(--space-3) var(--space-5);
  background: var(--accent);
  color: var(--text-inverse);
  font-weight: 600;
  font-size: var(--text-sm);
  border-radius: 8px;
  text-decoration: none;
  transition: top var(--transition);
}
.skip-link:focus {
  top: var(--space-4);
  outline: 3px solid var(--text);
  outline-offset: 2px;
}

/* -------------------------------------------------------------------------
   PHASE 14 — Calculator results disclaimer
   ------------------------------------------------------------------------- */
.calc-disclaimer {
  margin-bottom: var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: var(--surface-offset);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  font-size: var(--text-xs);
  line-height: 1.55;
  color: var(--text-muted);
}
.calc-disclaimer strong {
  color: var(--text);
  font-weight: 600;
}

/* -------------------------------------------------------------------------
   PHASE 14 — Site footer (expanded)
   ------------------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--divider);
  margin-top: var(--space-16);
  padding: var(--space-10) var(--space-6) var(--space-6);
  background: var(--bg);
  color: var(--text-faint);
  font-size: var(--text-sm);
}
.site-footer-inner {
  max-width: var(--content-default);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: var(--space-10);
}
.footer-brand .footer-logo {
  font-family: Georgia, serif;
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  display: inline-block;
  margin-bottom: var(--space-3);
}
.footer-brand .footer-logo .logo-accent {
  color: var(--accent);
}
.footer-tagline {
  font-size: var(--text-xs);
  line-height: 1.6;
  color: var(--text-faint);
  max-width: 40ch;
}
.footer-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-8);
}
.footer-nav-col h4 {
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 var(--space-3);
  font-weight: 600;
}
.footer-nav-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.footer-nav-col a {
  color: var(--text-faint);
  text-decoration: none;
  font-size: var(--text-xs);
  transition: color var(--transition);
}
.footer-nav-col a:hover {
  color: var(--accent);
}
.footer-legal {
  max-width: var(--content-default);
  margin: var(--space-8) auto 0;
  padding-top: var(--space-6);
  border-top: 1px solid var(--divider);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}
.footer-legal-copy {
  font-size: var(--text-xs);
  color: var(--text-faint);
  max-width: 70ch;
  line-height: 1.55;
}
.footer-legal-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
}
.footer-legal-links a {
  color: var(--text-faint);
  font-size: var(--text-xs);
  text-decoration: none;
  transition: color var(--transition);
}
.footer-legal-links a:hover {
  color: var(--accent);
}
@media (max-width: 768px) {
  .site-footer-inner {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }
  .footer-nav {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
  }
  .footer-legal {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* -------------------------------------------------------------------------
   PHASE 14 — Legal pages (prose)
   ------------------------------------------------------------------------- */
.legal-page {
  max-width: 72ch;
  margin: 0 auto;
  padding: var(--space-12) var(--space-6) var(--space-10);
}
.legal-page h1 {
  font-family: Georgia, serif;
  font-size: var(--text-4xl);
  line-height: 1.15;
  margin: 0 0 var(--space-3);
  color: var(--text);
}
.legal-page .legal-lead {
  font-size: var(--text-lg);
  color: var(--text-muted);
  margin: 0 0 var(--space-8);
  line-height: 1.55;
}
.legal-page h2 {
  font-size: var(--text-xl);
  margin: var(--space-8) 0 var(--space-3);
  color: var(--text);
}
.legal-page h3 {
  font-size: var(--text-base);
  margin: var(--space-6) 0 var(--space-2);
  color: var(--text);
}
.legal-page p,
.legal-page li {
  color: var(--text-muted);
  line-height: 1.7;
  font-size: var(--text-base);
}
.legal-page ul,
.legal-page ol {
  padding-left: var(--space-5);
  margin: 0 0 var(--space-4);
}
.legal-page li { margin-bottom: var(--space-2); }
.legal-page a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.legal-page a:hover { opacity: 0.85; }
.legal-meta {
  font-size: var(--text-xs);
  color: var(--text-faint);
  margin-top: var(--space-10);
  padding-top: var(--space-4);
  border-top: 1px solid var(--divider);
}


/* -------------------------------------------------------------------------
   PHASE 14.1 — Benchmark neutral / empty state
   ------------------------------------------------------------------------- */
.benchmark-icon.neutral {
  background: var(--surface-offset);
  color: var(--text-faint);
  border: 1px dashed var(--border);
}
.benchmark-message.neutral {
  color: var(--text-muted);
  font-style: italic;
}
