/* ============================================================
   QuoteCraft Mobile · Editorial atelier
   ============================================================ */

:root {
  --paper:    #f1ead8;
  --paper-2:  #ebe2cd;
  --vellum:   #faf5e6;
  --ivory:    #fffbf0;
  --ink:      #1a1612;
  --ink-2:    #3a3128;
  --ink-3:    #6b5d4f;
  --rule:     #c8b896;
  --rule-2:   #d8c9a5;
  --ochre:    #b8732a;
  --ochre-d:  #8a5318;
  --ochre-l:  #d49d4f;
  --ochre-bg: #ecd9b0;
  --madder:   #a8392c;
  --olive:    #5d6e3f;
  --olive-bg: #d8dcc4;

  --shadow-sm: 0 1px 2px rgba(26, 22, 18, 0.05);
  --shadow-md: 0 8px 24px rgba(26, 22, 18, 0.07);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  --safe-top: env(safe-area-inset-top);
  --safe-bottom: env(safe-area-inset-bottom);
  --safe-left: env(safe-area-inset-left);
  --safe-right: env(safe-area-inset-right);

  --appbar-h: 56px;
  --actionbar-h: 76px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  font-family: 'Instrument Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  overflow-x: hidden;
}
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; -webkit-tap-highlight-color: transparent; text-align: left; }
a { color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; }
ul, ol { list-style: none; }
em, i { font-style: italic; }

.display, h1, h2, h3, h4, .price-val, .meter-val, .rh-title,
.proc-title, .drop-title, .rq-amt, .hs-num, .qd-co {
  font-family: 'Fraunces', 'Times New Roman', serif;
  font-optical-sizing: auto;
}

.paper-grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.4;
  mix-blend-mode: multiply;
  background-image:
    radial-gradient(rgba(120, 90, 50, 0.05) 1px, transparent 1px),
    radial-gradient(rgba(80, 60, 40, 0.03) 1px, transparent 1px);
  background-size: 3px 3px, 7px 7px;
  background-position: 0 0, 1px 2px;
}
main, .appbar, .actionbar { position: relative; z-index: 1; }

/* ============ APP BAR ============ */
.appbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  gap: 8px;
  align-items: center;
  padding: var(--safe-top) max(12px, var(--safe-right)) 0 max(12px, var(--safe-left));
  height: calc(var(--appbar-h) + var(--safe-top));
  background: rgba(241, 234, 216, 0.85);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s var(--ease);
}
.appbar.scrolled { border-bottom-color: var(--rule); }

.appbar-back {
  width: 40px; height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--ink);
  transition: background 0.15s var(--ease), opacity 0.2s var(--ease), transform 0.2s var(--ease);
}
.appbar-back:active { background: rgba(26, 22, 18, 0.08); transform: scale(0.94); }
.appbar-back svg { width: 22px; height: 22px; }
.appbar-back.is-hidden { opacity: 0; pointer-events: none; transform: translateX(-4px); }

.appbar-meta { text-align: center; min-width: 0; }
.appbar-eyebrow {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 10px;
  color: var(--ink-3);
  line-height: 1;
  font-variation-settings: 'opsz' 12, 'SOFT' 100;
}
.appbar-title {
  font-family: 'Fraunces', serif;
  font-size: 17px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.01em;
  margin-top: 2px;
  font-variation-settings: 'opsz' 24, 'SOFT' 50;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.appbar-mark {
  width: 36px; height: 36px;
  color: var(--ink);
  justify-self: end;
}

/* ============ VIEWS ============ */
.view { display: none; }
.view.view-active { display: block; animation: viewFade 0.4s var(--ease); }
@keyframes viewFade {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============ HERO ============ */
.hero {
  padding: 16px max(20px, var(--safe-left)) 24px max(20px, var(--safe-left));
}
.masthead {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 18px;
}
.masthead em { color: var(--ochre-d); font-style: normal; }
.masthead .rule { flex: 1; height: 1px; background: var(--rule); }

.chapter {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rule);
}
.chap-roman {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 30px;
  color: var(--ochre);
  font-variation-settings: 'opsz' 144, 'SOFT' 100, 'WONK' 1;
  line-height: 1;
}
.chap-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-2);
}

