* { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: #f3f6fb;
  color: #15233a;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-tap-highlight-color: rgba(31, 111, 235, 0.15);
  color-scheme: light;
}
.container {
  max-width: 980px;
  margin: 16px auto 24px;
  padding: 0 max(16px, env(safe-area-inset-left)) 0 max(16px, env(safe-area-inset-right));
  padding-bottom: max(24px, env(safe-area-inset-bottom));
}
.card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 6px 24px rgba(0,0,0,.08);
  margin-bottom: 18px;
}
h1,h2,h3 { margin-top: 0; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 600; }
input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #ced6e0;
  margin-bottom: 12px;
  font-family: inherit;
}
button, .btn {
  border: none;
  background: #1f6feb;
  color: #fff;
  padding: 12px 16px;
  min-height: 44px;
  min-width: 44px;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 600;
  touch-action: manipulation;
}
button.secondary, .btn.secondary { background: #334155; }
.alert { padding: 12px 14px; border-radius: 8px; margin-bottom: 12px; }
.alert.success { background: #dcfce7; color: #166534; }
.alert.error { background: #fee2e2; color: #991b1b; }
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -4px;
  padding: 0 4px 4px;
}
.table-scroll table { min-width: 520px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px; border-bottom: 1px solid #e8edf4; font-size: 14px; }
th { white-space: nowrap; }
.badge { font-size: 12px; padding: 4px 8px; border-radius: 999px; text-transform: uppercase; }
.badge.deposit { background: #dcfce7; color: #166534; }
.badge.withdrawal { background: #fee2e2; color: #991b1b; }
.badge.interest { background: #dbeafe; color: #1e3a8a; }
.topbar { display:flex; justify-content: space-between; align-items:center; margin-bottom: 16px; flex-wrap: wrap; gap: 12px; }
.topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
small.note { color: #475569; display: block; margin-top: 8px; }

.home-signed-in-bar {
  padding: 14px 18px;
}
.home-signed-in-text {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.45;
}
.home-signed-in-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
@media (min-width: 720px) {
  .home-signed-in-text {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
  }
  .home-signed-in-actions {
    margin-top: 0;
  }
}

.hero {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}

.hero-content {
  background: linear-gradient(145deg, #0f1f3d, #1f6feb);
  color: #fff;
  border-radius: 14px;
  padding: 30px;
  box-shadow: 0 10px 30px rgba(31, 111, 235, 0.25);
}

.hero-content h1 {
  font-size: 34px;
  line-height: 1.2;
  margin: 14px 0 10px;
}

.hero-content p {
  color: #d7e5ff;
  max-width: 640px;
}

.hero-badge {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.hero-actions {
  margin-top: 18px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.hero-stats {
  margin: 0;
}

.feature-list {
  padding-left: 18px;
  margin: 12px 0 0;
  color: #334155;
}

.feature-list li {
  margin-bottom: 8px;
}

.steps .step {
  background: #f8fbff;
  border: 1px solid #e5eefb;
  border-radius: 10px;
  padding: 14px;
}

.cta {
  text-align: center;
}

.auth-card {
  max-width: 520px;
  margin: 40px auto;
}

.register-card {
  max-width: min(640px, 100%);
}

.form-section {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 16px 8px;
  margin-bottom: 16px;
  background: #fafbfd;
}

.form-section legend {
  font-weight: 700;
  font-size: 0.95rem;
  color: #0f172a;
  padding: 0 6px;
}

.register-form fieldset.form-section label:first-of-type {
  margin-top: 0;
}

.topbar h1 {
  font-size: clamp(1.15rem, 4vw, 1.75rem);
  line-height: 1.25;
  flex: 1 1 200px;
  margin: 0;
}

@media (max-width: 860px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .hero-content h1 {
    font-size: clamp(1.5rem, 5vw, 1.85rem);
  }
}

@media (max-width: 640px) {
  input[type="email"],
  input[type="password"],
  input[type="text"],
  input[type="number"],
  input[type="date"],
  select,
  textarea {
    font-size: 16px;
    min-height: 48px;
  }

  .container {
    margin-top: 12px;
  }

  .card {
    padding: 16px;
    border-radius: 14px;
  }

  .hero-content {
    padding: 22px 18px;
    border-radius: 16px;
  }

  .hero-actions {
    flex-direction: column;
  }

  .hero-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .auth-card,
  .register-card {
    margin: 24px auto;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions {
    justify-content: stretch;
  }

  .topbar-actions .btn {
    flex: 1;
    min-width: 0;
  }

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

@media (max-width: 380px) {
  .badge {
    font-size: 10px;
    padding: 4px 6px;
  }

  th, td {
    font-size: 13px;
    padding: 8px 6px;
  }
}

/* —— Admin panel —— */
body.is-admin {
  background: #eef2f7;
}

.admin-shell {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.admin-topbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}

.admin-brand h1 {
  margin: 0 0 4px;
  font-size: clamp(1.25rem, 4vw, 1.6rem);
}

.admin-sub {
  margin: 0;
  color: #64748b;
  font-size: 0.9rem;
}

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

.admin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px;
}

.admin-nav-link {
  padding: 10px 14px;
  border-radius: 8px;
  text-decoration: none;
  color: #334155;
  font-weight: 600;
  font-size: 0.9rem;
  border: 1px solid transparent;
}

.admin-nav-link:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.admin-nav-link.is-active {
  background: #1f6feb;
  color: #fff;
  border-color: #1f6feb;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}

.stat-card h3 {
  font-size: 0.85rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 8px;
}

.stat-value {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: #0f172a;
}

.admin-settings-grid {
  align-items: start;
}

.admin-settings-grid code {
  font-size: 0.85em;
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
}

.admin-overview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.admin-member-form {
  max-width: 560px;
}

@media (max-width: 640px) {
  .admin-top-actions {
    width: 100%;
  }

  .admin-top-actions .btn {
    flex: 1;
    min-width: 0;
  }

  .admin-nav {
    flex-direction: column;
  }

  .admin-nav-link {
    text-align: center;
  }
}
