:root {
  --font-heading: "Montserrat", sans-serif;
  --font-body: "Inter", sans-serif;
  --font-mono: "Fira Mono", monospace;

  --font-size-h1: 2rem;
  --font-size-h2: 1.5rem;
  --font-size-h3: 1.15rem;
  --font-size-body: 1rem;
  --font-size-small: 0.875rem;
  --font-size-xs: 0.75rem;

  --line-height-h1: 1.2;
  --line-height-h2: 1.3;
  --line-height-h3: 1.4;
  --line-height-body: 1.6;

  --space-section: 28px;
  --space-card: 14px;
  --space-element: 10px;
  --space-inline: 8px;

  --padding-section: 24px;
  --padding-card: 16px;
  --padding-callout: 14px;

  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --radius-xl: 20px;

  --header-height: 76px;
  --header-height-mobile: 68px;
  --header-max-width: 1120px;
  --layout-max-width: 720px;

  --bg: #ddd0bf;
  --bg-accent: #efe4d2;
  --surface-1: #fffaf1;
  --surface-2: #f2e8da;
  --surface-3: #e8dccb;
  --surface-4: #f6efe4;
  --card: var(--surface-1);
  --stroke: #d6c6b3;
  --stroke-med: #c8b59f;
  --stroke-strong: #b8a48e;

  --primary: #3f6f92;
  --primary-hover: #315a79;
  --primary-light: #5b9abf;
  --primary-glow: #7bbde0;
  --primary-soft: rgba(63, 111, 146, 0.10);
  --secondary: #2ec4b6;
  --secondary-soft: rgba(46, 196, 182, 0.10);
  --success: #168c48;
  --success-soft: rgba(22, 140, 72, 0.10);
  --warning: #b46400;
  --warning-soft: rgba(180, 100, 0, 0.10);
  --error: #b9321c;
  --error-soft: rgba(185, 50, 28, 0.10);

  --text: #1e3a4f;
  --text-strong: #0c1e2b;
  --muted: #4a7490;
  --muted-soft: #7a9ab5;
  --on-primary: #ffffff;

  --shadow-1: 0 8px 24px rgba(90, 69, 42, 0.08);
  --shadow-2: 0 12px 32px rgba(90, 69, 42, 0.11);
  --shadow-3: 0 20px 60px rgba(72, 53, 29, 0.16);
  --ring: 0 0 0 3px rgba(63, 111, 146, 0.35);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  zoom: 0.8;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  font-size: var(--font-size-body);
  line-height: var(--line-height-body);
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.55), transparent 32%),
    linear-gradient(180deg, #fbf6ee 0%, var(--bg) 45%, #f1e8db 100%);
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

.material-symbols-rounded {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24;
  line-height: 1;
  font-size: inherit;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0;
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--text-strong);
}

h1,
.page-title {
  font-size: var(--font-size-h1);
  line-height: var(--line-height-h1);
  text-align: center;
  color: #604028;
}

h2,
.section-title {
  font-size: 1.4rem;
  line-height: var(--line-height-h2);
  color: var(--muted);
  text-align: left;
}

h3 {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
  font-size: var(--font-size-h3);
  line-height: var(--line-height-h3);
  color: #604028;
}

h3::after {
  content: "";
  width: 100%;
  height: 2px;
  margin-top: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(63, 111, 146, 0.65), rgba(63, 111, 146, 0));
}

p {
  margin: 0;
  color: var(--text);
}

small {
  font-size: var(--font-size-small);
  color: var(--muted);
}

code {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.58);
  color: var(--text-strong);
  font-family: var(--font-mono);
  font-size: 0.85em;
  word-break: break-all;
}

:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

[hidden] {
  display: none !important;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(18px);
  background: rgba(248, 241, 231, 0.94);
  border-bottom: 1px solid rgba(214, 198, 179, 0.92);
  box-shadow: 0 8px 26px rgba(92, 74, 49, 0.05);
}

.header-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: var(--header-height);
  width: min(100%, calc(var(--header-max-width) + 48px));
  margin: 0 auto;
  padding: 8px 18px;
}

.header-brand {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  min-width: 0;
  max-width: 220px;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}

