/* Steam-inspired dark palette. Layout variance 4, motion 2, density 6. */
:root {
  color-scheme: dark;
  --top: #111823;
  --rail: #15202c;
  --bg: #1b2a3a;
  --surface: #213246;
  --field: #142333;
  --border: #3c5368;
  --text: #edf3f8;
  --muted: #b1c2d3;
  --accent: #7acaff;
  --accent-bg: #80cbf5;
  --ink: #10263a;
  --radius: 4px;
  font-family: "Segoe UI", "Microsoft YaHei UI", "PingFang SC", sans-serif;
  font-size: 14px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100dvh; color: var(--text); background: var(--bg); }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .5; }
button:focus-visible, input:focus-visible, select:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
button, input, select, .table-scroll { border-radius: var(--radius); }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(25px, 3vw, 34px); letter-spacing: -.025em; line-height: 1.22; }
h2 { font-size: 17px; font-weight: 650; line-height: 1.35; }

.topbar {
  height: 62px;
  padding: 0 30px;
  background: var(--top);
  border-bottom: 1px solid #344457;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.brand, .top-account { display: flex; align-items: center; gap: 12px; white-space: nowrap; }
.brand { font-size: 17px; font-weight: 700; letter-spacing: .01em; }
.brand small { margin-left: 8px; color: var(--muted); font-size: 13px; font-weight: 500; }
.mark, .avatar { display: grid; place-items: center; border-radius: var(--radius); }
.mark {
  width: 34px; height: 34px; color: #d9f0ff;
  background: linear-gradient(145deg, #23527a, #29405a); border: 1px solid #5181a4;
  font-size: 12px; letter-spacing: .04em;
}
.top-account { color: var(--muted); font-size: 13px; }
.view-switch { color: var(--accent); text-decoration: none; padding: 6px 0; }
.view-switch:hover { text-decoration: underline; }
.view-switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.avatar { width: 27px; height: 27px; color: var(--text); background: #28425a; }
.demo { border-left: 1px solid var(--border); padding-left: 12px; margin-right: 3px; color: var(--accent); }
.shell { display: grid; grid-template-columns: 214px minmax(0, 1fr); min-height: calc(100dvh - 62px); }
.rail { background: var(--rail); border-right: 1px solid #35475b; display: flex; flex-direction: column; padding: 29px 14px 22px; }
.rail-label { color: #a8bbcd; font-size: 12px; margin: 0 12px 12px; }
.rail nav button {
  display: block; width: 100%; text-align: left; border: 1px solid transparent; border-left: 3px solid transparent;
  color: var(--muted); background: transparent; padding: 10px 12px; margin-bottom: 5px;
  white-space: nowrap; transition: background-color .14s ease, color .14s ease;
}
.rail nav button:hover { background: #24384d; color: var(--text); }
.rail nav button.active {
  background: linear-gradient(90deg, #244c6b, #21374d); color: #f0f8ff;
  border-color: #385975; border-left-color: var(--accent); font-weight: 650;
}
.rail-wallet { border-top: 1px solid #3a4e61; margin: auto 8px 0; padding-top: 16px; display: grid; gap: 6px; }
.rail-wallet span { color: var(--muted); font-size: 12px; }
.rail-wallet strong { color: var(--accent); font-size: 18px; font-variant-numeric: tabular-nums; }
main {
  min-width: 0;
  padding: 32px clamp(24px, 4vw, 60px) 40px;
  background: linear-gradient(155deg, #22384d 0, var(--bg) 45%, #172635 100%);
}
main > section { max-width: 1250px; margin-inline: auto; }
.page-header { margin-bottom: 25px; }
.page-header p { margin-top: 8px; color: var(--muted); line-height: 1.6; }
.overview-grid { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(230px, 1fr); gap: 15px; }
.wallet-banner, .inventory-panel {
  padding: 22px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 0;
}
.wallet-banner {
  background: linear-gradient(115deg, #22405b 0%, #1e3952 56%, #24577d 100%);
  display: flex; align-items: end; justify-content: space-between; gap: 16px;
}
.wallet-banner h2 { font-size: 14px; font-weight: 550; color: #c4dbed; }
.balance-figure { display: block; font-size: clamp(30px, 4vw, 49px); line-height: 1.18; margin: 7px 0; letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.wallet-banner p { font-size: 13px; color: #c0d5e7; line-height: 1.5; }
.wallet-banner > button { align-self: center; }
.inventory-panel { background: #1d2e40; }
.counts { display: flex; gap: 32px; margin: 12px 0 13px; }
.counts div { display: grid; gap: 1px; }
.counts strong { font-size: 23px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.counts span { color: var(--muted); font-size: 12px; }
.primary, .secondary, .amounts button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 38px; padding: 8px 15px; border: 1px solid transparent; white-space: nowrap;
  transition: background-color .14s ease, border-color .14s ease;
}
.primary { background: var(--accent-bg); color: var(--ink); font-weight: 700; }
.primary:hover:not(:disabled) { background: #a3defe; }
.secondary { color: #e5f3ff; background: #263d53; border-color: #506d86; }
.secondary:hover:not(:disabled) { background: #354f69; }
.table-section { margin-top: 27px; }
.section-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.text-button {
  padding: 6px 1px; border: 0; background: transparent; color: var(--accent);
  font-weight: 600; white-space: nowrap;
}
.text-button:hover { color: #c2eaff; text-decoration: underline; }
.text-button + .text-button { margin-left: 12px; }
.table-scroll { overflow: auto; border: 1px solid var(--border); }
table { width: 100%; min-width: 590px; border-collapse: collapse; text-align: left; }
thead { background: #152638; color: #baccdc; }
th { padding: 11px 15px; font-size: 12px; font-weight: 650; }
td { padding: 11px 15px; height: 49px; border-top: 1px solid #394e62; }
tbody tr:nth-child(odd) { background: #23374a; }
tbody tr:nth-child(even) { background: #1f3042; }
tbody tr:hover { background: #2a4259; }
.mono { font-family: Consolas, "SFMono-Regular", monospace; font-variant-numeric: tabular-nums; white-space: nowrap; }
.badge { display: inline-block; border: 1px solid #58738b; border-radius: var(--radius); padding: 3px 7px; font-size: 12px; line-height: 1.35; white-space: nowrap; }
.badge.unused { color: #b8deff; background: #234c67; border-color: #507795; }
.badge.used { color: #dfebf5; background: #34495d; }
.badge.review { color: #f8deb0; background: #4b4035; border-color: #8a7052; }
.badge.refunded { color: #c2e8db; background: #26483f; border-color: #55786f; }
.page-note {
  margin-top: 15px; border-left: 3px solid #6389aa; padding: 12px 14px;
  background: #203347; color: var(--muted); display: flex; gap: 12px; align-items: baseline; line-height: 1.5;
}
.page-note strong { color: var(--text); white-space: nowrap; }
.filter-bar { display: flex; gap: 10px; margin-bottom: 12px; align-items: center; }
.filter-actions { margin-left: auto; display: flex; gap: 8px; }
.search-label { width: min(38%, 300px); }
input, select {
  display: block; width: 100%; min-height: 38px; padding: 8px 11px;
  border: 1px solid #627e96; background: var(--field); color: var(--text);
}
input::placeholder { color: #a7bbce; opacity: 1; }
.wallet-wide { min-height: 154px; }
.muted { color: var(--muted); line-height: 1.6; }

dialog {
  width: min(500px, calc(100vw - 26px));
  max-height: calc(100dvh - 26px);
  padding: 0;
  border: 1px solid #6486a1;
  border-top: 3px solid var(--accent);
  border-radius: var(--radius);
  background: #1e3144;
  color: var(--text);
  box-shadow: 0 16px 55px #060d16ba;
}
dialog::backdrop { background: #0a121ddd; }
dialog form { padding: 22px; }
.dialog-title { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 9px; }
.dialog-title h2 { font-size: 21px; }
.close-button { color: var(--muted); background: transparent; border: 0; font-size: 24px; line-height: 1; min-width: 34px; min-height: 34px; }
.close-button:hover { color: var(--text); background: #34516c; }
.fields { display: grid; grid-template-columns: minmax(0, 2fr) minmax(80px, 1fr); gap: 12px; margin-top: 18px; }
.fields label, .single-field { display: grid; gap: 6px; color: #d2e1ed; }
.single-field { margin: 15px 0 12px; }
.receipt { display: grid; gap: 9px; margin: 16px 0 0; background: #18293b; border: 1px solid var(--border); padding: 12px; border-radius: var(--radius); }
.receipt div { display: flex; justify-content: space-between; gap: 12px; }
.receipt dt { color: var(--muted); }
.receipt dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.receipt-total { border-top: 1px solid var(--border); padding-top: 9px; }
.receipt-total dd { color: var(--accent); }
.dialog-actions { display: flex; justify-content: end; gap: 8px; margin-top: 19px; }
.amounts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; margin-top: 17px; }
.amounts button {
  flex-direction: column; gap: 3px; min-height: 56px; padding-inline: 6px;
  background: #213b52; color: var(--text); border-color: #607b93;
  font-size: 15px; font-variant-numeric: tabular-nums;
}
.amounts small { font-size: 11px; font-weight: 500; }
.amounts button:hover { background: #315474; }
.amounts button[aria-pressed="true"] { color: var(--ink); background: var(--accent-bg); border-color: #b3e9ff; font-weight: 700; }
.toast {
  position: fixed; z-index: 2; right: 20px; bottom: 20px; max-width: min(360px, calc(100vw - 40px));
  background: #203e56; border: 1px solid #729bb9; border-left: 3px solid var(--accent);
  border-radius: var(--radius); color: var(--text); padding: 12px 16px; box-shadow: 0 10px 32px #08121e99;
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 940px) {
  .shell { grid-template-columns: 172px minmax(0, 1fr); }
  .wallet-banner, .inventory-panel { padding: 17px; }
  .overview-grid { grid-template-columns: minmax(0, 1.7fr) minmax(178px, 1fr); }
  .wallet-banner { align-items: start; flex-direction: column; }
  .wallet-banner > button { align-self: start; }
  .filter-bar { flex-wrap: wrap; }
  .search-label { width: min(50%, 300px); }
}
@media (max-width: 680px) {
  .topbar { height: 54px; padding-inline: 14px; }
  .brand, .top-account { gap: 7px; }
  .brand { font-size: 14px; }
  .brand small { margin-left: 2px; font-size: 11px; }
  .top-account { font-size: 11px; }
  .demo { padding-left: 6px; }
  .avatar { display: none; }
  .shell { grid-template-columns: minmax(0, 1fr); min-height: calc(100dvh - 54px); }
  .rail { padding: 9px 12px; border-right: 0; border-bottom: 1px solid var(--border); }
  .rail nav { display: grid; grid-template-columns: 1fr 1fr 1.15fr; gap: 6px; }
  .rail nav button { margin: 0; padding: 8px; text-align: center; }
  .rail-label, .rail-wallet { display: none; }
  main { padding: 23px 14px 32px; }
  .overview-grid { grid-template-columns: minmax(0, 1fr); }
  .wallet-banner { flex-direction: row; align-items: center; }
  .wallet-banner > button { align-self: center; }
  .counts { gap: 25px; }
  .page-note { display: grid; gap: 4px; }
  .filter-bar { align-items: stretch; }
  .search-label { width: 100%; }
  .filter-actions { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
@media (max-width: 420px) {
  .top-account .account-name { display: none; }
}
