/*
 * Captive portal styling.
 *
 * System fonts, no web fonts and no images: every byte here
 * is downloaded over a throttled link by a subscriber who has not been able to
 * use the network yet. What colour and depth there is comes from gradients and
 * borders, which cost nothing beyond the text you are reading.
 *
 * Layout is mobile-first because effectively every intercepted device is a
 * phone, and widens at two breakpoints so the same markup reads well on a
 * laptop without a second stylesheet or a second page.
 *
 * Colors and semantic states come from theme-tokens.css. Layout and component
 * rules remain here; a saved account preference overrides the system theme.
 */

:root {
  scrollbar-width: none;
  --divider-fade: linear-gradient(
    90deg,
    transparent,
    var(--line) 5%,
    var(--line) 95%,
    transparent
  );
  --night-owl-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cpath d='M12 8l10 8a24 24 0 0120 0l10-8-2 17a23 23 0 01-6 31L32 62 20 56a23 23 0 01-6-31L12 8zm12 16a7 7 0 100 14 7 7 0 000-14zm16 0a7 7 0 100 14 7 7 0 000-14zM27 42l5 8 5-8-5 3-5-3z'/%3E%3C/svg%3E");
  --radius: 14px;
  --radius-sm: 9px;
  --measure: 70rem;
  /* Spacing scale: every margin/gap that separates blocks of content should
     reference one of these instead of a hand-picked rem value, so the
     rhythm of the whole page can be tuned from one place. */
  --space-2xs: 0.25rem;
  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
}

:root::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.captive-loading {
  display: none;
}

.captive-entry:not(.captive-ready) .captive-loading {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 1.25rem;
  padding: 1.5rem;
  background: var(--bg);
  color: var(--muted);
  text-align: center;
}

.captive-loading p {
  margin: 0;
}

.captive-loading-mark {
  position: relative;
  display: grid;
  width: 5.25rem;
  height: 5.25rem;
  place-items: center;
}

.captive-loading-mark::after {
  position: absolute;
  inset: 0;
  border: 3px solid var(--line);
  border-top-color: var(--brand);
  border-radius: 50%;
  content: "";
  animation: captive-spin 0.9s linear infinite;
}

.captive-loading-mark img {
  width: 3.25rem;
  height: auto;
}

.captive-loading-mark img + img {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .captive-loading-mark img:first-child {
    display: none;
  }

  :root:not([data-theme="light"]) .captive-loading-mark img + img {
    display: block;
  }
}

:root[data-theme="dark"] .captive-loading-mark img:first-child {
  display: none;
}

:root[data-theme="dark"] .captive-loading-mark img + img {
  display: block;
}

@keyframes captive-spin {
  to {
    transform: rotate(1turn);
  }
}

@media (prefers-reduced-motion: reduce) {
  .captive-loading-mark::after {
    animation-duration: 2.5s;
  }
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand-logo-light {
    display: none;
  }

  :root:not([data-theme="light"]) .brand-logo-dark {
    display: block;
  }
}

:root[data-theme="dark"] .brand-logo-light {
  display: none;
}

:root[data-theme="dark"] .brand-logo-dark {
  display: block;
}

* {
  box-sizing: border-box;
}

/*
 * The hidden attribute is how every panel, drawer and banner on this page is
 * shown and hidden from script. Only the user-agent stylesheet sets it, so any
 * author rule that gives the same element a display value silently defeats it
 * and the element stays on screen with nothing anywhere reporting a fault.
 */
[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 0;
  font-family:
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
}

a {
  color: var(--brand-strong);
}

h1,
h2,
h3 {
  line-height: 1.25;
  letter-spacing: -0.015em;
}

/* --------------------------------------------------------------------------
   Masthead
   -------------------------------------------------------------------------- */

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 0.6rem 1rem;
  background: var(--brand-accent);
  color: var(--brand-ink);
  border-radius: 0 0 var(--radius-sm) 0;
  z-index: 10;
}

.skip-link:focus {
  left: 0;
}

.masthead {
  position: sticky;
  top: 0;
  z-index: 5;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.masthead-inner {
  max-width: calc(var(--measure) + 8rem);
  margin: 0 auto;
  padding: 0.7rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: inherit;
}

.brand-mark {
  display: block;
}

.brand-logo {
  display: block;
  height: 24px;
  width: auto;
}

.masthead .brand-logo {
  height: 32px;
}

/* Only one of the pair renders per theme; the other is removed from layout
   rather than merely hidden, so the header never lays out for both. */
.brand-logo-dark {
  display: none;
}

.masthead-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

.icon-button {
  color: var(--ink-soft);
}

.ghost-button {
  padding: var(--space-xs) var(--control-padding-inline);
  border: 1px solid var(--line-strong);
  border-radius: var(--control-radius);
  background: transparent;
  color: var(--ink);
  font-size: var(--control-font-size);
  font-weight: var(--control-font-weight);
}

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */

main {
  flex: 1;
  width: 100%;
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 1rem;
}

main.is-dashboard {
  max-width: 74rem;
}

.partner-callout {
  background: var(--surface-2);
}

.partner-callout > a {
  display: inline-block;
  text-align: center;
  text-decoration: none;
}

@media (min-width: 48rem) {
  .partner-callout {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-xl);
  }

  .partner-callout > div {
    max-width: 65%;
  }

  .partner-callout > a {
    flex: none;
    margin-top: 0;
  }
}

.section {
  margin: 2.5rem 0;
}

/* Same fallback pattern as `.card`: a section's direct children (the head,
   a grid of plan cards, a list, ...) get a default gap unless the child
   declares its own margin. */
:where(.section) > * + * {
  margin-top: var(--space-lg);
}

.section-head {
  margin-bottom: 1rem;
}

.section-head h2 {
  margin: 0;
  font-size: 1.25rem;
}

.section-head .hint {
  margin-top: 0.15rem;
}

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */

.hero {
  margin: 1.5rem 0 2rem;
  padding: 2rem 1.35rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background:
    radial-gradient(120% 120% at 100% 0%, var(--bg-tint) 0%, transparent 60%),
    linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  box-shadow: var(--shadow-md);
}

.eyebrow {
  margin: 0 0 0.6rem;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brand);
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.75rem, 6vw, 2.9rem);
}

