:root {
  --bg: #f5f5f2;
  --ink: #080808;
  --muted: #686868;
  --line: #d9d9d4;
  --panel: #ffffff;
  --soft: #eeeeea;
  --dark: #111111;
  --good: #0f8b4c;
  --bad: #b42318;
  --warn: #9a6700;
  --shadow: 0 18px 60px rgba(8, 8, 8, 0.08);
  font-family: "IBM Plex Sans", "Aptos", "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(8, 8, 8, 0.035) 1px, transparent 1px) 0 0 / 34px 34px,
    linear-gradient(rgba(8, 8, 8, 0.025) 1px, transparent 1px) 0 0 / 34px 34px,
    var(--bg);
}

button,
input,
select {
  font: inherit;
  font-size: 16px;
}

textarea {
  width: 100%;
  min-height: 120px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  color: var(--ink);
  outline: none;
  resize: vertical;
  font: inherit;
  font-size: 16px;
}

textarea:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(8, 8, 8, 0.08);
}

button {
  min-height: 46px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

button:disabled {
  opacity: 0.52;
  cursor: wait;
}

input,
select {
  width: 100%;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
  outline: none;
  font-size: 16px;
}

input:focus,
select:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(8, 8, 8, 0.08);
}

.shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 18px 14px 40px;
}

#protectedApp {
  display: none;
}

body.app-ready #protectedApp {
  display: block;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: stretch;
  margin: 8px 0 16px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 34px;
  line-height: 0.95;
  font-weight: 950;
}

h2 {
  font-size: 22px;
  font-weight: 950;
}

h3 {
  font-size: 15px;
  font-weight: 900;
}

.balance-card {
  min-width: 162px;
  display: grid;
  gap: 4px;
  align-content: center;
  border: 1px solid var(--ink);
  border-radius: 8px;
  padding: 13px 14px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow);
}

.balance-card span,
.balance-card small {
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 800;
}

.balance-card strong {
  font-size: 23px;
  line-height: 1.05;
}

.tabs,
.subtabs {
  display: grid;
  gap: 8px;
}

.tabs {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 12px;
}

.subtabs {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 14px 0;
}

.tab,
.subtab,
.secondary,
.icon-btn {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
}

.tab.active,
.subtab.active {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.panel,
.notice {
  display: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.panel.active,
.notice {
  display: block;
}

.panel {
  padding: 16px;
}

.notice {
  margin-bottom: 12px;
  padding: 13px 14px;
  color: var(--muted);
  font-weight: 800;
}

.notice.ok {
  color: var(--good);
}

.notice.error {
  color: var(--bad);
}

.section-head,
.split-title {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}

.icon-btn {
  width: 46px;
  padding: 0;
  font-size: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 0.45fr) 150px;
  gap: 12px;
  align-items: end;
  margin: 16px 0;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.split-title {
  margin: 16px 0 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.split-title span,
.limit {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.list {
  display: grid;
  gap: 10px;
}

.list.compact {
  margin: 14px 0;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(0, 1.1fr);
  gap: 12px;
  align-items: start;
}

.admin-detail {
  position: sticky;
  top: 12px;
}

.card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: #fff;
}

.card-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.card-title {
  min-width: 0;
  font-size: 15px;
  font-weight: 950;
  overflow-wrap: anywhere;
}

.card-meta,
.card-sub {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  line-height: 1.45;
}

.va-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.va-line span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.copy-btn,
.eye-btn {
  min-height: 34px;
  border-color: var(--line);
  background: var(--soft);
  color: var(--ink);
  padding: 0 10px;
  font-size: 12px;
}

.va-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.amount {
  white-space: nowrap;
  font-weight: 950;
}

.amount.good {
  color: var(--good);
}

.amount.bad {
  color: var(--bad);
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 9px;
  background: var(--soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.pill.pending {
  color: var(--warn);
  background: #fff3cd;
}

.pill.paid {
  color: var(--good);
  background: #dcf7e9;
}

.pill.rejected {
  color: var(--bad);
  background: #fee4e2;
}

.mono {
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-weight: 900;
}

.withdraw-box,
.settings-box {
  display: grid;
  gap: 12px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  padding: 14px;
  background: #fafaf8;
}

.withdraw-box {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.withdraw-box label:last-of-type {
  grid-column: 1 / -1;
}

.withdraw-box button {
  grid-column: 1 / -1;
}

.settings-box {
  margin: 14px 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 780;
}

.user-actions {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: end;
}

.small-btn {
  min-height: 38px;
  padding: 0 12px;
  font-size: 12px;
}

.toast {
  position: fixed;
  left: 14px;
  right: 14px;
  bottom: 18px;
  z-index: 10;
  width: min(520px, calc(100% - 28px));
  margin: 0 auto;
  border-radius: 8px;
  padding: 13px 14px;
  background: var(--ink);
  color: #fff;
  box-shadow: 0 18px 60px rgba(8, 8, 8, 0.22);
  font-weight: 850;
  text-align: center;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: end center;
  padding: 14px;
  background: rgba(8, 8, 8, 0.42);
  backdrop-filter: blur(8px);
}

.modal[hidden] {
  display: none;
}

.modal-card {
  width: min(560px, 100%);
  max-height: min(84vh, 720px);
  overflow: auto;
  border: 1px solid var(--ink);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 24px 80px rgba(8, 8, 8, 0.28);
  padding: 16px;
}

.result-lines {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

.history-block {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
  font-weight: 850;
}

@media (max-width: 700px) {
  .shell {
    padding: 12px 10px 30px;
  }

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

  h1 {
    font-size: 30px;
  }

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

  .form-grid,
  .withdraw-box,
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .panel {
    padding: 13px;
  }

  .card-row {
    flex-direction: column;
  }

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