/* Pricing (/pricing) and Plan and billing (/account), on top of app.css tokens and page.css. Rules sit under .doc
   where page.css styles bare p / li / a inside it, so they win without !important. */

.doc-wide .doc { max-width: 1120px; } /* the header and footer are this wide on every page (page.css) */

/* ---------- Buttons ---------- */

.btn-primary, .btn-secondary, .btn-quiet, .btn-danger, .doc .btn-primary, .doc .btn-secondary, .doc .btn-quiet, .doc .btn-danger {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: var(--hit); padding: 0 var(--space-3); border: 0; border-radius: var(--radius-sm);
  font: inherit; font-size: var(--text-md); font-weight: var(--weight-semibold); text-decoration: none; white-space: nowrap; cursor: pointer;
}
.btn-primary, .doc .btn-primary { background: var(--accent-strong); color: #fff; }
.btn-primary:hover { filter: brightness(1.1); }
.btn-secondary, .doc .btn-secondary { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--control-border); }
.btn-secondary:hover { box-shadow: inset 0 0 0 1px var(--control-border-hover); background: var(--surface-2); }
.btn-quiet, .doc .btn-quiet { padding: 0 var(--space-2); background: transparent; color: var(--ink-2); }
.btn-quiet:hover { background: var(--surface-2); color: var(--ink); }
.btn-danger, .doc .btn-danger { background: var(--down); color: #fff; }
.btn-danger:hover { filter: brightness(1.08); }
.btn-secondary .icon, .btn-primary .icon { width: var(--icon-xs); height: var(--icon-xs); }

/* Section label above a plan name, as elsewhere in the app ("TOP CITIES"). */
.doc .plan-audience, .plan-audience {
  margin: 0; color: var(--accent-text); font-size: var(--text-xs); line-height: var(--line-label);
  font-weight: var(--weight-semibold); letter-spacing: 0.04em; text-transform: uppercase;
}

/* ---------- Pricing: head ---------- */

.pricing > h1, .pricing > .lede { text-align: center; }
.doc.pricing .lede { max-width: 40ch; margin-inline: auto; margin-bottom: var(--space-4); }

.preview-note {
  display: flex; gap: var(--space-2); align-items: flex-start; max-width: 640px; margin: 0 auto var(--space-5);
  padding: var(--space-2) var(--space-3); border-radius: var(--radius-md); background: var(--accent-soft);
}
.preview-note .icon { margin-top: 3px; color: var(--accent-text); }
.doc .preview-note p { margin: 0; color: var(--ink); font-size: var(--text-md); line-height: var(--leading-body); }

/* Monthly / Yearly: radio buttons drawn as a two-part switch. */
.period-switch {
  display: flex; width: max-content; max-width: 100%; margin: 0 auto var(--space-5); gap: var(--space-1); padding: var(--space-1);
  border-radius: var(--radius-pill); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--control-border);
}
.period-switch label { position: relative; display: flex; }
.period-switch input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.period-switch label > span {
  display: inline-flex; align-items: center; gap: var(--space-2); min-height: 36px; padding: 0 var(--space-3);
  border-radius: var(--radius-pill); color: var(--ink-2); font-size: var(--text-md); font-weight: var(--weight-medium);
}
.period-switch input:checked + span { background: var(--surface); color: var(--ink); font-weight: var(--weight-semibold); box-shadow: var(--ring), 0 1px 2px rgba(0, 0, 0, 0.12); }
.period-switch input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.period-switch .save { padding: 1px var(--space-2); border-radius: var(--radius-pill); background: color-mix(in srgb, var(--up) 14%, transparent); color: var(--up); font-size: var(--text-xs); font-weight: var(--weight-semibold); }

/* ---------- Pricing: plan cards ---------- */

.plan-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); align-items: stretch; }
@media (max-width: 900px) { .plan-grid { grid-template-columns: minmax(0, 1fr); max-width: 520px; margin-inline: auto; } }

.plan-card {
  display: flex; flex-direction: column; padding: var(--space-4); border-radius: var(--radius-md);
  background: var(--surface); box-shadow: var(--ring), var(--shadow); scroll-margin-top: var(--space-4);
}
.plan-card:target { box-shadow: 0 0 0 2px var(--accent), var(--shadow); } /* arrived from a lock card in the map */
.plan-card.is-yours { box-shadow: 0 0 0 2px var(--ink-2), var(--shadow); }
.doc .plan-name { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin: var(--space-1) 0 var(--space-2); font-size: var(--text-2xl); }
.plan-yours { padding: 2px var(--space-2); border-radius: var(--radius-pill); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); color: var(--ink-2); font-size: var(--text-xs); line-height: var(--line-label); font-weight: var(--weight-semibold); }
.plan-yours[hidden] { display: none; }
.doc .plan-pitch { min-height: 4.8em; margin: 0 0 var(--space-3); font-size: var(--text-md); line-height: var(--leading-body); }
@media (max-width: 900px) { .doc .plan-pitch { min-height: 0; } }