.display {
  font-size: clamp(40px, 12vw, 64px);
  font-weight: 350;
  line-height: 0.97;
  letter-spacing: -0.03em;
  font-variation-settings: 'opsz' 144, 'SOFT' 30;
  margin-bottom: 22px;
}
.display em {
  font-style: italic;
  color: var(--ochre-d);
  font-variation-settings: 'opsz' 144, 'SOFT' 100, 'WONK' 1;
}
.display .break { display: block; }

.lede {
  font-family: 'Fraunces', serif;
  font-size: 16px;
  font-weight: 350;
  line-height: 1.5;
  color: var(--ink-2);
  font-variation-settings: 'opsz' 14, 'SOFT' 20;
  max-width: 36ch;
}

/* ============ DOSSIER (DROPZONE) ============ */
.dossier-wrap {
  position: relative;
  margin: 36px max(20px, var(--safe-left)) 28px;
}
.dossier-tab {
  position: absolute;
  top: -22px;
  left: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--ink);
  color: var(--paper);
  padding: 5px 12px;
  border-radius: 2px 2px 0 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  z-index: 2;
}
.tab-no { color: var(--ochre-l); font-weight: 600; }
.tab-state { opacity: 0.65; }

.dossier {
  width: 100%;
  position: relative;
  background: var(--vellum);
  border: 1px solid var(--rule);
  border-radius: 2px;
  box-shadow: var(--shadow-md);
  padding: 28px 22px 24px;
  overflow: hidden;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: transform 0.2s var(--ease), background 0.2s var(--ease);
}
.dossier:active { transform: scale(0.99); background: var(--ochre-bg); }
.dossier.is-drag { background: var(--ochre-bg); }

.weave-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.15;
  background-image:
    repeating-linear-gradient(0deg, transparent 0 9px, var(--ochre-d) 9px 10px),
    repeating-linear-gradient(90deg, transparent 0 9px, var(--ochre-d) 9px 10px);
}

.drop-mark {
  width: 52px; height: 52px;
  margin-bottom: 10px;
  color: var(--ink);
  position: relative;
  z-index: 1;
}
.drop-mark svg { width: 100%; height: 100%; }
.drop-title {
  font-size: 22px;
  font-weight: 400;
  letter-spacing: -0.015em;
  color: var(--ink);
  font-variation-settings: 'opsz' 36, 'SOFT' 50;
  position: relative;
  z-index: 1;
}
.drop-title em {
  color: var(--ochre-d);
  font-variation-settings: 'opsz' 36, 'SOFT' 100, 'WONK' 1;
}
.drop-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-3);
  margin-bottom: 18px;
  position: relative;
  z-index: 1;
}
.dot-sep { color: var(--ochre); padding: 0 4px; }

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 22px;
  background: var(--ink);
  color: var(--paper);
  font-size: 14px;
  font-weight: 500;
  border-radius: 3px;
  position: relative;
  z-index: 1;
  box-shadow: 0 2px 0 var(--ochre-d);
}
.btn-primary svg { width: 14px; height: 14px; }

/* ============ SECTIONS ============ */
.section {
  padding: 0 max(20px, var(--safe-left)) 28px;
}
.section-rule {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 14px;
}
.section-rule::before, .section-rule::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--rule), transparent);
}
.section-rule span {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 12.5px;
  color: var(--ink-3);
  font-variation-settings: 'opsz' 14, 'SOFT' 100;
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
}
.section-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.link {
  font-size: 12px;
  font-family: 'Fraunces', serif;
  font-style: italic;
  color: var(--ochre-d);
  font-variation-settings: 'opsz' 14, 'SOFT' 100;
}

/* ============ SAMPLE TEMPLATES ============ */
.dz-templates {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--rule-2);
  border: 1px solid var(--rule);
  border-radius: 3px;
  overflow: hidden;
}
.dz-template {
  display: grid;
  grid-template-columns: 36px 1fr 18px;
  gap: 12px;
  align-items: center;
  padding: 14px 14px;
  background: var(--ivory);
  width: 100%;
  transition: background 0.2s var(--ease);
}
.dz-template:active { background: var(--ochre-bg); }

