/* The Flatpay brand, as Ahmad's other Flatpay tools use it (JARVIS brand.css, AC Call Tracker, Offer Check, the project tracker):
   black top bar with the wordmark, white cards on the #f1f2f1 page, Arial Black headings, Calibri text, mint accents. */
:root {
  --ink: #000; --paper: #fff; --grey: #f1f2f1; --line: #e4e6e4; --muted: #6e6e6e; --faint: #9a9a9a;
  --mint: #92f8c2; --mint-soft: #dbf9eb; --peach: #f8b185; --pink: #f8b5d3; --cyan: #9beef8; --peri: #afbdfc;
  --peri-soft: #e7ebfe; --peach-soft: #fde6d6;
  --good: #1d7a4a; --warn: #c2382f; --warn-soft: #fde9e7; --r: 14px;
  --head: "Arial Black", "Arial Bold", Arial, sans-serif;
  --body: Calibri, Carlito, "Segoe UI", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; }
body { background: var(--grey); color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.45; -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom); }
h1, h2, h3 { font-family: var(--head); letter-spacing: -.01em; margin: 0; line-height: 1.15; }
p { margin: 0; }
a { color: var(--ink); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.c-perisoft { background: var(--peri-soft); } .c-peachsoft { background: var(--peach-soft); }

/* ---------------------------------------------------------------- the black top bar */
.wrap { max-width: 1180px; margin: 0 auto; padding-inline: 16px; }
.topbar { background: var(--ink); color: var(--paper); }
.toprow { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; min-height: 60px; padding-block: 10px; }
.brand { display: flex; align-items: center; gap: 12px; margin: 0; }
.logo { display: inline-block; width: 92px; color: var(--paper); line-height: 0; }
.logo svg { width: 100%; height: auto; }
.name { font-family: var(--head); font-size: 15px; color: var(--mint); text-transform: uppercase; letter-spacing: .06em; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.tabs button { color: var(--paper); background: transparent; border: 1px solid #3a3a3a; border-radius: 20px; padding: 6px 14px; font-weight: 700; font-size: 14px; }
.tabs button[aria-selected="true"] { background: var(--mint); color: var(--ink); border-color: var(--mint); }
.out { color: #bbb; font-size: 14px; }

main { padding-block: 0 48px; }
#matrix { padding-top: 16px; }

/* ---------------------------------------------------------------- the running total: a black card that stays in view */
.dock { position: sticky; top: 0; z-index: 4; background: var(--grey); padding-block: 16px 12px; }
.total { background: var(--ink); color: var(--paper); border-radius: var(--r); padding: 14px 18px; }
.kick { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--mint); }
.big { font-family: var(--head); font-size: 40px; line-height: 1.1; font-variant-numeric: tabular-nums; margin-top: 2px; }
.sub { color: #bebebe; font-size: 14px; }

/* ---------------------------------------------------------------- cards */
.grid { display: grid; gap: 12px; }
.inputs, .results { display: grid; gap: 12px; align-content: start; min-width: 0; }
.card { background: var(--paper); border-radius: var(--r); padding: 18px 20px; min-width: 0; }
.card h2 { font-size: 18px; margin: 0 0 10px; display: flex; align-items: center; gap: 9px; }
.card.next { background: var(--mint-soft); }
.card.next ul { margin: 0; padding-left: 20px; }
.card.next li { margin: 6px 0; }
.hint { margin: 8px 0 0; font-size: 13.5px; color: var(--muted); }
.hint.lead { margin: 0 0 12px; }
.small { font-size: 13px; color: var(--muted); }

/* ---------------------------------------------------------------- inputs */
.field { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.field .lab { font-weight: 700; flex: 1; min-width: 0; }
.ctr { display: flex; align-items: center; gap: 6px; flex: none; }
.ctr input { width: 60px; height: 44px; text-align: center; border: 1px solid var(--line); border-radius: 11px; background: var(--paper); font-family: var(--head); font-size: 18px; }
.st { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); font-family: var(--head); font-size: 20px; line-height: 1; padding: 0; }
.st[aria-label^="One more"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.st:active { transform: translateY(1px); }
.money { display: grid; gap: 6px; padding: 10px 0; border-top: 1px solid var(--line); }
.money span { font-weight: 700; }
.money input, .tpvrow input { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 11px; background: var(--paper); padding: 0 13px; font-size: 17px; font-weight: 700; }
.check { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); font-weight: 700; }
.card h2 + .field, .card h2 + .money, .card h2 + .check { border-top: 0; padding-top: 0; }
.check input { width: 22px; height: 22px; accent-color: var(--ink); flex: none; margin: 0; }

.seg { display: flex; gap: 4px; background: var(--grey); padding: 4px; border-radius: 12px; }
.seg button { flex: 1; min-height: 42px; border: 0; background: transparent; border-radius: 9px; font-weight: 700; color: var(--muted); padding: 6px 4px; white-space: nowrap; }
.seg button[aria-checked="true"] { background: var(--paper); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.seg.wrap { flex-wrap: wrap; }
.seg.wrap button { flex: 1 1 30%; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.seg button small { font-weight: 400; font-size: 12.5px; }

.cardhead { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.card .cardhead h2 { margin: 0; }
.count { color: var(--muted); font-weight: 700; font-size: 14px; white-space: nowrap; }
.picker { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; }
.picker select { min-width: 0; width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 11px; background: var(--paper); padding: 0 8px; font-size: 16px; font-weight: 700; }
.picker select:has(option[value=""]:checked) { color: var(--muted); font-weight: 400; }
.addbtn { min-height: 44px; border: 0; border-radius: 11px; background: var(--ink); color: var(--paper); font-weight: 700; padding: 0 14px; white-space: nowrap; }
.addbtn:disabled { background: var(--grey); color: var(--faint); cursor: default; }
.dlist { margin: 6px 0 4px; }
.dl { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.dl:first-child { border-top: 0; }
.dk { flex: 1; min-width: 0; }
.dk b { font-family: var(--head); }
.dv { font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.empty { color: var(--muted); font-size: 14px; padding: 10px 0 2px; }
.ctr.sm .st { width: 36px; height: 36px; font-size: 17px; border-radius: 10px; }
.ctr.sm input { width: 46px; height: 36px; font-size: 16px; border-radius: 10px; }
details.more summary { list-style: none; cursor: pointer; display: flex; align-items: baseline; gap: 4px 10px; flex-wrap: wrap; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary h2 { margin: 0; }
details.more summary span { color: var(--muted); font-size: 14px; }
details.more summary::after { content: "Show"; margin-left: auto; font-weight: 700; font-size: 14px; text-decoration: underline; }
details.more[open] summary::after { content: "Hide"; }
details.more[open] summary { margin-bottom: 6px; }
.subhead { font-weight: 700; padding-top: 10px; border-top: 1px solid var(--line); }
.add, .rm { font-weight: 700; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 0 16px; min-height: 44px; }
.add { margin: 8px 0 4px; }
.tpvbox { margin-top: 8px; }
.tpvrow { display: flex; align-items: center; gap: 8px; }
.tpvrow > span { font-weight: 700; }
.tpvout { margin: 6px 0 0 18px; font-size: 14px; font-weight: 700; color: var(--good); }
.tpvout:empty { display: none; }

/* ---------------------------------------------------------------- results */
.lines { width: 100%; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
.lines td { padding: 9px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.lines .num { text-align: right; white-space: nowrap; font-weight: 700; }
.lines tr.neg .num { color: var(--warn); }
.lines tfoot td { border-bottom: 0; padding-top: 12px; font-family: var(--head); font-size: 17px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .18); }

.target { margin: 6px 0 14px; }
.tl { display: flex; justify-content: space-between; font-weight: 700; margin-bottom: 6px; }
.tl b { font-family: var(--head); font-variant-numeric: tabular-nums; }
.track { height: 8px; border-radius: 6px; background: var(--grey); overflow: hidden; }
.track i { display: block; height: 100%; background: var(--peach); border-radius: 6px; }
.track i.done { background: var(--mint); }

.btn { width: 100%; min-height: 48px; border: 1px solid var(--ink); background: var(--ink); color: var(--paper); border-radius: 12px; font-weight: 700; font-size: 16px; }
.btn.light { background: var(--paper); color: var(--ink); border-color: var(--line); }

/* ---------------------------------------------------------------- the matrix tab */
.mscroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: 12px; margin: 0 0 12px; }
.mx { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 15px; font-variant-numeric: tabular-nums; }
.mx th, .mx td { padding: 7px 10px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); background: var(--paper); }
.mx thead th { font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.mx thead .cap { text-align: left; border-bottom: 0; color: var(--ink); }
.mx th:first-child { position: sticky; left: 0; z-index: 1; text-align: left; border-right: 1px solid var(--line); }
.mx tbody th { font-family: var(--head); font-size: 14px; }
.mx tr.posfloor > * { background: var(--peri-soft); }
.mx tr.termfloor > * { background: var(--peach-soft); }
.mx tr.termonly > * { color: var(--muted); }
.mx tbody tr:last-child > * { border-bottom: 0; }
.legend { display: grid; gap: 6px; font-size: 14px; margin: 0 0 10px; }
.legend .sw { width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; }

@media (min-width: 900px) {
  .grid { grid-template-columns: 1fr 1fr; align-items: start; }
  .total { display: grid; grid-template-columns: auto 1fr; column-gap: 18px; align-items: baseline; }
  .total .kick { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .toprow { padding-block: 10px 12px; }
  .out { margin-left: auto; }
  .tabs { order: 3; flex-basis: 100%; margin-left: 0; }
  .hide-sm { display: none; }
  .card { padding: 16px; }
  .seg button { font-size: 14.5px; }
}
@media (max-width: 360px) {
  .ctr input { width: 50px; }
  .st { width: 40px; }
  .big { font-size: 34px; }
}