.hero-lead {
  margin: 0.9rem 0 0;
  max-width: 34rem;
  color: var(--ink-soft);
  font-size: 1.02rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1.5rem;
}

.hero-actions .primary,
.hero-actions .secondary {
  width: auto;
  margin-top: 0;
  min-width: 10rem;
}

/* --------------------------------------------------------------------------
   Value grid
   -------------------------------------------------------------------------- */

.value-grid {
  display: grid;
  gap: 1rem;
  margin: 2rem 0;
}

.value {
  padding: 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.value-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: var(--radius-sm);
  background: var(--brand-wash);
  color: var(--brand);
  font-size: 1.1rem;
}

.value h2 {
  margin: 0.7rem 0 0.35rem;
  font-size: 1.02rem;
}

.value p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

/* --------------------------------------------------------------------------
   Steps
   -------------------------------------------------------------------------- */

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.9rem;
}

.steps li {
  display: flex;
  gap: 0.9rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.step-number {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 999px;
  background: var(--brand-accent);
  color: var(--brand-ink);
  font-weight: 700;
  font-size: 0.9rem;
}

.steps h3 {
  margin: 0 0 0.2rem;
  font-size: 0.98rem;
}

.steps p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

/* --------------------------------------------------------------------------
   Plan cards (landing)
   -------------------------------------------------------------------------- */

.plan-grid {
  display: grid;
  gap: var(--space-md);
  margin-top: var(--space-md);
}

.plan-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 1.2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.plan-card.is-featured {
  border-color: var(--brand);
  box-shadow: var(--shadow-md);
}

.plan-card.is-active {
  border-color: var(--ok);
  box-shadow:
    0 0 0 2px color-mix(in srgb, var(--ok) 18%, transparent),
    var(--shadow-md);
}

.plan-card.is-queued {
  border-color: color-mix(in srgb, var(--warn) 45%, var(--line));
  background: color-mix(in srgb, var(--warn-bg) 72%, var(--surface));
}

.plan-badge {
  position: absolute;
  top: -0.7rem;
  left: 1.2rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: var(--brand-accent);
  color: var(--brand-ink);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.plan-badge-queued {
  background: var(--warn);
  color: var(--surface);
}

.plan-card h3 {
  margin: 0;
  font-size: 1.05rem;
}

.plan-price {
  margin: 0.5rem 0 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.account-plan-price {
  font-size: 1.15rem;
}

.account-plan-price::after {
  content: "";
  display: block;
  width: 2.25rem;
  height: 1px;
  margin-top: 0.65rem;
  background: var(--divider-fade);
}

.account-plan-price + .plan-summary {
  margin-top: 0;
}

.plan-meta {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.plan-summary {
  color: var(--ink-soft);
  font-weight: 600;
}

.plan-points {
  list-style: disc;
  margin: 0.9rem 0 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.plan-points li::marker {
  color: var(--brand);
}

.account-plan-points {
  list-style: none;
  padding-left: 0;
}

.account-plan-points li {
  position: relative;
  padding-left: 1.15rem;
}

.account-plan-points li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--brand);
  font-weight: 700;
}

.plan-card-action {
  width: fit-content;
  align-self: center;
  margin: auto auto 0;
  padding: 0.48rem 0.72rem;
  font-size: 0.86rem;
}

.plan-grid .plan-card,
.current-plan-card {
  min-height: 17rem;
}

.current-plan-card #auto-renew-row {
  margin-top: 0;
}

.auto-pay-control {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.auto-pay-label {
  font-size: 0.82rem;
  font-weight: 700;
}

.switch {
  display: inline-flex;
  margin: 0;
  cursor: pointer;
}

.switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.switch-track {
  position: relative;
  display: block;
  width: 2.65rem;
  height: 1.5rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-2);
  transition:
    background 120ms ease,
    border-color 120ms ease;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 0.17rem;
  left: 0.18rem;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: var(--muted);
  transition:
    transform 120ms ease,
    background 120ms ease;
}

.switch input:checked + .switch-track {
  border-color: var(--ok);
  background: var(--ok-bg);
}

.switch input:checked + .switch-track::after {
  background: var(--ok);
  transform: translateX(1.08rem);
}

.switch input:focus-visible + .switch-track {
  outline: 3px solid color-mix(in srgb, var(--brand) 28%, transparent);
  outline-offset: 2px;
}

.current-plan-card #auto-renew-detail {
  margin: 1rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

/* --------------------------------------------------------------------------
   Cards, dashboard
   -------------------------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem;
  margin: 1rem 0;
  box-shadow: var(--shadow-sm);
}

.card h2 {
  margin: 0 0 0.6rem;
  font-size: 1.05rem;
}

/* Every direct child of a card gets breathing room from the one before it.
   This is spacing-by-adjacency: whatever markup lands inside a card (a
   hint, a label, an input, a grid of plan cards, a button) is separated
   consistently, so a new child added later never has to invent its own
   top margin to avoid crowding the previous one.
   `:where()` keeps this rule at zero specificity on purpose: it is a
   fallback. Any element that needs a different gap (.hint, label, ...)
   simply declares its own margin-top and wins automatically, without an
   order-dependent specificity fight against this default. */
:where(.card) > * + * {
  margin-top: var(--space-md);
}

.card h2 + * {
  margin-top: var(--space-2xs);
}

.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.card-header-row h2 {
  margin: 0;
}

.card-header-row + * {
  margin-top: 0.6rem;
}

.link-button {
  background: none;
  border: 0;
  padding: 0;
  color: var(--brand);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: underline;
}

.auth-card {
  max-width: 30rem;
  margin: 0;
  max-height: min(90vh, 46rem);
  overflow-y: auto;
}

.account-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin: 1.5rem 0 0.5rem;
}

.account-bar h1 {
  margin: 0;
  font-size: 1.4rem;
}

#view-dashboard.has-night-owl {
  position: relative;
  isolation: isolate;
}

