:root {
  color-scheme: light;
  --bg: #eef2f5;
  --panel: #ffffff;
  --ink: #14212b;
  --muted: #687584;
  --line: #d8e0e7;
  --accent: #16745f;
  --accent-dark: #0f5b4b;
  --danger: #b42318;
  --warn: #9a6700;
  --info: #235c9f;
  --shadow: 0 12px 30px rgba(21, 34, 43, .08);
}

* { box-sizing: border-box; }

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

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

button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

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

.app-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 16px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: stretch;
  margin-bottom: 14px;
}

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 700;
}

h1 {
  margin: 2px 0 0;
  font-size: 26px;
  line-height: 1.1;
}

h2 {
  margin: 0 0 14px;
  font-size: 18px;
}

.balance-box {
  min-width: 150px;
  background: #132b35;
  color: white;
  border-radius: 8px;
  padding: 12px 14px;
  display: grid;
  align-content: center;
  text-align: right;
}

.balance-box span {
  color: #b8c8cf;
  font-size: 12px;
}

.balance-box strong {
  font-size: 20px;
}

.tabs, .history-actions {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 8px;
}

.tab, .segment {
  background: #dde6ec;
  color: #2c3a45;
  padding: 0 14px;
  white-space: nowrap;
}

.tab.active, .segment.active {
  background: var(--accent);
  color: white;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.grid.two {
  display: grid;
  grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr);
  gap: 14px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 16px;
}

.panel.muted {
  box-shadow: none;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dropzone {
  position: relative;
  min-height: 150px;
  border: 1px dashed #9fb0bd;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #f7fafb;
  color: var(--muted);
  outline: none;
  transition: border-color .16s ease, background .16s ease, color .16s ease;
}

.dropzone:focus,
.dropzone.dragging {
  border-color: var(--accent);
  background: #edf8f4;
  color: var(--accent-dark);
}

.dropzone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.form-grid {
  display: grid;
  gap: 8px;
}

label {
  color: #3b4a56;
  font-size: 13px;
  font-weight: 700;
}

input, textarea, select {
  width: 100%;
  min-height: 42px;
  border: 1px solid #ccd6de;
  background: #fbfcfd;
  border-radius: 8px;
  padding: 9px 10px;
  color: var(--ink);
}

textarea {
  resize: vertical;
}

input:disabled, textarea:disabled, select:disabled {
  color: #43505b;
  background: #eef3f6;
  cursor: not-allowed;
}

.bank-picker {
  position: relative;
}

.native-bank-select {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.bank-picker-button {
  width: 100%;
  min-height: 48px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid #ccd6de;
  border-radius: 8px;
  background: #fbfcfd;
  color: var(--ink);
  padding: 6px 10px;
  text-align: left;
}

.bank-picker-button span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bank-picker-button img,
.bank-option img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.bank-picker-caret {
  color: var(--muted);
}

.bank-picker-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: min(320px, 54vh);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
  padding: 6px;
}

.bank-option {
  width: 100%;
  min-height: 48px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  background: transparent;
  color: var(--ink);
  border-radius: 6px;
  padding: 6px;
  text-align: left;
}

.bank-option:hover,
.bank-option.active {
  background: #edf3f6;
}

.bank-option-text {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.bank-option-text strong,
.bank-option-text small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bank-option-text small {
  color: var(--muted);
  font-size: 12px;
}

.inline-field {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.primary-btn {
  background: var(--accent);
  color: white;
  font-weight: 800;
  padding: 0 14px;
}

.primary-btn:hover {
  background: var(--accent-dark);
}

.secondary-btn {
  background: #dce8ef;
  color: #163140;
  font-weight: 800;
  padding: 0 12px;
}

.danger-btn {
  background: #f4d9d6;
  color: var(--danger);
  font-weight: 800;
  padding: 0 12px;
}

.wide {
  width: 100%;
  margin-top: 14px;
}

.summary-line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 12px;
  border-top: 1px solid var(--line);
  margin-top: 14px;
  padding-top: 12px;
}

.summary-line span {
  color: var(--muted);
}

.status-line {
  min-height: 22px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.status-line.ok { color: var(--accent); }
.status-line.err { color: var(--danger); }

.qr-image {
  width: min(320px, 100%);
  aspect-ratio: 1;
  object-fit: contain;
  display: block;
  margin: 0 auto 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.kv {
  display: grid;
  grid-template-columns: minmax(90px, .6fr) 1fr;
  gap: 8px 10px;
  word-break: break-word;
}

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

.kv strong {
  color: var(--ink);
}

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

.item {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}

.item-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 8px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 800;
  background: #e4eaf0;
  color: #344554;
}

.badge.success { background: #d8f1e9; color: #11624f; }
.badge.failed, .badge.rejected { background: #fae0dd; color: var(--danger); }
.badge.pending, .badge.processing { background: #fff1cc; color: var(--warn); }

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

.stat {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.stat strong {
  display: block;
  font-size: 20px;
  margin-top: 4px;
}

.user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-wallet-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}

.empty {
  color: var(--muted);
  padding: 12px 0;
}

.toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  max-width: 560px;
  margin: 0 auto;
  background: #132b35;
  color: white;
  padding: 12px 14px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  z-index: 20;
}

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

.modal-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: rgba(13, 27, 35, .58);
  border-radius: 0;
}

.modal-dialog {
  position: relative;
  width: min(460px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
  padding: 14px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.modal-head h2 {
  margin: 0;
}

.qr-modal-image {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.hidden { display: none !important; }

@media (max-width: 760px) {
  .app-shell {
    padding: 12px;
  }

  .topbar {
    flex-direction: column;
  }

  .balance-box {
    text-align: left;
  }

  .grid.two, .stats-grid {
    grid-template-columns: 1fr;
  }

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

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

  h1 {
    font-size: 23px;
  }
}