.brand-link:hover {
  text-decoration: none;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.site-header .brand-logo {
  width: 24px !important;
  height: 24px !important;
  max-width: 24px !important;
  flex-shrink: 0;
  object-fit: contain;
}

.brand-name {
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1;
  color: var(--text-strong);
  letter-spacing: -0.02em;
}

.brand-exclaim {
  color: var(--primary);
}

.brand-tagline {
  display: none;
}

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--stroke);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.66);
  color: var(--text-strong);
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.nav-toggle:hover {
  background: var(--surface-2);
  transform: translateY(-1px);
}

.nav-toggle-label {
  font-size: var(--font-size-xs);
  font-weight: 600;
}

.nav-toggle-icon,
.nav-toggle-icon::before,
.nav-toggle-icon::after {
  display: block;
  width: 16px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.nav-toggle-icon {
  position: relative;
}

.nav-toggle-icon::before,
.nav-toggle-icon::after {
  content: "";
  position: absolute;
  left: 0;
}

.nav-toggle-icon::before {
  top: -5px;
}

.nav-toggle-icon::after {
  top: 5px;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-icon {
  background: transparent;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-icon::before {
  transform: translateY(5px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-icon::after {
  transform: translateY(-5px) rotate(-45deg);
}

.header-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  flex: 0 1 auto;
  margin-left: auto;
}

.nav-link,
.nav-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.nav-link:hover,
.nav-link.active,
.nav-button:hover {
  background: var(--surface-2);
  border-color: var(--stroke);
  color: var(--text-strong);
  text-decoration: none;
  transform: translateY(-1px);
}

.nav-mod {
  color: var(--primary);
}

.nav-admin {
  color: var(--primary-light);
}

.nav-link-icon {
  font-size: 1rem;
}

.nav-form {
  margin: 0;
}

.nav-button {
  cursor: pointer;
}

.nav-user {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.54);
  border: 1px solid rgba(214, 198, 179, 0.72);
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 500;
  white-space: nowrap;
}

.site-main {
  flex: 1;
  width: min(100%, calc(var(--layout-max-width) + 48px));
  margin: 0 auto;
  padding: 26px 24px 56px;
}

.site-footer {
  border-top: 1px solid rgba(214, 198, 179, 0.85);
  background: rgba(246, 238, 226, 0.9);
  color: var(--muted);
  text-align: center;
  padding: 18px 24px 24px;
  font-size: var(--font-size-xs);
}

.flash,
.alert {
  margin-bottom: 20px;
  padding: var(--padding-callout);
  border-radius: var(--radius-sm);
  border: 1px solid var(--stroke);
  font-size: var(--font-size-small);
  font-weight: 500;
}

.flash-success,
.alert-success {
  background: var(--success-soft);
  border-color: rgba(22, 140, 72, 0.25);
  color: var(--success);
}

.flash-error,
.alert-error {
  background: var(--error-soft);
  border-color: rgba(185, 50, 28, 0.25);
  color: var(--error);
}

.flash-info,
.alert-info {
  background: var(--primary-soft);
  border-color: rgba(63, 111, 146, 0.25);
  color: var(--primary-hover);
}

.one-time-key-banner {
  display: grid;
  gap: 10px;
  margin-bottom: 24px;
  padding: 18px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(63, 111, 146, 0.18);
  background: linear-gradient(135deg, #edf5f9 0%, #dceaf2 100%);
  box-shadow: var(--shadow-1);
}

.otk-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--font-size-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--primary-hover);
}

.otk-icon {
  font-size: 1rem;
}

.otk-value {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(63, 111, 146, 0.18);
  background: rgba(255, 255, 255, 0.7);
}

.otk-copy {
  justify-self: start;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid rgba(63, 111, 146, 0.28);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.66);
  color: var(--primary-hover);
  font-size: var(--font-size-small);
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease;
}

.otk-copy:hover {
  background: rgba(255, 255, 255, 0.92);
  transform: translateY(-1px);
}

.page-wrap,
.dashboard-shell {
  display: flex;
  flex-direction: column;
  gap: var(--space-section);
}

.section-card,
.auth-card,
.order-block,
.buy-section,
.lookup-section,
.table-card,
.page-topbar {
  padding: var(--padding-section);
  border-radius: var(--radius-lg);
  border: 1px solid var(--stroke);
  background: rgba(255, 250, 241, 0.9);
  box-shadow: var(--shadow-1);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.section-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-card);
}

.section-card:hover,
.order-block:hover,
.buy-section:hover,
.lookup-section:hover,
.table-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
}