.t-mark {
  width: 30px; height: 30px;
  border: 1px solid var(--ink-2);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 14px;
  color: var(--ink);
  background: var(--paper);
  font-variation-settings: 'opsz' 24, 'SOFT' 100;
}
.t-name { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.t-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--ink-3);
  margin-top: 2px;
  letter-spacing: 0.02em;
}
.t-arrow {
  font-family: 'Fraunces', serif;
  font-size: 16px;
  color: var(--ink-3);
}

/* ============ ARCHIVE LIST ============ */
.archive-list {
  border: 1px solid var(--rule);
  border-radius: 3px;
  overflow: hidden;
  background: rgba(255, 251, 240, 0.5);
}
.rq {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--rule-2);
  transition: background 0.15s var(--ease);
}
.rq:last-child { border-bottom: 0; }
.rq:active { background: var(--ochre-bg); }
.rq-name { font-size: 13px; font-weight: 600; color: var(--ink); }
.rq-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--ink-3);
  margin-top: 2px;
}
.rq-amt {
  font-size: 18px;
  font-weight: 500;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.rq-amt span {
  font-style: italic;
  font-size: 11px;
  color: var(--ink-3);
  font-weight: 400;
  margin-left: 1px;
}
.badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  font-weight: 500;
  padding: 3px 7px;
  border-radius: 2px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border: 1px solid currentColor;
}
.b-pending { color: var(--ochre-d); background: var(--ochre-bg); }
.b-won     { color: var(--olive); background: var(--olive-bg); }
.b-lost    { color: var(--ink-3); background: rgba(0,0,0,0.04); }

/* ============ FEATURES ============ */
.features {
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: rgba(255, 251, 240, 0.5);
}
.features li {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 14px;
  padding: 14px;
  border-bottom: 1px solid var(--rule-2);
  align-items: baseline;
}
.features li:last-child { border-bottom: 0; }
.feat-num {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 22px;
  color: var(--ochre);
  font-variation-settings: 'opsz' 36, 'SOFT' 100, 'WONK' 1;
  line-height: 1;
}
.features h4 {
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 4px;
  font-variation-settings: 'opsz' 18, 'SOFT' 50;
}
.features p { font-size: 13px; color: var(--ink-3); line-height: 1.5; }

/* ============ FOOT RULE ============ */
.rule-foot {
  text-align: center;
  padding: 24px max(20px, var(--safe-left)) 32px;
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 12px;
  color: var(--ink-3);
  font-variation-settings: 'opsz' 14, 'SOFT' 100;
  border-top: 1px solid var(--rule);
  margin-top: 12px;
}

/* ============ PROCESSING ============ */
.proc-shell {
  padding: 32px max(20px, var(--safe-left)) 40px max(20px, var(--safe-left));
  text-align: center;
}
.proc-shell .chapter { justify-content: center; text-align: left; }
.proc-head { margin-bottom: 18px; }
.proc-title {
  font-size: 28px;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-variation-settings: 'opsz' 48, 'SOFT' 50;
  line-height: 1.05;
}
.proc-file {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  color: var(--ink-3);
  margin-top: 8px;
  word-break: break-all;
}
.proc-spinner {
  width: 56px; height: 56px;
  margin: 18px auto 24px;
  color: var(--ochre);
}

