:root {
  --ink: #1d2733;
  --muted: #5b6b7b;
  --line: #d9e0e8;
  --bg: #f4f6f8;
  --card: #ffffff;
  --accent: #b3541e;
  --accent-soft: #fdf0e6;
  --good: #157347;
  --bad: #b02a2a;
  --warn-bg: #fff7e0;
  --warn-line: #e3c566;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.45;
}
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.topbar { background: #22303d; color: #fff; padding: 22px 0 18px; }
.topbar h1 { margin: 0 0 4px; font-size: 26px; }
.tagline { margin: 0 0 6px; color: #cfd9e2; max-width: 720px; }
.privacy { margin: 0; font-size: 13px; color: #9fb4c6; }
main.wrap { padding-top: 18px; padding-bottom: 30px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px;
  margin-bottom: 16px;
}
.card h2 { margin-top: 0; font-size: 19px; }
.card h3 { font-size: 15px; margin-bottom: 8px; }
.hint { color: var(--muted); font-size: 13px; }
.dropzone {
  border: 2px dashed #a9b8c6;
  border-radius: 10px;
  padding: 26px;
  text-align: center;
  cursor: pointer;
  background: #fbfdfe;
}
.dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.btn {
  appearance: none; border: 1px solid var(--accent); background: var(--accent);
  color: #fff; border-radius: 8px; padding: 9px 14px; font-size: 14px; cursor: pointer;
}
.btn.secondary { background: #fff; color: var(--accent); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.row { display: flex; flex-wrap: wrap; margin-top: 12px; }
.row.gap { gap: 10px; }
.row.align-end { align-items: flex-end; }
.status { margin-top: 10px; font-size: 14px; }
.warnings {
  margin-top: 10px; background: var(--warn-bg); border: 1px solid var(--warn-line);
  border-radius: 8px; padding: 10px 12px; font-size: 13px; max-height: 180px; overflow: auto;
}
.demo-banner {
  margin-top: 10px; background: #eef3fb; border: 1px solid #b9cbe8;
  border-radius: 8px; padding: 10px 12px; font-size: 13px;
}
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 6px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px;
}
.stat .label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.stat .value { font-size: 22px; font-weight: 650; margin-top: 2px; }
.stat .sub { font-size: 12px; color: var(--muted); }
.recon { font-size: 13px; color: var(--muted); margin: 4px 2px 14px; }
.recon.ok { color: var(--good); }
.recon.bad { color: var(--bad); }
.recon.warn { color: #9a6200; }
.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0 0 14px; }
.step { background: #f4f1e9; border: 1px solid var(--line, #ddd8cc); border-radius: 12px; padding: 10px 12px; font-size: 13.5px; }
.step strong { display: block; margin-bottom: 2px; }
.file-label { cursor: pointer; display: inline-block; }
.exp-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: end; margin-bottom: 10px; }
.exp-form label { display: flex; flex-direction: column; gap: 5px; font-weight: 650; font-size: 14px; }
.exp-form input, .exp-form select { padding: 9px 10px; border: 1px solid #c9c3b6; border-radius: 10px; font: inherit; }
.exp-form .checkline { flex-direction: row; align-items: center; gap: 8px; padding-bottom: 10px; }
.exp-item { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line, #ddd8cc); border-radius: 12px; margin-bottom: 8px; background: #fffefb; }
.exp-item small { display: block; color: var(--muted); }
@media (max-width: 640px) { .steps, .exp-form { grid-template-columns: 1fr; } }
@media print {
  #upload-card, .tabs, #export-row, #panel-products, #panel-orders, #panel-pod, #panel-expenses, #panel-fees, .foot, .topbar .privacy { display: none !important; }
  #panel-pnl, #panel-tax, #panel-taxpack { display: block !important; }
  .card { box-shadow: none; break-inside: avoid; }
  body { background: #fff; }
}
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 12px; }
.tab {
  border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 8px 14px; font-size: 14px; cursor: pointer;
}
.tab.active { background: #22303d; color: #fff; border-color: #22303d; }
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; white-space: normal; min-width: 220px; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--accent); }
tfoot td { font-weight: 650; border-top: 2px solid var(--ink); border-bottom: none; }
.num-neg { color: var(--bad); }
.num-pos { color: var(--good); }
td input[type="number"], td input[type="text"] {
  width: 84px; padding: 5px 7px; border: 1px solid var(--line); border-radius: 6px; text-align: right; font-size: 14px;
}
td.maker-cost { white-space: normal; }
td.maker-cost label {
  display: flex; flex-direction: row; align-items: center; justify-content: flex-end; gap: 6px;
  font-size: 12px; margin-bottom: 4px;
}
td.maker-cost .maker-sum { display: block; font-size: 12px; color: var(--muted); }
label { font-size: 13px; color: var(--muted); display: inline-flex; flex-direction: column; gap: 4px; }
label input, label select {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; color: var(--ink);
}
.order {
  border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; background: #fff;
}
.order-head {
  width: 100%; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: baseline;
  background: none; border: none; padding: 12px 14px; cursor: pointer; text-align: left; font-size: 14px; color: var(--ink);
}
.order-head .oid { font-weight: 650; }
.order-head .kept { margin-left: auto; font-weight: 650; }
.order-body { border-top: 1px solid var(--line); padding: 12px 14px; }
.order-body table { font-size: 13.5px; }
.order-body td:first-child { min-width: 200px; }
.flag-ok { color: var(--good); font-size: 13px; }
.flag-off { color: var(--bad); font-size: 13px; }
/* POD True-Profit (v1d): flagged price-drift rows */
.drift-flag td { background: var(--accent-soft); }
.tax-disclaimer {
  background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: 8px;
  padding: 12px 14px; margin-bottom: 14px; font-size: 14px;
}
.big-setaside { font-size: 30px; font-weight: 700; margin: 6px 0 2px; }
.fee-ref td:first-child { min-width: 240px; }
.foot { color: var(--muted); font-size: 12.5px; text-align: center; margin-top: 10px; }
@media (max-width: 640px) {
  th:first-child, td:first-child { min-width: 150px; }
  .topbar h1 { font-size: 22px; }
}
