/* LazyFPL partner hub: plain panels, serif titles and big numbers, one 72rem column. */
:root {
  --bg: #f7f7f5; --panel: #ffffff; --fg: #1f1e1c; --muted: #6b6963; --line: #e4e2dc; --soft: #f1f0ec;
  --ok: #2f7a4b; --bad: #b3412e; --warn-bg: #fff4d6; --warn-line: #e6cf8f;
  --s1: #3a6fd8; --s2: #d97a2b; --s3: #5a9b6e; --s4: #8a63c9; --grid: #ecebe6;
  --font-display: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1c1b19; --panel: #252422; --fg: #ecebe7; --muted: #a3a19a; --line: #3a3935; --soft: #2e2d2a;
    --ok: #6cc28d; --bad: #f08a76; --warn-bg: #3a3220; --warn-line: #6b5a2e;
    --s1: #7aa3f0; --s2: #eea064; --s3: #7fc296; --s4: #b293e8; --grid: #33322e;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1c1b19; --panel: #252422; --fg: #ecebe7; --muted: #a3a19a; --line: #3a3935; --soft: #2e2d2a;
  --ok: #6cc28d; --bad: #f08a76; --warn-bg: #3a3220; --warn-line: #6b5a2e;
  --s1: #7aa3f0; --s2: #eea064; --s3: #7fc296; --s4: #b293e8; --grid: #33322e;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body {
  background: var(--bg); color: var(--fg); font-family: var(--font-body); font-size: 15px; line-height: 1.5;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
a { color: inherit; }
.wrap { max-width: 72rem; margin-inline: auto; padding-block: 16px 64px; display: flex; flex-direction: column; gap: 24px; }
#view { display: flex; flex-direction: column; gap: 24px; }
#err:empty { display: none; }
.topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; font-size: .85rem; color: var(--muted); }
.topbar .brand { font-weight: 600; color: var(--fg); text-decoration: none; }
.topbar .right { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.notice { background: var(--soft); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; font-size: .9rem; display: flex; flex-direction: column; gap: 8px; }
.notice.bad { border-color: var(--bad); }
.notice.ok { border-color: var(--ok); }
h1 { font-family: var(--font-display); font-weight: 400; font-size: 2rem; line-height: 1.15; margin: 0; text-wrap: balance; }
h2 { font-size: 1.1rem; font-weight: 500; margin: 0; }
h3 { font-size: .85rem; font-weight: 600; margin: 0; }
p { margin: 0; }
.muted { color: var(--muted); font-size: .85rem; }
header.page { display: flex; flex-direction: column; gap: 8px; }
.lede { font-size: 1rem; max-width: 46rem; }
.lede b { font-weight: 600; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 24px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; min-width: 560px; font-size: .95rem; }
th { text-align: left; font-size: .8rem; font-weight: 500; color: var(--muted); padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
td:first-child { font-weight: 600; }
td.num, th.num { text-align: right; }
td.wrapcell { white-space: normal; }
tr.total td { font-weight: 600; border-top: 2px solid var(--line); }
tr.archived td { color: var(--muted); }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; align-items: center; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-block; padding: 1px 9px; border-radius: 999px; background: var(--soft); border: 1px solid var(--line); font-size: .8rem; }
button, .button { font: inherit; font-size: .85rem; font-weight: 500; color: var(--fg); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 14px; cursor: pointer; min-height: 38px; white-space: nowrap; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
button:hover, .button:hover { background: var(--soft); }
button.primary { background: var(--fg); color: var(--bg); border-color: var(--fg); }
button.danger { color: var(--bad); }
button.small, .button.small { min-height: 32px; padding: 4px 10px; font-size: .8rem; }
button:disabled { opacity: .55; cursor: not-allowed; }
button:focus-visible, .button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
.linkrow { display: flex; gap: 8px; align-items: stretch; }
.code { flex: 1; min-width: 0; font-family: var(--font-mono); font-size: .8rem; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px; word-break: break-all; user-select: all; white-space: pre-wrap; }
form.stack { display: flex; flex-direction: column; gap: 18px; }
form.inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px 16px; margin: 0; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
legend { font-size: .85rem; font-weight: 500; padding: 0 6px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: .85rem; font-weight: 500; }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: 6px 12px; }
.tier { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: .9rem; padding-bottom: 10px; border-bottom: 1px dashed var(--line); }
.tier input[type=number] { width: 6rem; }
.tier select { width: auto; min-width: 9.5rem; }
select.fit { width: auto; min-width: 12rem; align-self: flex-start; }
.raterow { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; }
.row.start { justify-content: flex-start; }
.warn-text { color: var(--bad); font-size: .8rem; font-weight: 400; }
.paid { color: var(--ok); font-weight: 500; }
button.linkbtn { background: none; border: 0; padding: 0; min-height: 0; color: inherit; text-decoration: underline; font-size: .8rem; font-weight: 400; }
button.linkbtn:hover { background: none; }
.with-prefix { display: inline-flex; align-items: center; gap: 4px; }
input[type=email], input[type=text], input[type=number], select, textarea {
  font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; min-height: 40px; width: 100%;
}
textarea { min-height: 72px; }
.hint { font-weight: 400; color: var(--muted); font-size: .8rem; }
.month select, .inline-select { width: auto; min-width: 10rem; }
@media (max-width: 520px) { .tile { padding: 18px; } .panel { padding: 18px; } h1 { font-size: 1.7rem; } }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: 16px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 24px; display: flex; flex-direction: column; gap: 8px; }
.big { font-family: var(--font-display); font-weight: 400; font-size: 2rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: .8rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i, .tip i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.tip i { width: 8px; height: 8px; margin-right: 6px; }
.chart { position: relative; min-height: 220px; }
.chart svg { display: block; width: 100%; height: auto; }
.chart .empty { position: absolute; inset: 0 0 28px 0; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: .85rem; pointer-events: none; }
.tip { position: absolute; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 4px 14px rgba(0,0,0,.12); padding: 6px 10px; font-size: .8rem; pointer-events: none; white-space: nowrap; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); gap: 16px; }
.sub { border: 1px solid var(--line); border-radius: 10px; padding: 16px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.sub strong { font-weight: 600; }
.sub h3 { font-weight: 500; color: var(--muted); font-size: .8rem; }
.tiers { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.tiers li { display: flex; flex-direction: column; gap: 6px; }
.tiers li.done span:first-child { font-weight: 600; }
.bar { height: 8px; border-radius: 999px; background: var(--soft); border: 1px solid var(--line); overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--s1); }
.tiers li.done .bar span { background: var(--ok); }
.head-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
dl.terms { display: grid; grid-template-columns: minmax(8rem, 12rem) minmax(0, 1fr); gap: 10px 20px; margin: 0; }
dl.terms dt { color: var(--muted); }
dl.terms dd { margin: 0; }
.sub-h { margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--line); font-size: .95rem; font-weight: 500; }
@media (max-width: 520px) { dl.terms { grid-template-columns: 1fr; gap: 2px; } dl.terms dd { margin-bottom: 10px; } .head-meta { align-items: flex-start; } }
@media (max-width: 520px) {
  .tiles { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tile { padding: 14px; gap: 4px; }
  .tile .big { font-size: 1.5rem; }
}
/* Tables become one card per row on phones, so no column is hidden off-screen. */
@media (max-width: 640px) {
  table.cards { min-width: 0; }
  table.cards thead { display: none; }
  table.cards tr { display: block; padding: 10px 0; border-bottom: 1px solid var(--line); }
  table.cards td { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; border: 0; padding: 3px 0; white-space: normal; text-align: right; }
  table.cards td::before { content: attr(data-label); color: var(--muted); font-size: .85rem; font-weight: 400; text-align: left; }
  table.cards td[data-label=""]::before { content: none; }
  table.cards td:first-child { font-size: 1rem; text-align: left; justify-content: flex-start; padding-bottom: 6px; }
  table.cards td[data-label=""]:not(:first-child) { justify-content: flex-end; }
  table.cards tr.total { border-top: 2px solid var(--line); }
  table.cards tr.total td { border-top: 0; }
}

.wrap.narrow { max-width: 30rem; }
.warn { background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: 10px; padding: 10px 14px; font-size: .9rem; }
.topbar form { margin: 0; }
.paybox { display: inline-flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; }
.paybox input[type=date] { font: inherit; font-size: .85rem; color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 4px 6px; }
[hidden] { display: none !important; }
@media (max-width: 520px) {
  .linkrow { flex-direction: column; align-items: stretch; gap: 6px; }
  .linkrow button { align-self: flex-start; }
}
.backup-row { gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.backup-row label.button { cursor: pointer; }
/* Brand: logo, name and a filled Beta badge set apart from the title. */
.brand { display: inline-flex; align-items: center; gap: 8px; }
.brand img { border-radius: 6px; background: #fff; }
.beta { display: inline-flex; align-items: center; font-family: var(--font-body); font-size: .62rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--bg); background: var(--fg); border-radius: 4px; padding: 2px 6px; margin-left: 4px; line-height: 1.4; }
h1 .beta { font-size: .72rem; vertical-align: middle; position: relative; top: -5px; margin-left: 10px; }
.signin-head { display: flex; flex-direction: column; gap: 10px; }
.signin-logo { border-radius: 12px; background: #fff; }
/* Phones: the Results controls stack full width instead of overflowing the panel. */
@media (max-width: 520px) {
  .panel > .row:first-child { flex-wrap: wrap; }
  .panel > .row:first-child .actions { width: 100%; flex-wrap: wrap; }
  .panel > .row:first-child .actions > * { flex: 1 1 100%; max-width: 100%; }
  .panel > .row:first-child .actions select { width: 100%; }
  .panel > .row:first-child .actions .check.month { display: flex; gap: 8px; align-items: center; }
}
