/* Amos, Clean-Sheet 2026: the customer pages - portal, invoice (and the
   receipt it becomes), quote, save-a-card, the lead form, the legal
   pages. Loaded LAST in each page's head (see the templates' notes).

   These pages carry the tenant's brand, not Amos's: the page's own
   <style> sets --accent, --accent-text and the solved button pair
   (--btn-primary-fill / --btn-primary-ink) from the tenant's colour,
   and nothing here overrides those. A homeowner has no app theme, so
   the page follows the device (an inline script sets data-theme="dark"
   when the device asks for dark).

   Borrowed: Cash App / Apple Wallet - the amount is the page, one big
   action pays it, and "paid" is a calm confirmation. Stripe's invoice -
   line items in tabular figures under a rule, one state in words. */

/* 1. The original token names these pages' rules use, mapped onto the
      new system, so every existing rule renders in the new palette. */
body.cs-public {
  --bg: var(--canvas);
  --surface: var(--panel);
  --surface-raised: var(--overlay);
  --card-edge: var(--hairline);
  --border: var(--hairline);
  --text: var(--ink-1);
  --text-secondary: var(--ink-2);
  --text-secondary-strong: var(--ink-2);
  --text-tertiary: var(--ink-3);
  --danger: var(--attention-text);
  --danger-bg: var(--attention-fill);
  --success: var(--money-in-text);
  --warning: var(--owed-text);
  --ink-fill: var(--ink-1);
  --on-ink: var(--canvas);
  --brand: var(--accent);
  --shadow-card: none;
  --radius-sm: 8px;
  --radius-md: var(--r-control);
  --radius-lg: var(--r-panel);
  --radius-pill: var(--r-pill);
  --text-meta: 0.875rem;
  --text-body: 1.0625rem;
  --text-input: 1.0625rem;
  --text-title: 1.5rem;
  --text-heading: 1.375rem;
  --text-display: 2.5rem;

  margin: 0;
  background: var(--canvas); color: var(--ink-1);
  font: var(--t-body);
  -webkit-font-smoothing: antialiased;
}

/* 2. The page: one calm column. */
body.cs-public .wrap { max-width: 480px; margin: 0 auto; padding: var(--s-6) var(--gutter) var(--s-12); }
body.cs-public .card {
  background: var(--panel); border: 1px solid var(--hairline); border-radius: var(--r-panel);
  box-shadow: none; padding: var(--s-5) var(--s-4); margin-bottom: var(--s-3);
}
body.cs-public h1 { font: var(--t-title); font-size: 1.625rem; letter-spacing: var(--track-title); color: var(--ink-1); }
body.cs-public h2 { font: var(--t-meta); font-weight: 700; letter-spacing: 0; text-transform: none; color: var(--ink-2); }
body.cs-public .subtitle { color: var(--ink-2); }
body.cs-public .meta, body.cs-public .fine-print { color: var(--ink-2); }
body.cs-public a { color: var(--accent-text); }