.content-card,
.pkg-card,
.utility-card,
.stat-chip,
.empty-card,
.notice-card {
  padding: var(--padding-card);
  border-radius: var(--radius-md);
  border: 1px solid rgba(214, 198, 179, 0.75);
  background: rgba(245, 237, 226, 0.72);
  box-shadow: 0 2px 8px rgba(90, 69, 42, 0.025);
  transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.content-card:hover,
.pkg-card:hover,
.utility-card:hover,
.stat-chip:hover {
  transform: translateY(-1px);
  background: rgba(241, 232, 219, 0.8);
  box-shadow: 0 4px 12px rgba(90, 69, 42, 0.04);
}

.utility-card,
.notice-card {
  padding: var(--padding-callout);
  border-radius: var(--radius-sm);
}

.eyebrow {
  font-size: var(--font-size-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--primary);
}

.hint,
.section-sub,
.support-copy {
  color: var(--muted);
}

.section-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(214, 198, 179, 0.95);
  text-align: left;
}

.section-header h2,
.section-header .section-title {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
}

.section-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 0;
  background: transparent;
  color: var(--primary);
  font-size: 0.92rem;
  flex-shrink: 0;
}

.btn-icon,
.notice-icon {
  font-size: 1.1rem;
}

.content-stack,
.card-stack,
.support-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-card);
}

.card-head,
.card-row,
.actions-row,
.hero-actions,
.inline-actions,
.summary-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-element);
}

.card-head {
  justify-content: space-between;
}

.summary-grid,
.stats-row,
.help-grid {
  display: grid;
  gap: var(--space-card);
}

.summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.stats-row {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.help-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.stat-chip {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-height: 104px;
  justify-content: center;
}

.stat-num {
  font-family: var(--font-heading);
  font-size: 1.7rem;
  line-height: 1.1;
  color: var(--text-strong);
}

.stat-lbl,
.stat-meta {
  font-size: var(--font-size-small);
}

.stat-lbl {
  font-weight: 600;
  color: var(--text);
}

.stat-meta {
  color: var(--muted);
}

.detail-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-element);
}

.detail-row {
  display: flex;
  justify-content: space-between;
  gap: var(--space-inline);
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(214, 198, 179, 0.82);
  font-size: var(--font-size-small);
}

.detail-row:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.detail-row span {
  color: var(--muted);
}

.detail-row strong {
  color: var(--text-strong);
  font-weight: 600;
  text-align: right;
}

.notice-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.notice-card.info {
  background: var(--primary-soft);
  border-left: 4px solid var(--primary-light);
}

.notice-card.warning {
  background: var(--warning-soft);
}

.notice-card.success {
  background: var(--success-soft);
  border-left: 4px solid var(--success);
}

.notice-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--font-size-small);
  font-weight: 600;
  color: var(--text-strong);
}

.muted {
  color: var(--muted);
  font-size: var(--font-size-small);
}

.btn,
.btn-discord {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 18px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  font-size: var(--font-size-body);
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.btn:hover,
.btn-discord:hover {
  transform: translateY(-1px);
  text-decoration: none;
}

.btn-full {
  width: 100%;
}

.btn-sm {
  min-height: 40px;
  padding: 0 12px;
  font-size: 0.84rem;
  font-weight: 600;
}

.btn-primary,
.btn-accent {
  background: var(--primary);
  color: var(--on-primary);
  box-shadow: 0 6px 16px rgba(63, 111, 146, 0.22);
}

.btn-primary:hover,
.btn-accent:hover {
  background: var(--primary-hover);
}

.btn-teal {
  background: var(--secondary);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 6px 16px rgba(46, 196, 182, 0.18);
}

.btn-teal:hover {
  background: #21a89b;
}

.btn-secondary {
  background: var(--surface-2);
  border-color: var(--stroke);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--surface-3);
}

.btn-ghost {
  background: transparent;
  border-color: var(--stroke);
  color: var(--muted);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.54);
  color: var(--text-strong);
}

.btn-danger {
  background: var(--error);
  color: var(--on-primary);
  box-shadow: 0 6px 16px rgba(185, 50, 28, 0.18);
}

.btn-danger:hover {
  background: #9a2715;
}

.btn-discord {
  background: #5865f2;
  color: #fff;
  box-shadow: 0 6px 16px rgba(88, 101, 242, 0.22);
}

.btn-discord:hover {
  background: #4752c4;
}

