:root {
  color-scheme: dark;
  --bg: #07111f;
  --surface: #0e1b2d;
  --surface-raised: #13243a;
  --surface-input: #081423;
  --border: #29415d;
  --text: #e7f0fb;
  --muted: #9bb0c9;
  --subtle: #6f879f;
  --accent: #47d7a0;
  --accent-strong: #27b982;
  --accent-dark: #05291f;
  --danger: #fb7185;
  --focus: #7dd3fc;
  --shadow: 0 18px 45px rgba(0, 0, 0, .25);
}

body {
  min-width: 320px;
  background:
    radial-gradient(circle at 8% -12%, rgba(45, 212, 191, .17), transparent 32rem),
    radial-gradient(circle at 96% 8%, rgba(56, 189, 248, .10), transparent 25rem),
    var(--bg);
  color: var(--text);
  line-height: 1.45;
}

header {
  border-color: rgba(91, 124, 158, .35);
  background: rgba(7, 17, 31, .88);
  box-shadow: 0 8px 20px rgba(0, 0, 0, .16);
}

.header,
main {
  width: min(1120px, calc(100% - 40px));
}

.header {
  min-height: 76px;
}

h1 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  letter-spacing: -.025em;
}

h2 {
  font-size: clamp(1rem, 1.5vw, 1.12rem);
  letter-spacing: -.015em;
}

p {
  color: var(--muted);
  line-height: 1.55;
}

main {
  padding: clamp(20px, 4vw, 38px) 0 56px;
}

button,
input {
  min-height: 40px;
}

button {
  border-color: var(--border);
  background: #172a42;
  transition: transform .16s ease, background-color .16s ease, border-color .16s ease;
}

button:hover {
  background: #203954;
  border-color: #486887;
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

button:focus-visible,
input:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(125, 211, 252, .8);
  outline-offset: 3px;
}

input {
  width: 100%;
  border-color: var(--border);
  background: var(--surface-input);
  color: var(--text);
  transition: border-color .16s ease, box-shadow .16s ease;
}

input:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(125, 211, 252, .13);
  outline: 0;
}


.card,
.panel {
  border-color: rgba(71, 101, 134, .55);
  background: linear-gradient(145deg, rgba(19, 36, 58, .96), rgba(11, 25, 42, .96));
  box-shadow: var(--shadow);
}

.card {
  border-color: rgba(53, 201, 145, .45);
  padding: clamp(17px, 3vw, 24px);
}

.card .banker {
  font-size: clamp(1.3rem, 3vw, 1.7rem);
  letter-spacing: -.04em;
}

.queue {
  border: 1px solid rgba(91, 124, 158, .42);
  border-radius: 999px;
  padding: 7px 11px;
  background: rgba(5, 16, 30, .45);
  text-align: center;
}

.tabs {
  position: sticky;
  top: 88px;
  z-index: 1;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 5px;
  border: 1px solid rgba(71, 101, 134, .44);
  border-radius: 13px;
  background: rgba(11, 25, 42, .94);
  box-shadow: 0 12px 28px rgba(0, 0, 0, .15);
}

.tab {
  min-width: 0;
  border: 1px solid transparent;
  padding: 11px 9px;
  font-size: .79rem;
  white-space: nowrap;
}

.tab:hover {
  background: rgba(81, 117, 153, .18);
}

