:root {
  --red: #731004;
  --red-2: #a01808;
  --gold-pale: #fdd872;
  --gold: #ffd21f;
  --black: #000000;
  --white: #ffffff;
  --felt: #10583d;
  --ink: #140605;
  --panel: rgba(12, 5, 4, 0.9);
  --panel-soft: rgba(255, 255, 255, 0.08);
  --line: rgba(253, 216, 114, 0.28);
  --muted: rgba(255, 255, 255, 0.72);
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--white);
  background: var(--black);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

.scene-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(circle at 50% 12%, rgba(255, 210, 31, 0.2), transparent 31rem),
    linear-gradient(180deg, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.9)),
    linear-gradient(90deg, rgba(115, 16, 4, 0.72), rgba(0, 0, 0, 0.3)),
    url("../width_1024.webp") center / cover no-repeat;
}

.scene-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(253, 216, 114, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(253, 216, 114, 0.06) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.35), transparent 72%);
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(100%, 1180px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 14px;
}

.auth-card,
.panel,
.topbar,
.closed-screen {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.auth-card {
  width: min(100%, 460px);
  margin: 7vh auto 0;
  padding: 22px;
}

.auth-card h1,
.closed-screen h1 {
  margin: 6px 0 12px;
  color: var(--gold);
  font-size: clamp(2.1rem, 12vw, 4rem);
  line-height: 0.95;
  text-transform: uppercase;
}

.eyebrow {
  margin: 0;
  color: var(--gold-pale);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.82rem;
}

.auth-form,
.form-grid {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 7px;
}

.field span,
.field label {
  color: var(--gold-pale);
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(253, 216, 114, 0.28);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--white);
  background: rgba(0, 0, 0, 0.42);
  outline: none;
}

.field textarea {
  min-height: 94px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(255, 210, 31, 0.18);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  color: var(--white);
}

.checkbox-row input {
  width: 20px;
  height: 20px;
  accent-color: var(--gold);
}

.btn {
  min-height: 44px;
  border: 1px solid rgba(253, 216, 114, 0.32);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--white);
  background: rgba(255, 255, 255, 0.08);
  font-weight: 850;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: var(--gold);
}

.btn.primary {
  color: var(--black);
  border-color: var(--gold);
  background: linear-gradient(180deg, var(--gold-pale), var(--gold));
}

.btn.red {
  border-color: rgba(255, 255, 255, 0.16);
  background: linear-gradient(180deg, var(--red-2), var(--red));
}

.btn.ghost {
  background: rgba(0, 0, 0, 0.24);
}

.btn.danger {
  border-color: rgba(255, 108, 82, 0.55);
  background: rgba(115, 16, 4, 0.72);
}

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

.topbar {
  display: grid;
  gap: 12px;
  padding: 14px;
  margin-bottom: 14px;
}

.brand-row,
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.brand h1 {
  margin: 2px 0 0;
  color: var(--gold);
  font-size: clamp(1.6rem, 8vw, 3.2rem);
  line-height: 1;
  text-transform: uppercase;
}

.badge,
.status-pill,
.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  border: 1px solid rgba(253, 216, 114, 0.36);
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--gold-pale);
  background: rgba(0, 0, 0, 0.34);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.status-strip {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(115, 16, 4, 0.72), rgba(16, 88, 61, 0.52));
}

.status-strip strong {
  color: var(--gold);
}

.dashboard-grid {
  display: grid;
  gap: 14px;
}

.panel {
  padding: 14px;
}

.panel h2,
.panel h3 {
  margin: 0 0 10px;
  color: var(--gold-pale);
  font-size: 1rem;
  text-transform: uppercase;
}

.balance-panel {
  display: grid;
  gap: 10px;
  min-height: 190px;
  align-content: center;
  background:
    linear-gradient(135deg, rgba(115, 16, 4, 0.9), rgba(0, 0, 0, 0.86)),
    var(--panel);
}

.balance-value {
  color: var(--gold);
  font-size: clamp(3.2rem, 19vw, 6.5rem);
  font-weight: 950;
  line-height: 0.95;
  overflow-wrap: anywhere;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.metric {
  min-height: 74px;
  border: 1px solid rgba(253, 216, 114, 0.16);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.06);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 4px;
  color: var(--white);
  font-size: 1.15rem;
  overflow-wrap: anywhere;
}

.leaderboard {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.leader-row,
.account-row,
.transaction-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  padding: 9px;
  background: rgba(255, 255, 255, 0.055);
}

