/* ==========================================================================
   DoDo Panel Store — shared interface system

   Loaded by public/dashboard.html, public/admin.html and (as a base layer)
   public/index.html, which adds css/landing.css on top.

   This is the app-side skin of the public landing page: warm paper, ink rules,
   Instrument Serif display type, mono micro-labels, gold reserved for value and
   primary actions, and ticket / hard-offset details. Class names used by
   app.js and admin.js are part of the contract with the scripts; do not rename
   them.
   ========================================================================== */

:root {
  /* Paper */
  --paper: #f7f3e9;
  --paper-raised: #fffdf7;
  --paper-sunken: #efe9db;

  /* Ink */
  --ink: #191509;
  --ink-2: #4a4436;
  --ink-3: #6d6555;

  /* Rules */
  --rule: #ddd3bf;
  --rule-strong: #c6b99e;

  /* Gold — value, selection, primary action */
  --gold: #d99500;
  --gold-hover: #c08500;
  --gold-soft: #f3e2b8;
  --gold-ink: #7d5400;

  /* Night — inverted panels */
  --night: #17130b;
  --night-2: #221c11;
  --night-3: #2e2617;
  --night-text: #f6f0e2;
  --night-muted: #bcb098;
  --night-rule: #3b3221;
  --night-gold: #e9b64a;

  /* Semantic */
  --text-on-dark: #fffdf7;

  --success: #067647;
  --success-hover: #05603a;
  --success-bg: #eefaf3;
  --success-line: #a9e3c2;

  --danger: #b42318;
  --danger-hover: #912018;
  --danger-bg: #fdf1ef;
  --danger-line: #f2c2bc;

  --warning: #8a5b00;
  --warning-bg: #fdf6e5;
  --warning-line: #ecd7a8;

  --info: #4a4436;
  --info-bg: #f2eee3;
  --info-line: #ddd3bf;

  /* Type */
  --serif: 'Instrument Serif', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: var(--gold-soft);
  color: var(--ink);
}

h1,
h2,
h3 {
  font-weight: 400;
}

.content-overlay {
  min-height: 100vh;
}

/* --------------------------------------------------------------------------
   Top strip (shared with the public page)
   -------------------------------------------------------------------------- */

.topbar {
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: 100%;
  max-width: 1240px;
  min-height: 34px;
  margin: 0 auto;
  padding: 0 32px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.topbar-brand {
  color: var(--ink-2);
  white-space: nowrap;
}

.topbar-brand span {
  color: var(--gold-ink);
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.topbar-meta span[aria-hidden] {
  color: var(--gold);
}

/* --------------------------------------------------------------------------
   Navigation
   -------------------------------------------------------------------------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(247, 243, 233, 0.94);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--ink);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: 100%;
  max-width: 1240px;
  height: 64px;
  margin: 0 auto;
  padding: 0 32px;
}

.nav-brand {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  flex-shrink: 0;
  color: var(--ink);
  text-decoration: none;
}

.brand-text {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.01em;
  white-space: nowrap;
  color: var(--ink);
}

.brand-tag {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  white-space: nowrap;
}

.nav-brand:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.nav-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.wallet-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 13px 0 8px;
  background: var(--paper-raised);
  border: 1px solid var(--rule-strong);
  border-radius: 4px;
}

.wallet-icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 3px;
  background: var(--gold-soft);
  color: var(--gold-ink);
}

.wallet-icon svg {
  width: 13px;
  height: 13px;
}

.wallet-info {
  display: flex;
  align-items: baseline;
  gap: 7px;
}

.wallet-label {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.wallet-amount {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-left: 16px;
  border-left: 1px solid var(--rule);
}

.nav-meta > .nav-user:first-child {
  padding-left: 0;
  border-left: 0;
}

.user-name {
  max-width: 180px;
  overflow: hidden;
  font-size: 13.5px;
  color: var(--ink-2);
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 34px 32px 56px;
}

.grid {
  display: grid;
  gap: 20px;
}

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

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

/* --------------------------------------------------------------------------
   Page header and tabs
   -------------------------------------------------------------------------- */

.page-header {
  margin-bottom: 24px;
}

.header-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.page-kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-ink);
}