.doc .plan-price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--space-2); margin: 0 0 var(--space-3); }
.plan-price .amount { color: var(--ink); font-size: 36px; line-height: var(--leading-tight); font-weight: var(--weight-bold); font-variant-numeric: tabular-nums; }
.plan-price .per { color: var(--ink-2); font-size: var(--text-md); }
.plan-price .billed, .plan-price .vat { flex-basis: 100%; color: var(--muted); font-size: var(--text-sm); line-height: var(--leading-body); }

.doc .plan-cta {
  display: flex; align-items: center; justify-content: center; min-height: var(--hit-touch); margin: 0 0 var(--space-4);
  border-radius: var(--radius-sm); background: var(--accent-strong); color: #fff;
  font-size: var(--text-md); font-weight: var(--weight-semibold); text-decoration: none;
}
.doc .plan-cta:hover { filter: brightness(1.1); }
.doc .plan-cta-quiet { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--control-border); }
.doc .plan-cta-quiet:hover { filter: none; background: var(--surface-2); }
/* "Available soon": a paid plan's button while payments are off. */
.doc button.plan-cta { width: 100%; border: 0; font: inherit; font-size: var(--text-md); font-weight: var(--weight-semibold); cursor: pointer; }
.doc .plan-cta-soon, .doc .plan-cta-soon:hover, .doc a.plan-cta-soon { background: var(--surface-2); color: var(--muted); box-shadow: inset 0 0 0 1px var(--border); filter: none; cursor: not-allowed; }

.doc .plan-includes { margin: 0 0 var(--space-2); color: var(--ink); font-size: var(--text-sm); font-weight: var(--weight-semibold); }
.doc .plan-features { margin: 0; padding: 0; list-style: none; }
.doc .plan-features li { display: flex; gap: var(--space-2); align-items: flex-start; margin: 0; padding: 6px 0; color: var(--ink-2); font-size: var(--text-md); line-height: var(--leading-body); }
.doc .plan-features li + li { margin: 0; border-top: 1px solid var(--divider); }
.plan-features .icon { margin-top: 3px; color: var(--up); }

.doc .price-note { margin: var(--space-3) 0 0; color: var(--muted); font-size: var(--text-sm); text-align: center; }

/* ---------- Pricing: comparison ---------- */

.doc table.compare { min-width: 640px; table-layout: fixed; }
.compare thead th { width: 15%; padding-top: 0; text-align: center; font-size: var(--text-md); }
.compare thead th:first-child { width: auto; }
.compare tbody th[scope="row"] { padding-right: var(--space-3); color: var(--ink-2); font-weight: var(--weight-regular); }
.compare td { text-align: center; vertical-align: middle; }
.compare td.yes .icon { color: var(--up); }
.compare td.no { color: var(--muted); }
.compare tr.group th {
  padding-top: var(--space-4); color: var(--ink); font-size: var(--text-xs); letter-spacing: 0.04em; text-transform: uppercase;
}
.compare .col-pro, .compare .col-team { color: var(--accent-text); }

/* ---------- Pricing: questions ---------- */

.faq { max-width: 760px; }
.faq details { border-bottom: 1px solid var(--divider); }
.faq summary {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: var(--hit-touch);
  padding: var(--space-2) 0; color: var(--ink); font-size: var(--text-lg); font-weight: var(--weight-semibold); cursor: pointer; list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; flex: none; color: var(--ink-2); font-size: var(--text-xl); font-weight: var(--weight-regular); }
.faq details[open] summary::after { content: "–"; }
.doc .faq p { margin: 0 0 var(--space-3); max-width: 70ch; font-size: var(--text-md); }

/* ---------- Checkout (preview) ---------- */