.tab.active {
  border-color: rgba(97, 235, 181, .75);
  background: linear-gradient(135deg, #4ce0a7, #31c892);
  color: #03291f;
  box-shadow: 0 5px 14px rgba(39, 185, 130, .22);
}

.panel {
  border-radius: 16px;
  padding: clamp(16px, 3vw, 25px);
}

.panel-heading {
  align-items: center;
  padding-bottom: 17px;
  margin-bottom: 18px;
}

.eyebrow,
.subheading {
  color: #72e4b8;
  letter-spacing: .1em;
}

.score-list,
.list,
.history-list {
  gap: 11px;
}

.score-row {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(118px, 160px) 42px;
  padding: 12px 14px;
  border-color: rgba(71, 101, 134, .48);
  background: linear-gradient(100deg, rgba(5, 16, 30, .92), rgba(10, 26, 45, .92));
}

.score-row > span {
  font-size: .92rem;
}

.score-row input {
  width: 100%;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}

.score-row small {
  justify-self: start;
  color: var(--muted);
  font-weight: 700;
}

.banker-result {
  align-items: center;
  gap: 16px;
  border-color: rgba(71, 215, 160, .48);
  background: linear-gradient(110deg, rgba(12, 83, 66, .36), rgba(10, 37, 45, .7));
}

.primary {
  min-height: 50px;
  background: linear-gradient(135deg, #50e2a9, #2cc18c);
  box-shadow: 0 10px 24px rgba(39, 185, 130, .18);
}

.primary:hover {
  background: linear-gradient(135deg, #75ecc0, #3dd49e);
}

.secondary {
  min-height: 40px;
  background: #4169e1;
}

.columns {
  gap: 22px;
}

.list-row {
  min-height: 58px;
  padding: 11px 13px;
  border-color: rgba(71, 101, 134, .48);
  background: rgba(5, 16, 30, .72);
}

.list-row > span:first-child {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 650;
}

.actions {
  gap: 7px;
}

.actions button {
  min-height: 36px;
}

.selected {
  border-color: rgba(71, 215, 160, .75);
  background: linear-gradient(100deg, rgba(18, 105, 78, .31), rgba(5, 30, 38, .72));
}

.balance-grid {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 11px;
}

.balance-grid > div {
  min-height: 88px;
  justify-content: center;
  border-color: rgba(71, 101, 134, .48);
  background: rgba(5, 16, 30, .72);
}

.balance-grid b {
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}

.settlement-list > div {
  min-height: 54px;
  border-color: rgba(71, 101, 134, .48);
  background: rgba(5, 16, 30, .72);
  font-variant-numeric: tabular-nums;
}

.history {
  border-color: rgba(71, 101, 134, .52);
  background: rgba(5, 16, 30, .78);
}

.history[open] {
  border-color: rgba(71, 215, 160, .5);
  box-shadow: inset 0 0 0 1px rgba(71, 215, 160, .08);
}

.history summary {
  min-height: 34px;
  align-items: center;
  list-style: none;
  font-size: .82rem;
}

.history summary::-webkit-details-marker {
  display: none;
}

.history summary::after {
  content: '+';
  color: var(--subtle);
  font-size: 1.2rem;
  line-height: 1;
}

.history[open] summary::after {
  content: '−';
  color: var(--accent);
}

.history-details {
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  margin: 14px 0;
}

.history-details div {
  border: 1px solid rgba(71, 101, 134, .3);
  background: var(--surface-input);
  font-variant-numeric: tabular-nums;
}

.notice,
.error {
  padding: 13px 15px;
  font-weight: 600;
  box-shadow: var(--shadow);
}

.notice {
  border-color: rgba(71, 215, 160, .5);
}

.error {
  border-color: rgba(251, 113, 133, .7);
}

.empty {
  padding: 34px 20px;
  border-color: rgba(91, 124, 158, .5);
  background: rgba(5, 16, 30, .35);
}

.account-bar {
  display: flex;
  justify-content: flex-end;
  min-height: 40px;
  margin-bottom: 12px;
}

.account-actions,
.readonly-note {
  display: flex;
  align-items: center;
  gap: 11px;
}

.account-actions form {
  margin: 0;
}

.account-label,
.readonly-status {
  color: var(--muted);
  font-size: .82rem;
}

.login-link {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(71, 215, 160, .62);
  border-radius: 9px;
  padding: 8px 12px;
  color: #8bf0c9;
  font-size: .84rem;
  font-weight: 800;
  text-decoration: none;
}

.login-link:hover {
  border-color: var(--accent);
  background: rgba(71, 215, 160, .12);
}

.readonly-note {
  justify-content: space-between;
  border: 1px solid rgba(91, 124, 158, .48);
  border-radius: 14px;
  padding: 16px;
  background: rgba(5, 16, 30, .38);
}

.readonly-note p {
  margin: 5px 0 0;
}

.compact-note {
  margin: 0 0 13px;
  border-radius: 10px;
  padding: 11px 12px;
  color: var(--muted);
  font-size: .84rem;
}

.compact-note .login-link {
  min-height: 34px;
  padding: 6px 10px;
}

.auth-card h1 {
  margin-top: 7px;
}

.auth-card .notice,
.auth-card .error {
  margin-top: 17px;
  margin-bottom: 0;
}

.auth-shell {
  width: 100%;
  min-height: 100dvh;
  margin: 0;
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-card {
  margin: 0;
}

@media (max-width: 800px) {
  .tabs {
    position: static;
    display: flex;
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .tab {
    flex: 0 0 auto;
    min-width: 140px;
  }

  .columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .header,
  main {
    width: min(100% - 24px, 1120px);
  }

  .header {
    min-height: 60px;
    flex-direction: row;
  }

  .header p {
    display: none;
  }

  .card,
  .panel-heading,
  .banker-result {
    align-items: stretch;
    flex-direction: column;
  }

  .queue {
    align-self: flex-start;
  }

  .score-row {
    grid-template-columns: 1fr 38px;
    gap: 8px;
  }

  .score-row > span {
    grid-column: 1 / -1;
  }

  .score-row input {
    grid-column: 1;
  }

  .score-row small {
    align-self: center;
  }

  .inline-form {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .inline-form input {
    min-width: 100%;
  }

  .inline-form button {
    width: 100%;
  }

  .list-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .actions {
    width: 100%;
    justify-content: flex-start;
  }

  .actions form,
  .actions button {
    flex: 1;
  }

  .history summary {
    align-items: flex-start;
    padding-right: 3px;
  }

  .history summary > span:first-child {
    flex: 1;
  }

  .settlement-list > div {
    flex-wrap: wrap;
  }

  .settlement-list strong {
    width: 100%;
    margin-left: 0;
  }

  .account-bar {
    justify-content: stretch;
  }

  .account-actions,
  .account-bar > .login-link {
    width: 100%;
  }

  .account-actions button,
  .account-bar > .login-link {
    flex: 1;
  }

  .readonly-note {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 390px) {
  .header,
  main {
    width: min(100% - 18px, 1120px);
  }


  .panel {
    padding: 14px;
  }

  .balance-grid,
  .history-details {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
  }
}