/* The business, not Amos: their initial in their colour, their name. */
body.cs-public .wordmark { display: flex; align-items: center; justify-content: center; gap: var(--s-2); margin: 0 0 var(--s-5); }
body.cs-public .wordmark-initial {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  background: var(--btn-primary-fill, var(--accent)); color: var(--btn-primary-ink, #fff);
  font: var(--t-body); font-weight: 800;
}
body.cs-public .wordmark-name { font: var(--t-body); font-weight: 700; color: var(--ink-1); }

/* 3. The amount is the page. */
body.cs-public .card-hero, body.cs-public .hero { text-align: center; padding-top: var(--s-6); padding-bottom: var(--s-6); }
body.cs-public .hero-label { font: var(--t-meta); font-weight: 700; color: var(--ink-2); }
body.cs-public .hero-amount {
  font: var(--t-display); font-size: clamp(2.75rem, 14vw, 3.5rem); letter-spacing: var(--track-display);
  font-variant-numeric: tabular-nums; color: var(--ink-1); margin: var(--s-1) 0;
}
body.cs-public .hero-sub { font: var(--t-meta); color: var(--ink-2); }
body.cs-public .doc-anchor, body.cs-public .doc-anchor-line { color: var(--ink-1); text-align: center; margin: 0 0 2px; }
body.cs-public .doc-anchor-line { color: var(--ink-2); }
body.cs-public .invoice-hero-amount { text-align: center; margin: var(--s-4) 0 var(--s-2); }
body.cs-public .invoice-hero-state { text-align: center; margin-bottom: var(--s-5); }

/* One state, in words: the app's own chip (round 2, item 1) - these
   pages do not load components.css, so the chip is restated here from
   the same tokens. Owed is amber, not an alarm, on the customer's own
   bill; paid is money in. */
body.cs-public .status { display: inline-flex; align-items: center; flex-wrap: wrap; justify-content: center; gap: var(--s-1) var(--s-2); }
body.cs-public .chip {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 var(--s-3);
  border-radius: var(--r-pill); font: var(--t-meta); font-weight: 650; white-space: nowrap;
  background: var(--sunken); color: var(--ink-2);
}
body.cs-public .chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
body.cs-public .chip[data-role="money-in"] { background: var(--money-in-fill); color: var(--money-in-ink); }
body.cs-public .chip[data-role="owed"] { background: var(--owed-fill); color: var(--owed-ink); }
body.cs-public .chip[data-role="attention"] { background: var(--attention-fill); color: var(--attention-ink); }
body.cs-public .chip[data-role="planned"] { background: var(--planned-fill); color: var(--planned-ink); }
body.cs-public .chip-degree { font: var(--t-meta); color: var(--ink-2); }
body.cs-public .row .meta .status { justify-content: flex-start; }
body.cs-public .moment-check { width: 14px; height: 14px; stroke-dasharray: 24; stroke-dashoffset: 24; animation: pub-draw 420ms var(--ease) forwards; }
@keyframes pub-draw { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) { body.cs-public .moment-check { animation: none; stroke-dashoffset: 0; } }

/* The ledger. */
body.cs-public .item-row, body.cs-public .row {
  display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-3);
  padding: var(--s-3) 0; border-bottom: 1px solid var(--hairline);
}
body.cs-public .item-row > :last-child, body.cs-public .row > :last-child { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
body.cs-public .total-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding-top: var(--s-3); margin-top: var(--s-1); border-top: 2px solid var(--ink-1);
  font: var(--t-title); font-variant-numeric: tabular-nums;
}
body.cs-public .notes, body.cs-public .card-note { color: var(--ink-2); white-space: pre-line; }

/* 4. One big action, in the business's own colour (solved per tenant). */
body.cs-public .btn, body.cs-public button:not(.photo-lightbox-close):not(.photo-lightbox-nav):not(.photo-picker-remove):not(.photo-trigger) {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: var(--hit); padding: 0 var(--s-5); border-radius: var(--r-control);
  font: var(--t-body); font-weight: 650; text-decoration: none; cursor: pointer;
}
body.cs-public .btn-primary, body.cs-public .btn-pay, body.cs-public .btn-approve,
body.cs-public form button[type=submit]:not(.btn-secondary):not(.btn-decline):not(.link-button) {
  background: var(--btn-primary-fill); color: var(--btn-primary-ink); border: 0;
}
body.cs-public .btn-full, body.cs-public .btn-pay, body.cs-public .btn-approve { width: 100%; }
body.cs-public .btn-pay, body.cs-public .btn-approve { min-height: var(--hit-lg); font-size: 1.1875rem; }
body.cs-public .btn-secondary, body.cs-public .btn:not(.btn-primary):not(.btn-pay):not(.btn-approve) {
  background: var(--panel); color: var(--ink-1); border: 1px solid var(--line-strong);
}
/* Round 3, item 8: one primary. Declining is a quiet answer under
   Approve, not a second full-width button stacked below it. */
body.cs-public .btn-decline {
  background: none; color: var(--ink-2); border: 0; width: auto; margin: 0 auto; display: flex;
  text-decoration: underline; text-underline-offset: 3px;
}
body.cs-public .btn-small { min-height: 44px; padding: 0 var(--s-3); font: var(--t-meta); font-weight: 700; }
body.cs-public .link-button { background: none !important; border: 0; color: var(--accent-text); padding: 0; min-height: 44px; }