.kicker-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 27px;
  height: 20px;
  padding: 0 6px;
  border: 1px solid var(--rule-strong);
  border-radius: 3px;
  font-size: 9.5px;
  letter-spacing: 0.08em;
  color: var(--ink-3);
}

.header-title-group h1 {
  font-family: var(--serif);
  font-size: clamp(30px, 3.4vw, 42px);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -0.015em;
  color: var(--ink);
}

.header-title-group h1 em {
  font-style: italic;
  color: var(--gold-ink);
}

.header-subtitle {
  max-width: 56ch;
  margin-top: 10px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-2);
}

.tabs {
  display: flex;
  align-items: stretch;
  gap: 24px;
  margin-top: 22px;
  overflow-x: auto;
  border-bottom: 1px solid var(--ink);
  scrollbar-width: thin;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: -1px;
  padding: 12px 2px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--ink-2);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.tab svg {
  flex: none;
  width: 15px;
  height: 15px;
  color: var(--ink-3);
  transition: color 0.15s ease;
}

.tab:hover {
  color: var(--ink);
}

.tab:hover svg {
  color: var(--gold-ink);
}

.tab.active {
  color: var(--ink);
  font-weight: 600;
  border-bottom-color: var(--gold);
}

.tab.active svg {
  color: var(--gold-ink);
}

.tab:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.tab .badge {
  height: 19px;
  margin-left: 2px;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* --------------------------------------------------------------------------
   Cards
   -------------------------------------------------------------------------- */

.card {
  background: var(--paper-raised);
  border: 1px solid var(--rule-strong);
  border-radius: 5px;
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px 15px;
  border-bottom: 1px solid var(--rule);
}

.card-title {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.card-subtitle {
  margin-top: 5px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.card-body {
  padding: 22px;
}

.card-body-flush {
  padding: 0;
}

/* --------------------------------------------------------------------------
   Overview
   -------------------------------------------------------------------------- */

.welcome-card {
  position: relative;
  overflow: hidden;
  background: var(--night);
  border-color: var(--night);
  box-shadow: 6px 6px 0 var(--gold-soft);
}

.welcome-card::after {
  content: '';
  position: absolute;
  right: -110px;
  bottom: -150px;
  width: 300px;
  height: 300px;
  border: 1px solid var(--night-rule);
  border-radius: 50%;
  pointer-events: none;
}

.welcome-card .card-body {
  position: relative;
  z-index: 1;
  padding: 30px;
}

.welcome-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(240px, 0.8fr);
  gap: 40px;
  align-items: center;
}

.welcome-content h2 {
  font-family: var(--serif);
  font-size: clamp(28px, 3vw, 38px);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.015em;
  color: var(--night-text);
}

.welcome-content h2 span {
  font-style: italic;
  color: var(--night-gold);
}

.welcome-content p {
  max-width: 54ch;
  margin: 12px 0 20px;
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--night-muted);
}

.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quick-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--rule-strong);
  border-radius: 4px;
  background: var(--paper-raised);
  color: var(--ink-2);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.quick-link svg {
  flex: none;
  width: 14px;
  height: 14px;
  color: var(--gold-ink);
}

.quick-link:hover {
  background: var(--paper-sunken);
  border-color: var(--ink);
  color: var(--ink);
}

.quick-link:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.welcome-card .quick-link {
  border-color: var(--night-rule);
  background: transparent;
  color: var(--night-text);
}

.welcome-card .quick-link svg {
  color: var(--night-gold);
}

.welcome-card .quick-link:hover {
  background: var(--night-2);
  border-color: var(--night-muted);
  color: #fffdf7;
}

.welcome-card .quick-link:focus-visible {
  outline-color: var(--night-gold);
}

/* Balance ticket inside the dark overview panel --------------------------- */

.balance-showcase {
  position: relative;
  padding: 22px 22px 20px;
  background: var(--paper-raised);
  border: 1px solid var(--night-rule);
  border-radius: 4px;
  box-shadow: 6px 6px 0 var(--night-3);
}

.balance-showcase::before,
.balance-showcase::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  border-radius: 50%;
  background: var(--night);
}

.balance-showcase::before {
  left: -8px;
}

