/* The pairing page. Deliberately plain: this is a utility a customer visits once per pair of
   glasses, and the thing that matters is that the code field is obvious and the errors are
   readable. No product name, no logo, no brand colour — branding is tenant config (CLAUDE.md),
   and this page is reached before there is a tenant to brand it with. */

:root {
  --bg: #ffffff;
  --fg: #1b1f24;
  --muted: #5c6773;
  --line: #d9dee4;
  --accent: #15497a;
  --error: #96221b;
  --ok: #1d6b3f;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15181c;
    --fg: #e8ecf0;
    --muted: #9aa5b1;
    --line: #333a42;
    --accent: #7db2ec;
    --error: #ef8279;
    --ok: #71c894;
  }
}

* { box-sizing: border-box; }

/* The `hidden` attribute hides things via the UA rule `[hidden] { display: none }`, which ANY
   author display rule outranks — `label { display: block }` below was enough to keep a hidden
   label on screen while its input stayed hidden. Restate it with the weight to win, once, rather
   than remembering not to set display on anything that might be hidden. */
[hidden] { display: none !important; }

body {
  margin: 0;
  padding: 24px 16px;                 /* a 16px side gutter holds at phone width */
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

main { max-width: 32rem; margin: 0 auto; }

h1 { font-size: 1.4rem; margin: 0 0 1rem; }
h2 { font-size: 1.05rem; margin: 2rem 0 0.5rem; }

/* ---------------------------------------------------------------- tabs */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--line); margin-bottom: 1rem; }

.tabs button {
  flex: 1;
  padding: 0.6rem 0.5rem;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
}

.tabs button[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--accent); font-weight: 600; }

/* ---------------------------------------------------------------- forms */
label { display: block; margin: 0.9rem 0 0.25rem; font-size: 0.9rem; font-weight: 600; }
.opt { font-weight: 400; color: var(--muted); }

input {
  width: 100%;
  padding: 0.55rem 0.6rem;
  font: inherit;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
}

input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* The code is the point of the page: monospace and spaced so it reads like the glasses show it. */
#code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.3rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

button[type="submit"] {
  margin-top: 1.1rem;
  width: 100%;
  padding: 0.65rem;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

button[type="submit"]:disabled { opacity: 0.6; cursor: progress; }

.link {
  background: none; border: 0; padding: 0;
  color: var(--accent); font: inherit; text-decoration: underline; cursor: pointer;
}

/* The one link on this page that is the next step rather than a side door, so it is shaped like
   the submit buttons instead of like prose. */
.go {
  display: block;
  margin-top: 0.4rem;
  padding: 0.65rem;
  font-weight: 600;
  text-align: center;
  color: #fff;
  background: var(--accent);
  border-radius: 6px;
  text-decoration: none;
}

.hint { margin: 0.3rem 0 0; font-size: 0.85rem; color: var(--muted); }
.who { font-size: 0.9rem; color: var(--muted); margin: 0 0 1rem; }

/* ---------------------------------------------------------------- devices */
.devices { list-style: none; margin: 0; padding: 0; }

.devices li {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 0.15rem;
}

.devices .meta { font-size: 0.85rem; color: var(--muted); }
.devices .empty { color: var(--muted); border-bottom: 0; }

/* ---------------------------------------------------------------- status */
#message { margin-top: 1rem; padding: 0.6rem 0.7rem; border-radius: 6px; border: 1px solid var(--line); }
#message.error { color: var(--error); border-color: var(--error); }
#message.ok { color: var(--ok); border-color: var(--ok); }

/* ---------------------------------------------------------------- billing and service state */

/* The banner sits above everything else on the page because it changes what the buttons below it
   will do. Bordered rather than filled: a solid red block on a utility page reads as a crash. */
#service-banner {
  margin: 0 0 1rem;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 6px;
  font-size: 0.9rem;
}

/* `warn` is grace — a card to fix, not a service failure, and it must not look like one.
   `error` is past grace, where work really is restricted. */
#service-banner.warn { border-left-color: var(--accent); }
#service-banner.error { border-left-color: var(--error); color: var(--error); }

#billing { margin-bottom: 0.5rem; }
#billing-summary { margin: 0; }

/* Not a submit button: this one leaves the page for Stripe, so it is deliberately quieter than
   "Add these glasses", which is the thing the person came here to press. */
#subscribe {
  margin-top: 0.6rem;
  padding: 0.45rem 0.8rem;
  font: inherit;
  color: var(--accent);
  background: none;
  border: 1px solid var(--accent);
  border-radius: 6px;
  cursor: pointer;
}

#subscribe:disabled { opacity: 0.6; cursor: progress; }

/* The quote line. Sits directly above the button it describes, and is given a little room so it
   is not read as a continuation of the label above it. */
#quote { margin-top: 0.9rem; font-size: 0.9rem; }

/* A claim button disabled by the service ladder is not "working" — it is refused. The default
   `cursor: progress` from the submit rule would say the opposite. */
#submit-claim:disabled { cursor: not-allowed; }

/* Links. There were none in this stylesheet until Nov 7 2026, so every `<a>` fell back to the
   browser default -- a dark blue that is close to unreadable on the dark background this page
   already defines. It showed up on the reset page, which is the worst possible place for it: the
   only people who see that page are already locked out, and "Back to sign in" was the way out.
   Uses --accent, which is the one colour that is defined for BOTH schemes. */
a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
a:hover { text-decoration-thickness: 2px; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

/* A link that is the main thing to do next, on a page whose form is finished. Same shape as the
   submit buttons so "Sign in" after a reset does not read as an afterthought. */
a.button {
  display: inline-block;
  padding: 0.6rem 1.1rem;
  border-radius: 6px;
  background: var(--accent);
  color: var(--bg);
  font-weight: 600;
  text-decoration: none;
}
a.button:hover { text-decoration: none; filter: brightness(1.08); }

/* The legal footer on pair, account and reset.
 *
 * Muted and small on purpose: these links have to be FINDABLE on the page where somebody decides
 * to pay, without competing with the button they came to press. The agreement sentence itself is
 * next to that button (pair.html `terms-hint`), which is where it does its job; this is for the
 * person who comes looking afterwards.
 */
.page-footer {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--muted);
}
.page-footer a { margin-right: 1.1rem; color: var(--muted); }
.page-footer a:hover { color: var(--accent); }