#view-dashboard.has-night-owl::before {
  content: "";
  position: fixed;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  background: var(--night-owl-motif);
  -webkit-mask:
    var(--night-owl-mask) 5% 6% / 4.25rem 4.25rem no-repeat,
    var(--night-owl-mask) 38% 3% / 2.5rem 2.5rem no-repeat,
    var(--night-owl-mask) 69% 9% / 7.5rem 7.5rem no-repeat,
    var(--night-owl-mask) 93% 2% / 3.25rem 3.25rem no-repeat,
    var(--night-owl-mask) 20% 15% / 5.75rem 5.75rem no-repeat,
    var(--night-owl-mask) 51% 18% / 3rem 3rem no-repeat,
    var(--night-owl-mask) 84% 21% / 9rem 9rem no-repeat,
    var(--night-owl-mask) 7% 27% / 2.75rem 2.75rem no-repeat,
    var(--night-owl-mask) 32% 31% / 8rem 8rem no-repeat,
    var(--night-owl-mask) 62% 28% / 4.5rem 4.5rem no-repeat,
    var(--night-owl-mask) 96% 35% / 2.25rem 2.25rem no-repeat,
    var(--night-owl-mask) 16% 39% / 6.75rem 6.75rem no-repeat,
    var(--night-owl-mask) 46% 42% / 3.5rem 3.5rem no-repeat,
    var(--night-owl-mask) 76% 38% / 5.25rem 5.25rem no-repeat,
    var(--night-owl-mask) 4% 50% / 9.5rem 9.5rem no-repeat,
    var(--night-owl-mask) 29% 54% / 2.5rem 2.5rem no-repeat,
    var(--night-owl-mask) 58% 50% / 7rem 7rem no-repeat,
    var(--night-owl-mask) 88% 57% / 3.75rem 3.75rem no-repeat,
    var(--night-owl-mask) 13% 64% / 4rem 4rem no-repeat,
    var(--night-owl-mask) 40% 61% / 8.5rem 8.5rem no-repeat,
    var(--night-owl-mask) 69% 67% / 2.75rem 2.75rem no-repeat,
    var(--night-owl-mask) 95% 63% / 6rem 6rem no-repeat,
    var(--night-owl-mask) 2% 75% / 3.25rem 3.25rem no-repeat,
    var(--night-owl-mask) 25% 72% / 5rem 5rem no-repeat,
    var(--night-owl-mask) 54% 78% / 9rem 9rem no-repeat,
    var(--night-owl-mask) 82% 74% / 4.5rem 4.5rem no-repeat,
    var(--night-owl-mask) 14% 88% / 7.5rem 7.5rem no-repeat,
    var(--night-owl-mask) 43% 91% / 3rem 3rem no-repeat,
    var(--night-owl-mask) 70% 86% / 5.75rem 5.75rem no-repeat,
    var(--night-owl-mask) 94% 94% / 8.75rem 8.75rem no-repeat;
  mask:
    var(--night-owl-mask) 5% 6% / 4.25rem 4.25rem no-repeat,
    var(--night-owl-mask) 38% 3% / 2.5rem 2.5rem no-repeat,
    var(--night-owl-mask) 69% 9% / 7.5rem 7.5rem no-repeat,
    var(--night-owl-mask) 93% 2% / 3.25rem 3.25rem no-repeat,
    var(--night-owl-mask) 20% 15% / 5.75rem 5.75rem no-repeat,
    var(--night-owl-mask) 51% 18% / 3rem 3rem no-repeat,
    var(--night-owl-mask) 84% 21% / 9rem 9rem no-repeat,
    var(--night-owl-mask) 7% 27% / 2.75rem 2.75rem no-repeat,
    var(--night-owl-mask) 32% 31% / 8rem 8rem no-repeat,
    var(--night-owl-mask) 62% 28% / 4.5rem 4.5rem no-repeat,
    var(--night-owl-mask) 96% 35% / 2.25rem 2.25rem no-repeat,
    var(--night-owl-mask) 16% 39% / 6.75rem 6.75rem no-repeat,
    var(--night-owl-mask) 46% 42% / 3.5rem 3.5rem no-repeat,
    var(--night-owl-mask) 76% 38% / 5.25rem 5.25rem no-repeat,
    var(--night-owl-mask) 4% 50% / 9.5rem 9.5rem no-repeat,
    var(--night-owl-mask) 29% 54% / 2.5rem 2.5rem no-repeat,
    var(--night-owl-mask) 58% 50% / 7rem 7rem no-repeat,
    var(--night-owl-mask) 88% 57% / 3.75rem 3.75rem no-repeat,
    var(--night-owl-mask) 13% 64% / 4rem 4rem no-repeat,
    var(--night-owl-mask) 40% 61% / 8.5rem 8.5rem no-repeat,
    var(--night-owl-mask) 69% 67% / 2.75rem 2.75rem no-repeat,
    var(--night-owl-mask) 95% 63% / 6rem 6rem no-repeat,
    var(--night-owl-mask) 2% 75% / 3.25rem 3.25rem no-repeat,
    var(--night-owl-mask) 25% 72% / 5rem 5rem no-repeat,
    var(--night-owl-mask) 54% 78% / 9rem 9rem no-repeat,
    var(--night-owl-mask) 82% 74% / 4.5rem 4.5rem no-repeat,
    var(--night-owl-mask) 14% 88% / 7.5rem 7.5rem no-repeat,
    var(--night-owl-mask) 43% 91% / 3rem 3rem no-repeat,
    var(--night-owl-mask) 70% 86% / 5.75rem 5.75rem no-repeat,
    var(--night-owl-mask) 94% 94% / 8.75rem 8.75rem no-repeat;
}

#plans-hero {
  position: relative;
}

#view-dashboard.has-night-owl #plans-hero {
  min-height: 6.25rem;
  padding: 1rem 8.5rem 1rem 1.1rem;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--night-owl) 24%, var(--line));
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 100% 0%, var(--night-owl-wash), transparent 58%),
    var(--surface);
  box-shadow: var(--shadow-sm);
}

.night-owl-mode {
  position: absolute;
  top: 50%;
  right: 1.2rem;
  display: grid;
  justify-items: center;
  gap: var(--space-2xs);
  color: var(--night-owl);
  transform: translateY(-50%);
}

.night-owl-mode span {
  width: 3rem;
  height: 3rem;
  background: currentColor;
  filter: drop-shadow(
    0 2px 5px color-mix(in srgb, var(--night-owl) 25%, transparent)
  );
  -webkit-mask: var(--night-owl-mask) center / contain no-repeat;
  mask: var(--night-owl-mask) center / contain no-repeat;
}

