/* ============================================================================
   TvBeaver design system
   ----------------------------------------------------------------------------
   Deliberately distinct from the sibling player app (Sofabeam, which is a dark
   green/coral palette). This one is ink + violet with a cyan accent, so the two
   brands never read as related.

   The brand name is applied by JS from the server's BRAND_NAME, so nothing here
   depends on the working title.
   ========================================================================== */

:root {
  color-scheme: dark;

  /* Surfaces */
  --bg: #0b0d12;
  --surface: #12151c;
  --raised: #181c25;
  --line: #262b36;
  --line-strong: #333a48;

  /* Text */
  --text: #eceef3;
  --muted: #9aa3b2;
  --faint: #6b7484;

  /* Brand */
  --accent: #7c6cff;
  --accent-hover: #8d7fff;
  --accent-soft: #1c1a35;
  --accent-text: #b9b1ff;

  /* Feedback */
  --ok: #4ade80;
  --ok-soft: #10241a;
  --warn: #f0b64a;
  --warn-soft: #2a2113;
  --danger: #f87171;
  --danger-soft: #2a1517;

  /* Shape */
  --radius: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  /* Layout */
  --page: 1120px;
  --page-narrow: 720px;
  --gap: 20px;

  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 16px;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}

button, input, select, textarea { font: inherit; }
button, a, input, select, summary { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; color: inherit; }
button:disabled { opacity: 0.55; cursor: wait; }
a { color: inherit; text-decoration: none; }

button:focus-visible, a:focus-visible, input:focus-visible,
select:focus-visible, summary:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); line-height: 1.15; letter-spacing: -1.2px; font-weight: 650; margin-bottom: 14px; }
h2 { font-size: clamp(1.3rem, 2.5vw, 1.6rem); line-height: 1.25; letter-spacing: -0.5px; font-weight: 650; margin-bottom: 10px; }
h3 { font-size: 1.05rem; font-weight: 600; margin-bottom: 8px; }
p { color: var(--muted); margin-bottom: 14px; }

/* ---------------------------------------------------------------- layout -- */

.page { width: min(100% - 40px, var(--page)); margin-inline: auto; }
.page-narrow { width: min(100% - 40px, var(--page-narrow)); margin-inline: auto; }
.stack > * + * { margin-top: var(--gap); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }

/* --------------------------------------------------------------- header --- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.site-header .page { display: flex; align-items: center; gap: 20px; height: 62px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 650; letter-spacing: -0.3px; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 8px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), #4dc9ff);
  display: grid; place-items: center;
  color: #0b0d12; font-size: 14px; font-weight: 800;
}
.site-nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.site-nav a {
  padding: 7px 11px; border-radius: 8px; font-size: 0.92rem; color: var(--muted);
}
.site-nav a:hover { color: var(--text); background: var(--raised); }
.site-nav a[aria-current="page"] { color: var(--text); background: var(--raised); }
@media (max-width: 620px) { .site-nav .hide-sm { display: none; } }

/* -------------------------------------------------------------- buttons --- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: 10px; border: 1px solid transparent;
  font-size: 0.94rem; font-weight: 550; white-space: nowrap;
  transition: background 120ms ease, border-color 120ms ease, opacity 120ms ease;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary { background: var(--raised); border-color: var(--line-strong); color: var(--text); }
.btn-secondary:hover:not(:disabled) { background: var(--line); }
.btn-ghost { background: transparent; border-color: var(--line-strong); color: var(--muted); }
.btn-ghost:hover:not(:disabled) { color: var(--text); background: var(--raised); }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: var(--danger-soft); }
.btn-lg { padding: 13px 22px; font-size: 1rem; border-radius: 12px; }
.btn-block { width: 100%; }

/* ---------------------------------------------------------------- cards --- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px;
}
.card-raised { background: var(--raised); }
.card + .card { margin-top: var(--gap); }
.card-header { margin-bottom: 16px; }
.card-header h2, .card-header h3 { margin-bottom: 4px; }
.card-header p { margin-bottom: 0; }

.grid { display: grid; gap: var(--gap); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

/* --------------------------------------------------------------- forms ---- */

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 0.86rem; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
.input, .select, .textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px;
  background: var(--bg); border: 1px solid var(--line-strong); color: var(--text);
}
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); outline: none; }
.textarea { min-height: 84px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.88rem; }
.field-hint { font-size: 0.82rem; color: var(--faint); margin-top: 5px; }
.checkbox { display: flex; gap: 9px; align-items: flex-start; font-size: 0.9rem; color: var(--muted); }
.checkbox input { margin-top: 3px; }