.balance-showcase::after {
  right: -8px;
}

.balance-label {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.balance-value {
  margin-top: 8px;
  font-family: var(--serif);
  font-size: 44px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.balance-unit {
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-ink);
}

/* --------------------------------------------------------------------------
   Purchase
   -------------------------------------------------------------------------- */

.purchase-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 20px;
  align-items: start;
}

.purchase-layout > .grid {
  gap: 20px;
}

.summary-stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.summary-stack > .card:first-child {
  border: 1.5px solid var(--ink);
  box-shadow: 6px 6px 0 var(--gold-soft);
}

/* Wallet: form on the left, wide enough for the history table on the right */
.wallet-grid {
  grid-template-columns: minmax(0, 420px) minmax(0, 1fr);
}

#generatedKeys.card {
  border: 1.5px solid var(--ink);
  box-shadow: 6px 6px 0 var(--paper-sunken);
}

@media (min-width: 1101px) {
  .summary-stack {
    position: sticky;
    top: 88px;
  }
}

.duration-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.pricing-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 14px 14px;
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: 4px;
  text-align: left;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}

.pricing-card:hover {
  background: var(--paper-sunken);
  border-color: var(--ink-3);
}

.pricing-card.active {
  background: var(--gold-soft);
  border-color: var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
}

.pricing-card:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.pricing-days {
  font-family: var(--serif);
  font-size: 24px;
  line-height: 1;
  color: var(--ink);
}

.pricing-cost {
  margin-top: 7px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.pricing-card.active .pricing-cost {
  color: var(--gold-ink);
  font-weight: 500;
}

.pricing-check {
  position: absolute;
  top: 12px;
  right: 12px;
  display: none;
  width: 15px;
  height: 15px;
  color: var(--gold-ink);
}

.pricing-card.active .pricing-check {
  display: block;
}

/* Access level */

.access-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.access-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}

.access-option:not(.disabled):hover {
  background: var(--paper-sunken);
  border-color: var(--ink-3);
}

.access-option.active {
  background: var(--gold-soft);
  border-color: var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
}

.access-option:focus-within {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.access-option.disabled {
  background: var(--paper-sunken);
  border-color: var(--rule);
  border-style: dashed;
  cursor: not-allowed;
}

.access-option.disabled .access-name {
  color: var(--ink-3);
}

.access-option.disabled .access-desc {
  color: var(--ink-3);
}

.access-radio {
  flex: none;
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--gold-ink);
  cursor: inherit;
}

.access-info {
  flex: 1;
  min-width: 0;
}

.access-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.access-desc {
  font-size: 13px;
  color: var(--ink-2);
}

.access-option .badge {
  flex: none;
}

.combo-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 14px;
  padding-left: 12px;
  border-left: 2px solid var(--gold);
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-2);
}

.combo-note svg {
  flex: none;
  width: 15px;
  height: 15px;
  margin-top: 1px;
  color: var(--gold-ink);
}

/* Order summary — folded into a ticket rule set */

.order-summary {
  display: flex;
  flex-direction: column;
  margin: 14px 0 16px;
  padding: 4px 0 0;
  background: transparent;
  border: 0;
  border-top: 1px solid var(--ink);
  border-radius: 0;
}

.summary-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px dotted var(--rule);
  font-size: 13.5px;
  color: var(--ink-3);
}

.summary-row span:first-child {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.summary-row span:last-child {
  color: var(--ink);
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.summary-row.total {
  margin-top: 6px;
  padding-top: 14px;
  border-top: 1px solid var(--ink);
  border-bottom: 0;
}

.summary-row.total span:first-child {
  color: var(--ink-2);
}

.summary-row.total span:last-child {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.01em;
  color: var(--gold-ink);
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 42px;
  padding: 0 18px;
  border: 1px solid var(--ink);
  border-radius: 4px;
  background: var(--gold);
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--ink);
  transition: background 0.14s ease, transform 0.14s ease, box-shadow 0.14s ease;
}

.btn-primary:hover {
  background: var(--gold-hover);
  transform: translate(1px, 1px);
  box-shadow: 2px 2px 0 var(--ink);
}

.btn-primary:active {
  transform: translate(3px, 3px);
  box-shadow: 0 0 0 var(--ink);
}

.btn-primary:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: 2px 2px 0 var(--ink);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--rule-strong);
  border-radius: 4px;
  background: transparent;
  color: var(--ink-2);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn-ghost:hover {
  background: var(--paper-raised);
  border-color: var(--ink);
  color: var(--ink);
}

