:root {
  --bg: #0f1115; --panel: #171a21; --field: #0c0e12; --line: #2a2f3a; --ink: #e6e9ef; --dim: #98a1b3;
  --accent: #fbbf24; --accent-ink: #1a1406; --bad: #fca5a5; --bad-bg: rgba(190,30,45,.18); --bad-line: #f87171;
  --ok: #4ade80; --ok-bg: rgba(34,197,94,.12); --info-bg: rgba(47,155,245,.12); --info-line: #2f9bf5; --info-ink: #cfe4fb;
  --test-bg: #3f3113; --test-ink: #fbbf24;
}
/* Measure Studio's own light theme (app/index.html, LIGHT THEME): the same tokens. */
:root:is([data-theme="light"], [data-theme="spark"]) {
  color-scheme: light;
  --bg: #f6f5f1; --panel: #ffffff; --field: #ffffff; --line: #e2dfd6; --ink: #151820; --dim: #515a6b;
  --accent: #d97706; --accent-ink: #1a1406; --bad: #b91c1c; --bad-bg: #fee2e2; --bad-line: #f3b4b4;
  --ok: #16a34a; --ok-bg: #dcfce7; --info-bg: #e0f2fe; --info-line: #0284c7; --info-ink: #1e40af;
  /* The hover card (app/hover-tip.css) reads these, as in the app's light theme. */
  --lt-tip: #ffffff; --lt-line: #e2dfd6;
  --test-bg: #fef3c7; --test-ink: #92400e;
  --head: #f1efe9; --sunk: #ecebe5; --hover: #ece8df; --link: #b45309;
}
:root:not([data-theme="light"]):not([data-theme="spark"]) { --head: #141821; --sunk: #0c0e12; --hover: rgba(255,255,255,.04); --link: #fbbf24; }
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--link); }
.page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 32px 16px; }
.card { width: min(420px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 28px 26px;
  display: flex; flex-direction: column; gap: 10px; }
.card--wide { width: min(880px, 100%); }
.card h1 { font-size: 20px; margin: 0 0 4px; text-align: center; }
.card .lead { margin: 0 0 6px; color: var(--dim); text-align: center; }
label { font-size: 12.5px; color: var(--dim); margin-top: 4px; }
label .opt { font-size: 11.5px; opacity: .8; }
input[type=email], input[type=password], input[type=text], input[type=tel], input:not([type]) {
  background: var(--field); border: 1px solid var(--line); border-radius: 6px; color: var(--ink);
  padding: 9px 10px; font: inherit; font-size: 14px; width: 100%; }
input:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.check { display: flex; gap: 8px; align-items: flex-start; color: var(--ink); font-size: 13px; margin-top: 8px; }
.check input { margin: 3px 0 0; width: 16px; height: 16px; flex: none; }
.btn { padding: 10px 14px; border-radius: 6px; font: inherit; font-weight: 700; cursor: pointer; border: 1px solid var(--line);
  background: none; color: var(--ink); }
.btn--main { margin-top: 12px; border: none; background: var(--accent); color: var(--accent-ink); }
.btn:disabled { opacity: .55; cursor: default; }
/* On hover the main button's text takes the page background colour; set after the link hover
 * rule's amber, which made a link-styled main button's text vanish into the button. */
.btn--main:hover:not(:disabled), a.btn--main:hover { color: var(--bg); text-decoration: none; }
/* "Check your email": a close button top right, one centred "Send a new link" at the bottom. */
.card--closable { position: relative; }
.card__close { position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; display: grid; place-items: center;
  border: 0; border-radius: 8px; background: none; color: var(--dim); cursor: pointer; }
.card__close:hover { color: var(--ink); background: var(--hover); }
.card__close svg { width: 18px; height: 18px; }
.card__resend { align-self: center; margin-top: 10px; min-width: 200px; }
.card__resend:hover:not(:disabled) { border-color: var(--accent); color: var(--link); }
/* "Leave now, pay later": its own centred button under the plans or the card form. */
.later { display: flex; justify-content: center; margin-top: 14px; padding-top: 16px; border-top: 1px solid var(--line); }
.btn--later { min-height: 46px; padding: 10px 30px; font-size: 15.5px; border-color: var(--dim); }
.btn--later:hover { border-color: var(--accent); color: var(--link); }
.links { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 14px; margin-top: 6px; }
/* Links: amber, medium weight, never underlined (SRH, 2026-11-13); a lighter amber on hover. */
a, .link { color: var(--link); text-decoration: none; font-weight: 600; }
.link { background: none; border: 0; padding: 0; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
a:hover, .link:hover { color: var(--accent); text-decoration: none; }
a:focus-visible, .link:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.link.back { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; margin-top: 8px; }
.link.back svg { width: 16px; height: 16px; }
.alt { text-align: center; color: var(--dim); font-size: 14px; margin: 10px 0 0; }
.check a { font-weight: 600; }
.msg { border-radius: 6px; padding: 8px 10px; font-size: 13px; margin: 0; }
.msg--bad { background: var(--bad-bg); border: 1px solid var(--bad-line); color: var(--bad); }
.msg--ok { background: var(--ok-bg); border: 1px solid var(--ok); color: var(--ink); }
.msg--work { background: var(--info-bg); border: 1px solid var(--info-line); color: var(--info-ink); display: flex; gap: 9px; align-items: center; }
.msg--work::before { content: ''; flex: none; width: 15px; height: 15px; border-radius: 50%; border: 2px solid rgba(127,127,127,.3);
  border-top-color: var(--info-line); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.code { font-size: 24px !important; letter-spacing: .4em; text-align: center; font-variant-numeric: tabular-nums; }
/*
 * The plan page (SRH, 2026-11-13; the rule book's pricing pattern): one period switch on top for all
 * plans, three equal cards side by side - name, price for the period and per month, the limits with
 * checks, one button at the bottom. The current plan has an amber border and a badge.
 */
.card--plans { width: min(1180px, 100%); padding: 36px 32px; gap: 14px; }
.card--plans h1 { font-size: 26px; }
.card--plans .lead { font-size: 16px; margin-bottom: 10px; }
.period-switch { align-self: center; display: inline-grid; grid-template-columns: repeat(4, minmax(96px, auto)); gap: 4px;
  padding: 4px; margin: 4px 0 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--sunk); }
.period-switch button { min-height: 42px; padding: 0 16px; border: 0; border-radius: 9px; background: none; color: var(--dim);
  font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; transition: background-color .15s ease, color .15s ease; }
.period-switch button:hover { color: var(--ink); }
.period-switch button[aria-checked="true"] { background: var(--accent); color: #1a1406; }
.period-switch button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.plans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; align-items: stretch; }
.plan { position: relative; display: flex; flex-direction: column; gap: 14px; padding: 26px 24px 24px; border: 1px solid var(--line);
  border-radius: 14px; background: var(--panel); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.plan h2 { margin: 0; font-size: 20px; }
.plan .price { font-size: 36px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.plan .price small { font-size: 15px; font-weight: 500; color: var(--dim); }
.plan .permonth { margin-top: -8px; color: var(--dim); font-size: 14px; font-variant-numeric: tabular-nums; }
.plan .btn--main { margin-top: auto; min-height: 46px; font-size: 15.5px; }
.plan.is-current { border: 2px solid var(--accent); }
.plan.is-off { opacity: .55; }
/* The current plan is the reference on Upgrade: shown in full, only its button is off. */
.plan.is-current.is-off { opacity: 1; }
.period-switch button { white-space: nowrap; }
.plan .badge { position: absolute; top: -12px; left: 20px; padding: 3px 12px; border-radius: 99px; background: var(--accent); color: #1a1406;
  font-size: 12.5px; font-weight: 700; }
.limits { list-style: none; margin: 4px 0 8px; padding: 14px 0 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px;
  font-size: 15px; color: var(--ink); }
.limits li { display: flex; align-items: center; gap: 10px; }
.limits svg { width: 17px; height: 17px; flex: none; color: var(--ok); }
@media (max-width: 900px) {
  .plans { grid-template-columns: 1fr; max-width: 460px; width: 100%; margin: 0 auto; }
  .card--plans { padding: 26px 18px; }
}
@media (max-width: 480px) {
  .period-switch { grid-template-columns: repeat(4, 1fr); width: 100%; }
  .period-switch button { padding: 0 4px; font-size: 13px; }
  /* Room for the theme switch above the card. */
  .page { padding-top: 64px; }
}
.testband { background: var(--test-bg); color: var(--test-ink); text-align: center; font-size: 12.5px; font-weight: 700;
  padding: 6px 10px; border-radius: 6px; }
.checkout { display: grid; grid-template-columns: 1fr 1fr; gap: 0; padding: 0; overflow: hidden; }
.checkout__sum { padding: 28px 26px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.checkout__pay { padding: 28px 26px; display: flex; flex-direction: column; gap: 8px; }
.checkout__brand { font-weight: 700; color: var(--dim); }
.checkout__amount { font-size: 34px; font-weight: 800; margin: 0; }
.checkout__line { display: flex; justify-content: space-between; gap: 12px; font-size: 14.5px; border-top: 1px solid var(--line); padding-top: 10px; font-variant-numeric: tabular-nums; }
.checkout__line.is-minus span:last-child { color: var(--ok); }
.checkout__total { font-size: 16px; }
.checkout__note { margin: 0; color: var(--dim); font-size: 13.5px; }
.cardbox { border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--field); }
.cardbox input { border: none; border-radius: 0; background: transparent; }
/* Inside the card box the focus ring is drawn inside each field, so the box does not cut it off. */
.cardbox input:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--accent); }
.cardbox__row { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); }
.cardbox__row input + input { border-left: 1px solid var(--line); }
.fine { font-size: 12px; color: var(--dim); margin: 6px 0 0; text-align: center; }
.theme-switch { position: absolute; top: 16px; right: 16px; width: 64px; height: 34px; padding: 0; border-radius: 99px;
  border: 1px solid var(--line); background: var(--field); cursor: pointer; }
.theme-switch__knob { position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; display: grid;
  place-items: center; background: var(--accent); color: #1a1406; transition: transform .25s ease; }
:root:is([data-theme="light"], [data-theme="spark"]) .theme-switch__knob { transform: translateX(30px) rotate(180deg); }
.theme-switch svg { width: 15px; height: 15px; }
.theme-switch .th-sun, :root:is([data-theme="light"], [data-theme="spark"]) .theme-switch .th-moon { display: none; }
:root:is([data-theme="light"], [data-theme="spark"]) .theme-switch .th-sun { display: block; }
[hidden] { display: none !important; }
/* Admin panel */
.page--wide { align-items: flex-start; padding: 64px 16px 16px; }
.admin { width: 100%; align-self: flex-start; }
.admin__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.tile { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--sunk); }
.tile b { display: block; font-size: 22px; }
.tile span { color: var(--dim); font-size: 12.5px; }
button.tile { font: inherit; text-align: left; color: var(--ink); cursor: pointer; }
.tile--near.has { border-color: var(--accent); }
.tile--near.has b { color: var(--link); }
button.tile:hover { border-color: var(--accent); }
button.tile.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, var(--sunk)); }
button.tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
td.lv--amber { color: var(--link); font-weight: 700; }
td.lv--red { color: var(--bad); font-weight: 700; }
.remind { border: 1px solid var(--accent); border-radius: 8px; padding: 10px 12px; background: var(--test-bg); color: var(--ink); }
.tbl-wrap { scrollbar-color: var(--line) var(--sunk); scrollbar-width: thin; }
/* Search boxes in the table's heading: a magnifier, rounded, amber when in use. */
.tsearch { width: 100%; min-width: 120px; box-sizing: border-box; padding: 7px 10px 7px 30px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--field) no-repeat 9px 50% / 14px 14px; color: var(--ink);
  font: inherit; font-size: 13px; text-transform: none; letter-spacing: 0; font-weight: 400;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2398a1b3' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='10.5' cy='10.5' r='6.5'/%3E%3Cpath d='M15.5 15.5 21 21'/%3E%3C/svg%3E"); }
