:root {
  --bg: #07090d;
  --panel: #0f131a;
  --panel-2: #151a23;
  --panel-3: #1a202b;
  --border: rgba(255, 255, 255, .08);
  --border-strong: rgba(255, 255, 255, .14);
  --text: #f8fafc;
  --muted: #8f98a8;
  --yellow: #fbbf24;
  --yellow-2: #f59e0b;
  --purple: #9146ff;
  --green: #34d399;
  --red: #fb7185;
  --blue: #60a5fa;
  --shadow: 0 22px 60px rgba(0, 0, 0, .28);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 0%, rgba(251, 191, 36, .08), transparent 28rem),
    radial-gradient(circle at 90% 8%, rgba(145, 70, 255, .07), transparent 24rem),
    var(--bg);
  color: var(--text);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

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

.eyebrow {
  margin: 0 0 8px;
  color: var(--yellow);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .16em;
}

.card,
.kpi-card {
  border: 1px solid var(--border);
  background: rgba(15, 19, 26, .9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 12px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(7, 9, 13, .88);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand strong {
  display: block;
  font-size: 15px;
}

.brand span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 1px solid rgba(251, 191, 36, .3);
  border-radius: 17px;
  background:
    linear-gradient(145deg, rgba(251, 191, 36, .2), rgba(251, 191, 36, .03));
  color: var(--yellow);
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -.04em;
}

.brand-mark.small {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  font-size: 15px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-box {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 130px;
  padding-right: 8px;
}

.user-box strong,
.user-box span {
  display: block;
}

.user-box strong {
  font-size: 13px;
}

.user-box span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.user-avatar,
.mini-avatar {
  object-fit: cover;
  border-radius: 50%;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-strong);
}

.dashboard {
  width: min(1540px, calc(100% - 40px));
  margin: 0 auto;
  padding: 34px 0 70px;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.page-heading h1 {
  margin: 0;
  font-size: clamp(32px, 4vw, 54px);
  line-height: 1;
  letter-spacing: -.04em;
}

.page-heading .muted {
  margin: 12px 0 0;
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.tiny-btn,
.twitch-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  font-weight: 750;
  transition:
    transform .15s ease,
    border-color .15s ease,
    background .15s ease,
    opacity .15s ease;
}

.primary-btn {
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--yellow);
  background: var(--yellow);
  color: #17120a;
}

.primary-btn:hover {
  transform: translateY(-1px);
  background: #ffd055;
}

.secondary-btn {
  min-height: 42px;
  padding: 0 15px;
  border: 1px solid var(--border-strong);
  background: var(--panel-3);
  color: var(--text);
}

.secondary-btn:hover,
.ghost-btn:hover,
.tiny-btn:hover {
  border-color: rgba(251, 191, 36, .35);
  background: rgba(251, 191, 36, .08);
}

.ghost-btn {
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid var(--border);
  background: transparent;
  color: #d9dee7;
}

.tiny-btn {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  background: var(--panel-3);
  color: #d9dee7;
  font-size: 11px;
}

button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.filter-bar {
  margin-bottom: 18px;
  padding: 16px;
  border-radius: var(--radius);
}

.filter-grid {
  display: grid;
  grid-template-columns:
    minmax(135px, .8fr)
    minmax(135px, .8fr)
    minmax(150px, 1fr)
    minmax(150px, 1fr)
    minmax(220px, 1.7fr)
    auto;
  gap: 12px;
  align-items: end;
}

label {
  display: grid;
  gap: 7px;
  color: #c8cfda;
  font-size: 12px;
  font-weight: 650;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 11px;
  outline: none;
  background: #0b0e13;
  color: var(--text);
}

input,
select {
  min-height: 42px;
  padding: 0 12px;
}

textarea {
  padding: 11px 12px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(251, 191, 36, .48);
  box-shadow: 0 0 0 3px rgba(251, 191, 36, .08);
}

.filter-button {
  height: 42px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.kpi-card {
  min-height: 170px;
  padding: 22px;
  border-radius: var(--radius);
}

.kpi-card > span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.kpi-card > strong {
  display: block;
  margin-top: 12px;
  font-size: clamp(28px, 2.6vw, 42px);
  letter-spacing: -.04em;
}

.kpi-change {
  margin-top: 14px;
  font-size: 12px;
  font-weight: 800;
}

.kpi-change.positive {
  color: var(--green);
}

.kpi-change.negative {
  color: var(--red);
}

.kpi-change.neutral {
  color: var(--muted);
}

.kpi-card small {
  display: block;
  margin-top: 6px;
  color: #697386;
  font-size: 11px;
}

.analytics-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(340px, .8fr);
  gap: 18px;
  margin-bottom: 18px;
}

.card {
  border-radius: var(--radius);
}

.chart-card {
  min-width: 0;
}

.card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px 0;
}