/* When paying fails: said plainly, right above the button. */
body.cs-public .pay-error {
  display: flex; align-items: flex-start; gap: var(--s-3);
  background: var(--attention-fill); color: var(--attention-ink);
  border-radius: var(--r-control); padding: var(--s-3) var(--s-4);
}
body.cs-public .pay-error .t1 { font-weight: 700; }
body.cs-public .pay-error .t2 { font: var(--t-meta); }
body.cs-public .status-message { color: var(--ink-2); }
body.cs-public .card-on-file { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }
body.cs-public .digits { font-variant-numeric: tabular-nums; font-weight: 700; letter-spacing: 0.04em; }

/* 5. Forms (the lead form, the card form). */
body.cs-public label { display: block; margin: var(--s-4) 0 6px; font: var(--t-meta); font-weight: 700; color: var(--ink-1); }
body.cs-public :is(input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=file]), select, textarea) {
  appearance: none; width: 100%; box-sizing: border-box;
  min-height: 52px; padding: 0 var(--s-4);
  background: var(--panel); color: var(--ink-1);
  border: 1px solid var(--line-strong); border-radius: var(--r-control); font: var(--t-body);
}
body.cs-public textarea { padding: var(--s-3) var(--s-4); min-height: 104px; }
/* The customer's date (the portal's "When works for you?"): the app's own
   rule (shell.css, Sept 24) - drawn as a block so iOS shows it at all, and
   its one line centred in the 52px box by padding, in any engine. */
body.cs-public :is(input:is([type=date], [type=time], [type=datetime-local]), #date-field-centring) {
  display: block; line-height: 1.4;
  padding-top: max(0px, calc((52px - 2px - 1.4em) / 2));
  padding-bottom: max(0px, calc((52px - 2px - 1.4em) / 2));
  height: max(52px, calc(1.4em + 2px));   /* the other fields' 52px: Chrome's value box runs a little taller than the line */
}
body.cs-public input:is([type=date], [type=time], [type=datetime-local])::-webkit-date-and-time-value {
  text-align: left; min-height: 1.4em; margin: 0;
}
body.cs-public :is(input, select, textarea):focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
body.cs-public .agreement { font: var(--t-meta); color: var(--ink-2); }

/* 6. Photos, visits, the rest. */
body.cs-public .photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: var(--s-2); }
body.cs-public .photo-grid img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--r-control); display: block; }
body.cs-public .photo-more-count { font: var(--t-meta); font-weight: 700; }
body.cs-public .row-next { font-weight: 700; }
body.cs-public .show-more { font: var(--t-meta); font-weight: 700; color: var(--accent-text); }
body.cs-public .empty { color: var(--ink-3); }
body.cs-public .powered-by { text-align: center; font: var(--t-meta); color: var(--ink-3); margin: var(--s-2) 0 0; }
body.cs-public .powered-by a { color: inherit; }

/* The legal pages: a readable document. */
body.cs-public .doc-card { line-height: 1.6; }
body.cs-public .doc-card h2 { font: var(--t-body); font-weight: 700; color: var(--ink-1); margin: var(--s-6) 0 var(--s-2); }
body.cs-public .updated { font: var(--t-meta); color: var(--ink-3); }
body.cs-public .other-doc-link { font: var(--t-meta); font-weight: 700; }
body.cs-public .logo { border-radius: 16px; }

/* Polish pass, 6: the footer's Terms and Privacy, and the way-in pages'
   own links ("Forgot password?", "Sign up") drew 18-22px tall. Each
   takes a 44px tap, centred on it, without moving a pixel of layout. */
body.cs-public .powered-by a { position: relative; }
body.cs-public .powered-by a::after {
  content: ""; position: absolute;
  top: min(0px, calc((100% - 44px) / 2)); bottom: min(0px, calc((100% - 44px) / 2));
  left: min(0px, calc((100% - 44px) / 2)); right: min(0px, calc((100% - 44px) / 2));
}