.btn-discord img,
.btn-discord svg {
  width: 20px;
  height: 20px;
}

.field-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: var(--font-size-small);
  font-weight: 600;
  color: var(--text);
}

.field-label input,
.field-label select,
.filter-input,
.filter-select,
.inline-select,
.label-input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--stroke);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.74);
  color: var(--text);
  font-size: var(--font-size-body);
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.filter-select,
.inline-select {
  min-height: 40px;
}

.label-input {
  min-height: 36px;
  font-size: 0.84rem;
}

.field-label input:focus,
.field-label select:focus,
.filter-input:focus,
.filter-select:focus,
.inline-select:focus,
.label-input:focus {
  border-color: rgba(63, 111, 146, 0.45);
  box-shadow: var(--ring);
  background: #fff;
}

.label-form,
.inline-form,
.create-key-form {
  margin: 0;
}

.keys-table-wrap,
.table-wrap {
  overflow-x: auto;
}

.keys-table,
.table-wrap table,
table {
  width: 100%;
  border-collapse: collapse;
}

.keys-table th,
.keys-table td,
.table-wrap th,
.table-wrap td,
table th,
table td {
  padding: 12px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(214, 198, 179, 0.82);
  vertical-align: top;
  font-size: var(--font-size-small);
}

.keys-table thead th,
.table-wrap thead th,
table thead th {
  font-size: var(--font-size-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted-soft);
  background: rgba(242, 232, 218, 0.92);
}

.keys-table tbody tr:last-child td,
.table-wrap tbody tr:last-child td,
table tbody tr:last-child td {
  border-bottom: none;
}

.keys-table tbody tr:hover,
.table-wrap tbody tr:hover,
table tbody tr:hover {
  background: rgba(255, 255, 255, 0.45);
}

.td-date,
.td-email,
.td-empty,
.no-keys {
  font-size: var(--font-size-small);
  color: var(--muted);
}

.td-email {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.td-empty,
.no-keys {
  text-align: center;
  padding: 20px 12px;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: var(--font-size-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pill-success {
  background: var(--success-soft);
  color: var(--success);
  border: 1px solid rgba(22, 140, 72, 0.2);
}

.pill-warning {
  background: var(--warning-soft);
  color: var(--warning);
  border: 1px solid rgba(180, 100, 0, 0.2);
}

.pill-danger {
  background: var(--error-soft);
  color: var(--error);
  border: 1px solid rgba(185, 50, 28, 0.2);
}

.pill-info {
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid rgba(63, 111, 146, 0.2);
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-inline);
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.7);
  color: var(--text);
  font-size: var(--font-size-small);
  font-weight: 600;
  text-decoration: none;
}

.page-btn:hover,
.page-btn.active {
  background: var(--surface-2);
  border-color: var(--stroke-strong);
  text-decoration: none;
}

.auth-wrap {
  min-height: calc(100vh - var(--header-height) - 120px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 0;
}

.auth-card {
  gap: 20px;
  max-width: 680px;
  width: 100%;
  background:
    radial-gradient(circle at top right, rgba(63, 111, 146, 0.08), transparent 32%),
    linear-gradient(180deg, rgba(255, 250, 241, 0.98), rgba(246, 238, 225, 0.96));
}

.auth-card .card-title {
  font-size: var(--font-size-h1);
  line-height: var(--line-height-h1);
}

.support-copy {
  font-size: var(--font-size-small);
}

.cta-text {
  font-size: var(--font-size-small);
  color: var(--muted);
}

.page-topbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-element);
}

.topbar-email {
  font-size: var(--font-size-body);
  font-weight: 600;
  color: var(--text-strong);
}

.order-block,
.buy-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-card);
}

.pkg-select-wrap {
  max-width: 420px;
}

.pkg-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-element);
}

.pkg-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-element);
}

.pkg-label {
  font-size: 1rem;
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--text-strong);
}

.pkg-price {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  color: var(--primary);
}

.pkg-desc {
  color: var(--muted);
  font-size: var(--font-size-small);
}

.pkg-details {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pkg-row {
  display: flex;
  justify-content: space-between;
  gap: var(--space-inline);
  font-size: var(--font-size-small);
}

.pkg-row span {
  color: var(--muted);
}

.pkg-row strong {
  color: var(--text-strong);
}

.empty-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  border-style: dashed;
}

.empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 2.3rem;
}