.night-owl-mode strong {
  font-size: 0.76rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

#view-dashboard.has-night-owl #status-card {
  position: relative;
  overflow: visible;
  background:
    radial-gradient(circle at 100% 0%, var(--night-owl-wash), transparent 38%),
    var(--surface);
}

#view-dashboard.has-night-owl #status-card::after {
  content: "";
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2.8rem;
  height: 2.8rem;
  background: var(--night-owl);
  -webkit-mask: var(--night-owl-mask) center / contain no-repeat;
  mask: var(--night-owl-mask) center / contain no-repeat;
}

.current-balance-summary {
  display: grid;
  gap: var(--space-md);
  margin-top: var(--space-md);
  overflow: visible;
}

.current-balance-summary h3 {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 0.95rem;
}

.current-balance-summary .progress-block {
  margin: 0;
}

.anytime-balance-block,
.night-balance-block {
  padding: var(--space-sm);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.anytime-balance-block {
  border-color: color-mix(in srgb, var(--brand) 20%, var(--line));
  background: color-mix(in srgb, var(--brand-wash) 48%, var(--surface));
}

.night-balance-block {
  position: relative;
  z-index: 10;
  overflow: visible;
  border-color: color-mix(in srgb, var(--night-owl) 28%, var(--line));
  background: color-mix(in srgb, var(--night-owl-wash) 62%, var(--surface));
}

#usage-hero-card .night-balance-block .balance-head {
  align-items: baseline;
}

#usage-hero-card .night-balance-block .balance-head > span {
  white-space: nowrap;
}

#usage-hero-card .night-window-note {
  margin-top: var(--space-xs);
}

#status-card .night-balance-block {
  padding: 0;
  border: 0;
  background: transparent;
}

.dashboard-grid {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem;
}

.dashboard-grid .card {
  margin: 0;
}

/* --------------------------------------------------------------------------
   Account menu
   -------------------------------------------------------------------------- */

.menu-button {
  gap: var(--control-gap);
}

.menu-button:hover {
  border-color: var(--brand);
}

.menu-icon {
  display: inline-flex;
  flex-direction: column;
  justify-content: space-between;
  width: 1rem;
  height: 0.7rem;
}

.menu-icon span {
  display: block;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
}

.menu-button-label {
  white-space: nowrap;
}

/*
 * Only ever seen behind the drawer, so it is never on screen at a width where
 * the menu is a column instead.
 */
.menu-scrim {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgb(8 12 16 / 45%);
}

/*
 * Narrow screens: a drawer over the page, entering from the right where the
 * thumb already is. Wide screens: the column defined further down, on the
 * left beside the content. One element either way, so there is only ever one
 * set of navigation state to keep in step with the section on screen.
 */
.account-menu {
  position: fixed;
  z-index: 50;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(19rem, 86vw);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1rem;
  overflow-y: auto;
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: -18px 0 40px rgb(8 12 16 / 22%);
}

.dashboard-layout {
  display: grid;
  gap: 1.5rem;
}

.dashboard-main {
  min-width: 0;
}

.themed-scrollbar {
  width: 0.5rem;
  padding: 0.1rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--line-strong) 55%, transparent);
  pointer-events: none;
}

.themed-scrollbar > span {
  display: block;
  width: 100%;
  min-height: 2.5rem;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--brand-bright), var(--brand));
  box-shadow: 0 1px 5px color-mix(in srgb, var(--brand) 35%, transparent);
  will-change: transform;
}

.portal-scrollbar {
  position: fixed;
  z-index: 15;
  top: 0.5rem;
  right: 0.3rem;
  bottom: 0.5rem;
}

@media (max-width: 39.999rem) {
  .portal-scrollbar {
    display: none;
  }
}

.portal-section {
  display: grid;
  gap: 1rem;
}

.portal-section-header {
  min-height: 4.25rem;
  padding: 0 0.15rem;
}

.portal-section-header h1 {
  margin: 0;
  font-size: clamp(1.45rem, 4vw, 1.8rem);
  line-height: 1.15;
}

.portal-section-header p {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.portal-section-body {
  width: 100%;
}

.settings-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
}

.settings-heading .ui-control {
  border-color: transparent;
  background: transparent;
}

.settings-heading .ui-control:hover {
  background: var(--surface-2);
}

@media (min-width: 40rem) {
  #panel-settings .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  #panel-settings .span-wide {
    grid-column: 1 / -1;
  }
}

.account-menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.4rem;
}

.account-menu-title {
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.account-menu-foot {
  display: grid;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.account-menu-foot .ghost-button {
  width: 100%;
}

.section-tab {
  flex: none;
  width: 100%;
  padding: 0.7rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}

.section-tab:hover {
  border-color: var(--brand);
}

.section-tab.is-active {
  background: var(--brand-accent);
  border-color: transparent;
  color: var(--brand-ink);
  box-shadow: var(--shadow-sm);
}

/*
 * The drawer slides rather than appearing, so it reads as covering the page
 * it came from. Anyone who has asked not to see motion gets neither.
 */
@media (prefers-reduced-motion: no-preference) {
  .account-menu {
    animation: menu-in 160ms ease-out;
  }

  .menu-scrim {
    animation: scrim-in 160ms ease-out;
  }
}

@keyframes menu-in {
  from {
    transform: translateX(100%);
  }
}

@keyframes scrim-in {
  from {
    opacity: 0;
  }
}

/*
 * Wide screens: the menu stops being something you open and becomes a column
 * beside the content, sticky so it stays reachable down a long settings page.
 *
 * The breakpoint is where a 15rem column still leaves the cards a comfortable
 * measure. Below it the content would be squeezed to pay for navigation that
 * is only occasionally used, which is the wrong trade.
 */
@media (min-width: 62rem) {
  .dashboard-layout {
    grid-template-columns: 15rem minmax(0, 1fr);
    align-items: start;
  }

  .dashboard-main {
    margin-top: -0.5rem;
  }

  /*
   * The column comes first in the source as well as on screen, so tabbing
   * through the page reaches the navigation before the content it controls
   * rather than after everything it could have skipped.
   */
  .account-menu {
    position: sticky;
    /* Clears the sticky nav bar it would otherwise slide under. */
    top: 5rem;
    z-index: 1;
    right: auto;
    bottom: auto;
    width: auto;
    max-height: calc(100vh - 7rem);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    animation: none;
  }

  /* Nothing to close: the column is not covering anything. */
  #account-menu-close {
    display: none;
  }
}

.pill {
  display: inline-block;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.pill-ok {
  background: var(--ok-bg);
  border-color: transparent;
  color: var(--ok);
}

.pill-warn {
  background: var(--warn-bg);
  border-color: transparent;
  color: var(--warn);
}

.pill-error {
  background: var(--error-bg);
  border-color: transparent;
  color: var(--error);
}

.record {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--line);
}

.record:last-child {
  border-bottom: 0;
}

#usage-sessions-body {
  max-height: 22rem;
  overflow-y: auto;
  overflow-x: clip;
  padding: 0.35rem 1.2rem 0.35rem 0.55rem;
  scrollbar-width: none;
}

