/* CardBuddy's look: an achromatic ledger. The chrome is ink on a blue-grey ground; the accent blue appears once per
   screen, on the figure the screen exists to show (the extra a card earned, the card that wins a category). */
@font-face { font-family: 'Inter Tight'; font-weight: 400; font-display: swap; src: url(/fonts/inter-tight-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Inter Tight'; font-weight: 500; font-display: swap; src: url(/fonts/inter-tight-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'Inter Tight'; font-weight: 600; font-display: swap; src: url(/fonts/inter-tight-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Sora'; font-weight: 700; font-display: swap; src: url(/fonts/sora-latin-700-normal.woff2) format('woff2'); }

:root {
  --ground: #f2f4f7; --surface: #fff; --raised: #f6f7f9; --border: #e3e7ed; --rule: #edf0f4; --control: #cfd5de;
  --text: #0c1322; --muted: #5d6879; --faint: #8a94a3; --accent: #0f1626; --data: #1a5fdb; --data-soft: #dbe6fa; --navy: #0a2366;
  --positive: #1f7a3a; --negative: #b42328; --warning: #8a4b0b;
  --pill-pos: #e3f6e8; --pill-pos-ink: #0f4a22; --pill-neg: #fdecea; --pill-neg-ink: #7d1a1d;
  --pill-warn: #fdf3e2; --pill-warn-ink: #7a420a; --pill-neutral: #edf0f4; --pill-neutral-ink: #3a4352;
  --r-card: 8px; --r-control: 6px;
  --col: 1120px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; } /* the same width whether or not a page scrolls, so the menu never shifts sideways */
body { margin: 0; background: var(--ground); color: var(--text); font: 15px/1.5 'Inter Tight', system-ui, -apple-system, 'Segoe UI', sans-serif; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--data); outline-offset: 2px; border-radius: 3px; }
.num, td.r, .kpi b, .amount { font-variant-numeric: tabular-nums; }

/* Top bar: on the ground, no fill; the mark sits on the column's left edge. */
.top { height: 52px; border-bottom: 1px solid var(--border); }
.top .in { max-width: var(--col); height: 100%; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; gap: 28px; }
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; white-space: nowrap; }
.brand img { width: 25px; height: 20px; display: block; }
.brand b { font: 700 15.5px/1 'Sora', 'Inter Tight', sans-serif; letter-spacing: -0.02em; }

.top nav { display: flex; gap: 4px; flex: 1; }
.top nav a { text-decoration: none; color: var(--muted); font-weight: 500; font-size: 14px; padding: 5px 9px; border: 1px solid transparent; border-radius: var(--r-control); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.top nav a:hover { color: var(--text); background: rgba(12, 19, 34, .04); }
.top nav a[aria-current] { color: var(--text); background: var(--surface); border-color: var(--border); }
.count { font-size: 11.5px; font-weight: 600; line-height: 18px; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #fff; text-align: center; }
.count:empty { display: none; }
.env { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.env i { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }

/* Page */
main { max-width: var(--col); margin: 0 auto; padding: 52px 24px 72px; min-width: 0; }
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px 24px; margin-bottom: 36px; flex-wrap: wrap; }
h1 { font: 700 27px/1.15 'Sora', 'Inter Tight', sans-serif; letter-spacing: -0.03em; margin: 0 0 10px; }
.sub { color: var(--muted); margin: 0; max-width: 64ch; font-size: 15.5px; }
h2 { font-size: 15px; font-weight: 600; margin: 0; letter-spacing: -0.005em; }
.grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 28px; align-items: start; }
.stack { display: grid; gap: 28px; min-width: 0; }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); min-width: 0; overflow: hidden; }
.panel > .ph { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 20px 24px; border-bottom: 1px solid var(--rule); }
.panel > .ph p { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }
.panel > .ph .meta { color: var(--muted); font-size: 13px; white-space: nowrap; }
.panel > .pb { padding: 22px 24px; }
.scroll { overflow-x: auto; }