.checkout {
  width: min(760px, calc(100vw - 2 * var(--space-3))); max-height: calc(100dvh - 2 * var(--space-3)); padding: 0;
  border: 0; border-radius: var(--radius-md); background: var(--surface); color: var(--ink); box-shadow: var(--ring), var(--shadow);
}
.checkout::backdrop { background: rgba(0, 0, 0, 0.5); }
.co-head { display: flex; align-items: center; justify-content: space-between; padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--divider); }
.co-head h2 { margin: 0; font-size: var(--text-xl); }
.co-close { display: inline-flex; align-items: center; justify-content: center; width: var(--hit); height: var(--hit); border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--ink-2); cursor: pointer; }
.co-close:hover { background: var(--surface-2); color: var(--ink); }
.co-step[data-co-step="pay"] { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-4); padding: var(--space-4); }
.co-step[hidden] { display: none !important; }
@media (max-width: 640px) { .co-step[data-co-step="pay"] { grid-template-columns: minmax(0, 1fr); } }
.co-plan { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-2); margin: 0 0 var(--space-3); font-size: var(--text-xl); font-weight: var(--weight-bold); }
.co-audience { color: var(--accent-text); font-size: var(--text-xs); font-weight: var(--weight-semibold); letter-spacing: 0.04em; text-transform: uppercase; }
.co-lines { margin: 0 0 var(--space-3); }
.co-lines > div { display: flex; justify-content: space-between; gap: var(--space-3); padding: var(--space-2) 0; border-bottom: 1px solid var(--divider); font-size: var(--text-md); }
.co-lines > div[hidden] { display: none; }
.co-lines dt { color: var(--ink-2); }
.co-lines dd { margin: 0; color: var(--ink); text-align: right; font-weight: var(--weight-medium); font-variant-numeric: tabular-nums; }
.co-fine { margin: var(--space-2) 0 0; color: var(--muted); font-size: var(--text-sm); line-height: var(--leading-body); }
.co-fine a { color: var(--ink-2); text-underline-offset: 3px; }
.co-pay { display: flex; flex-direction: column; }
.co-paddle {
  flex: 1; margin-bottom: var(--space-3); padding: var(--space-3); border-radius: var(--radius-sm);
  background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--control-border); border: 1px dashed transparent;
  background-image: repeating-linear-gradient(135deg, transparent 0 10px, color-mix(in srgb, var(--ink) 3%, transparent) 10px 20px);
}
.co-paddle p { margin: 0 0 var(--space-2); color: var(--ink-2); font-size: var(--text-md); line-height: var(--leading-body); }
.co-paddle b { color: var(--ink); }
.co-wait, .co-done { padding: var(--space-6) var(--space-4); text-align: center; }
.co-wait p, .co-done p { max-width: 48ch; margin: 0 auto var(--space-2); color: var(--ink-2); font-size: var(--text-md); line-height: var(--leading-body); }
.co-wait b { color: var(--ink); font-size: var(--text-lg); }
.co-done h3 { margin: var(--space-3) 0 var(--space-2); font-size: var(--text-2xl); }
.co-done h3:focus { outline: none; }
.co-done-mark { display: inline-flex; align-items: center; justify-content: center; width: 56px; height: 56px; border-radius: 50%; background: color-mix(in srgb, var(--up) 14%, transparent); color: var(--up); }
.co-done-mark .icon { width: 28px; height: 28px; }
.co-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2); margin-top: var(--space-4); }
.spinner { display: inline-block; width: 32px; height: 32px; margin-bottom: var(--space-3); border-radius: 50%; border: 3px solid var(--surface-2); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

/* ---------- Plan and billing ---------- */
/* Spacing: 24px inside cards and from the title to the first card, 16px between a notice and its card, 32px before
   a new section, then 16px from its heading to its cards. */

.doc.billing > h1 { margin-bottom: var(--space-4); } /* page.css leaves 4px under h1 for a lede; here a card follows */

.preview-bar { margin: 0 0 var(--space-4); padding: var(--space-3); border-radius: var(--radius-md); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--surface-edge); }
.preview-bar[hidden] { display: none; }
.doc .preview-head p { margin: 0 0 var(--space-2); font-size: var(--text-sm); line-height: var(--leading-body); }
.preview-states { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.preview-states label { position: relative; display: flex; }
.preview-states input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.preview-states span { display: inline-flex; align-items: center; min-height: 32px; padding: 0 var(--space-2); border-radius: var(--radius-pill); box-shadow: inset 0 0 0 1px var(--control-border); color: var(--ink-2); font-size: var(--text-sm); }
.preview-states input:checked + span { background: var(--ink); color: var(--page); box-shadow: none; font-weight: var(--weight-semibold); }
.preview-states input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.doc .preview-flag { display: flex; align-items: center; gap: var(--space-1); margin: 0 0 var(--space-3); color: var(--accent-text); font-size: var(--text-xs); font-weight: var(--weight-semibold); letter-spacing: 0.04em; text-transform: uppercase; }

.acct-card { margin: 0 0 var(--space-4); padding: var(--space-4); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--ring), var(--shadow); }
.acct-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-4); }
.doc .acct-card-head h2 { margin: var(--space-1) 0 0; font-size: var(--text-2xl); line-height: var(--leading-tight); }
.doc .acct-lede { margin: 0; font-size: var(--text-md); line-height: var(--leading-body); }
/* The fine print closes the card, under a hairline, so it doesn't read as part of the buttons above it. */
.doc .acct-note { margin: var(--space-4) 0 0; padding-top: var(--space-3); border-top: 1px solid var(--divider); color: var(--muted); font-size: var(--text-sm); line-height: var(--leading-body); }
.doc .acct-h2 { margin: var(--space-5) 0 var(--space-3); font-size: var(--text-lg); }