#payments-body {
  max-height: 30rem;
  overflow-y: auto;
  overflow-x: clip;
  padding: 0.35rem 1.2rem 0.35rem 0.55rem;
  scrollbar-width: none;
}

#payments-body::-webkit-scrollbar,
#usage-sessions-body::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.history-scroll-shell {
  position: relative;
}

.history-scrollbar {
  position: absolute;
  z-index: 1;
  top: 0.35rem;
  right: 0.15rem;
  bottom: 0.35rem;
}

.record-compact {
  padding: 0.5rem 0 0.25rem 1.1rem;
  font-size: 0.85rem;
  position: relative;
  border-bottom: none;
  border-radius: var(--radius-sm);
  background-image: var(--divider-fade);
  background-repeat: no-repeat;
  background-position: bottom center;
  background-size: 90% 1px;
  transition: transform 160ms ease;
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .record-compact:hover {
    transform: scale(1.012);
  }
}

.record-compact::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.9rem;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: var(--brand);
  z-index: 1;
}

.record-compact::after {
  content: "";
  position: absolute;
  left: 0.3rem;
  top: 1.5rem;
  bottom: -0.9rem;
  width: 1px;
  background: var(--line);
}

.record-compact:last-child::after {
  display: none;
}

.record-compact:last-child {
  background-image: none;
}

.record-compact .hint {
  font-size: 0.78rem;
}

.record-compact .record-amount {
  font-size: 0.85rem;
}

.history-record-info {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.history-record-title {
  font-weight: 600;
}

.history-record-time {
  color: var(--muted);
  font-size: 0.78rem;
}

.history-record-time::before {
  content: "•";
  margin-right: 0.35rem;
  opacity: 0.5;
}

.history-record-outcome {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.history-record {
  align-items: flex-start;
}

.payment-record {
  padding-bottom: var(--space-sm);
}

.history-record-content {
  min-width: 0;
}

.payment-record-payer {
  margin-top: var(--space-2xs);
  color: var(--muted);
}

.history-record-outcome {
  flex: 0 0 auto;
}

.session-active-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--ok);
  font-size: 0.78rem;
  font-weight: 600;
}

.session-active-glyph {
  display: inline-grid;
  place-items: center;
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  background-color: var(--ok);
}

.session-active-glyph svg {
  display: block;
  width: 0.68rem;
  height: 0.68rem;
  fill: none;
  stroke: var(--surface);
  stroke-width: 2.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-toggle {
  background: none;
  border: 0;
  padding: 0.2rem;
  color: var(--brand);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-toggle svg {
  transition: transform 150ms ease;
  transform: rotate(180deg);
}

.icon-toggle[aria-expanded="false"] svg {
  transform: rotate(0deg);
}

.record-amount {
  font-weight: 700;
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Forms and buttons
   -------------------------------------------------------------------------- */

label {
  display: block;
  margin: 0.85rem 0 0.3rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.field {
  display: block;
}

.field-label {
  display: block;
  margin-bottom: 0.3rem;
}

.consent-control {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
}

.consent-control input {
  width: auto;
  margin-top: 0.2rem;
  flex: 0 0 auto;
}

.legal-page {
  width: min(var(--measure), calc(100% - 2rem));
  margin: 2rem auto;
}

.information-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-xs);
}

.information-nav a {
  color: var(--ink-soft);
}

.information-nav a:hover,
.information-faq #information-nav-faq,
.information-terms #information-nav-terms {
  background: var(--surface-2);
  color: var(--ink);
  box-shadow: inset 0 -2px var(--brand-accent);
}

.information-content {
  display: grid;
  gap: var(--space-lg);
}

.information-page-header {
  padding: clamp(0.25rem, 2vw, 1rem);
}

.information-page-header h1,
.information-section h2 {
  margin-top: 0;
}

.information-section {
  margin: 0;
  padding: clamp(1.25rem, 4vw, 2rem);
}

.legal-actions {
  display: grid;
  gap: var(--space-sm);
}

.legal-actions .as-button {
  margin-top: 0;
}

.faq-jump-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-top: var(--space-md);
}

.faq-jump-links a {
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
}

.faq-table-wrap {
  margin-top: var(--space-md);
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.faq-plan-table {
  width: 100%;
  min-width: 56rem;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.faq-plan-table th,
.faq-plan-table td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.faq-plan-table thead th {
  background: var(--surface-2);
  color: var(--ink-soft);
  font-size: 0.74rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.faq-plan-table tbody tr:last-child > * {
  border-bottom: 0;
}

.faq-legend {
  margin-top: var(--space-lg);
  padding: var(--space-md);
  border: 1px solid color-mix(in srgb, var(--brand) 20%, var(--line));
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--brand-wash) 45%, var(--surface));
}

.faq-legend h3 {
  margin: 0;
  font-size: 1rem;
}

.faq-legend dl,
.faq-glossary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: var(--space-sm) var(--space-lg);
  margin: var(--space-md) 0;
}

.faq-legend dl > div,
.faq-glossary > div {
  padding-left: var(--space-sm);
  border-left: 2px solid var(--brand);
}

.faq-legend dt,
.faq-glossary dt {
  font-weight: 700;
}

.faq-legend dd,
.faq-glossary dd {
  margin: var(--space-2xs) 0 0;
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.faq-legend > p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.faq-card details {
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--line);
}

.faq-card details:last-child {
  border-bottom: 0;
}

.faq-card summary {
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
}

.faq-card details p {
  margin: var(--space-sm) 0 0;
  color: var(--ink-soft);
}