.proc-steps {
  background: var(--vellum);
  border: 1px solid var(--rule);
  border-radius: 3px;
  text-align: left;
  margin-bottom: 18px;
}
.proc-steps li {
  display: grid;
  grid-template-columns: 24px 14px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 11px 14px;
  font-size: 13px;
  color: var(--ink-3);
  border-bottom: 1px solid var(--rule-2);
}
.proc-steps li:last-child { border-bottom: 0; }
.step-num {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 13px;
  color: var(--ink-3);
  font-variation-settings: 'opsz' 18, 'SOFT' 100;
  text-align: center;
}
.dot {
  width: 12px; height: 12px;
  border: 1.5px solid var(--rule);
  border-radius: 50%;
  position: relative;
  transition: all 0.3s var(--ease);
}
.proc-steps li.active { color: var(--ink); background: linear-gradient(90deg, var(--ochre-bg) 0%, transparent 80%); }
.proc-steps li.active .step-num { color: var(--ochre-d); }
.proc-steps li.active .dot {
  border-color: var(--ochre);
  border-top-color: transparent;
  animation: spin 0.9s linear infinite;
}
.proc-steps li.done { color: var(--ink-2); }
.proc-steps li.done .step-num { color: var(--ochre-d); }
.proc-steps li.done .dot {
  background: var(--ink);
  border-color: var(--ink);
}
.proc-steps li.done .dot::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f1ead8' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5L20 7'/%3E%3C/svg%3E");
  background-size: 8px;
  background-position: center;
  background-repeat: no-repeat;
}
@keyframes spin { to { transform: rotate(360deg); } }
.label { font-weight: 500; line-height: 1.3; }
.meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
}
.proc-steps li.done .meta { color: var(--ochre-d); }

.proc-extracted {
  background: var(--paper);
  border: 1px solid var(--rule-2);
  border-radius: 3px;
  padding: 14px 16px;
  text-align: left;
  min-height: 100px;
}
.ex-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-3);
  margin-bottom: 12px;
}
.ex-rule { flex: 1; height: 1px; background: var(--rule-2); }
.ex-fields {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px 16px;
  font-size: 12px;
}
.ex-fields .f {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px dashed var(--rule-2);
  opacity: 0;
  transform: translateY(4px);
  transition: all 0.4s var(--ease);
  font-variant-numeric: tabular-nums;
}
.ex-fields .f.show { opacity: 1; transform: translateY(0); }
.ex-fields .f span {
  color: var(--ink-3);
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 12px;
  font-variation-settings: 'opsz' 14, 'SOFT' 100;
}
.ex-fields .f b {
  color: var(--ink);
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
}

/* ============ RESULT ============ */
.result-hero {
  padding: 16px max(20px, var(--safe-left)) 16px max(20px, var(--safe-left));
}
.rh-title {
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-variation-settings: 'opsz' 36, 'SOFT' 50;
  line-height: 1.1;
  margin-bottom: 6px;
}
.rh-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--ink-3);
  margin-bottom: 12px;
  letter-spacing: 0.02em;
}
.rh-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 5px 10px;
  background: var(--olive-bg);
  color: var(--olive);
  border: 1px solid var(--olive);
  border-radius: 2px;
}
.conf-dot {
  width: 6px; height: 6px;
  background: var(--olive);
  border-radius: 50%;
  animation: confpulse 2.4s ease-in-out infinite;
}
@keyframes confpulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.card {
  margin: 0 max(20px, var(--safe-left)) 16px;
  background: var(--vellum);
  border: 1px solid var(--rule);
  border-radius: 3px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--rule-2);
  gap: 10px;
}
.card-head h2 {
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
  font-variation-settings: 'opsz' 24, 'SOFT' 50;
}
.card-head h2 em {
  color: var(--ochre-d);
  font-variation-settings: 'opsz' 24, 'SOFT' 100, 'WONK' 1;
}
.src-pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ochre-d);
  padding: 3px 7px;
  background: var(--ochre-bg);
  border: 1px solid var(--ochre);
  border-radius: 2px;
}