.card-heading h2 {
  margin: 0;
  font-size: 17px;
}

.card-heading p {
  margin: 6px 0 0;
  font-size: 12px;
}

.chart-wrap {
  height: 340px;
  padding: 18px 18px 20px;
}

.breakdown-list {
  display: grid;
  gap: 8px;
  max-height: 356px;
  overflow: auto;
  padding: 14px 16px 18px;
}

.breakdown-row {
  width: 100%;
  padding: 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: rgba(255, 255, 255, .025);
  color: var(--text);
  text-align: left;
}

.breakdown-row:hover {
  border-color: var(--border);
  background: rgba(255, 255, 255, .045);
}

.breakdown-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

.breakdown-row small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 10px;
}

.progress {
  height: 5px;
  margin-top: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, .06);
}

.progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--yellow), var(--yellow-2));
}

.table-card {
  overflow: hidden;
}

.table-scroll {
  overflow: auto;
  margin-top: 14px;
}

table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

th,
td {
  padding: 13px 16px;
  border-top: 1px solid var(--border);
  text-align: left;
  font-size: 12px;
}

th {
  color: #808999;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

tbody tr:hover {
  background: rgba(255, 255, 255, .022);
}

.amount-cell {
  color: #f4d777;
  font-weight: 800;
}

.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: #dfe7ff;
  font-weight: 800;
}

.link-button:hover {
  color: var(--yellow);
}

.site-badge,
.creator-badge,
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, .04);
  font-size: 10px;
  font-weight: 750;
}

.creator-badge {
  border-color: rgba(145, 70, 255, .18);
  background: rgba(145, 70, 255, .08);
  color: #c8adff;
}

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

.row-actions {
  width: 42px;
  padding-left: 4px;
  padding-right: 10px;
}

.delete-btn {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(251, 113, 133, .2);
  border-radius: 8px;
  background: rgba(251, 113, 133, .06);
  color: var(--red);
}

.empty-state {
  padding: 22px;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 22px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .72);
  backdrop-filter: blur(6px);
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: min(720px, 100%);
  max-height: calc(100vh - 44px);
  overflow: auto;
  border: 1px solid var(--border-strong);
  border-radius: 22px;
  background: #0d1118;
  box-shadow: 0 30px 100px rgba(0, 0, 0, .65);
}

.modal-wide {
  width: min(880px, 100%);
}

.player-panel,
.settings-panel {
  width: min(1040px, 100%);
}

.modal-heading {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 24px 16px;
  border-bottom: 1px solid var(--border);
}

.modal-heading h2 {
  margin: 0;
  font-size: 24px;
}

.modal-heading p.muted {
  margin: 8px 0 0;
  font-size: 12px;
}

.icon-btn {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--panel-2);
  color: #cbd3de;
  font-size: 22px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
  padding: 22px 24px 26px;
}

.span-2 {
  grid-column: span 2;
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

.form-error {
  margin-right: auto;
  color: var(--red);
  font-size: 12px;
}

.player-filter-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 10px;
  align-items: end;
  padding: 18px 24px 0;
}

.player-total-box {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 12px;
  margin: 18px 24px;
}

.player-total-box > div {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, .025);
}

.player-total-box span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.player-total-box strong {
  display: block;
  margin-top: 6px;
  font-size: 24px;
}

.player-notes-label {
  margin: 0 24px;
}