input {
  width: 100%;
  padding: 0.75rem 0.8rem;
  font-size: 1rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink);
}

input:focus {
  border-color: var(--brand);
}

input:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

button {
  font: inherit;
  cursor: pointer;
}

.primary,
.as-button {
  position: relative;
  display: block;
  overflow: hidden;
  isolation: isolate;
  width: 100%;
  margin-top: var(--space-lg);
  padding: 0.8rem 1.1rem;
  border: 0;
  border-radius: var(--control-radius);
  background: var(--brand-accent);
  color: var(--brand-ink);
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}

/*
 * The hover "fill" is a full-width overlay that scales in from the left,
 * rather than a fixed-length inset box-shadow: a fixed length only ever
 * covers buttons narrower than that length, leaving any wider CTA (a
 * full-width card button, a wide hero button) visibly unfilled on hover.
 */
.primary::after,
.danger-button::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 180ms ease;
}

.primary::after {
  background: color-mix(in srgb, white 13%, transparent);
}

.primary,
.secondary,
.danger-button {
  transition:
    box-shadow 180ms ease,
    background-color 180ms ease,
    color 180ms ease,
    transform 180ms ease;
}

.primary:hover:not(:disabled),
.secondary:hover:not(:disabled),
.danger-button:hover:not(:disabled) {
  transform: translateY(-2px);
}

.primary:hover:not(:disabled) {
  box-shadow: var(--shadow-md);
}

.primary:hover:not(:disabled)::after,
.danger-button:hover:not(:disabled)::after {
  transform: scaleX(1);
}

.primary[disabled] {
  opacity: 0.55;
  cursor: progress;
}

.secondary {
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--control-radius);
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
}

.secondary:hover:not(:disabled) {
  background: var(--brand-accent);
  color: var(--brand-ink);
  box-shadow: var(--shadow-sm);
}

.secondary[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.link {
  border: 0;
  background: none;
  color: var(--brand);
  font-weight: 600;
  text-decoration: underline;
  padding: 0;
}

.tabs {
  display: flex;
  gap: 0.4rem;
  padding: 0.25rem;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  margin-bottom: 0.75rem;
}

.tab {
  flex: 1;
  padding: 0.55rem 0.5rem;
  border: 0;
  border-radius: 999px;
  background: none;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--muted);
}

.tab.is-active {
  color: var(--brand-ink);
  background: var(--brand-accent);
  box-shadow: var(--shadow-sm);
}

/* --------------------------------------------------------------------------
   Notices, meters, rows
   -------------------------------------------------------------------------- */

.hint {
  margin: var(--space-xs) 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.notice {
  margin: 1rem 0;
  padding: 0.8rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 0.92rem;
}

.notice-error {
  background: var(--error-bg);
  border-color: transparent;
  color: var(--error);
}

.notice-ok {
  background: var(--ok-bg);
  border-color: transparent;
  color: var(--ok);
}

.notice-warn {
  background: var(--warn-bg);
  border-color: transparent;
  color: var(--warn);
}

.meter {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
  margin: 0.5rem 0 0.25rem;
}

#status-card .meter {
  height: 20px;
  margin-top: 0.7rem;
}

.meter-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  transition:
    width 180ms ease,
    background 180ms ease;
}

.meter.is-healthy > .meter-fill {
  background: var(--ok);
}

.meter.is-warning > .meter-fill {
  background: var(--warn);
}

.meter.is-critical > .meter-fill {
  background: var(--error);
}

.meter.category-social > .meter-fill {
  background: var(--category-social);
}

.meter.category-streaming > .meter-fill {
  background: var(--category-streaming);
}

.meter.category-browsing > .meter-fill {
  background: var(--category-browsing);
}

.meter.category-other > .meter-fill {
  background: var(--category-other);
}

.night-balance-block .meter {
  z-index: 11;
  height: var(--meter-thickness);
  overflow: visible;
  background: color-mix(in srgb, var(--night-owl) 10%, var(--line));
  transition: height 180ms ease;
}

#status-card .night-balance-block .meter {
  height: 20px;
}

#status-card .night-owl-meter-head {
  top: 42%;
  left: clamp(0.7rem, var(--meter-progress), 100%);
  width: 2.25rem;
  height: 2.25rem;
  transform: translate(-50%, -50%);
}

#usage-hero-card .night-owl-meter-head {
  top: 42%;
  left: clamp(0.55rem, var(--meter-progress), 100%);
}

.night-balance-block .meter > .meter-fill {
  background: color-mix(
    in srgb,
    var(--night-owl) var(--meter-intensity),
    var(--night-owl-wash)
  );
}

.meter-marker {
  position: absolute;
  z-index: 20;
  top: 50%;
  left: clamp(0.6rem, var(--meter-progress), calc(100% - 0.6rem));
  width: 1.75rem;
  height: 1.75rem;
  transform: translate(-50%, -50%);
  transition: left 180ms ease;
}

.night-owl-meter-head {
  background: var(--night-owl);
  filter: drop-shadow(
    0 1px 2px color-mix(in srgb, var(--night-owl) 35%, transparent)
  );
  -webkit-mask: var(--night-owl-mask) center / contain no-repeat;
  mask: var(--night-owl-mask) center / contain no-repeat;
}

#usage-hero-card {
  overflow: visible;
}

.pie-chart-wrap {
  display: grid;
  grid-template-columns: minmax(0, 220px) minmax(0, 1fr);
  align-items: center;
  justify-content: center;
  gap: clamp(1rem, 5vw, 2.5rem);
  margin: 1rem 0;
}

.pie-chart {
  width: 100%;
  height: auto;
  transform: rotate(-90deg);
}

.pie-track {
  fill: none;
  stroke: var(--line);
  stroke-width: 6;
}

.pie-slice {
  fill: none;
  stroke-width: 6;
}

.pie-chart-labels {
  display: grid;
  gap: 0;
}

.pie-chart-label {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0;
  font-size: 0.92rem;
}

.pie-chart-label:not(:last-child)::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 10%;
  width: 80%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    color-mix(in srgb, var(--line) 45%, transparent) 10%,
    color-mix(in srgb, var(--line) 45%, transparent) 90%,
    transparent
  );
}

.pie-chart-label strong {
  padding-right: 0.4rem;
  font-variant-numeric: tabular-nums;
}

.pie-chart-swatch {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
}