/* PRICE CARD */
.price-card {
  background:
    radial-gradient(circle at 80% 20%, rgba(184, 115, 42, 0.15), transparent 60%),
    linear-gradient(135deg, var(--vellum) 0%, var(--ochre-bg) 100%);
  border-color: var(--ochre);
  position: relative;
  padding: 22px 22px 20px;
}
.price-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(0deg, transparent 0 23px, rgba(138, 83, 24, 0.06) 23px 24px),
    repeating-linear-gradient(90deg, transparent 0 23px, rgba(138, 83, 24, 0.06) 23px 24px);
  pointer-events: none;
}
.price-card > * { position: relative; }
.price-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ochre-d);
  margin-bottom: 8px;
}
.price-val {
  font-size: clamp(48px, 14vw, 72px);
  font-weight: 350;
  line-height: 0.9;
  letter-spacing: -0.04em;
  color: var(--ink);
  font-variation-settings: 'opsz' 144, 'SOFT' 30;
  display: flex;
  align-items: flex-start;
  gap: 4px;
  margin-bottom: 16px;
  font-variant-numeric: tabular-nums;
}
.price-currency {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 0.5em;
  color: var(--ochre-d);
  font-variation-settings: 'opsz' 144, 'SOFT' 100, 'WONK' 1;
  margin-top: 0.2em;
}
.price-suffix {
  display: flex;
  flex-direction: column;
  font-size: 13px;
  color: var(--ink-2);
  margin-left: 12px;
  margin-top: 0.55em;
  font-weight: 400;
  line-height: 1.2;
}
.price-suffix em {
  font-family: 'Fraunces', serif;
  font-style: italic;
  color: var(--ink);
  font-size: 14px;
  font-variation-settings: 'opsz' 18, 'SOFT' 100;
}
.price-incoterm {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-3);
  margin-top: 4px;
}
.price-lines {
  border-top: 1px solid var(--ink);
}
.price-lines > div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 9px 0;
  border-bottom: 1px dashed rgba(26, 22, 18, 0.18);
  font-size: 13px;
}
.price-lines > div:last-child { border-bottom: 0; }
.price-lines dt {
  font-family: 'Fraunces', serif;
  font-style: italic;
  color: var(--ink-2);
  font-variation-settings: 'opsz' 14, 'SOFT' 100;
}
.price-lines dd {
  font-family: 'Fraunces', serif;
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  font-variation-settings: 'opsz' 18, 'SOFT' 50;
}
.price-lines .success dd { color: var(--olive); }

/* METER */
.meter-card { padding: 18px 22px 18px; }
.meter-card .card-head { padding: 0 0 12px; border-bottom: 1px solid var(--rule-2); margin-bottom: 14px; }
.meter-val {
  font-size: 30px;
  font-weight: 400;
  color: var(--ink);
  font-variation-settings: 'opsz' 48, 'SOFT' 30;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.meter-val i {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 16px;
  color: var(--ochre-d);
  font-variation-settings: 'opsz' 24, 'SOFT' 100, 'WONK' 1;
  margin-left: 2px;
}
.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--madder) 0%, var(--ochre) 25%, var(--olive) 50%, var(--ink) 100%);
  border-radius: 2px;
  outline: none;
  margin-bottom: 10px;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--ivory);
  border: 2px solid var(--ink);
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}
.slider::-moz-range-thumb {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--ivory);
  border: 2px solid var(--ink);
}
.meter-axis {
  display: flex;
  justify-content: space-between;
  margin-bottom: 14px;
}
.meter-axis span {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}
.meter-axis span:first-child { align-items: flex-start; }
.meter-axis span:last-child  { align-items: flex-end; }
.meter-axis b {
  font-family: 'Fraunces', serif;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
}
.meter-axis i {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 10px;
  color: var(--ink-3);
  font-variation-settings: 'opsz' 12, 'SOFT' 100;
}
.meter-rules {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 12px;
  border-top: 1px dashed var(--rule-2);
}
.meter-rules li {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 11.5px;
  color: var(--ink-2);
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-variation-settings: 'opsz' 12, 'SOFT' 100;
}
.rule-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.rule-dot.ok { background: var(--olive); }
.rule-dot.warn { background: var(--ochre); }

/* SPECS */
.spec-list { padding: 6px 16px 14px; }
.spec-list > div {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--rule-2);
  font-size: 12.5px;
}
.spec-list > div:last-child { border-bottom: 0; }
.spec-list dt {
  color: var(--ink-3);
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 12.5px;
  font-variation-settings: 'opsz' 14, 'SOFT' 100;
}
.spec-list dd {
  color: var(--ink);
  font-weight: 600;
  text-align: right;
}

