/* FBA Fee Calculator - kraft-carton palette: warm paper, carton-brown accent, tabular numbers. */
:root {
  --bg: #f6f2ec; --paper: #ffffff; --ink: #221a12; --muted: #6b5d4f; --line: #e0d6c8; --line2: #efe8de;
  --accent: #9a4a12; --accent-ink: #ffffff; --accent-soft: #f6e5d4; --calc: #faf5ee; --calc-ink: #3a2b1c;
  --warn: #9a5b00; --warn-bg: #fff3dc; --bad: #b3261e; --bad-bg: #fde8e6; --good: #11643f; --good-bg: #e1f3e8; --info-bg: #e9eff6; --info: #2b4c6f;
  --focus: #1d7dd8; --shadow: 0 1px 2px rgba(20, 33, 27, .06), 0 4px 18px rgba(20, 33, 27, .05);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #15110d; --paper: #1e1812; --ink: #efe6db; --muted: #b0a08e; --line: #3a3026; --line2: #2a221a;
  --accent: #f0a565; --accent-ink: #1a0f05; --accent-soft: #3a2614; --calc: #241d16; --calc-ink: #e6d8c6;
  --warn: #f2b453; --warn-bg: #33270f; --bad: #ff8a80; --bad-bg: #3a1c1a; --good: #6fdca5; --good-bg: #133022; --info-bg: #17263a; --info: #9cc3ea;
  --focus: #5aa9ff; --shadow: none;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; -webkit-text-size-adjust: 100%; }
a { color: var(--accent); }
.hidden { display: none !important; }
.small { font-size: .875rem; }
.muted { color: var(--muted); }
code { font-family: var(--mono); font-size: .9em; }

.top { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--paper); position: sticky; top: 0; z-index: 5; }
.back { color: var(--muted); text-decoration: none; font-size: .9rem; white-space: nowrap; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; }
.session { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.credits { font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; }

main { max-width: 1180px; margin: 0 auto; padding: 0 16px 40px; }
.hero { padding: 26px 0 14px; }
h1 { font-size: 2rem; line-height: 1.15; margin: 0 0 8px; letter-spacing: -.01em; }
.lede { margin: 0 0 12px; color: var(--muted); max-width: 46rem; }
.trust { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; }
.trust li { font-size: .82rem; padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); }

.card { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin: 14px 0; box-shadow: var(--shadow); }
.h2 { font-size: 1.1rem; margin: 18px 0 8px; }
h3 { font-size: 1rem; margin: 14px 0 4px; }

.btn { font: inherit; font-size: .95rem; min-height: 40px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); cursor: pointer; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.solid { background: var(--ink); color: var(--paper); border-color: var(--ink); font-weight: 600; }
.btn.solid:disabled { opacity: .45; cursor: not-allowed; }
.btn.quiet { background: transparent; }
.btn.small { min-height: 34px; padding: 5px 10px; font-size: .85rem; }
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible, a:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.xtoggle { margin-left: auto; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: .9rem; min-height: 40px; }
.check input { width: 18px; height: 18px; }
.samples { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 10px 0 4px; }
.sample { font: inherit; font-size: .88rem; min-height: 36px; padding: 4px 12px; border-radius: 999px; border: 1px dashed var(--accent); background: var(--accent-soft); color: var(--ink); cursor: pointer; }
.sample[aria-pressed="true"] { border-style: solid; font-weight: 600; }
.note { margin: 8px 0; padding: 8px 12px; border-radius: 8px; background: var(--info-bg); color: var(--info); font-size: .92rem; }
.note.bad { background: var(--warn-bg); color: var(--warn); }
.hint { margin: 8px 0 0; }

