/* iFour Quotes — tokens taken from the Figma prototype variables */
:root {
  --ink: #1a1a1a; --shadow-ink: #030303; --grey: #7a7a7a; --dark: #1e1e1e;
  --mist: #f6f7fc; --snow: #fff; --line: #d2d7dc; --line-soft: #e1e1e2;
  --teal: #14b8a5; --teal-ink: #0f8f80; --blush: #eb51b7; --yellow: #fed430;
  --amber: #b8860b; --red: #c2410c;
  --radius: 10px; --radius-sm: 7px;
  --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --pad: clamp(16px, 4vw, 48px);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--snow); color: var(--ink); font: 15px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--blush); outline-offset: 2px; }

/* ---------- shell ---------- */
.top { position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,.94); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line-soft); }
.top-in { max-width: 1180px; margin: 0 auto; padding: 10px var(--pad); display: flex; align-items: center; gap: 16px; }
.logo { display: flex; flex-direction: column; text-decoration: none; line-height: 1; }
.logo svg { width: 64px; height: auto; display: block; }
.logo small { font-size: 9.5px; margin-top: 3px; letter-spacing: .01em; }
.tabs { display: flex; gap: 4px; margin-left: 8px; }
.tab { text-decoration: none; padding: 8px 12px; border-radius: 999px; font-weight: 500; color: var(--grey); white-space: nowrap; }
.tab.on { color: var(--ink); background: var(--mist); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.who { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--snow); border-radius: 999px; padding: 4px 10px 4px 4px; font-size: 13px; }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--dark); color: var(--yellow); display: grid; place-items: center; font-size: 11px; font-weight: 700; }
main { max-width: 1180px; margin: 0 auto; padding: 24px var(--pad) 120px; }
.narrow { max-width: 956px; margin: 0 auto; }

