/* Price-It-Right — boutique visual identity.
 * Warm neutrals, restrained terracotta, serif display type, subtle depth.
 * Mobile-first. System typefaces only — no webfonts, stays lightweight. */
:root {
  --bg: #faf6f0;
  --card: #ffffff;
  --ink: #2b2520;
  --muted: #756a5e;
  --faint: #a89c8e;
  --line: #eae1d3;
  --accent: #a2592a;        /* terracotta — primary actions */
  --accent-deep: #8a4a22;   /* terracotta text on light grounds */
  --accent-soft: #f6e8d7;   /* tinted grounds */
  --sage: #7c8b6f;
  --sage-soft: #edf1e8;
  --amber: #8a5a00;
  --amber-bg: #fff6dc;
  --amber-line: #eedfae;
  --danger: #a93226;
  --danger-bg: #fbedea;
  --radius: 16px;
  --pad: 20px;
  --tap: 46px;
  --serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
  --shadow-soft: 0 2px 10px rgba(90, 64, 38, 0.06);
  --shadow-lift: 0 -10px 30px rgba(90, 64, 38, 0.10);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  font-size: 17px; line-height: 1.55; color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
.app { max-width: 560px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 4px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  background: var(--bg);
  position: sticky; top: 0; z-index: 30;
}
.brand {
  font-family: var(--serif); font-size: 21px; font-weight: 700; letter-spacing: 0.005em;
  flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.iconbtn {
  border: none; background: none; font-size: 21px; color: var(--muted);
  width: var(--tap); height: var(--tap); border-radius: 14px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; flex: none;
}
.iconbtn:active { background: var(--accent-soft); color: var(--accent-deep); }
.backbtn {
  border: none; background: none; color: var(--accent-deep); font-size: 17px; font-weight: 600;
  min-height: var(--tap); padding: 0 12px 0 0; cursor: pointer;
}

/* ---------- views ---------- */
.view { flex: 1; padding: 6px var(--pad) calc(32px + env(safe-area-inset-bottom)); }
.view h1 {
  font-family: var(--serif); font-size: 31px; line-height: 1.18; letter-spacing: 0.002em;
  margin: 14px 0 6px; font-weight: 700;
}
.view h2 { font-size: 20px; letter-spacing: -0.01em; margin: 30px 0 2px; }
.lede { color: var(--muted); margin: 0 0 22px; font-size: 16.5px; }
.hint { color: var(--muted); font-size: 14px; margin: 2px 0 12px; line-height: 1.5; }

/* ---------- home actions ---------- */
.action {
  display: flex; align-items: center; gap: 16px; width: 100%;
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  padding: 20px 18px; margin: 0 0 14px; cursor: pointer; text-align: left;
  font: inherit; color: inherit; box-shadow: var(--shadow-soft);
}
.action:active { background: #fdfaf5; transform: scale(0.995); }
.action .dot {
  flex: none; width: 50px; height: 50px; border-radius: 16px;
  background: var(--accent-soft); color: var(--accent-deep);
  display: flex; align-items: center; justify-content: center;
  font-size: 23px; font-weight: 700;
}
.action .t { flex: 1; min-width: 0; }
.action .t b { display: block; font-size: 18.5px; letter-spacing: -0.01em; }
.action .t span { color: var(--muted); font-size: 14.5px; }
.action .chev { color: var(--faint); font-size: 22px; flex: none; }
.firsttip {
  margin: 22px 0 0; padding: 16px 18px; font-size: 15px; color: var(--muted);
  background: var(--sage-soft); border-radius: var(--radius); line-height: 1.55;
}
.firsttip b { color: var(--ink); }
.guidecard {
  display: flex; align-items: center; gap: 14px; width: 100%;
  background: var(--accent-soft); border: 1px solid var(--accent-soft);
  border-radius: 18px; padding: 18px; margin: 0 0 16px; cursor: pointer; text-align: left;
  font: inherit; color: inherit; box-shadow: var(--shadow-soft);
}
.guidecard:active { filter: brightness(0.97); }
.guidecard .t { flex: 1; min-width: 0; }
.guidecard .t b {
  display: block; font-family: var(--serif); font-size: 19px; color: var(--accent-deep);
  letter-spacing: 0.002em; margin-bottom: 2px;
}
.guidecard .t span { color: var(--accent-deep); font-size: 14.5px; opacity: 0.85; }
.guidecard .chev { color: var(--accent-deep); font-size: 22px; flex: none; }

/* ---------- how-it-works guide ---------- */
.guide-step {
  display: flex; gap: 16px; margin: 22px 0; align-items: flex-start;
}
.guide-step .n {
  flex: none; width: 44px; height: 44px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-deep);
  font-family: var(--serif); font-size: 21px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.guide-step .t b { display: block; font-size: 18px; margin-bottom: 3px; letter-spacing: -0.01em; }
.guide-step .t p { margin: 0; color: var(--muted); font-size: 15.5px; line-height: 1.55; }
.guide-note {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin-top: 26px; box-shadow: var(--shadow-soft);
}
.guide-note b { font-family: var(--serif); font-size: 18px; display: block; margin-bottom: 6px; }
.guide-note p { margin: 0 0 10px; color: var(--muted); font-size: 15.5px; line-height: 1.6; }
.guide-note p:last-child { margin-bottom: 0; }

/* ---------- sections & rows ---------- */
.sec { margin-top: 32px; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 2px; }
.sec-title { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.rows {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-soft);
}
.row {
  display: flex; align-items: center; gap: 12px;
  padding: 15px 18px; min-height: 64px;
}
.row + .row { border-top: 1px solid var(--line); }
.row .grow { flex: 1; min-width: 0; }
.row .name { font-weight: 600; font-size: 17px; letter-spacing: -0.005em; }
.row .sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.row.bad { background: var(--danger-bg); }
.rowwarn { color: var(--danger); font-size: 13.5px; margin-top: 3px; }
.rowbtn { border: none; background: none; font: inherit; color: inherit; text-align: left;
  padding: 0; cursor: pointer; display: block; width: 100%; }
.chevbtn { border: none; background: none; color: var(--faint); font-size: 20px; padding: 8px 0 8px 8px; cursor: pointer; }

/* ---------- steppers, inputs, pills ---------- */
.stepper { display: flex; align-items: center; gap: 4px; flex: none; }
.stepper button {
  width: var(--tap); height: var(--tap); border-radius: 14px;
  border: 1px solid var(--line); background: var(--card); color: var(--accent-deep);
  font-size: 22px; font-weight: 600; cursor: pointer; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-soft);
}
.stepper button:active { background: var(--accent-soft); }
.stepper .val { min-width: 54px; text-align: center; font-size: 18px; font-weight: 700;
  font-variant-numeric: tabular-nums; }
.stepper .unit { color: var(--muted); font-size: 14px; margin-left: 2px; }

.field { margin: 16px 0; }
.field label { display: block; font-size: 14.5px; font-weight: 600; color: var(--muted); margin-bottom: 7px; }
.input, select.input, textarea.input {
  width: 100%; font: inherit; font-size: 17px; color: var(--ink);
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 16px; min-height: 56px; box-shadow: var(--shadow-soft);
}
.input::placeholder { color: var(--muted); opacity: 0.75; }
.input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.moneywrap { position: relative; }
.moneywrap .cur { position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: 17px; }
.moneywrap .input { padding-left: 34px; }
.pctwrap { position: relative; }
.pctwrap .pct { position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: 17px; }
.pctwrap .input { padding-right: 38px; }

.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.pillbtn {
  border: 1px solid var(--line); background: var(--card); border-radius: 999px;
  padding: 11px 18px; font: inherit; font-size: 15.5px; font-weight: 600; cursor: pointer;
  min-height: var(--tap); color: var(--muted); box-shadow: var(--shadow-soft);
}
.pillbtn.on { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---------- collapsible ---------- */
.collap-head {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  border: none; background: none; font: inherit; padding: 14px 0; cursor: pointer; text-align: left;
}
.collap-head .sec-title { margin: 0; }
.collap-head .caret { color: var(--faint); font-size: 18px; transition: transform 0.15s; }
.collap-head[aria-expanded="true"] .caret { transform: rotate(180deg); }

/* ---------- sticky price bar ---------- */
#pricebarSlot:empty { display: none; }
.pricebar {
  position: sticky; bottom: 0; z-index: 30;
  background: var(--card); border-top: 1px solid var(--line);
  border-radius: 22px 22px 0 0;
  padding: 14px var(--pad) calc(14px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 14px;
  box-shadow: var(--shadow-lift);
}
.pricebar .pinfo { flex: 1; min-width: 0; border: none; background: none; font: inherit;
  text-align: left; cursor: pointer; padding: 0; color: inherit; }
.pricebar .plab { font-size: 12.5px; color: var(--accent-deep); text-transform: uppercase;
  letter-spacing: 0.09em; font-weight: 700; }
.pricebar .pval { font-family: var(--serif); font-size: 34px; font-weight: 700; letter-spacing: 0;
  font-variant-numeric: tabular-nums; line-height: 1.15; }
.pricebar .pval.attn { font-family: inherit; font-size: 19px; font-weight: 700; color: var(--amber); }
.pricebar .psub { font-size: 13.5px; color: var(--muted); }
.btn {
  border: none; border-radius: var(--radius); font: inherit; font-size: 17px; font-weight: 700;
  min-height: 56px; padding: 0 28px; cursor: pointer;
  background: var(--accent); color: #fff; flex: none;
  box-shadow: 0 4px 14px rgba(162, 89, 42, 0.28);
}
.btn:active { filter: brightness(0.94); transform: scale(0.99); }
.btn.ghost {
  background: var(--card); color: var(--ink); border: 1px solid var(--line);
  font-weight: 600; box-shadow: var(--shadow-soft);
}
.btn.block { display: block; width: 100%; margin-top: 20px; }
.btn.danger { background: none; color: var(--danger); font-weight: 600; padding: 0 8px; box-shadow: none; }
.attnstrip {
  background: var(--amber-bg); color: var(--amber); border-top: 1px solid var(--amber-line);
  font-size: 14px; padding: 11px var(--pad); line-height: 1.45;
}

/* ---------- bottom sheet ---------- */
.sheetback {
  position: fixed; inset: 0; background: rgba(43, 37, 32, 0.45); z-index: 70;
  opacity: 0; transition: opacity 0.18s;
}
.sheetback.show { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 71;
  background: var(--card); border-radius: 24px 24px 0 0;
  max-height: 88dvh; display: flex; flex-direction: column;
  transform: translateY(100%); transition: transform 0.22s ease-out;
  max-width: 560px; margin: 0 auto;
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -12px 40px rgba(43, 37, 32, 0.18);
}
.sheet.show { transform: translateY(0); }
.sheet .grab { width: 42px; height: 5px; border-radius: 3px; background: var(--line); margin: 12px auto 2px; flex: none; }
.sheet .shead { display: flex; align-items: center; justify-content: space-between;
  padding: 8px 20px 4px; flex: none; }
.sheet .shead b { font-family: var(--serif); font-size: 20px; }
.sheet .sbody { overflow-y: auto; padding: 6px 20px 26px; -webkit-overflow-scrolling: touch; }
.sheet .x { border: none; background: none; font-size: 20px; color: var(--muted);
  width: var(--tap); height: var(--tap); cursor: pointer; }
.search { margin: 8px 0 4px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; font-size: 16px;
  border-top: 1px solid var(--line); }
.kv:first-child { border-top: none; }
.kv .k { color: var(--muted); }
.kv .v { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.kv.total .v { font-size: 21px; font-family: var(--serif); }
.verdict { margin-top: 14px; padding: 15px 17px; border-radius: 14px; font-size: 15.5px; line-height: 1.55; }
.verdict.ok { background: var(--sage-soft); color: #3f5a34; }
.verdict.warn { background: var(--amber-bg); color: var(--amber); }
.verdict.bad { background: var(--danger-bg); color: var(--danger); }

/* ---------- misc ---------- */
.divider { border: none; border-top: 1px solid var(--line); margin: 24px 0; }
.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom));
  background: var(--ink); color: #fff; padding: 14px 18px; border-radius: 14px; font-size: 15px;
  z-index: 90; text-align: center; box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  max-width: 528px; margin: 0 auto;
}
.storewarn {
  position: sticky; top: 0; z-index: 60;
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--amber-bg); color: var(--amber); border-bottom: 1px solid var(--amber-line);
  padding: 10px 12px; padding-top: calc(10px + env(safe-area-inset-top));
  font-size: 13.5px; line-height: 1.45;
}
.storewarn button {
  flex: none; border: none; background: none; color: var(--amber);
  font-size: 16px; padding: 2px 6px; cursor: pointer;
}
.empty { text-align: center; color: var(--muted); padding: 48px 24px; font-size: 16px; }
.listbtn { border: none; background: none; font: inherit; color: inherit; text-align: left;
  padding: 0; cursor: pointer; display: block; width: 100%; }
.totals { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 8px 18px; margin-top: 16px; box-shadow: var(--shadow-soft); }
@media (min-width: 700px) {
  .view { padding-top: 16px; }
}