.lookup-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-element);
}

.lookup-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-card);
  margin-top: var(--space-card);
}

.lookup-email {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-strong);
}

.lookup-sub {
  margin: 0 0 12px;
  color: var(--primary);
}

.panel-filter {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-inline);
}

.filter-input {
  flex: 1 1 220px;
}

.filter-select,
.inline-select {
  width: auto;
  min-width: 140px;
}

.table-note {
  font-size: var(--font-size-xs);
  color: var(--muted);
}

@media (max-width: 820px) {
  .header-inner {
    min-height: var(--header-height-mobile);
    padding: 10px 14px;
  }

  .site-main {
    width: min(100%, calc(var(--layout-max-width) + 32px));
    padding: 22px 16px 46px;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .header-nav {
    position: absolute;
    top: calc(100% + 10px);
    left: 16px;
    right: 16px;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--stroke);
    border-radius: var(--radius-lg);
    background: rgba(255, 250, 241, 0.98);
    box-shadow: var(--shadow-2);
  }

  .header-nav.is-open {
    display: flex;
  }

  .nav-link,
  .nav-button,
  .nav-user {
    width: 100%;
    justify-content: flex-start;
    min-height: 44px;
  }

  .nav-form {
    width: 100%;
  }
}

@media (min-width: 821px) {
  .header-nav[aria-hidden="true"] {
    display: flex;
  }
}

@media (max-width: 700px) {
  .section-card,
  .auth-card,
  .order-block,
  .buy-section,
  .lookup-section,
  .table-card,
  .page-topbar {
    padding: 20px;
  }

  .pkg-card-header,
  .card-head,
  .detail-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .detail-row strong {
    text-align: left;
  }

  .keys-table th,
  .keys-table td,
  .table-wrap th,
  .table-wrap td,
  table th,
  table td {
    padding: 12px 10px;
  }
}

@media (max-width: 560px) {
  .brand-name {
    font-size: 0.92rem;
  }

  .brand-tagline {
    display: none;
  }

  .site-main {
    padding-inline: 14px;
  }

  .section-card,
  .auth-card,
  .order-block,
  .buy-section,
  .lookup-section,
  .table-card,
  .page-topbar {
    padding: 16px;
  }

  .auth-wrap {
    min-height: auto;
    padding-top: 8px;
  }

  .btn,
  .btn-discord {
    width: 100%;
  }
}

/* ── Accordion ── */
.accordion { display: flex; flex-direction: column; }

.accordion-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 0;
    background: none;
    border: none;
    border-bottom: 1px solid var(--stroke);
    cursor: pointer;
    color: var(--text-strong);
    text-align: left;
}

.accordion-toggle[aria-expanded="true"] .accordion-chevron {
    transform: rotate(180deg);
}

.accordion-chevron {
    font-size: 1.1rem;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.accordion-body {
    padding: 12px 0 4px;
}

.accordion-body[aria-hidden="true"] {
    pointer-events: none;
}

.dl-item .btn-sm {
    flex: 0 0 auto;
    width: max-content;
    min-width: 92px;
}

@media (max-width: 560px) {
    #downloads .dl-item {
        align-items: stretch;
        flex-direction: column;
        gap: 8px;
        padding: 12px 18px;
    }

    #downloads .dl-item-info {
        width: 100%;
    }

    #downloads .dl-item-name {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }

    #downloads .dl-item .btn-sm {
        width: 100%;
        min-height: 40px;
    }
}

/* ── Download list ── */
.download-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.download-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    font-size: var(--font-size-small);
    padding: 8px 10px;
    border-radius: var(--radius-xs);
    border: 1px solid rgba(214, 198, 179, 0.6);
    background: rgba(255, 255, 255, 0.5);
}

.download-meta {
    display: flex;
    flex: 1 1 220px;
    min-width: 0;
    flex-direction: column;
    gap: 3px;
}

.download-name {
    font-weight: 600;
    color: var(--text-strong);
    word-break: break-word;
}

.download-submeta {
    color: var(--muted);
    font-size: 0.82rem;
}

.download-list a {
    white-space: nowrap;
}

.download-list a:not(.btn) {
    font-weight: 600;
    color: var(--primary);
}

.download-list a:not(.btn):hover {
    text-decoration: underline;
}

@media (max-width: 640px) {
    .download-list li {
        align-items: flex-start;
    }

    .download-list .btn {
        width: 100%;
        justify-content: center;
    }
}