/* WATERFALL */
.waterfall {
  padding: 14px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.wf-row {
  display: grid;
  grid-template-columns: minmax(120px, 40%) 1fr 44px;
  gap: 10px;
  align-items: center;
}
.wf-lbl { font-size: 12px; color: var(--ink-2); }
.wf-lbl span {
  display: block;
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 10.5px;
  color: var(--ink-3);
  font-variation-settings: 'opsz' 12, 'SOFT' 100;
  margin-top: 1px;
}
.wf-bar {
  position: relative;
  height: 22px;
  background: var(--paper);
  border: 1px solid var(--rule-2);
  border-radius: 1px;
  overflow: hidden;
}
.wf-bar::before {
  content: '';
  display: block;
  height: 100%;
  width: var(--w);
  background: linear-gradient(90deg, var(--ochre-d) 0%, var(--ochre) 50%, var(--ochre-l) 100%);
  animation: wfFill 1s var(--ease);
}
@keyframes wfFill { from { width: 0; } }
.wf-bar span {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  color: var(--ivory);
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.wf-pct {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: var(--ink-3);
  font-weight: 500;
  text-align: right;
}
.wf-row.total {
  padding-top: 8px;
  margin-top: 4px;
  border-top: 2px solid var(--ink);
}
.wf-row.total .wf-lbl {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  color: var(--ink);
  font-size: 14px;
  font-variation-settings: 'opsz' 18, 'SOFT' 50;
}
.wf-row.total .wf-bar { background: var(--paper); border-color: var(--ink); }
.wf-row.total .wf-bar::before { background: linear-gradient(90deg, var(--ink), var(--ink-2)); }
.wf-row.total .wf-pct {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 12px;
  color: var(--ink);
}

/* COMPARABLES */
.comparables {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.comp {
  background: var(--paper);
  border: 1px solid var(--rule-2);
  border-radius: 2px;
  padding: 11px 13px;
}
.comp-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 5px;
  gap: 8px;
}
.comp-id {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.04em;
}
.comp-margin {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 12px;
  font-weight: 500;
  font-variation-settings: 'opsz' 14, 'SOFT' 100;
}
.comp-margin.pos { color: var(--olive); }
.comp-margin.neg { color: var(--madder); }
.comp-body {
  font-size: 11.5px;
  color: var(--ink-2);
  margin-bottom: 8px;
  line-height: 1.45;
}
.comp-body em {
  color: var(--ink);
  font-family: 'Fraunces', serif;
}
.comp-bar {
  height: 3px;
  background: var(--rule-2);
  border-radius: 2px;
  overflow: hidden;
}
.comp-bar div {
  height: 100%;
  background: var(--olive);
  animation: barFill 0.8s var(--ease);
}
.comp-bar.negbar div { background: var(--madder); }
@keyframes barFill { from { transform: scaleX(0); transform-origin: left; } }

/* ============ ACTION BAR ============ */
.actionbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 60;
  display: none;
  grid-template-columns: 1fr 1fr 1.6fr;
  gap: 8px;
  padding: 10px max(14px, var(--safe-right)) max(14px, var(--safe-bottom)) max(14px, var(--safe-left));
  background: rgba(241, 234, 216, 0.92);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--rule);
}
.actionbar.is-on { display: grid; }

.ab-secondary, .ab-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 48px;
  border-radius: 4px;
  font-size: 13.5px;
  font-weight: 500;
  transition: transform 0.15s var(--ease);
  font-family: 'Fraunces', serif;
  font-variation-settings: 'opsz' 18, 'SOFT' 50;
}
.ab-secondary {
  background: var(--vellum);
  border: 1px solid var(--rule);
  color: var(--ink);
}
.ab-secondary:active { transform: scale(0.96); }
.ab-primary {
  background: var(--ink);
  color: var(--paper);
  box-shadow: 0 2px 0 var(--ochre-d);
}
.ab-primary:active { transform: scale(0.97); }
.ab-secondary svg, .ab-primary svg { width: 15px; height: 15px; }

.bottom-spacer {
  height: calc(var(--actionbar-h) + var(--safe-bottom) + 12px);
}

/* Constrain to phone width on desktop */
@media (min-width: 720px) {
  body {
    max-width: 480px;
    margin: 0 auto;
    border-left: 1px solid var(--rule);
    border-right: 1px solid var(--rule);
    min-height: 100vh;
    background: var(--paper);
  }
  .actionbar { left: 50%; transform: translateX(-50%); right: auto; width: 480px; }
}

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