.pie-slice.category-social {
  stroke: var(--category-social);
}

.pie-chart-swatch.category-social {
  background: var(--category-social);
}

.pie-slice.category-streaming {
  stroke: var(--category-streaming);
}

.pie-chart-swatch.category-streaming {
  background: var(--category-streaming);
}

.pie-slice.category-browsing {
  stroke: var(--category-browsing);
}

.pie-chart-swatch.category-browsing {
  background: var(--category-browsing);
}

.pie-slice.category-other {
  stroke: var(--category-other);
}

.pie-chart-swatch.category-other {
  background: var(--category-other);
}

@media (max-width: 35rem) {
  .pie-chart-wrap {
    grid-template-columns: minmax(0, 200px);
  }
}

.link-inline {
  color: var(--brand);
  text-decoration: underline;
}

.balance {
  margin: 0.85rem 0;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--line);
}

.balance:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.balance-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.92rem;
  font-weight: 600;
}

.plan,
.device {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
}

.device-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.device-overview-list .device-card-copy,
.device-card-grid .device-card-copy {
  padding-right: 2.75rem;
}

.device-card-disconnect {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  display: grid;
  width: 2.25rem;
  height: 2.25rem;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--error);
  background: var(--surface);
  cursor: pointer;
}

.device-card-disconnect:hover:not(:disabled) {
  border-color: var(--error);
  background: var(--error-bg);
}

.device-card-disconnect:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.device-card-disconnect svg {
  width: 1.2rem;
  height: 1.2rem;
}

.device-card-disconnect:disabled {
  cursor: wait;
  opacity: 0.6;
}

.device-card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.device-card-grid .device-card:not(.device-card-placeholder) {
  display: grid;
  min-height: 12rem;
  grid-template-columns: 3rem minmax(0, 1fr);
  grid-template-rows: auto 1fr auto;
  align-items: start;
}

.device-card-grid
  .device-card:not(.device-card-placeholder)
  > .device-card-icon {
  grid-column: 1;
  grid-row: 1;
}

.device-card-grid
  .device-card:not(.device-card-placeholder)
  > .device-card-copy {
  grid-column: 2;
  grid-row: 1;
}

.device-card-grid
  .device-card:not(.device-card-placeholder)
  > .device-card-details {
  grid-column: 1 / -1;
  grid-row: 2;
}

.device-card-grid
  .device-card:not(.device-card-placeholder)
  > .device-card-actions {
  width: 100%;
  margin-top: 1rem;
  grid-column: 1 / -1;
  grid-row: 3;
  align-self: end;
}

.device-card-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.device-card-actions button {
  width: 100%;
}

.device-overview-list {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.device-count {
  display: inline-flex;
  margin: 0.25rem 0 0;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 750;
}

.device-count.is-safe {
  color: var(--ok);
  background: var(--ok-bg);
}

.device-count.is-warning {
  color: var(--warn);
  background: var(--warn-bg);
}

.device-count.is-full {
  color: var(--error);
  background: var(--error-bg);
}

.device-card-icon {
  display: grid;
  flex: 0 0 3rem;
  width: 3rem;
  height: 3rem;
  place-items: center;
  border-radius: 50%;
  background: var(--brand-wash);
}

.device-card-icon-glyph {
  display: block;
  width: 1.5rem;
  height: 1.5rem;
  background-color: var(--brand);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

.device-card-copy {
  min-width: 0;
  flex: 1;
}

.device-card-details {
  display: grid;
  justify-items: start;
  gap: 0.55rem;
  margin-top: 0.85rem;
}

.device-card-copy > .device-card-details {
  margin-top: 0.55rem;
}

.device-card-name {
  margin: 0;
  font-size: 1rem;
}

.device-card-mac {
  overflow-wrap: anywhere;
}

.device-card-usage {
  display: inline-flex;
  align-items: baseline;
  width: fit-content;
  gap: 0.32rem;
  margin-top: 0;
  padding: 0.28rem 0.55rem;
  border: 1px solid color-mix(in srgb, var(--brand) 18%, var(--line));
  border-radius: 999px;
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--brand) 10%, var(--surface-2)),
    var(--surface-2)
  );
  font-size: 0.78rem;
}

.device-card-usage-mark {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 12%, transparent);
}

.device-card-usage-value {
  color: var(--ink);
  font-weight: 800;
}

.device-card-usage-label {
  color: var(--muted);
}

.device-card-placeholder {
  min-height: 8.5rem;
  flex-direction: column;
  justify-content: center;
  gap: 0.35rem;
  color: var(--muted);
  border-style: dashed;
  background: transparent;
  text-align: center;
}

.device-card-add {
  display: grid;
  width: 3rem;
  height: 3rem;
  place-items: center;
  border-radius: 50%;
  color: var(--brand);
  background: var(--brand-wash);
  font-size: 2rem;
  font-weight: 300;
  line-height: 1;
}

.device-card-placeholder-label {
  font-size: 0.9rem;
  font-weight: 600;
}

.device-profile-fields {
  display: grid;
  gap: 0.75rem;
  margin: 1rem 0;
}

.device-profile-fields label {
  margin: 0;
}

.device-type-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(4.25rem, 1fr));
  gap: 0.5rem;
  margin-top: 0.4rem;
}

.device-type-option {
  display: grid;
  justify-items: center;
  gap: 0.35rem;
  padding: 0.6rem 0.4rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink);
}

.device-type-option.is-selected {
  border-color: var(--brand);
  background: var(--brand-wash);
}

.device-type-option-glyph {
  width: 1.35rem;
  height: 1.35rem;
  background-color: var(--ink);
}

.device-type-option.is-selected .device-type-option-glyph {
  background-color: var(--brand);
}

.device-type-option-label {
  font-size: 0.78rem;
  font-weight: 600;
}