/* ── Keyring panel ── */
.keyring-panel { margin-top: var(--space-card); }

/* ── Auth page (login) ── */
@keyframes auth-logo-float {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-7px); }
}

.page-auth .auth-wrap {
  background: radial-gradient(ellipse at 50% 38%,
    rgba(63, 111, 146, 0.07) 0%, transparent 66%);
}

.auth-card {
  gap: 24px;
  max-width: 460px;
  text-align: center;
  background:
    radial-gradient(circle at 72% 8%, rgba(63, 111, 146, 0.11), transparent 46%),
    radial-gradient(circle at 18% 88%, rgba(63, 111, 146, 0.06), transparent 40%),
    linear-gradient(170deg, rgba(255, 252, 245, 1) 0%, rgba(240, 229, 214, 0.97) 100%);
  box-shadow: var(--shadow-3);
  border-color: var(--stroke-strong);
}

.auth-logo {
  width: 80px;
  height: 80px;
  object-fit: contain;
  margin: 0 auto 4px;
  animation: auth-logo-float 3.2s ease-in-out infinite;
  filter: drop-shadow(0 6px 16px rgba(63, 111, 146, 0.22));
}

.auth-card .card-title {
  font-size: 2.1rem;
  line-height: var(--line-height-h1);
  color: var(--text-strong);
}

.hero-actions {
  margin: 6px 0 10px;
}

.btn-discord {
  box-shadow: 0 8px 24px rgba(88, 101, 242, 0.30);
}

.btn-discord:hover {
  box-shadow: 0 12px 30px rgba(88, 101, 242, 0.38);
}

.btn-discord .discord-symbol,
.btn-discord img,
.btn-discord svg {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
}

.auth-sep {
  border: none;
  border-top: 1px solid var(--stroke);
  margin: 0;
}

.cta-text {
  font-size: var(--font-size-small);
  color: var(--muted);
  text-align: center;
  line-height: 1.65;
}

/* ── New design system compat ──────────────────────────── */
/* Overrides for pages using keyui.css */

/* Page container updates */
.page { max-width: 480px; margin: 0 auto; padding: 14px 14px 52px; display: flex; flex-direction: column; gap: 10px; }
.page-wide { max-width: 680px; }