.btn-ghost:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.btn-ghost:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 29px;
  padding: 0 9px;
  border: 1px solid var(--rule-strong);
  border-radius: 3px;
  background: var(--paper);
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.11em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.btn-copy:hover {
  background: var(--gold-soft);
  border-color: var(--gold-ink);
  color: var(--gold-ink);
}

.btn-copy:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.btn-copy:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-success {
  background: var(--success);
  border-color: var(--success);
  color: var(--text-on-dark, #fffdf7);
}

.btn-success:hover {
  background: var(--success-hover);
  border-color: var(--success-hover);
  color: #fffdf7;
}

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: var(--text-on-dark, #fffdf7);
}

.btn-danger:hover {
  background: var(--danger-hover);
  border-color: var(--danger-hover);
  color: #fffdf7;
}

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  margin-bottom: 7px;
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.form-input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: 4px;
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.form-input::placeholder {
  color: var(--ink-3);
  opacity: 1;
}

.form-input:hover {
  border-color: var(--ink-3);
}

.form-input:focus {
  outline: none;
  background: var(--paper-raised);
  border-color: var(--ink);
  box-shadow: 0 0 0 3px var(--gold-soft);
}

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */

.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

.table thead th {
  padding: 12px 22px;
  background: transparent;
  border-bottom: 1px solid var(--ink);
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.13em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.table tbody td {
  padding: 14px 22px;
  border-bottom: 1px solid var(--rule);
  color: var(--ink-2);
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
  vertical-align: middle;
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table tbody tr:hover {
  background: rgba(25, 21, 9, 0.035);
}

.table tbody td strong {
  color: var(--ink);
  font-weight: 600;
}

.table-primary {
  color: var(--ink);
  font-weight: 600;
}

.table-link {
  color: var(--gold-ink);
  font-weight: 500;
  text-decoration: none;
  text-underline-offset: 3px;
}

.table-link:hover {
  text-decoration: underline;
}

.table-link:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Token amounts inside tables — emphasis, not another accent colour */
.amount {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.empty-state {
  padding: 44px 20px;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-align: center;
  text-transform: uppercase;
}

/* Wins over `.table tbody td` when the empty state is rendered inside a cell. */
.table tbody td.empty-state {
  padding: 44px 20px;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-align: center;
  text-transform: uppercase;
}

/* --------------------------------------------------------------------------
   Badges — outlined mono chips
   -------------------------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border: 1px solid transparent;
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 8.5px;
  font-weight: 500;
  letter-spacing: 0.1em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge-success {
  background: var(--success-bg);
  border-color: var(--success-line);
  color: var(--success);
}

.badge-warning {
  background: var(--warning-bg);
  border-color: var(--warning-line);
  color: var(--warning);
}

.badge-danger {
  background: var(--danger-bg);
  border-color: var(--danger-line);
  color: var(--danger);
}

.badge-info {
  background: var(--info-bg);
  border-color: var(--info-line);
  color: var(--ink-2);
}

.badge-neutral {
  background: var(--paper-sunken);
  border-color: var(--rule);
  color: var(--ink-3);
}

/* --------------------------------------------------------------------------
   License keys — night ticket rows
   -------------------------------------------------------------------------- */

.key-display {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 7px 7px 14px;
  background: var(--night);
  border: 1px solid var(--night-rule);
  border-radius: 4px;
}

.key-text {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  color: #f2ead9;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: 0.03em;
}

.key-display .btn-copy {
  flex: none;
  background: transparent;
  border-color: var(--night-rule);
  color: var(--night-gold);
}

.key-display .btn-copy:hover {
  background: var(--night-2);
  border-color: var(--night-muted);
  color: var(--night-gold);
}

.key-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* --------------------------------------------------------------------------
   Alerts
   -------------------------------------------------------------------------- */

.alert {
  display: none;
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-left-width: 3px;
  border-radius: 4px;
  font-size: 13px;
  line-height: 1.55;
}

.alert.show {
  display: block;
}

.alert-success {
  background: var(--success-bg);
  border-color: var(--success-line);
  border-left-color: var(--success);
  color: #0a5b39;
}

.alert-error {
  background: var(--danger-bg);
  border-color: var(--danger-line);
  border-left-color: var(--danger);
  color: #8f1d14;
}

.alert-info {
  background: var(--info-bg);
  border-color: var(--info-line);
  border-left-color: var(--ink-2);
  color: var(--ink-2);
}

/* --------------------------------------------------------------------------
   Auth — the ticket
   -------------------------------------------------------------------------- */

.auth-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 35px);
  padding: 56px 20px;
}

.auth-wrapper::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(25, 21, 9, 0.14) 1px, transparent 1.2px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(ellipse 58% 54% at 50% 46%, #000 22%, transparent 74%);
  mask-image: radial-gradient(ellipse 58% 54% at 50% 46%, #000 22%, transparent 74%);
  pointer-events: none;
}

.auth-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  background: var(--paper-raised);
  border: 1.5px solid var(--ink);
  border-radius: 5px;
  box-shadow: 10px 10px 0 var(--gold-soft);
}

.auth-header {
  position: relative;
  padding: 30px 28px 22px;
  border-bottom: 1px dashed var(--rule-strong);
  text-align: center;
}

.auth-header::before,
.auth-header::after {
  content: '';
  position: absolute;
  bottom: -9px;
  z-index: 2;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--paper);
}

.auth-header::before {
  left: -9px;
}

.auth-header::after {
  right: -9px;
}

.auth-logo {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 9px;
  margin-bottom: 7px;
}

.auth-logo .brand-text {
  font-size: 31px;
}

.auth-logo .brand-tag {
  font-size: 9px;
}

.auth-subtitle {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.auth-body {
  padding: 24px 28px 28px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin-bottom: 20px;
  padding: 0;
  overflow: hidden;
  background: transparent;
  border: 1px solid var(--ink);
  border-radius: 4px;
}

.auth-tab {
  height: 38px;
  padding: 0 8px;
  border: 0;
  border-right: 1px solid var(--rule-strong);
  border-radius: 0;
  background: transparent;
  color: var(--ink-2);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.auth-tab:last-child {
  border-right: 0;
}

.auth-tab:hover {
  background: var(--paper-sunken);
  color: var(--ink);
}

.auth-tab.active {
  background: var(--gold);
  color: var(--ink);
  font-weight: 600;
}

.auth-tab:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: -3px;
}

/* --------------------------------------------------------------------------
   Admin stat blocks
   -------------------------------------------------------------------------- */

.stat-value {
  font-family: var(--serif);
  font-size: 46px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   Footer strip
   -------------------------------------------------------------------------- */

.desk-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 24px;
  margin-top: 44px;
  padding-top: 16px;
  border-top: 1px solid var(--ink);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.desk-footer a {
  color: var(--ink-2);
  text-decoration: none;
}

.desk-footer a:hover {
  color: var(--gold-ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.desk-footer a:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

/* --------------------------------------------------------------------------
   Modal (admin balance adjustment)
   -------------------------------------------------------------------------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(23, 19, 11, 0.55);
}

.modal-card {
  width: 100%;
  max-width: 420px;
  background: var(--paper-raised);
  border: 1.5px solid var(--ink);
  border-radius: 5px;
  box-shadow: 12px 12px 0 rgba(23, 19, 11, 0.22);
}

.modal-close {
  width: 32px;
  height: 32px;
  padding: 0;
  border-color: transparent;
  background: transparent;
  color: var(--ink-3);
}

.modal-close:hover {
  background: var(--paper-sunken);
  border-color: transparent;
  color: var(--ink);
}

.modal-close svg {
  width: 16px;
  height: 16px;
}

.modal-lede {
  margin-bottom: 16px;
  font-size: 14px;
  color: var(--ink-2);
}

.modal-lede strong {
  color: var(--ink);
  font-weight: 600;
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 4px;
}

.modal-actions .btn-primary,
.modal-actions .btn-ghost {
  flex: 1;
  width: auto;
}

/* --------------------------------------------------------------------------
   Utility
   -------------------------------------------------------------------------- */

.hidden {
  display: none !important;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1240px) {
  .wallet-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 1100px) {
  .purchase-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .welcome-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 26px;
  }

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

@media (max-width: 860px) {
  .nav-inner,
  .container,
  .topbar-inner {
    padding-left: 20px;
    padding-right: 20px;
  }

  /* The meta line is the first thing to go: next to the full wordmark it
     needs roughly 790px of content, so it overflows before 860px. */
  .topbar-meta {
    display: none;
  }

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

  .header-title-group h1 {
    font-size: 32px;
  }

  .table {
    min-width: 640px;
  }

  .table thead th,
  .table tbody td {
    padding-left: 16px;
    padding-right: 16px;
  }
}

@media (max-width: 720px) {
  .nav-inner {
    height: 60px;
    gap: 12px;
    padding: 0 16px;
  }
  .container,
  .topbar-inner {
    padding-left: 16px;
    padding-right: 16px;
  }

  .container {
    padding-top: 24px;
    padding-bottom: 40px;
  }

  .brand-text {
    font-size: 23px;
  }

  .wallet-label {
    display: none;
  }

  .nav-meta {
    gap: 10px;
  }

  .nav-user {
    gap: 8px;
    padding-left: 10px;
  }

  .user-name {
    max-width: 110px;
  }

  .page-kicker {
    margin-bottom: 10px;
  }

  .page-header {
    margin-bottom: 20px;
  }

  .header-title-group h1 {
    font-size: 28px;
  }

  .header-subtitle {
    margin-top: 8px;
    font-size: 13px;
  }

  .tabs {
    gap: 18px;
  }

  .tab {
    padding: 11px 2px;
    font-size: 13.5px;
  }

  .card-header {
    padding: 16px 18px 13px;
  }

  .card-title {
    font-size: 20px;
  }

  .card-body {
    padding: 18px;
  }

  .welcome-card .card-body {
    padding: 22px;
  }

  .auth-wrapper {
    padding: 40px 16px;
  }

  .auth-header {
    padding: 26px 22px 20px;
  }

  .auth-body {
    padding: 22px;
  }

  .modal {
    padding: 16px;
  }
}

/* Between 421px and 600px the app nav carries the wordmark, desk tag, wallet
   badge and sign-out together; the desk tag is what gives way first. */
@media (max-width: 600px) {
  .nav .brand-tag {
    display: none;
  }
}

@media (max-width: 420px) {
  .brand-tag {
    display: none;
  }

  /* Shorter measure for the full wordmark so it never crowds the wallet
     and the sign-out control out of the bar on small phones. */
  .brand-text {
    font-size: 20px;
  }

  .nav-user {
    gap: 6px;
    padding-left: 8px;
  }

  .header-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .duration-grid {
    grid-template-columns: repeat(auto-fill, minmax(124px, 1fr));
  }

  .summary-row.total span:last-child {
    font-size: 25px;
  }

  .balance-value {
    font-size: 40px;
  }
}

/* Very small phones (360-380px): trim the bar instead of letting the
   wallet and sign-out controls push past the viewport. */
@media (max-width: 380px) {
  .nav-inner {
    gap: 8px;
    padding: 0 12px;
  }

  .nav-meta {
    gap: 8px;
  }

  .wallet-badge {
    gap: 8px;
    padding: 0 10px 0 7px;
  }

  .brand-text {
    font-size: 18px;
  }
}

/* Rare sub-360px screens: let the bar break into two rows (wordmark, then
   wallet + account) rather than force a horizontal scrollbar. */
@media (max-width: 340px) {
  .nav-inner {
    flex-wrap: wrap;
    height: auto;
    padding-top: 8px;
    padding-bottom: 8px;
    row-gap: 2px;
  }

  .nav-meta {
    width: 100%;
    justify-content: space-between;
  }
}

@media (prefers-reduced-motion: reduce) {  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }

  .btn-primary:hover,
  .btn-primary:active {
    transform: none;
  }
}