.status { flex: none; padding: 2px var(--space-2); border-radius: var(--radius-pill); font-size: var(--text-xs); line-height: var(--line-label); font-weight: var(--weight-semibold); }
.status-ok { background: color-mix(in srgb, var(--up) 14%, transparent); color: var(--up); }
.status-warn { background: color-mix(in srgb, var(--series-4) 20%, transparent); color: var(--ink); }
.status-bad { background: color-mix(in srgb, var(--down) 14%, transparent); color: var(--down); }

.acct-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3) var(--space-4); margin: 0; }
@media (max-width: 560px) { .acct-facts { grid-template-columns: minmax(0, 1fr); } }
.acct-facts dt { color: var(--muted); font-size: var(--text-xs); line-height: var(--line-label); font-weight: var(--weight-semibold); letter-spacing: 0.04em; text-transform: uppercase; }
.doc .acct-facts dd { margin: var(--space-1) 0 0; color: var(--ink); font-size: var(--text-md); line-height: var(--leading-body); overflow-wrap: anywhere; }
.acct-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-4); }

/* A notice about the plan (ends soon, payment failed): a tinted card with a hairline in its tone, the icon in that
   tone. Its 24px side padding puts the icon on the same line as the text in the card below. */
.acct-banner {
  --tone: var(--accent);
  display: flex; gap: var(--space-3); align-items: flex-start; margin: 0 0 var(--space-3); padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md); background: color-mix(in srgb, var(--tone) 10%, var(--surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tone) 35%, transparent);
}
.acct-banner.warn { --tone: var(--series-4); }
.acct-banner.bad { --tone: var(--down); }
.acct-banner > .icon { width: var(--icon-md); height: var(--icon-md); margin-top: 1px; color: var(--tone); } /* centred on the first 21px line */
.doc .acct-banner p { margin: 0 0 var(--space-3); color: var(--ink-2); font-size: var(--text-md); line-height: var(--leading-body); }
.doc .acct-banner b { color: var(--ink); }

.acct-confirm { margin-top: var(--space-3); padding: var(--space-3); border-radius: var(--radius-sm); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--surface-edge); }
.doc .acct-confirm p { margin: 0; font-size: var(--text-md); line-height: var(--leading-body); }
.acct-confirm .acct-actions { margin-top: var(--space-3); }

.upgrade-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--space-3); }
/* Same padding as the plan card above; label and name sit as in its head, then price, pitch and the link. */
.doc a.upgrade-card { display: flex; flex-direction: column; align-items: flex-start; padding: var(--space-4); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--ring), var(--shadow); color: var(--ink-2); text-decoration: none; }
.doc a.upgrade-card:hover { box-shadow: 0 0 0 2px var(--accent), var(--shadow); }
.upgrade-name { margin-top: var(--space-1); color: var(--ink); font-size: var(--text-xl); line-height: var(--leading-tight); font-weight: var(--weight-bold); }
.upgrade-price { margin-top: var(--space-1); color: var(--ink); font-size: var(--text-md); line-height: var(--leading-body); font-weight: var(--weight-semibold); }
.upgrade-pitch { margin-top: var(--space-2); font-size: var(--text-sm); line-height: var(--leading-body); }
.upgrade-go { display: inline-flex; align-items: center; gap: var(--space-1); margin-top: auto; padding-top: var(--space-3); /* at the foot, level across cards whose pitches wrap differently */ color: var(--accent-text); font-size: var(--text-md); line-height: var(--leading-body); font-weight: var(--weight-semibold); }
.doc a.upgrade-card:hover .upgrade-go { text-decoration: underline; text-underline-offset: 3px; }

/* On a phone, 16px inside the cards leaves the text room to wrap; the notice's icon still lines up with the card text. */
@media (max-width: 520px) {
  .acct-card, .acct-banner, .doc a.upgrade-card { padding: var(--space-3); }
}

.toast {
  position: fixed; left: 50%; bottom: var(--space-4); z-index: 10; max-width: min(520px, calc(100vw - 2 * var(--space-3))); transform: translateX(-50%);
  padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); background: var(--ink); color: var(--page); box-shadow: var(--shadow);
  font-size: var(--text-md); line-height: var(--leading-body);
}
.toast[hidden] { display: none; }