.note-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  padding: 10px 24px 0;
}

.note-actions span {
  margin-right: auto;
  font-size: 11px;
}

.mini-breakdown {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 9px;
  padding: 18px 24px 4px;
}

.mini-stat {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, .02);
}

.mini-stat span,
.mini-stat strong,
.mini-stat small {
  display: block;
}

.mini-stat span {
  color: var(--muted);
  font-size: 10px;
}

.mini-stat strong {
  margin-top: 4px;
  font-size: 15px;
}

.mini-stat small {
  margin-top: 4px;
  color: #737c8b;
  font-size: 10px;
}

.compact-table {
  margin-top: 18px;
  padding-bottom: 10px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 20px 24px 28px;
}

.settings-box {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: rgba(255, 255, 255, .018);
}

.settings-box-wide {
  grid-column: span 2;
}

.settings-box h3 {
  margin: 0 0 7px;
  font-size: 15px;
}

.settings-box > .muted {
  margin: 0 0 14px;
  font-size: 11px;
}

.inline-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-bottom: 12px;
}

.inline-form.three-col {
  grid-template-columns: minmax(160px, 1fr) minmax(130px, .35fr) auto;
}

.settings-list {
  display: grid;
  gap: 7px;
}

.settings-row,
.access-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: rgba(0, 0, 0, .12);
}

.settings-row strong,
.settings-row small,
.access-person strong,
.access-person small {
  display: block;
}

.settings-row strong,
.access-person strong {
  font-size: 12px;
}

