/*
 * Stylesheet of the customer portal (/account). Separate from the public site's CSS and from the admin panel's, so
 * neither build depends on it. The colours and radii repeat the site's design tokens (frontend/src/styles/tokens.css)
 * so the portal looks like BluWebMedia. System fonts only: the Content-Security-Policy allows nothing from other
 * hosts, and no inline style either, so every visual state is a class here.
 */

/* Tokens (same values as the site's brand tokens). */
:root {
  --brand-blue: #2457d6;
  --brand-orange: #f7902a;
  --brand-orange-hover: #e27b14;
  --brand-navy: #0a2342;
  --surface: #ffffff;
  --page: #f3f6fb;
  --text: #0b1730;
  --muted: #4a5a73;
  --border: #c9d4e5;
  --danger: #a31515;
  --good: #14633a;
  --radius: 10px;
  --space: 16px;
}

/* Page frame. */
* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--text); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
main { max-width: 760px; margin: 0 auto; padding: var(--space); }
[hidden] { display: none !important; }

/* Top bar and its menu. */
.bar { display: flex; align-items: center; justify-content: space-between; gap: var(--space); padding: 12px var(--space); background: var(--brand-navy); color: #fff; }
.brand { color: #fff; font-weight: 700; text-decoration: none; }
.bar-user { display: flex; align-items: center; gap: var(--space); margin: 0; }
.nav { display: flex; gap: var(--space); margin: 0; padding: 0; list-style: none; }
.nav a { color: #fff; text-decoration: none; padding: 10px 4px; display: inline-block; }
.nav a:hover { text-decoration: underline; }

/* Cards and headings. */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: calc(var(--space) * 1.5); margin-top: var(--space); }
.narrow { max-width: 440px; margin-left: auto; margin-right: auto; }
.plain { max-width: 440px; }
h1 { margin: 0 0 var(--space); font-size: 1.5rem; }
h2 { margin: 0 0 8px; font-size: 1.15rem; }
.card h2 + form label:first-of-type { margin-top: 8px; }

/* Forms: labels above fields, 44px touch targets. */
label { display: block; margin: var(--space) 0 4px; font-weight: 600; }
input[type="text"], input[type="email"], input[type="password"], select, textarea { width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); font: inherit; }
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid var(--brand-blue); outline-offset: 2px; }
.button { display: inline-block; min-height: 44px; margin-top: var(--space); padding: 10px 20px; border: 0; border-radius: var(--radius); background: var(--brand-orange); color: var(--text); font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
.button:hover { background: var(--brand-orange-hover); }
.button-quiet { margin-top: 0; padding: 6px 14px; background: transparent; color: #fff; border: 1px solid #fff; }
.button-quiet:hover { background: rgba(255, 255, 255, 0.15); }
.button-secondary { background: var(--surface); border: 2px solid var(--brand-blue); color: var(--brand-blue); }
.button-secondary:hover { background: var(--page); }
.button-small { margin-top: 0; padding: 8px 14px; }
.captcha { margin-top: var(--space); min-height: 78px; }

/* Messages. */
.error { color: var(--danger); font-weight: 600; }
.done { color: var(--good); font-weight: 600; }
.muted { color: var(--muted); font-size: 0.9rem; }
/* Link back to the common sign-in page (/login): a 44px touch target. */
.back-link { margin: 8px 0 0; font-size: 0.9rem; }
.back-link a { display: inline-flex; align-items: center; min-height: 44px; }
.notice-box { padding: var(--space); border: 1px solid var(--brand-orange); border-radius: var(--radius); background: var(--page); }
ul.error { padding-left: var(--space); }

/* Licence status, site rows. */
.status { font-size: 0.8rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); vertical-align: middle; }
.status-active { color: var(--good); border-color: var(--good); }
.status-expired, .status-revoked { color: var(--danger); border-color: var(--danger); }
.site-row { max-width: none; }
summary { cursor: pointer; min-height: 44px; padding: 10px 0; font-weight: 600; }

/* QR code, keys and backup codes. */
.qr { width: 220px; max-width: 100%; }
.qr svg { width: 100%; height: auto; }
code { padding: 2px 6px; background: var(--page); border-radius: 4px; word-break: break-all; }
.codes { columns: 2; padding-left: calc(var(--space) * 1.5); }
.sessions { padding-left: var(--space); }

/* Phones: the bar wraps, cards lose some padding, the backup codes go in one column. */
@media (max-width: 600px) {
  .bar { flex-wrap: wrap; }
  .bar nav { width: 100%; }
  .nav { flex-wrap: wrap; gap: 0 var(--space); }
  .nav a { padding: 12px 4px; }
  .card { padding: var(--space); }
  .codes { columns: 1; }
}

/* People who ask for less motion get no smooth focus or hover changes (there are none above; kept as the rule for later additions). */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* Demo checkout (only shown when store.demo_checkout is on): the always-visible "no real payment" banner, the choice
   of Card or PayPal, the "processing" spinner and the demo licence card. */
.demo-banner { margin: 0 0 var(--space); padding: 10px var(--space); border: 2px dashed var(--brand-orange); border-radius: var(--radius); background: var(--page); font-weight: 700; }
.demo-methods { margin: var(--space) 0 0; padding: 0; border: 0; }
.demo-methods legend { padding: 0; font-weight: 600; }
.demo-method { display: flex; align-items: center; gap: 8px; min-height: 44px; margin: 4px 0; font-weight: 400; }
.demo-method input { width: 20px; height: 20px; }
.demo-processing { font-weight: 700; }
.spinner { display: inline-block; width: 18px; height: 18px; vertical-align: text-bottom; border: 3px solid var(--border); border-top-color: var(--brand-blue); border-radius: 50%; animation: spin 0.9s linear infinite; }
.demo-card { border-style: dashed; }
@keyframes spin { to { transform: rotate(360deg); } }

/* People who ask for less motion see a still ring instead of a spinning one. */
@media (prefers-reduced-motion: reduce) {
  .spinner { border-top-color: var(--brand-blue); }
}

/* Buy pages: the plan list, the facts of an order, the phone field and the Terms checkbox (44px touch targets). */
input[type="tel"] { width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); font: inherit; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px var(--space); margin: 0 0 var(--space); }
.facts dt { font-weight: 600; }
.facts dd { margin: 0; }
.plans { list-style: none; padding: 0; }
.plans li { margin: 0 0 var(--space); }
.check { display: flex; gap: 10px; align-items: flex-start; margin: var(--space) 0 0; }
.check input { width: 24px; height: 24px; margin-top: 2px; flex: none; }
label.inline { display: inline; margin: 0; font-weight: 400; }