.leader-row.current {
  border-color: rgba(255, 210, 31, 0.62);
  background: rgba(255, 210, 31, 0.12);
}

.rank-badge {
  width: 34px;
  height: 34px;
  padding: 0;
  color: var(--black);
  background: var(--gold);
}

.name-block {
  min-width: 0;
}

.name-block strong,
.name-block span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.name-block span {
  color: var(--muted);
  font-size: 0.78rem;
}

.amount {
  color: var(--gold);
  font-size: 1rem;
  font-weight: 950;
  white-space: nowrap;
}

.tabs,
.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

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

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

.segmented .btn[aria-pressed="true"],
.tabs .btn[aria-current="page"] {
  color: var(--black);
  border-color: var(--gold);
  background: var(--gold);
}

.chip-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.chip-control {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 40px;
  align-items: center;
  gap: 8px;
  min-height: 76px;
  border: 1px solid rgba(253, 216, 114, 0.22);
  border-radius: 8px;
  padding: 8px;
  background: rgba(0, 0, 0, 0.28);
}

.chip-button {
  width: 40px;
  height: 40px;
  border: 1px solid rgba(253, 216, 114, 0.35);
  border-radius: 8px;
  color: var(--white);
  background: rgba(255, 255, 255, 0.08);
  font-size: 1.2rem;
  font-weight: 950;
}

.chip-face {
  display: grid;
  place-items: center;
  min-height: 52px;
  border: 2px dashed rgba(0, 0, 0, 0.28);
  border-radius: 999px;
  color: var(--black);
  background:
    radial-gradient(circle, var(--gold-pale) 0 45%, var(--gold) 46% 66%, #7d0900 67% 100%);
  font-weight: 950;
  text-align: center;
}

.chip-face span {
  display: block;
  width: 100%;
  padding: 0 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip-count {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  text-align: center;
}

.transaction-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0;
  border-top: 1px solid rgba(253, 216, 114, 0.18);
  border-bottom: 1px solid rgba(253, 216, 114, 0.18);
  padding: 12px 0;
}

.transaction-total strong {
  color: var(--gold);
  font-size: 1.6rem;
}

.action-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.suggestion {
  display: grid;
  gap: 8px;
  margin: 12px 0;
  border: 1px solid rgba(253, 216, 114, 0.18);
  border-radius: 8px;
  padding: 10px;
  background: rgba(16, 88, 61, 0.24);
}

.chip-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip-summary span {
  border: 1px solid rgba(253, 216, 114, 0.28);
  border-radius: 999px;
  padding: 5px 8px;
  color: var(--gold-pale);
  background: rgba(0, 0, 0, 0.3);
  font-size: 0.8rem;
  font-weight: 850;
}

.accounts-list,
.transactions-list {
  display: grid;
  gap: 8px;
}

.account-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.role-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--black);
  background: var(--gold-pale);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.transaction-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.transaction-row strong {
  display: block;
  overflow-wrap: anywhere;
}

.transaction-row small {
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 20;
  width: min(calc(100% - 28px), 420px);
  border: 1px solid rgba(253, 216, 114, 0.4);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--white);
  background: rgba(0, 0, 0, 0.88);
  box-shadow: var(--shadow);
}

.toast.error {
  border-color: rgba(255, 108, 82, 0.72);
}

.closed-screen {
  display: grid;
  gap: 16px;
  width: min(100%, 620px);
  margin: 7vh auto 0;
  padding: 22px;
}

.countdown {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.countdown div {
  border: 1px solid rgba(253, 216, 114, 0.2);
  border-radius: 8px;
  padding: 12px 8px;
  text-align: center;
  background: rgba(255, 255, 255, 0.06);
}

.countdown strong {
  display: block;
  color: var(--gold);
  font-size: 1.6rem;
}

.admin-section {
  display: grid;
  gap: 14px;
}

.raw-json {
  min-height: 240px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.82rem;
}

.empty-state {
  border: 1px dashed rgba(253, 216, 114, 0.32);
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
  text-align: center;
}

@media (min-width: 560px) {
  .app-shell {
    padding: 24px;
  }

  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .status-strip {
    grid-column: 1 / -1;
  }

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

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

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

@media (min-width: 920px) {
  .dashboard-grid {
    grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
    align-items: start;
  }

  .dashboard-grid.staff {
    grid-template-columns: minmax(360px, 0.85fr) minmax(0, 1.15fr);
  }

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

  .auth-card {
    margin-top: 10vh;
  }
}