@media (min-width: 48rem) {
  .device-card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.plan:last-child,
.device:last-child {
  border-bottom: 0;
}

.plan-name {
  font-weight: 600;
}

.plan-title {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
}

.plan-title h3 {
  margin: 0;
}

.plan-unlimited-badge {
  flex: 0 0 auto;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  color: var(--brand);
  background: var(--brand-wash);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.mono {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.85rem;
  color: var(--muted);
}

.footer {
  margin-top: 3rem;
  padding: 1.5rem 1rem;
  border-top: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.85rem;
}

.footer-inner {
  max-width: var(--measure);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}

.footer-links a {
  color: var(--ink-soft);
  text-underline-offset: 0.2em;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(4, 12, 10, 0.68);
}

.modal-card {
  width: min(100%, 28rem);
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.modal-card h2 {
  margin-top: 0;
}

.modal-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.modal-heading h2 {
  margin: 0;
}

.auth-modal-brand {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.auth-modal-brand .brand-logo {
  height: 30px;
}

.modal-close {
  flex: none;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.modal-close:hover {
  border-color: var(--brand);
}

.auth-card .tabs {
  margin-top: 1.25rem;
}

.text-button {
  display: block;
  margin: var(--space-md) auto 0;
  padding: 0.25rem;
  border: 0;
  background: transparent;
  color: var(--brand);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  cursor: pointer;
}

#panel-reset-pin h3 {
  margin: 1.25rem 0 0.35rem;
}

.purchase-summary {
  margin: 1rem 0 0;
  border-top: 1px solid var(--line);
}

.purchase-summary > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--line);
}

.purchase-summary dt {
  color: var(--muted);
}

.purchase-summary dd {
  margin: 0;
  font-weight: 700;
  text-align: right;
}

.purchase-confirm-specs {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin: var(--space-md) 0 0;
  text-align: center;
}

.purchase-confirm-specs span + span::before {
  content: "✦";
  margin-right: var(--space-xs);
  color: var(--brand);
  font-size: 0.65rem;
}

.purchase-features {
  list-style: none;
  margin: var(--space-md) 0 0;
  padding: 0;
  display: grid;
  justify-items: center;
  gap: var(--space-xs);
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.purchase-features li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-xs);
  align-items: baseline;
  width: fit-content;
  text-align: center;
}

.purchase-features li::before {
  content: "✦";
  color: var(--brand);
  font-size: 0.75rem;
}

.purchase-features strong {
  color: var(--ink);
  font-weight: 800;
}

.purchase-status {
  min-height: 1.35rem;
  margin: var(--space-md) 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.purchase-status.is-error {
  color: var(--error);
}

.purchase-status.is-success {
  color: var(--ok);
}

.payment-failure {
  display: inline-flex;
  gap: var(--space-2xs);
  align-items: center;
  color: var(--error);
}

.payment-failure::before {
  content: "!";
  display: inline-grid;
  width: 0.85rem;
  height: 0.85rem;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 0.56rem;
  font-weight: 800;
}

.modal-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.modal-actions button {
  display: inline-flex;
  min-height: 2.6rem;
  width: 100%;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0.6rem 0.9rem;
}

.footer p {
  margin: 0.2rem 0;
}

/* --------------------------------------------------------------------------
   Wider screens
   -------------------------------------------------------------------------- */

@media (min-width: 40rem) {
  main {
    padding: 0 1.5rem;
  }

  .hero {
    padding: 3rem 2.5rem;
  }

  .value-grid,
  .plan-grid {
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  }

  .current-balance-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .legal-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .footer-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .steps {
    grid-template-columns: repeat(3, 1fr);
  }

  .steps li {
    flex-direction: column;
  }
}

@media (min-width: 64rem) {
  .hero {
    padding: 4rem 3.5rem;
  }

  .hero-lead {
    font-size: 1.1rem;
  }

  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
    align-items: start;
  }

  .dashboard-grid .span-wide {
    grid-column: 1 / -1;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* A checkbox and its label read as one target, so the whole row is clickable. */
.check {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  margin-top: 0.9rem;
  cursor: pointer;
  font-weight: 500;
}

.check input {
  width: 1.15rem;
  height: 1.15rem;
  margin: 0;
  flex: none;
  accent-color: var(--brand);
  cursor: pointer;
}

/* --------------------------------------------------------------------------
   Closure
   -------------------------------------------------------------------------- */

/*
 * A pending closure is the one state worth interrupting the page for, so the
 * banner sits above the section tabs rather than inside the settings section
 * the subscriber may never open again before the grace period runs out.
 */
.banner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius);
  margin: 0 0 1rem;
  border: 1px solid transparent;
}

.banner p {
  margin: 0.25rem 0 0;
}

.banner-warn {
  background: var(--warn-bg);
  border-color: var(--warn);
  color: var(--warn);
}

.banner-warn strong {
  color: var(--warn);
}

.card-danger {
  border-color: var(--error);
}

.card-danger h2 {
  color: var(--error);
}

.danger-button {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background: var(--error);
  color: var(--error-ink);
  border: 1px solid var(--error);
  border-radius: var(--radius-sm);
  padding: 0.65rem 1.1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.danger-button::after {
  background: color-mix(in srgb, black 12%, var(--error));
}

.danger-button:hover:not(:disabled) {
  box-shadow: var(--shadow-sm);
}

@media (prefers-reduced-motion: reduce) {
  .primary,
  .secondary,
  .danger-button,
  .primary::after,
  .danger-button::after {
    transition: none;
  }

  .primary:hover:not(:disabled),
  .secondary:hover:not(:disabled),
  .danger-button:hover:not(:disabled) {
    transform: none;
  }
}

@media (max-width: 30rem) {
  .banner {
    flex-direction: column;
    align-items: stretch;
  }

  .banner button {
    width: 100%;
  }

  .modal-card {
    padding: 1.15rem;
  }

  .modal-actions {
    grid-template-columns: 1fr;
  }

  /* Confirm button appears after Cancel in the DOM; keep it on top when stacked. */
  .modal-actions .primary {
    order: -1;
  }
}

/* Holds the page still while an overlay above it is being read. */
body.menu-open,
body.auth-open {
  overflow: hidden;
}

body.menu-open #view-dashboard {
  position: relative;
  z-index: 6;
}

/*
 * How renewal will happen on this subscriber's mobile money network. Sits
 * under the auto-pay switch because it is the consequence of turning it on,
 * not a separate setting.
 */
#renewal-method {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.6rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}

#renewal-method p {
  margin: 0;
}

.masthead,
.current-plan-card #auto-renew-detail,
.account-menu-foot,
.record,
.balance,
.plan,
.device,
.footer,
.purchase-summary,
.purchase-summary > div,
#renewal-method {
  border-image: var(--divider-fade) 1;
}