/* Phones: the facts list becomes one column. */
@media (max-width: 480px) {
  .facts { grid-template-columns: 1fr; }
  .facts dd { margin-bottom: 8px; }
}

/* Price display on the buy pages: the struck-through regular price, the offer label, and text for screen readers only. */
.plans del { color: var(--muted, inherit); }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.85em; background: var(--surface-tint, #e8f0ff); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.button:disabled { opacity: 0.6; cursor: not-allowed; }

/* The invoice as the portal shows it: the same rules the stored invoice HTML carries (the portal's strict policy blocks inline style). */
.invoice-doc { font-family: "DejaVu Sans", Arial, sans-serif; font-size: 12px; color: #1b1b1b; }
.invoice-doc h1 { font-size: 22px; margin: 0 0 4px; }
.invoice-doc table { width: 100%; border-collapse: collapse; margin-top: 16px; }
.invoice-doc th, .invoice-doc td { border-bottom: 1px solid #cccccc; padding: 6px 4px; text-align: left; vertical-align: top; }
.invoice-doc th.n, .invoice-doc td.n { text-align: right; }
.invoice-doc table.cols td { border: 0; padding: 0 12px 0 0; width: 50%; }
.invoice-doc .muted { color: #555555; }
.invoice-doc table.totals td { border: 0; }