.tsearch::placeholder { color: var(--dim); text-transform: uppercase; letter-spacing: .05em; font-size: 11.5px; }
.tsearch:hover { border-color: var(--dim); }
.tsearch:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(251,191,36,.18); }
.tsearch:not(:placeholder-shown) { border-color: var(--accent); }
.tbl-wrap { overflow: auto; max-height: 62vh; border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { position: sticky; top: 0; background: var(--head); text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--dim); padding: 8px; border-bottom: 1px solid var(--line); }
td { padding: 7px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td.wrap { white-space: normal; }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover td { background: var(--hover); }
.st { font-weight: 700; }
.st--active { color: var(--ok); } .st--ended { color: var(--accent); } .st--frozen { color: var(--bad); } .st--pending { color: var(--dim); }
/* A payment to check (admin panel): the danger colours, small, under the state. */
.flag { display: inline-block; margin-top: 4px; padding: 1px 8px; border-radius: 99px; font-size: 12px; font-weight: 700;
  background: var(--bad-bg); color: var(--bad); border: 1px solid var(--bad-line); }
.small { padding: 5px 10px; font-size: 12.5px; }
/* The admin table's last column: an on/off switch (green = active, grey = frozen) and a delete button. */
.act__in { display: flex; align-items: center; gap: 6px; }
/* The admin table's action columns: one icon each, centred, as narrow as the icon. */
th.act, td.act { width: 1%; padding-left: 4px; padding-right: 4px; text-align: center; white-space: nowrap; }
td.act > * { vertical-align: middle; }
/* The plan-limits mark: green within limits, orange from 80%, red at or over a limit, grey with no plan. */
.qmark { display: inline-grid; place-items: center; width: 26px; height: 26px; cursor: default; }
.qmark svg { width: 22px; height: 22px; }
.qmark--ok { color: var(--ok); }
.qmark--near { color: #f59e0b; }
:root:is([data-theme="light"], [data-theme="spark"]) .qmark--near { color: #d97706; }
.qmark--over { color: var(--bad-line); }
:root:is([data-theme="light"], [data-theme="spark"]) .qmark--over { color: #dc2626; }
.qmark--none { color: var(--dim); opacity: .6; }
.sw { position: relative; width: 40px; height: 22px; flex: none; padding: 0; border: 0; border-radius: 99px; cursor: pointer;
  background: var(--line); transition: background-color .15s ease; }
.sw::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: transform .15s ease; }
.sw[aria-checked="true"] { background: var(--ok); }
.sw[aria-checked="true"]::after { transform: translateX(18px); }
.sw:focus-visible, .icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; flex: none; padding: 0; border: 1px solid transparent;
  border-radius: 6px; background: none; color: var(--dim); cursor: pointer; transition: color .15s ease, border-color .15s ease, background-color .15s ease; }
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn--bad:hover { color: var(--bad); border-color: var(--bad-line); background: var(--bad-bg); }
.btn--danger { border: none; background: var(--bad); color: var(--panel); }
/* The delete confirmation: the app's own card over a dimmed page. */
dialog.del { width: min(460px, calc(100% - 32px)); padding: 26px 24px; color: var(--ink); }
dialog.del:not([open]) { display: none; }
dialog.del::backdrop { background: rgba(0,0,0,.55); }
dialog.del form { display: flex; flex-direction: column; gap: 10px; }
.del__list { margin: 0; padding: 12px 14px 12px 32px; border: 1px solid var(--line); border-radius: 8px; background: var(--sunk);
  display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.del__warn { margin: 0; color: var(--bad); font-weight: 600; font-size: 13.5px; }
.del__btns { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.del__btns .btn { min-height: 42px; }
@media (max-width: 700px) {
  .checkout { grid-template-columns: 1fr; }
  .checkout__sum { border-right: none; border-bottom: 1px solid var(--line); }
}
@media (prefers-reduced-motion: reduce) { .theme-switch__knob { transition: none; } .msg--work::before { animation: none; } }
