:root {
  --bg: #f7f1fb;
  --panel: rgba(255, 255, 255, .84);
  --text: #11213a;
  --muted: #667085;
  --line: rgba(37, 99, 235, .18);
  --primary: #108577;
  --primary-2: #0e6f68;
  --danger: #b42318;
  --warn: #fff8df;
  --shadow: 0 20px 54px rgba(36, 46, 84, .14);
  --soft-shadow: 0 10px 28px rgba(50, 64, 112, .10);
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  min-height: 100%;
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background:
    linear-gradient(145deg, rgba(255, 111, 168, .22), rgba(250, 255, 255, .78) 34%, rgba(68, 210, 230, .24) 62%, rgba(150, 91, 255, .25)),
    linear-gradient(180deg, #fff6fb 0%, #eefbff 48%, #fff7f9 100%);
}

body.night {
  --panel: rgba(16, 24, 40, .78);
  --text: #f8fafc;
  --muted: #cbd5e1;
  --line: rgba(148, 163, 184, .25);
  background:
    linear-gradient(145deg, rgba(28, 36, 74, .96), rgba(18, 83, 94, .82) 55%, rgba(67, 56, 202, .72)),
    #101828;
}

.shell {
  width: min(100%, 520px);
  margin: 0 auto;
  padding: 16px 14px 36px;
}

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

.app-top {
  min-height: 62px;
  padding: 11px 14px 11px 18px;
  border: 1px solid rgba(14, 165, 233, .23);
  border-radius: 26px;
  background: rgba(247, 254, 255, .86);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(10px);
}

.brand {
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: .5px;
  color: #f43f8f;
  text-shadow: 0 1px 0 rgba(255,255,255,.5);
}

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

.top .muted {
  margin-top: 5px;
  font-size: 14px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.panel, .stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.panel {
  padding: 18px;
  margin-bottom: 16px;
}

.warn {
  background: var(--warn);
}

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

.stat {
  padding: 14px;
}

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

.stat b {
  display: block;
  margin-top: 8px;
  font-size: 24px;
}

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

h1 { font-size: 28px; }
h2 { font-size: 22px; }

.row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-bottom: 10px;
}

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

input, textarea, select {
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(148, 163, 184, .48);
  border-radius: 16px;
  padding: 12px 16px;
  font: inherit;
  background: rgba(255, 255, 255, .84);
  color: #1f2937;
  outline: none;
}

input:focus, textarea:focus, select:focus {
  border-color: #18c4d6;
  box-shadow: 0 0 0 4px rgba(24, 196, 214, .14);
}

textarea {
  min-height: 96px;
  resize: vertical;
  margin-bottom: 12px;
}

select {
  appearance: none;
}

button, .ghost {
  border: 0;
  border-radius: 14px;
  background: var(--primary);
  color: #fff;
  padding: 11px 14px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
}

button:hover, .ghost:hover {
  background: var(--primary-2);
}

.secondary {
  background: #334155;
}

.icon-btn {
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(14, 116, 144, .17);
  background: rgba(255, 255, 255, .72);
  color: #0f6c7e;
  font-size: 24px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, .08);
}

.icon-btn:hover {
  background: #fff;
  color: #0e7490;
}

.admin-chip {
  min-height: 40px;
  padding: 9px 12px;
  border-radius: 12px;
  background: #108577;
  color: #fff;
}

.icon-action {
  width: 34px;
  height: 34px;
  min-height: 34px;
  margin-right: 6px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #eefcff;
  color: #0f6c7e;
}

.small {
  min-height: 34px;
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 13px;
}

.balance-card {
  position: relative;
  overflow: hidden;
  margin-bottom: 16px;
  padding: 22px 20px 24px;
  border-radius: 28px;
  color: #fff;
  background: linear-gradient(135deg, #ff3f78 0%, #ff9f1a 24%, #22c55e 52%, #06b6d4 73%, #6366f1 100%);
  box-shadow: 0 24px 60px rgba(61, 73, 128, .24);
}

.balance-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(255,255,255,.18), transparent 42%, rgba(255,255,255,.16));
  pointer-events: none;
}

.balance-card > * {
  position: relative;
  z-index: 1;
}

.balance-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-weight: 800;
}

.balance-card > b {
  display: block;
  margin: 8px 0 16px;
  font-size: 34px;
  line-height: 1;
}

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

.mini-stats article {
  min-height: 82px;
  padding: 12px 11px;
  border: 1px solid rgba(255,255,255,.24);
  border-radius: 16px;
  background: rgba(255,255,255,.18);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.16);
}

.mini-stats span {
  display: block;
  font-size: 12px;
  font-weight: 700;
  opacity: .9;
}

.mini-stats strong {
  display: block;
  margin-top: 8px;
  font-size: 19px;
  line-height: 1.05;
}

.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.quick-actions button {
  min-height: 46px;
  border: 1px solid rgba(255,255,255,.58);
  border-radius: 12px;
  background: rgba(255,255,255,.86);
  color: #17616c;
  box-shadow: 0 8px 18px rgba(17, 24, 39, .08);
}