/* ---------- type ---------- */
h1 { font-size: clamp(26px, 3.4vw, 34px); font-weight: 500; letter-spacing: -.015em; margin: 8px 0 8px; line-height: 1.15; }
h2 { font-size: clamp(22px, 2.6vw, 28px); font-weight: 500; letter-spacing: -.01em; margin: 2px 0 6px; line-height: 1.2; }
h3 { font-size: 16px; font-weight: 600; margin: 0 0 8px; }
.lede { color: var(--grey); margin: 0 0 22px; max-width: 62ch; }
.eyebrow { font-size: 12px; color: var(--grey); margin: 0; }
.muted { color: var(--grey); }
.tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--mist); border: 1px solid var(--line); color: var(--ink); }
.tag.preview { background: #fff5c9; border-color: #f3dc7a; }

/* ---------- buttons ---------- */
.btn { border: 1px solid var(--ink); background: var(--snow); border-radius: 999px; padding: 10px 18px; font-weight: 600; font-size: 14px;
  min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; white-space: nowrap; }
.btn.dark { background: var(--shadow-ink); color: #fff; border-color: var(--shadow-ink); }
.btn.yellow { background: var(--yellow); border-color: var(--yellow); color: var(--shadow-ink); }
.btn.ghost-light { background: transparent; color: #fff; border-color: #fff; }
.btn.quiet { border-color: var(--line); }
.btn.sm { min-height: 34px; padding: 6px 12px; font-size: 13px; }
.btn.danger { color: var(--red); border-color: #f0c7b3; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.link { background: none; border: 0; padding: 0; text-decoration: underline; text-underline-offset: 3px; color: var(--grey); font-size: 13px; }

/* ---------- step cards (Figma "Rectangle 1" panels) ---------- */
.step { background: var(--mist); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(18px, 3.4vw, 32px) clamp(16px, 3.6vw, 48px); margin-bottom: 20px; scroll-margin-top: 80px; }
.step .lede { margin-bottom: 18px; }
.grid { display: grid; gap: 18px 28px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.grid.counts { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px 20px; }
.field > label, .field > .flabel { display: block; font-weight: 500; font-size: 14px; margin-bottom: 8px; }
.field.wide { grid-column: 1 / -1; }
.sub-h { font-weight: 600; font-size: 13px; letter-spacing: .02em; color: var(--grey); text-transform: uppercase; margin: 20px 0 10px; }
.sub-h:first-child { margin-top: 0; }

/* option cards (step 1) */
.cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.opt { text-align: left; background: var(--snow); border: 1.5px solid var(--line); border-radius: var(--radius-sm); padding: 18px 16px; min-height: 104px;
  display: flex; flex-direction: column; justify-content: center; gap: 4px; transition: border-color .12s, box-shadow .12s; }
.opt b { font-weight: 600; font-size: 14px; }
.opt span { font-size: 12.5px; color: var(--grey); line-height: 1.35; }
.opt:hover { border-color: #9aa3ad; }
.opt.on { border: 2.5px solid var(--shadow-ink); padding: 17px 15px; box-shadow: 0 1px 0 rgba(0,0,0,.04); }
.opt .tick { width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--line); margin-bottom: 6px; display: grid; place-items: center; }
.opt.on .tick { background: var(--teal); border-color: var(--teal); }

/* segmented choice + checkbox chips */
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--snow); border-radius: 8px; padding: 8px 12px 8px 9px; min-height: 40px; font-size: 14px; }
.chip i { width: 20px; height: 20px; border-radius: 5px; border: 1.5px solid var(--line); flex: none; display: grid; place-items: center; }
.chip.radio i { border-radius: 50%; }
.chip.on { border-color: var(--teal); background: #effbf9; }
.chip.on i { background: var(--teal); border-color: var(--teal); }
.chip.on i::after { content: ""; width: 9px; height: 5px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px,-1px); }
.chip.radio.on i::after { width: 8px; height: 8px; border: 0; border-radius: 50%; background: #fff; transform: none; }

/* inputs */
.input, select.input { width: 100%; border: 1px solid var(--line); background: var(--snow); border-radius: var(--radius-sm); padding: 11px 14px; min-height: 46px; font-size: 15px; }
select.input { appearance: none; padding-right: 40px; background: var(--snow) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='7' viewBox='0 0 13 7'%3E%3Cpath d='M1 1l5.5 5L12 1' fill='none' stroke='%231a1a1a' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 14px center; }
.input::placeholder { color: #9b9b9b; }
.stepper { display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--snow); min-height: 46px; overflow: hidden; }
.stepper button { width: 44px; border: 0; background: transparent; font-size: 20px; line-height: 1; color: var(--ink); flex: none; }
.stepper button:active { background: var(--mist); }
.stepper input { flex: 1; min-width: 0; border: 0; text-align: center; font-weight: 600; font-size: 16px; background: transparent; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.stepper .unit { align-self: center; font-size: 12px; color: var(--grey); padding-right: 4px; }
.hint { font-size: 12px; color: var(--grey); margin-top: 6px; }

/* ---------- summary (Figma "Ready to add this item?") ---------- */
.facts { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin: 14px 0 18px; }
.fact { background: var(--snow); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px; min-height: 96px; display: flex; flex-direction: column; justify-content: center; }
.fact small { font-size: 12px; color: var(--grey); }
.fact b { font-size: 15px; font-weight: 600; margin-top: 2px; }
.fact.pink { border: 1.5px solid var(--blush); }
.fact select { border: 0; background: transparent; font-weight: 600; font-size: 15px; padding: 2px 24px 2px 0; margin-left: -2px; appearance: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='7' viewBox='0 0 13 7'%3E%3Cpath d='M1 1l5.5 5L12 1' fill='none' stroke='%231a1a1a' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 4px center; }
.included { background: var(--snow); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 18px 20px; margin-bottom: 18px; }
.included .cols { display: grid; gap: 14px 28px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.included h4 { margin: 0 0 6px; font-size: 12px; color: var(--grey); font-weight: 600; }
.included ul { margin: 0; padding-left: 16px; font-size: 13px; }
.included li { margin: 2px 0; }
.price-panel { background: var(--dark); color: #fff; border-radius: var(--radius-sm); padding: 22px 20px 20px; }
.price-panel small { font-size: 12px; color: #c9c9c9; }
.price-panel .big { font-size: clamp(34px, 6vw, 44px); font-weight: 500; letter-spacing: -.02em; line-height: 1.1; margin: 4px 0 4px; font-variant-numeric: tabular-nums; }
.price-panel .note { font-size: 12.5px; color: #c9c9c9; margin: 0 0 16px; }
.price-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.price-actions .spacer { flex: 1; }
details.breakdown { border-top: 1px solid #3a3a3a; margin-top: 4px; padding-top: 10px; }
details.breakdown summary { cursor: pointer; font-size: 13px; color: #e6e6e6; }
.bd { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 13px; font-variant-numeric: tabular-nums; }
.bd td { padding: 5px 0; border-bottom: 1px solid #333; }
.bd td:last-child { text-align: right; white-space: nowrap; padding-left: 12px; }
.bd tr.mod td { color: #fed430; }

/* sticky mobile price bar */
.pricebar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; background: var(--dark); color: #fff; padding: 10px var(--pad) calc(10px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 12px; transform: translateY(0); transition: transform .2s; }
.pricebar.away { transform: translateY(110%); }
.pricebar small { display: block; font-size: 11px; color: #bdbdbd; }
.pricebar b { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.pricebar .btn { margin-left: auto; }
@media (min-width: 1100px) { .pricebar { display: none; } }

/* jump nav */
.jump { display: flex; gap: 6px; overflow-x: auto; margin: -4px 0 18px; padding-bottom: 4px; scrollbar-width: none; }
.jump a { flex: none; font-size: 12.5px; text-decoration: none; border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px; color: var(--grey); background: var(--snow); }

/* ---------- login ---------- */
.login { min-height: 100svh; display: grid; place-items: center; padding: 24px; background: var(--mist); }
.login-card { width: min(440px, 100%); background: var(--snow); border: 1px solid var(--line); border-radius: 14px; padding: 32px 28px; }
.login-card .logo svg { width: 92px; }
.login-card .logo small { font-size: 12px; }
.login-card h1 { margin-top: 26px; }
.recent { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px; }

/* ---------- quotes list ---------- */
.head-row { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.head-row h1 { margin-bottom: 0; }
.head-row .btn { margin-left: auto; }
.filters { display: grid; gap: 10px; grid-template-columns: 2fr repeat(4, 1fr); margin-bottom: 14px; }
.filters .input { min-height: 42px; padding-top: 8px; padding-bottom: 8px; font-size: 14px; }
@media (max-width: 860px) { .filters { grid-template-columns: 1fr 1fr; } .filters .search { grid-column: 1 / -1; } }
.stats { display: flex; gap: 22px; flex-wrap: wrap; margin: 4px 0 16px; font-size: 13px; color: var(--grey); }
.stats b { color: var(--ink); font-weight: 600; }
.group-h { font-size: 13px; font-weight: 600; margin: 22px 0 8px; display: flex; justify-content: space-between; color: var(--grey); }
.qlist { display: grid; gap: 10px; }
.qrow { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; align-items: center; text-decoration: none; background: var(--snow); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.qrow:hover { border-color: #9aa3ad; }
.qrow .t { font-weight: 600; }
.qrow .m { font-size: 12.5px; color: var(--grey); display: flex; gap: 6px 12px; flex-wrap: wrap; align-items: center; }
.qrow .v { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.cats { display: flex; gap: 4px; flex-wrap: wrap; }
.status { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); background: var(--mist); text-transform: capitalize; }
.status.won { background: #e3f7f3; border-color: #9fe0d6; color: #0b6b60; }
.status.sent { background: #fff6cf; border-color: #f0d873; color: #6b5300; }
.status.lost { background: #fbe8e3; border-color: #f1c2b4; color: #8a2f12; }
.empty { text-align: center; padding: 48px 16px; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--grey); }
.banner { display: flex; gap: 10px; align-items: center; font-size: 13px; border: 1px solid #f3dc7a; background: #fffbea; border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; }

/* ---------- quote page ---------- */
.quote-grid { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
@media (max-width: 960px) { .quote-grid { grid-template-columns: 1fr; } }
.item { background: var(--snow); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin-bottom: 10px; }
.item .t { font-weight: 600; }
.item .d { font-size: 12.5px; color: var(--grey); }
.item .p { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.item .acts { grid-column: 1 / -1; display: flex; gap: 14px; margin-top: 6px; }
.totals { position: sticky; top: 84px; }
.totals .price-panel { padding: 20px; }
.trow { display: flex; justify-content: space-between; font-size: 14px; padding: 6px 0; border-bottom: 1px solid #333; font-variant-numeric: tabular-nums; }
.trow.grand { border: 0; font-size: 18px; font-weight: 600; padding-top: 12px; }
.trow input { width: 64px; background: #2a2a2a; border: 1px solid #444; color: #fff; border-radius: 6px; padding: 3px 6px; text-align: right; }
.similar a { display: block; text-decoration: none; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.similar a:last-child { border: 0; }
.cat-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.cat-grid .opt { min-height: 96px; }

/* ---------- insights ---------- */
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 20px; }
.kpi { background: var(--mist); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.kpi small { font-size: 12px; color: var(--grey); }
.kpi b { display: block; font-size: 26px; font-weight: 500; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.kpi span { font-size: 12px; color: var(--grey); }
.chart-card { background: var(--snow); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; }
.chart-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.chart-head h3 { margin: 0; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--grey); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(110px, 190px) 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.bar-row .lab { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { display: grid; gap: 2px; }
.bar { height: 9px; border-radius: 0 4px 4px 0; min-width: 2px; position: relative; }
.bar-row .val { font-size: 12px; color: var(--grey); font-variant-numeric: tabular-nums; text-align: right; min-width: 52px; }
.bar-hit { cursor: default; padding: 3px 0; }
.tip { position: fixed; z-index: 50; pointer-events: none; background: var(--dark); color: #fff; font-size: 12px; padding: 7px 10px; border-radius: 6px; line-height: 1.4; max-width: 240px; }
.zero-line { position: relative; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
table.data th { text-align: left; font-weight: 600; color: var(--grey); font-size: 12px; border-bottom: 1px solid var(--line); padding: 6px 8px 6px 0; }
table.data td { border-bottom: 1px solid var(--line-soft); padding: 7px 8px 7px 0; }
table.data td.n, table.data th.n { text-align: right; }
.table-wrap { overflow-x: auto; }

#toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%) translateY(20px); opacity: 0; background: var(--shadow-ink); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 14px; transition: .2s; z-index: 60; pointer-events: none; }
#toast.show { opacity: 1; transform: translateX(-50%); }

@media (max-width: 640px) {
  .tabs { position: fixed; bottom: 0; left: 0; right: 0; margin: 0; background: var(--snow); border-top: 1px solid var(--line-soft); justify-content: center; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); z-index: 22; }
  body.has-pricebar .tabs { display: none; }
  .tab { flex: 1; text-align: center; }
  .who .nm { display: none; }
  .who { padding: 3px; }
  .top-actions .btn { padding: 8px 14px; min-height: 38px; }
  .bar-row { grid-template-columns: 96px 1fr auto; }
  main { padding-top: 16px; }
}

/* ---------- print (quote → PDF) ---------- */
@media print {
  .top, .pricebar, .no-print, .tabs, #toast { display: none !important; }
  main { padding: 0; max-width: none; }
  .quote-grid { grid-template-columns: 1fr; }
  .price-panel { background: #fff; color: #000; border: 1px solid #000; }
  .trow { border-color: #ccc; }
  .print-only { display: block !important; }
}
.print-only { display: none; }