.settings-row small,
.access-person small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.access-person {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.mini-avatar {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
}

.mini-avatar.placeholder {
  display: grid;
  place-items: center;
  background: rgba(145, 70, 255, .1);
  color: #c8adff;
  font-size: 12px;
  font-weight: 900;
}

.access-controls {
  display: flex;
  align-items: center;
  gap: 7px;
}

.access-controls select {
  width: auto;
  min-width: 112px;
  min-height: 32px;
  padding: 0 8px;
  font-size: 11px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 120;
  min-width: 240px;
  max-width: 420px;
  padding: 13px 15px;
  border: 1px solid rgba(52, 211, 153, .25);
  border-radius: 12px;
  background: #101a17;
  box-shadow: var(--shadow);
  color: #dffbee;
  font-size: 12px;
}

.toast[data-type="error"] {
  border-color: rgba(251, 113, 133, .25);
  background: #1d1216;
  color: #ffd9e0;
}

.modal-open {
  overflow: hidden;
}

/* Login */

.login-page {
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-shell {
  width: min(440px, 100%);
}

.login-card {
  padding: 36px;
  border: 1px solid var(--border-strong);
  border-radius: 24px;
  background: rgba(13, 17, 24, .92);
  box-shadow: 0 30px 100px rgba(0, 0, 0, .45);
  text-align: center;
}

.login-card .brand-mark {
  margin: 0 auto 20px;
}

.login-card h1 {
  margin: 0;
  font-size: 34px;
  letter-spacing: -.04em;
}

.login-copy {
  margin: 12px auto 24px;
  line-height: 1.65;
}

.twitch-btn {
  width: 100%;
  min-height: 52px;
  gap: 10px;
  border: 1px solid #a970ff;
  background: #9146ff;
  color: white;
}

.twitch-btn:hover {
  transform: translateY(-1px);
  background: #a45fff;
}

.twitch-btn svg {
  width: 21px;
  height: 21px;
  fill: currentColor;
}

.login-note {
  display: block;
  margin-top: 18px;
  color: #677181;
  line-height: 1.5;
}

.login-card .form-error {
  margin: 14px 0 0;
}

.denied-card .deny-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin: 0 auto 20px;
  border: 1px solid rgba(251, 113, 133, .28);
  border-radius: 50%;
  background: rgba(251, 113, 133, .08);
  color: var(--red);
  font-size: 24px;
  font-weight: 900;
}

.centered-btn {
  min-width: 180px;
}

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

  .grow-filter {
    grid-column: span 2;
  }

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

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

@media (max-width: 760px) {
  .topbar {
    position: static;
    align-items: flex-start;
    padding: 14px 16px;
  }

  .topbar-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .user-box {
    min-width: 0;
  }

  .user-box > div {
    display: none;
  }

  .dashboard {
    width: min(100% - 24px, 1540px);
    padding-top: 24px;
  }

  .page-heading {
    align-items: stretch;
    flex-direction: column;
  }

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

  .grow-filter {
    grid-column: span 2;
  }

  .filter-button {
    grid-column: span 2;
  }

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

  .kpi-card {
    min-height: 145px;
  }

  .chart-wrap {
    height: 280px;
  }

  .modal {
    padding: 10px;
  }

  .modal-panel {
    max-height: calc(100vh - 20px);
    border-radius: 16px;
  }

  .form-grid {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .span-2 {
    grid-column: span 1;
  }

  .form-actions {
    flex-wrap: wrap;
  }

  .form-error {
    width: 100%;
  }

  .player-filter-row {
    grid-template-columns: 1fr 1fr;
    padding: 16px 18px 0;
  }

  .player-filter-row label:nth-child(3),
  .player-filter-row button {
    grid-column: span 2;
  }

  .player-total-box {
    margin: 16px 18px;
    grid-template-columns: 1fr;
  }

  .player-notes-label {
    margin: 0 18px;
  }

  .note-actions {
    padding-left: 18px;
    padding-right: 18px;
  }

  .mini-breakdown {
    padding-left: 18px;
    padding-right: 18px;
  }

  .settings-grid {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .settings-box-wide {
    grid-column: span 1;
  }

  .inline-form.three-col {
    grid-template-columns: 1fr;
  }

  .access-row {
    align-items: stretch;
    flex-direction: column;
  }

  .access-controls {
    flex-wrap: wrap;
  }
}

@media (max-width: 480px) {
  .topbar {
    gap: 10px;
  }

  .brand span {
    display: none;
  }

  .topbar-actions .ghost-btn {
    padding: 0 9px;
    font-size: 11px;
  }

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

  .grow-filter,
  .filter-button {
    grid-column: span 1;
  }

  .login-card {
    padding: 28px 20px;
  }

  .login-card h1 {
    font-size: 29px;
  }

  .player-filter-row {
    grid-template-columns: 1fr;
  }

  .player-filter-row label:nth-child(3),
  .player-filter-row button {
    grid-column: span 1;
  }
}


/* MatthewSlots image inside the existing gold brand frame */
.brand-mark {
  padding: 0;
  overflow: hidden;
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}


/* Deposits pagination */
.deposit-table-scroll {
  max-height: min(70vh, 720px);
  overflow: auto;
}

.deposit-table-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #10141c;
  box-shadow: 0 1px 0 var(--border);
}

.deposit-pagination {
  display: grid;
  grid-template-columns: minmax(150px, auto) 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 16px 4px 2px;
  border-top: 1px solid var(--border);
}

.page-size-control {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.page-size-control label {
  margin: 0;
}

.page-size-control select {
  width: auto;
  min-width: 76px;
  min-height: 36px;
  padding: 0 30px 0 10px;
}

.pagination-info {
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.pagination-controls,
.pagination-pages {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pagination-btn {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  height: 34px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: rgba(255, 255, 255, .035);
  color: #cbd3df;
  font-size: 12px;
  font-weight: 800;
}

.pagination-btn:hover:not(:disabled) {
  border-color: rgba(251, 191, 36, .35);
  background: rgba(251, 191, 36, .08);
  color: var(--yellow);
}

.pagination-btn.active {
  border-color: rgba(251, 191, 36, .45);
  background: rgba(251, 191, 36, .14);
  color: var(--yellow);
}

.pagination-btn:disabled {
  cursor: not-allowed;
  opacity: .35;
}

.pagination-ellipsis {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 34px;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 820px) {
  .deposit-pagination {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .page-size-control,
  .pagination-info,
  .pagination-controls {
    justify-content: center;
  }

  .pagination-controls {
    flex-wrap: wrap;
  }

  .deposit-table-scroll {
    max-height: 65vh;
  }
}