/* KPIs: type, not tiles. One row divided by rules; the lead figure takes the data hue. */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpis.n3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi { padding: 22px 24px; border-left: 1px solid var(--rule); min-width: 0; }
.kpi:first-child { border-left: 0; }
.kpi span { display: block; color: var(--muted); font-size: 13px; }
.kpi b { display: block; font-size: 26px; line-height: 1.2; font-weight: 600; letter-spacing: -0.02em; margin-top: 4px; }
.kpi small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.kpi.lead b { color: var(--data); font: 700 34px/1.15 'Sora', 'Inter Tight', sans-serif; letter-spacing: -0.035em; }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12.5px; padding: 11px 24px; border-bottom: 1px solid var(--rule); background: var(--raised); white-space: nowrap; }
td { padding: 16px 24px; border-bottom: 1px solid var(--rule); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
td.r, th.r { text-align: right; }
td small, .muted { color: var(--muted); }
td small { font-size: 12.5px; }
td b { font-weight: 600; }
td.empty { color: var(--muted); text-align: center; padding: 36px 20px; }

/* Pills: pale, sentence case */
.pill { display: inline-block; font-size: 12px; font-weight: 500; line-height: 20px; padding: 0 8px; border-radius: 10px; white-space: nowrap; background: var(--pill-neutral); color: var(--pill-neutral-ink); }
.pill.pos { background: var(--pill-pos); color: var(--pill-pos-ink); }
.pill.neg { background: var(--pill-neg); color: var(--pill-neg-ink); }
.pill.warn { background: var(--pill-warn); color: var(--pill-warn-ink); }

/* Controls */
button { font: inherit; font-size: 14px; font-weight: 500; height: 36px; padding: 0 14px; border-radius: var(--r-control); border: 1px solid var(--accent); background: var(--accent); color: #fff; cursor: pointer; white-space: nowrap; }
button:hover { background: #262e3d; }
button.ghost { background: var(--surface); color: var(--text); border-color: var(--control); }
button.ghost:hover { background: var(--raised); }
button.link { background: none; border: 0; color: var(--muted); height: 32px; padding: 0 8px; }
button.link:hover { color: var(--text); background: none; text-decoration: underline; }
button:disabled { opacity: .45; cursor: default; }
label { display: block; font-weight: 500; font-size: 13.5px; margin: 14px 0 6px; }
label:first-child { margin-top: 0; }
select, input[type=number], input[type=text], input[type=password] { width: 100%; font: inherit; height: 40px; padding: 0 12px; border: 1px solid var(--control); border-radius: var(--r-control); background: #fff; color: var(--text); }
select:focus, input:focus { outline: 2px solid var(--data); outline-offset: -1px; }
.check { display: flex; gap: 9px; align-items: flex-start; font-weight: 400; font-size: 13.5px; color: var(--muted); margin-top: 16px; }
.check input { margin: 3px 0 0; }
.field { min-height: 52px; margin: 0 -4px; } /* PayPal's iframes carry their own 4px inset */
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.msg { min-height: 1.5em; font-size: 13.5px; font-weight: 500; margin: 10px 0 0; }
.msg.err { color: var(--negative); }
.note { font-size: 13px; color: var(--muted); margin: 0; }
.hint { font-size: 13px; color: var(--muted); background: var(--raised); border: 1px solid var(--rule); border-radius: var(--r-control); padding: 10px 12px; margin: 0 0 16px; }

/* Approvals */
.w40 { width: 40%; }
.pad { padding: 0 20px; }
.pad:empty { display: none; }
.held { padding: 22px 24px; border-bottom: 1px solid var(--rule); display: grid; gap: 12px; }
.held:last-child { border-bottom: 0; }
.held-main { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 16px; align-items: baseline; }
.held-main .amount { font: 700 24px/1.2 'Sora', 'Inter Tight', sans-serif; letter-spacing: -0.03em; }
.held-main small, .held-foot small { display: block; color: var(--muted); font-size: 13px; }
.held-foot small b { color: var(--text); font-weight: 600; }
.why { list-style: none; margin: 0; padding: 0 0 0 136px; display: grid; gap: 6px; font-size: 13.5px; }
.why li { padding-left: 12px; border-left: 2px solid #e0a34a; color: var(--text); }
.held-foot { padding-left: 136px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.acts { display: flex; gap: 8px; align-items: center; }
.empty-state { padding: 52px 24px; text-align: center; }
.empty-state b { display: block; font-weight: 600; }
.empty-state p { color: var(--muted); max-width: 46ch; margin: 6px auto 0; font-size: 14px; }
.month { padding-bottom: 18px; margin-bottom: 4px; border-bottom: 1px solid var(--rule); }
.month-h { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; color: var(--muted); }
.month-h b { color: var(--text); font-weight: 600; }
.meter { height: 6px; background: var(--rule); border-radius: 3px; margin: 10px 0 8px; overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 3px; }
.month small { color: var(--muted); font-size: 12.5px; }
.money { position: relative; }
.money span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.money input { padding-left: 25px; }
fieldset.cats { border: 0; padding: 0; margin: 0; min-width: 0; }
.rules { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 20px 40px; }
@media (max-width: 760px) { .rules { grid-template-columns: 1fr; } }
fieldset.cats legend { font-weight: 500; font-size: 13.5px; padding: 0; }
#cats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 16px; }
@media (max-width: 1000px) { #cats { grid-template-columns: 1fr 1fr; } }
#cats .check { color: var(--text); margin-top: 9px; }
.save { margin: 20px 0 0; }

/* Receipts */
.order { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; letter-spacing: .01em; }
.fell { display: block; color: var(--warning); font-size: 12.5px; margin-top: 2px; }
td .pill { margin-left: 6px; }
.extra { color: var(--data); font-weight: 600; }

/* Simulation report */
.cmp td { vertical-align: middle; }
.pair { display: grid; gap: 4px; min-width: 120px; }
.pair i { display: block; height: 7px; border-radius: 3px; min-width: 2px; }
.pair .without { background: var(--control); }
.pair .with { background: var(--data); }
.legend2 { display: flex; gap: 16px; font-size: 12.5px; color: var(--muted); }
.legend2 span { display: flex; align-items: center; gap: 6px; }
.legend2 i { width: 14px; height: 7px; border-radius: 3px; background: var(--control); }
.legend2 i.with { background: var(--data); }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.facts div { padding: 16px 20px; border-left: 1px solid var(--rule); font-size: 13.5px; color: var(--muted); }
.facts div:first-child { border-left: 0; }
.facts b { display: block; color: var(--text); font-weight: 600; margin-bottom: 2px; }
.callout { margin: 0; padding: 14px 20px; border-top: 1px solid var(--rule); font-size: 13.5px; color: var(--muted); background: var(--raised); }
.callout b { color: var(--text); font-weight: 600; }

/* Trust line at the foot of every page */
.foot { max-width: var(--col); margin: 0 auto; padding: 0 24px 40px; color: var(--muted); font-size: 12.5px; display: flex; gap: 6px 22px; flex-wrap: wrap; }
.foot span { display: flex; gap: 7px; align-items: center; }
.foot svg { width: 13px; height: 13px; flex: none; stroke: var(--faint); fill: none; stroke-width: 1.6; }

/* Loading */
.skel { display: block; height: 12px; border-radius: 4px; background: var(--rule); animation: sk 1.1s ease-in-out infinite alternate; }
@keyframes sk { to { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .skel { animation: none; } }

@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
  .env { display: none; }
}
@media (max-width: 640px) {
  .top { height: auto; }
  .top .in { flex-wrap: wrap; gap: 6px 12px; padding: 12px 16px 8px; }
  .top nav { flex: 1 0 100%; margin: 0 -10px; overflow-x: auto; scrollbar-width: none; }
  .top nav a { padding: 6px 9px; }
  main { padding: 24px 16px 48px; }
  .foot { padding: 0 16px 32px; }
  h1 { font-size: 24px; }
  .kpis, .kpis.n3 { grid-template-columns: 1fr 1fr; }
  .kpi, .kpi:first-child { border-left: 0; border-top: 1px solid var(--rule); }
  .kpi.lead { grid-column: 1 / -1; border-top: 0; }
  .kpi.lead ~ .kpi:nth-child(odd), .kpis:not(:has(.lead)) .kpi:nth-child(even) { border-left: 1px solid var(--rule); }
  .kpis:not(:has(.lead)) .kpi:nth-child(-n+2) { border-top: 0; }
  th, td { padding-left: 14px; padding-right: 14px; }
  .panel > .ph, .panel > .pb { padding-left: 16px; padding-right: 16px; }
  .row2 { grid-template-columns: 1fr; }
  .held-main { grid-template-columns: 1fr; gap: 2px; }
  .why, .held-foot { padding-left: 0; }
  .held-foot .acts { width: 100%; }
  .held-foot .acts button { flex: 1; }
  .facts { grid-template-columns: 1fr; }
  .facts div { border-left: 0; border-top: 1px solid var(--rule); }
  .facts div:first-child { border-top: 0; }
  .legend2 { display: none; }
}

/* Totals sit on the page as a ledger line, not in a box */
.panel.bare { background: none; border: 0; border-top: 1px solid var(--text); border-bottom: 1px solid var(--border); border-radius: 0; }
.panel.bare .kpi { padding-left: 0; padding-right: 24px; }
.panel.bare .kpi + .kpi { padding-left: 24px; }

/* Drawn card faces: each card in its own colours, no issuer artwork */
.face { width: 46px; height: 29px; border-radius: 4px; position: relative; background: var(--face, #1c2333); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); overflow: hidden; } /* taste-skill-ignore: a hairline that draws the card's edge */
.face::before { content: ''; position: absolute; left: 6px; top: 9px; width: 9px; height: 7px; border-radius: 1.5px; background: var(--chip, #d9c48a); }
.face::after { content: attr(data-net); position: absolute; right: 5px; bottom: 3px; font: 700 6.5px/1 'Inter Tight', sans-serif; letter-spacing: .04em; color: var(--net, rgba(255, 255, 255, .85)); }
.face.sm { width: 22px; height: 14px; border-radius: 2.5px; display: inline-block; vertical-align: -2px; margin-right: 8px; }
.face.sm::before { left: 3px; top: 4px; width: 5px; height: 4px; }
.face.sm::after { content: none; }
@media (max-width: 640px) { .panel.bare .kpi, .panel.bare .kpi + .kpi { padding: 14px 12px 14px 0; } .panel.bare .kpi.lead ~ .kpi:nth-child(odd) { padding-left: 12px; } }

/* Moving between pages: the top bar stays put and only the page below it cross-fades. */
@view-transition { navigation: auto; }
.top { view-transition-name: topbar; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 160ms; animation-timing-function: ease-out; }
::view-transition-group(topbar) { animation: none; }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }
.wait main, .wait .foot { opacity: 0; }
main, .foot { transition: opacity 140ms ease-out; }
@media (prefers-reduced-motion: reduce) { main, .foot { transition: none; } }

/* Demo store */
.shops { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; align-items: start; }
.shop .meta b { color: var(--text); font-weight: 600; }
.store-note { margin-top: 24px; }
@media (max-width: 900px) { .shops { grid-template-columns: 1fr; } }

/* "Run the demo agent" (dry-run mode only): a strip under the page title. */
.demo { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px 20px; margin: -16px 0 28px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.demo[hidden] { display: none; }
.demo > p { margin: 0; font-size: 14px; color: var(--muted); flex: 1 1 280px; }
.demo > p b { color: var(--text); }
.demo-out { flex: 1 1 100%; }
.demo-out:empty { display: none; }
.demo-out ul { list-style: none; margin: 0; padding: 12px 0 0; border-top: 1px solid var(--rule); display: grid; gap: 10px; font-size: 13.5px; }
.demo-out li { display: grid; grid-template-columns: minmax(180px, 260px) 1fr; gap: 4px 16px; }
.demo-out .ask { color: var(--muted); }
.demo-held { color: var(--warning); }
.demo-links { margin: 12px 0 0; font-size: 13.5px; }
@media (max-width: 640px) { .demo-out li { grid-template-columns: 1fr; } }
