/* ── Reset & Base ─────────────────────────────────────────────────── */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #fff;
  color: #111;
  line-height: 1.5;
  min-height: 100dvh;
}

/* ── Layout ───────────────────────────────────────────────────────── */

.page {
  display: none;
  max-width: 480px;
  margin: 0 auto;
  padding: 16px;
}

.page.active {
  display: block;
}

/* ── Status Banner (always visible at top) ────────────────────────── */

#status-banner {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 12px 16px;
  font-size: 0.875rem;
  font-weight: 600;
  text-align: center;
  display: none;
}

#status-banner.passive {
  display: block;
  background: #e5e7eb;
  color: #374151;
}

#status-banner.active {
  display: block;
  background: #F97316;
  color: #fff;
}

#status-banner.reconciliation {
  display: block;
  background: #3b82f6;
  color: #fff;
}

#status-banner.error {
  display: block;
  background: #dc2626;
  color: #fff;
}

/* ── Nav ──────────────────────────────────────────────────────────── */

.nav {
  display: flex;
  border-bottom: 2px solid #e5e7eb;
  margin-bottom: 16px;
  gap: 4px;
}

.nav a {
  flex: 1;
  text-align: center;
  padding: 14px 8px;
  text-decoration: none;
  color: #374151;
  font-weight: 600;
  font-size: 0.9rem;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav a.active {
  color: #F97316;
  border-bottom: 3px solid #F97316;
}

/* ── Forms ─────────────────────────────────────────────────────────── */

label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 0.9rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"] {
  width: 100%;
  padding: 14px 12px;
  font-size: 1.1rem;
  border: 2px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
  -webkit-appearance: none;
  appearance: none;
  min-height: 56px;
}

input:focus {
  outline: none;
  border-color: #F97316;
}

.form-group {
  margin-bottom: 16px;
}

/* ── Buttons ──────────────────────────────────────────────────────── */

.btn {
  display: block;
  width: 100%;
  padding: 16px;
  font-size: 1.1rem;
  font-weight: 700;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  min-height: 56px;
  -webkit-appearance: none;
  appearance: none;
}

.btn-primary {
  background: #F97316;
  color: #fff;
}

.btn-primary:disabled {
  background: #d1d5db;
  color: #9ca3af;
  cursor: not-allowed;
}

.btn-secondary {
  background: #f3f4f6;
  color: #374151;
  border: 2px solid #d1d5db;
}

.btn-logout {
  background: none;
  border: none;
  color: #dc2626;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px;
  cursor: pointer;
  min-height: 44px;
}

/* ── Toggle ───────────────────────────────────────────────────────── */

.toggle-group {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  background: #f3f4f6;
  border-radius: 8px;
  padding: 4px;
}

.toggle-group button {
  flex: 1;
  padding: 12px 8px;
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #6b7280;
  cursor: pointer;
  min-height: 48px;
}

.toggle-group button.active {
  background: #fff;
  color: #111;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* ── Client info card ─────────────────────────────────────────────── */

.client-card {
  background: #f9fafb;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
  display: none;
}

.client-card.visible {
  display: block;
}

.client-card .name {
  font-size: 1.2rem;
  font-weight: 700;
}

.client-card .balance {
  font-size: 2rem;
  font-weight: 800;
  color: #F97316;
  margin: 4px 0;
}

.client-card .sync-time {
  font-size: 0.8rem;
  color: #6b7280;
}

/* ── Messages ─────────────────────────────────────────────────────── */

.msg {
  padding: 12px 16px;
  border-radius: 8px;
  font-weight: 600;
  margin-bottom: 16px;
  display: none;
}

.msg.visible {
  display: block;
}

.msg-success {
  background: #d1fae5;
  color: #065f46;
}

.msg-error {
  background: #fee2e2;
  color: #991b1b;
}

/* ── Passive / Reconciliation status ──────────────────────────────── */

.status-message {
  text-align: center;
  padding: 48px 16px;
}

.status-message h2 {
  font-size: 1.3rem;
  margin-bottom: 8px;
}

.status-message p {
  color: #6b7280;
  font-size: 0.95rem;
}

/* ── Transaction History Table ────────────────────────────────────── */

.tx-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.tx-table th {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 2px solid #e5e7eb;
  font-size: 0.8rem;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.tx-table td {
  padding: 12px 8px;
  border-bottom: 1px solid #f3f4f6;
}

.tx-table .amount {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.empty-state {
  text-align: center;
  padding: 48px 16px;
  color: #9ca3af;
}

/* ── Header ───────────────────────────────────────────────────────── */

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

.header h1 {
  font-size: 1.1rem;
  font-weight: 800;
  color: #F97316;
}

/* ── Login page ───────────────────────────────────────────────────── */

.login-header {
  text-align: center;
  padding: 48px 0 32px;
}

.login-header h1 {
  font-size: 1.5rem;
  font-weight: 800;
  color: #F97316;
}

.login-header p {
  color: #6b7280;
  font-size: 0.9rem;
  margin-top: 4px;
}