/* Auth page still uses old card style - keep section-card */
.section-card { background: var(--card,var(--surface-1,#fff)); border-radius: var(--radius-lg,16px); overflow: hidden; }

/* Inline form compat */
.inline-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.inline-form .fld-select, .inline-form .fld-input { flex: 1 1 160px; }

/* Header compat: keyui.css owns the current dropdown menu. */
.site-header .nav-toggle {
  display: inline-flex;
}

/* Design system color bridge: style.css loads after keyui.css, so legacy
   aliases must resolve back to the friendsGO token set. */
:root {
  --font-heading: var(--font-display);
  --font-size-h1: var(--text-h1);
  --font-size-h2: var(--text-h2);
  --font-size-h3: var(--text-h3);
  --font-size-body: var(--text-body);
  --font-size-small: var(--text-h5);
  --font-size-xs: var(--text-tiny);
  --line-height-h1: 1.15;
  --line-height-h2: 1.2;
  --line-height-h3: 1.25;
  --line-height-body: 1.5;

  --fgo-green: #2CB67D;
  --fgo-green-hover: #4AD49A;
  --fgo-green-press: #1F8F63;
  --fgo-green-soft: #66E2AF;
  --fgo-green-tint: rgba(44, 182, 125, 0.10);
  --fgo-deep: #264653;
  --fgo-secondary: #1F8F63;
  --fgo-error: #E76F51;
  --fgo-warning: #FFD399;
  --fgo-warning-text: #5C3800;

  --fg1: #264653;
  --fg2: #5B6B73;
  --fg-on-primary: #FFFFFF;
  --bg: #FEF9EF;
  --bg-low: #FEF9EF;
  --bg-card: #F2EDE2;
  --bg-input: #FEF9EF;
  --bg-surface: #F0E8DA;
  --bg-highest: #E0D4C2;
  --bg-overlay: rgba(254, 249, 239, 0.90);
  --border: #E0D4C2;
  --border-strong: #5B6B73;

  --bg-accent: var(--bg-card);
  --surface-1: var(--bg);
  --surface-2: var(--bg-card);
  --surface-3: var(--bg-surface);
  --surface-4: var(--bg-highest);
  --card: var(--bg);
  --stroke: var(--border);
  --stroke-med: var(--border);
  --stroke-strong: var(--border-strong);
  --primary: var(--fgo-green);
  --primary-hover: var(--fgo-green-hover);
  --primary-light: var(--fgo-green-soft);
  --primary-glow: var(--fgo-green-hover);
  --primary-soft: var(--fgo-green-tint);
  --secondary: var(--fgo-secondary);
  --secondary-soft: var(--fgo-green-tint);
  --success: var(--fgo-secondary);
  --success-soft: var(--fgo-green-tint);
  --warning: var(--fgo-warning-text);
  --warning-soft: rgba(255, 211, 153, 0.28);
  --error: var(--fgo-error);
  --error-soft: rgba(231, 111, 81, 0.12);
  --text: var(--fg1);
  --text-strong: var(--fg1);
  --muted: var(--fg2);
  --muted-soft: var(--fg2);
  --on-primary: var(--fg-on-primary);
  --shadow-1: var(--shadow-sm);
  --shadow-2: var(--shadow-md);
  --shadow-3: var(--shadow-lg);
  --ring: 0 0 0 3px var(--fgo-green-tint);
}

.dark,
[data-theme="dark"] {
  --fg1: #DFE3E7;
  --fg2: #9AAAB6;
  --fg-on-primary: #FFFFFF;
  --bg: #101417;
  --bg-low: #1A1E22;
  --bg-card: #24282C;
  --bg-input: #1A1E22;
  --bg-surface: #2F3337;
  --bg-highest: #3A3E42;
  --bg-overlay: rgba(16, 20, 23, 0.90);
  --border: #3A3E42;
  --border-strong: #ACB3B9;
  --fgo-deep: #4AD49A;
  --fgo-green-tint: rgba(74, 212, 154, 0.10);
  --fgo-warning: #7A5500;
  --fgo-warning-text: #FFD399;
  --fgo-green-soft: #3A7D62;
  --fgo-logo-friends: #B7C2D0;
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.28);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.30);
  --shadow-lg: 0 28px 70px rgba(0, 0, 0, 0.45);
}

body {
  color: var(--fg1);
  background: var(--bg-card);
}

a,
.eyebrow,
.section-icon,
.nav-mod,
.nav-admin,
.brand-exclaim,
.download-list a:not(.btn),
.pkg-price,
.lookup-sub {
  color: var(--fgo-green);
}

h1,
h2,
h3,
h4,
h5,
h6,
.page-title,
.section-title,
.card-title,
.brand-name,
.download-name,
.notice-title,
.stat-num,
.table-meta h3 {
  color: var(--fg1);
}

p,
small,
.hint,
.section-sub,
.support-copy,
.muted,
.table-note,
.panel-note,
.download-submeta,
.td-date,
.td-email,
.td-empty,
.no-keys {
  color: var(--fg2);
}

h3::after {
  background: linear-gradient(90deg, var(--fgo-green), rgba(44, 182, 125, 0));
}

.sec-divider {
  min-height: 1px;
  background: linear-gradient(90deg, var(--fgo-green), var(--border) 46%, transparent);
  opacity: 1;
}

.page-mod .card > .sec-head,
.page-admin .card > .sec-head {
  align-items: flex-start;
}

.page-mod .card > .sec-head > .sec-title,
.page-admin .card > .sec-head > .sec-title {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
}

.page-mod .card > .sec-head > .sec-title::after,
.page-admin .card > .sec-head > .sec-title::after {
  content: "";
  width: 100%;
  height: 2px;
  margin-top: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--fgo-green), rgba(44, 182, 125, 0));
}

.page-mod .sec-divider,
.page-admin .sec-divider,
.page-mod h3::after,
.page-admin h3::after {
  content: none;
  display: none;
}

code {
  border-color: var(--border);
  background: var(--bg-card);
  color: var(--fg1);
}

.site-header {
  background: var(--bg-overlay);
  border-bottom-color: var(--border);
  box-shadow: var(--shadow-sm);
}

.site-footer {
  background: var(--bg);
  border-top-color: var(--border);
  color: var(--fg2);
}

.nav-toggle,
.nav-user,
.panel-tab,
.page-btn {
  background: var(--bg);
  border-color: var(--border);
  color: var(--fg1);
}