/* --------------------------------------------------------------- badges --- */

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: var(--radius-pill);
  font-size: 0.78rem; font-weight: 550; letter-spacing: 0.2px;
  background: var(--raised); color: var(--muted); border: 1px solid var(--line-strong);
}
.badge-ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.badge-warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.badge-danger { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.badge-accent { background: var(--accent-soft); color: var(--accent-text); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }

/* --------------------------------------------------------------- alerts --- */

.alert {
  padding: 12px 14px; border-radius: 10px; font-size: 0.9rem;
  border: 1px solid var(--line-strong); background: var(--raised); color: var(--muted);
}
.alert-error { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, transparent); color: #ffc9c9; }
.alert-ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 30%, transparent); color: #b9f5cf; }
.alert-warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); color: #f7dcae; }
.alert:empty { display: none; }

/* ------------------------------------------------------------ credentials - */

.cred {
  display: grid; grid-template-columns: 132px 1fr auto; gap: 10px;
  align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line);
}
.cred:last-child { border-bottom: 0; }
.cred-label { font-size: 0.84rem; color: var(--muted); }
.cred-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.86rem; word-break: break-all; color: var(--text);
}
@media (max-width: 560px) {
  .cred { grid-template-columns: 1fr; gap: 4px; }
  .cred .btn { justify-self: start; }
}

/* ---------------------------------------------------------------- tables -- */

.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.table th { color: var(--muted); font-weight: 550; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.5px; }
.table tbody tr:hover { background: var(--surface); }
.table-wrap { overflow-x: auto; }

/* ----------------------------------------------------------------- hero --- */

.hero { padding: clamp(48px, 8vw, 88px) 0 clamp(32px, 5vw, 56px); }
.hero h1 { max-width: 18ch; }
.hero p.lead { font-size: 1.08rem; max-width: 58ch; color: var(--muted); }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.8rem; font-weight: 600; letter-spacing: 0.6px; text-transform: uppercase;
  color: var(--accent-text); margin-bottom: 14px;
}

/* -------------------------------------------------------------- pricing --- */

.plan {
  display: flex; flex-direction: column; gap: 14px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 22px;
}
.plan-featured { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-soft); }
.plan-name { font-size: 1.05rem; font-weight: 650; }
.plan-price { font-size: 2rem; font-weight: 700; letter-spacing: -1px; }
.plan-price small { font-size: 0.9rem; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.plan-compare { color: var(--faint); text-decoration: line-through; font-size: 0.9rem; }
.plan-features { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.plan-features li { display: flex; gap: 9px; align-items: flex-start; font-size: 0.9rem; color: var(--muted); }
.plan-features li::before { content: "✓"; color: var(--ok); font-weight: 700; flex-shrink: 0; }
.plan .btn { margin-top: auto; }

/* ----------------------------------------------------------------- misc --- */

.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 0.86rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.nowrap { white-space: nowrap; }
.divider { height: 1px; background: var(--line); border: 0; margin: 24px 0; }
.spinner {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid color-mix(in srgb, currentColor 30%, transparent);
  border-top-color: currentColor; animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2s; }
  * { scroll-behavior: auto !important; }
}

.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 64px; padding: 28px 0 40px;
  font-size: 0.88rem; color: var(--faint);
}
.site-footer .row { gap: 18px; }
.site-footer a:hover { color: var(--text); }

.legal { max-width: 74ch; }
.legal h2 { margin-top: 32px; }
.legal h3 { margin-top: 22px; color: var(--text); }
.legal ul { color: var(--muted); padding-left: 20px; }
.legal li { margin-bottom: 6px; }
.legal .updated { font-size: 0.86rem; color: var(--faint); margin-bottom: 28px; }

/* Skeleton for content that is still loading. */
.skeleton {
  background: linear-gradient(90deg, var(--raised) 25%, var(--line) 37%, var(--raised) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: 6px; min-height: 1em;
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* Print the credentials section cleanly; customers do print these. */
@media print {
  .site-header, .site-footer, .btn, .no-print { display: none !important; }
  body { background: #fff; color: #000; }
  .card { border-color: #ccc; }
  .cred-value { color: #000; }
}