.quick-actions button:hover {
  background: #fff;
}

.quick-actions button:last-child {
  grid-column: 1 / 2;
}

.panel-title {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.panel-title p {
  margin: 0;
}

.collapse-pill {
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid rgba(20, 184, 166, .22);
  border-radius: 14px;
  background: rgba(255,255,255,.82);
  color: #17616c;
  box-shadow: 0 7px 18px rgba(15, 23, 42, .08);
}

.collapse-pill:hover {
  background: #fff;
  color: #0f6c7e;
}

.va-create-card {
  border-color: rgba(34, 211, 238, .66);
  background:
    linear-gradient(135deg, rgba(240, 253, 255, .92), rgba(255, 247, 251, .92)),
    var(--panel);
  box-shadow: 0 22px 56px rgba(14, 116, 144, .12);
}

.field-label {
  display: block;
  margin: 18px 0 8px;
  color: #667085;
  font-weight: 900;
  font-size: 13px;
  text-transform: uppercase;
}

.bank-pill {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  width: min(210px, 100%);
  min-height: 52px;
  padding: 10px 16px;
  border-radius: 14px;
  color: #fff;
  font-weight: 900;
  background: linear-gradient(135deg, #ff3f78 0%, #ffb020 35%, #17c964 64%, #06b6d4 100%);
  box-shadow: 0 12px 22px rgba(20, 184, 166, .20);
}

.bank-logo {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #fff;
  color: #eab308;
  font-size: 14px;
  font-weight: 900;
  box-shadow: 0 2px 7px rgba(15,23,42,.14);
}

.gradient-btn {
  width: min(250px, 76%);
  min-height: 50px;
  margin: 28px auto 2px;
  border-radius: 16px;
  background: linear-gradient(135deg, #ff3f78, #ff9f1a 42%, #10b981 68%, #06b6d4);
  box-shadow: 0 14px 24px rgba(14, 165, 233, .18);
}

.gradient-btn:hover {
  background: linear-gradient(135deg, #f43f8f, #f59e0b 42%, #10b981 68%, #0891b2);
}

.batch-card {
  border-color: rgba(168, 85, 247, .28);
  background:
    linear-gradient(135deg, rgba(236, 254, 255, .86), rgba(255, 251, 235, .72), rgba(253, 242, 248, .84)),
    var(--panel);
}

.batch-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
}

.batch-head h2 {
  font-size: 20px;
  margin-bottom: 4px;
}

.batch-head p {
  margin: 0;
}

.plus-badge {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f43f8f, #7c3aed);
  color: #fff;
  font-size: 26px;
  font-weight: 900;
  box-shadow: 0 10px 18px rgba(124, 58, 237, .22);
}

#batchBody {
  margin-top: 16px;
}

.fee-preview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.fee-preview span {
  min-height: 48px;
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(238, 242, 247, .88);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(15, 23, 42, .48);
}

.modal[hidden], [hidden] {
  display: none !important;
}

.modal-card {
  width: min(420px, 100%);
  border-radius: 22px;
  background: #fff;
  padding: 20px;
  box-shadow: 0 22px 70px rgba(15, 23, 42, .28);
}

.receipt {
  display: grid;
  grid-template-columns: 95px 1fr;
  gap: 10px;
  margin: 16px 0;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #f8fafc;
}

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

.receipt strong {
  color: var(--primary);
  font-size: 22px;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
}

table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  background: rgba(255,255,255,.9);
}

th, td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 14px;
  vertical-align: top;
}

th {
  background: #eefcff;
  color: #344054;
}

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

#toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 30;
  max-width: calc(100vw - 30px);
  padding: 11px 14px;
  border-radius: 14px;
  background: #111827;
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(20px);
  transition: .2s ease;
}

#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.admin-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.side {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  background: #101828;
  color: #fff;
}

.side b {
  margin-bottom: 10px;
}

.side a, .side button {
  justify-content: flex-start;
  padding: 10px;
  border-radius: 10px;
  background: transparent;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
}

.side a:hover, .side button:hover {
  background: rgba(255,255,255,.12);
}

.content {
  padding: 18px;
  overflow: auto;
}

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

  .row, .row.three, .admin-shell, .fee-preview {
    grid-template-columns: 1fr;
  }

  .admin-shell {
    display: block;
  }

  .side {
    position: sticky;
    top: 0;
    z-index: 2;
  }

  .side button, .side a {
    display: inline-flex;
  }
}

@media (max-width: 390px) {
  .brand {
    font-size: 21px;
  }

  .top .muted {
    font-size: 12px;
  }

  .app-top {
    padding-left: 14px;
  }

  .icon-btn {
    width: 40px;
    height: 40px;
    min-height: 40px;
  }

  .mini-stats {
    gap: 8px;
  }

  .mini-stats article {
    padding: 10px 8px;
  }

  .mini-stats strong {
    font-size: 17px;
  }

  .quick-actions button {
    font-size: 14px;
    padding-inline: 8px;
  }
}
