/* Price-It-Right — Concept B "Canvas" redesign.
 * Mobile-first, restrained, whitespace-driven. No framework. */
:root {
  --ink: #1d1f1c;
  --muted: #6f736c;
  --faint: #9aa09a;
  --line: #e9e7e2;
  --bg: #fbfaf8;
  --card: #ffffff;
  --accent: #2e7d4f;
  --accent-ink: #ffffff;
  --accent-soft: #eaf4ee;
  --amber: #8a5a00;
  --amber-bg: #fff8e1;
  --amber-line: #f0dfae;
  --danger: #b3261e;
  --danger-bg: #fdecea;
  --radius: 14px;
  --pad: 20px;
  --tap: 44px;
}
* { 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.5; 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: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--bg);
  position: sticky; top: 0; z-index: 30;
}
.brand { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.iconbtn {
  border: none; background: none; font-size: 22px; color: var(--muted);
  width: var(--tap); height: var(--tap); border-radius: 12px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; flex: none;
}
.iconbtn:active { background: var(--line); }
.backbtn {
  border: none; background: none; color: var(--accent); font-size: 17px; font-weight: 600;
  min-height: var(--tap); padding: 0 12px 0 0; cursor: pointer;
}

/* ---------- views ---------- */
.view { flex: 1; padding: 8px var(--pad) calc(32px + env(safe-area-inset-bottom)); }
.view h1 { font-size: 28px; line-height: 1.2; letter-spacing: -0.02em; margin: 12px 0 4px; }
.view h2 { font-size: 20px; letter-spacing: -0.01em; margin: 30px 0 2px; }
.lede { color: var(--muted); margin: 0 0 20px; font-size: 16px; }
.hint { color: var(--muted); font-size: 14px; margin: 2px 0 12px; }

/* ---------- home actions ---------- */
.action {
  display: flex; align-items: center; gap: 14px; width: 100%;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin: 0 0 12px; cursor: pointer; text-align: left;
  font: inherit; color: inherit;
}
.action:active { background: #f4f3f0; }
.action .dot {
  flex: none; width: 46px; height: 46px; border-radius: 14px;
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700;
}
.action .t { flex: 1; min-width: 0; }
.action .t b { display: block; font-size: 18px; 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: 20px 0 0; padding: 14px 16px; font-size: 14.5px; color: var(--muted);
  background: var(--accent-soft); border-radius: var(--radius); line-height: 1.5;
}
.firsttip b { color: var(--ink); }

/* ---------- sections & rows ---------- */
.sec { margin-top: 30px; }
.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; }
.row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px; min-height: 60px;
}
.row + .row { border-top: 1px solid var(--line); }
.row .grow { flex: 1; min-width: 0; }
.row .name { font-weight: 600; font-size: 16.5px; }
.row .sub { color: var(--muted); font-size: 14px; margin-top: 1px; }
.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: 2px; flex: none; }
.stepper button {
  width: var(--tap); height: var(--tap); border-radius: 12px;
  border: 1px solid var(--line); background: var(--card); color: var(--accent);
  font-size: 22px; font-weight: 600; cursor: pointer; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.stepper button:active { background: var(--accent-soft); }
.stepper .val { min-width: 52px; 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: 14px 0; }
.field label { display: block; font-size: 14.5px; color: var(--muted); margin-bottom: 6px; }
.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: 12px;
  padding: 13px 14px; min-height: var(--tap);
}
.input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.moneywrap { position: relative; }
.moneywrap .cur { position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: 17px; }
.moneywrap .input { padding-left: 32px; }
.pctwrap { position: relative; }
.pctwrap .pct { position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: 17px; }
.pctwrap .input { padding-right: 36px; }

.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.pillbtn {
  border: 1px solid var(--line); background: var(--card); border-radius: 999px;
  padding: 10px 16px; font: inherit; font-size: 15.5px; cursor: pointer; min-height: var(--tap);
}
.pillbtn.on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- 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);
  padding: 12px var(--pad) calc(12px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 12px;
  box-shadow: 0 -8px 24px rgba(0,0,0,0.06);
}
.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: 13px; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.06em; }
.pricebar .pval { font-size: 30px; font-weight: 800; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums; line-height: 1.15; }
.pricebar .pval.attn { 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: 52px; padding: 0 26px; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); flex: none;
}
.btn:active { filter: brightness(0.93); }
.btn.ghost { background: var(--card); color: var(--ink); border: 1px solid var(--line); font-weight: 600; }
.btn.block { display: block; width: 100%; margin-top: 18px; }
.btn.danger { background: none; color: var(--danger); font-weight: 600; padding: 0 8px; }
.attnstrip {
  background: var(--amber-bg); color: var(--amber); border-top: 1px solid var(--amber-line);
  font-size: 14px; padding: 10px var(--pad); line-height: 1.45;
}

/* ---------- bottom sheet ---------- */
.sheetback {
  position: fixed; inset: 0; background: rgba(20,22,20,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: 22px 22px 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);
}
.sheet.show { transform: translateY(0); }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 10px 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-size: 19px; letter-spacing: -0.01em; }
.sheet .sbody { overflow-y: auto; padding: 6px 20px 24px; -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: 9px 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: 20px; }
.verdict { margin-top: 12px; padding: 13px 15px; border-radius: 12px; font-size: 15.5px; line-height: 1.5; }
.verdict.ok { background: var(--accent-soft); color: #1e5c37; }
.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: 22px 0; }
.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom));
  background: var(--ink); color: #fff; padding: 13px 16px; border-radius: 12px; 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: 6px 16px; margin-top: 16px; }
@media (min-width: 700px) {
  .view { padding-top: 16px; }
}