/* results */
.tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.tile { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--calc); }
.tile .tl { display: block; font-size: .75rem; color: var(--muted); }
.tile b { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.sumline { margin: 10px 0; }
.targets { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin: 6px 0 12px; }
.opt { display: flex; flex-direction: column; gap: 3px; }
.lab { font-size: .8rem; color: var(--muted); }
.opt input, .opt select, #aiNote { font: inherit; font-size: .95rem; min-height: 40px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink); }
.opt input { width: 11rem; }
.opt input.wrong { border-color: var(--bad); background: var(--bad-bg); }
#aiNote { width: 100%; }
.more summary { cursor: pointer; min-height: 40px; display: flex; align-items: center; color: var(--muted); font-size: .9rem; }
.more[open] { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.exports { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 4px; }
.checks, .flags { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.checks li, .flags li { padding: 8px 12px; border-radius: 8px; border-left: 4px solid var(--line); background: var(--line2); font-size: .93rem; }
.checks li.ok, .flags li.ok { border-left-color: var(--good); background: var(--good-bg); }
.checks li.warn, .flags li.warn { border-left-color: var(--warn); background: var(--warn-bg); }
.checks li.info { border-left-color: var(--info); background: var(--info-bg); }

/* AI review */
.aibox summary { cursor: pointer; min-height: 40px; display: flex; align-items: center; gap: 8px; }
.ai-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 6px; }
.progress { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 8px 0; }
.ph { display: flex; justify-content: space-between; }
.steps { margin: 6px 0 0; padding-left: 20px; font-size: .9rem; }
.steps li { color: var(--muted); }
.steps li.now { color: var(--ink); font-weight: 600; }
.steps li.done { color: var(--good); }
.steps li.fail { color: var(--bad); font-weight: 600; }
.verdict-line { margin: 10px 0 4px; }
.verdict { display: inline-block; font-weight: 700; padding: 3px 10px; border-radius: 6px; background: var(--line2); }
.verdict.v-worth-selling { background: var(--good-bg); color: var(--good); }
.verdict.v-thin-margin { background: var(--warn-bg); color: var(--warn); }
.verdict.v-losing-money, .verdict.v-missing-data { background: var(--bad-bg); color: var(--bad); }
.proj { color: var(--muted); }
.fhm { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 8px; }
.plain { margin: 0; padding-left: 18px; font-size: .92rem; }
.plain li { margin: 3px 0; }

.saved { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 6px; }
.hist { font: inherit; text-align: left; width: 100%; min-height: 40px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink); cursor: pointer; }
.about { max-width: 52rem; margin-top: 26px; }
.foot { max-width: 1180px; margin: 0 auto; padding: 14px 16px 40px; border-top: 1px solid var(--line); font-size: .85rem; color: var(--muted); }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 8px 14px; border-radius: 8px; font-size: .9rem; z-index: 20; max-width: calc(100% - 32px); }

@media (max-width: 760px) {
  h1 { font-size: 1.55rem; }
  .hero { padding-top: 16px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fhm { grid-template-columns: 1fr; }
  .xtoggle { margin-left: 0; }
    .back-t { display: none; }
  .opt input { width: 9.5rem; }
}
@media print {
  .top, .samples, .form, .aibox .ai-row, #historyCard, .about, .foot, .exports, #ss-overlay, .toast { display: none !important; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; border: 0; padding: 0; }
}

/* the form */
.form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 10px; }
.fld { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.fld input, .fld select { font: inherit; font-size: 1rem; min-height: 44px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink); width: 100%; }
.fld input { font-variant-numeric: tabular-nums; }
.fld input.wrong { border-color: var(--bad); background: var(--bad-bg); }
.dims { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.form .more { grid-column: 1 / -1; display: block; }
.moregrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: end; padding: 4px 0 6px; }
.go { grid-column: 1 / -1; }
.go .btn { min-width: 12rem; }
.tile b.good { color: var(--good); }
.tile b.poor, .tile b.miss { color: var(--bad); }
.tile b.warnv { color: var(--warn); }
.tile b.miss { font-size: 1rem; }

/* breakdown */
.bd { width: 100%; max-width: 46rem; border-collapse: collapse; font-variant-numeric: tabular-nums; margin: 6px 0 10px; }
.bd th, .bd td { padding: 7px 8px; border-bottom: 1px solid var(--line2); text-align: left; font-weight: 400; vertical-align: top; }
.bd td.num { text-align: right; font-family: var(--mono); font-size: .92rem; white-space: nowrap; }
.bd td.num.neg { color: var(--muted); }
.bd tr.total th, .bd tr.total td { border-top: 2px solid var(--ink); border-bottom: 0; font-weight: 700; color: var(--ink); }
.bd td.nt { width: 45%; }

/* AI levers */
.levers { margin: 8px 0 10px; padding-left: 22px; display: grid; gap: 8px; }
.levers li { padding-left: 2px; }
.kind { display: inline-block; font-size: .72rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); vertical-align: 1px; }
.save { color: var(--good); font-weight: 600; font-size: .9rem; }
.why { display: block; font-size: .9rem; color: var(--muted); }
.why.chk { color: var(--info); }

@media (max-width: 760px) {
  .form { grid-template-columns: 1fr 1fr; }
  .form .fld.wide { grid-column: 1 / -1; }
  .dims { grid-template-columns: 1fr 1fr; }
  .moregrid { grid-template-columns: 1fr 1fr; }
  .go .btn { width: 100%; }
  .bd td.nt { display: none; }
}
.start, .result { scroll-margin-top: 64px; }
.u-len, .u-wt { white-space: nowrap; }
