:root {
  --bg: #f8fafc;
  --text: #111827;
  --card: #ffffff;
  --primary: #14532d;
  --primary-soft: #dcfce7;
  --danger: #991b1b;
  --danger-soft: #fee2e2;
  --good: #065f46;
  --good-soft: #d1fae5;
  --info: #1d4ed8;
  --info-soft: #dbeafe;
  --warn: #92400e;
  --warn-soft: #fef3c7;
  --muted: #6b7280;
  --border: #e5e7eb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top right, #e2fbe8 0%, var(--bg) 50%);
}

.app {
  max-width: 760px;
  margin: 0 auto;
  padding: 1rem;
  display: grid;
  gap: 0.9rem;
}

.hero {
  background: linear-gradient(135deg, #14532d, #166534);
  color: white;
  border-radius: 16px;
  padding: 1rem;
}

.hero a {
  color: #ecfeff;
}

.admin-hero {
  background: linear-gradient(135deg, #1e3a8a, #1d4ed8);
}

.small-on-hero {
  margin-top: 0.45rem;
  font-size: 0.88rem;
}

.hero h1 {
  margin: 0 0 0.3rem;
  font-size: 1.35rem;
}

.hero-top-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
}

.hero p {
  margin: 0.2rem 0;
}

.auth-chip {
  display: grid;
  gap: 0.35rem;
  justify-items: end;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 10px;
  padding: 0.4rem 0.55rem;
  font-size: 0.8rem;
}

.auth-chip button {
  color: white;
  border-color: rgba(255, 255, 255, 0.8);
  background: rgba(0, 0, 0, 0.18);
}

.minimal-auth {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.minimal-auth .inconspicuous {
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
  padding: 0.1rem 0;
}

.pill {
  display: inline-block;
  margin-top: 0.35rem;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  padding: 0.25rem 0.6rem;
  font-size: 0.82rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.9rem;
  box-shadow: 0 6px 18px rgba(17, 24, 39, 0.05);
}

h2 {
  margin: 0 0 0.7rem;
  font-size: 1.06rem;
}

label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.9rem;
}

input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.62rem;
  font-size: 0.95rem;
  background: white;
}

select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.5rem;
  font-size: 0.86rem;
  background: white;
}

.field-group {
  display: grid;
  gap: 0.55rem;
  margin-bottom: 0.6rem;
}

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

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

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

button {
  border: 1px solid var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 10px;
  padding: 0.65rem 0.7rem;
  font-weight: 600;
  font-size: 0.92rem;
}

button.good {
  border-color: var(--good);
  color: var(--good);
  background: var(--good-soft);
}

button.info {
  border-color: var(--info);
  color: var(--info);
  background: var(--info-soft);
}

button.warn {
  border-color: var(--warn);
  color: var(--warn);
  background: var(--warn-soft);
}

button.danger {
  border-color: var(--danger);
  color: var(--danger);
  background: var(--danger-soft);
}

button.subtle {
  border-color: var(--border);
  background: #f9fafb;
  color: #1f2937;
}

button:disabled {
  opacity: 0.55;
}

button.needs-attention {
  border-color: var(--danger);
  color: var(--danger);
  background: var(--danger-soft);
}

.small {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.required-text {
  color: var(--danger);
  font-weight: 700;
}

.hidden {
  display: none;
}

.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
}

.tx-list {
  list-style: none;
  margin: 0.8rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}

.table-wrap {
  margin-top: 0.6rem;
  overflow-x: auto;
}

.wallet-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 660px;
}

.wallet-table th,
.wallet-table td {
  border-bottom: 1px solid var(--border);
  text-align: left;
  padding: 0.55rem 0.45rem;
  font-size: 0.88rem;
}

.wallet-table th {
  background: #f8fafc;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #334155;
}

.sort-btn {
  border: none;
  background: transparent;
  color: inherit;
  padding: 0;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.sort-btn.active {
  color: #0f172a;
  font-weight: 700;
}

.filter-row th {
  background: #ffffff;
  text-transform: none;
  letter-spacing: normal;
}

.filter-row input,
.filter-row select {
  font-size: 0.78rem;
  padding: 0.36rem 0.4rem;
  border-radius: 8px;
}

.filter-pair {
  display: grid;
  gap: 0.25rem;
}

.wallet-table code {
  font-size: 0.78rem;
}

.row-actions {
  display: flex;
  gap: 0.35rem;
}

button.mini {
  padding: 0.38rem 0.52rem;
  font-size: 0.78rem;
}

.inline-actions {
  display: flex;
  gap: 0.45rem;
}

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

.login-layout {
  min-height: 100vh;
  align-content: center;
}

.login-card {
  max-width: 420px;
  margin: 0 auto;
}

.login-card h1 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 1.3rem;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.55rem 0 0.75rem;
}

.checkbox-row input {
  width: auto;
}

.tx-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.58rem;
  background: #fafafa;
}

.tx-top {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.2rem;
}

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

.tx-amount.debit {
  color: var(--danger);
}

@media (min-width: 700px) {
  .two-col {
    grid-template-columns: 1fr auto;
  }

  .three-col {
    grid-template-columns: 1fr auto auto;
    align-items: end;
  }

  .four-col {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