.nav-toggle:hover,
.nav-link:hover,
.nav-link.active,
.nav-button:hover,
.panel-tab:hover,
.panel-tab.active,
.page-btn:hover,
.page-btn.active {
  background: var(--bg-card);
  border-color: var(--border);
  color: var(--fg1);
}

.header-nav {
  background: var(--bg);
  border-color: var(--border);
}

.nav-link,
.nav-button {
  color: var(--fg1);
}

.section-card,
.auth-card,
.order-block,
.buy-section,
.lookup-section,
.table-card,
.page-topbar,
.card {
  background: var(--bg);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}

.content-card,
.pkg-card,
.utility-card,
.stat-chip,
.empty-card,
.notice-card,
.lookup-card,
.download-list li {
  background: var(--bg-card);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}

.content-card:hover,
.pkg-card:hover,
.utility-card:hover,
.stat-chip:hover {
  background: var(--bg-surface);
}

.section-header,
.keys-table th,
.keys-table td,
.table-wrap th,
.table-wrap td,
table th,
table td,
.download-list li {
  border-color: var(--border);
}

.keys-table thead th,
.table-wrap thead th,
table thead th {
  background: var(--bg-card);
  color: var(--fg2);
}

.keys-table tbody tr:hover,
.table-wrap tbody tr:hover,
table tbody tr:hover {
  background: var(--bg-card);
}

.btn-primary,
.btn-accent,
.btn-teal,
.btn-new,
.m-btn-save,
.page-btn.active {
  background: var(--fgo-green);
  border-color: var(--fgo-green);
  color: var(--fg-on-primary);
  box-shadow: 0 6px 16px rgba(44, 182, 125, 0.18);
}

.btn-primary:hover,
.btn-accent:hover,
.btn-teal:hover,
.btn-new:hover,
.m-btn-save:hover {
  background: var(--fgo-green-hover);
  border-color: var(--fgo-green-hover);
  color: var(--fg-on-primary);
}

.btn-secondary,
.btn-ghost,
.m-btn-cancel,
.btn-edit {
  background: var(--bg);
  border-color: var(--border);
  color: var(--fg1);
}

.btn-secondary:hover,
.btn-ghost:hover,
.m-btn-cancel:hover,
.btn-edit:hover {
  background: var(--bg-card);
  border-color: var(--fgo-green);
  color: var(--fgo-green);
}

.field-label,
.field-checkbox,
.table-checkbox {
  color: var(--fg1);
}

.field-label input,
.field-label select,
.field-label textarea,
.fld-input,
.fld-select,
.filter-input,
.filter-select,
.inline-select,
.label-input,
.table-input,
.modal-input,
.modal-select,
.modal-textarea {
  background: var(--bg-input);
  border-color: var(--border);
  color: var(--fg1);
}

.field-label input:focus,
.field-label select:focus,
.field-label textarea:focus,
.fld-input:focus,
.fld-select:focus,
.filter-input:focus,
.filter-select:focus,
.inline-select:focus,
.label-input:focus,
.table-input:focus,
.modal-input:focus,
.modal-select:focus,
.modal-textarea:focus {
  background: var(--bg);
  border-color: var(--fgo-green);
}

.flash-info,
.alert-info,
.one-time-key-banner,
.pill-info {
  background: var(--fgo-green-tint);
  border-color: var(--fgo-green-soft);
  color: var(--fgo-secondary);
}

.otk-value,
.otk-copy {
  background: var(--bg-card);
  border-color: var(--fgo-green-soft);
  color: var(--fgo-green);
}

.otk-copy:hover {
  background: var(--bg-surface);
}

.pill-success,
.notice-card.success {
  background: var(--fgo-green-tint);
  border-color: var(--fgo-green-soft);
  color: var(--fgo-secondary);
}

.auth-card,
.page-auth .auth-wrap {
  background:
    radial-gradient(circle at 72% 8%, var(--fgo-green-tint), transparent 46%),
    var(--bg);
}

.auth-logo {
  filter: drop-shadow(0 6px 16px rgba(44, 182, 125, 0.22));
}

.modal-dialog,
.modal-content {
  background: var(--bg-card);
  border-color: var(--border);
}

.modal-subtitle,
.modal-close {
  color: var(--fg2);
}

@media (max-width: 820px) {
  .header-nav {
    background: var(--bg);
    border-color: var(--border);
  }
}
