:root {
  color-scheme: dark;
  --bg: #081013;
  --panel: rgba(20, 32, 38, 0.78);
  --panel-strong: #101a20;
  --line: rgba(255, 255, 255, 0.1);
  --text: #eef7f3;
  --muted: #9bb0ac;
  --green: #7ee787;
  --amber: #ffcc66;
  --blue: #7ab7ff;
  --rose: #ff8fa3;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  --radius-xl: 32px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Aptos", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(126, 231, 135, 0.2), transparent 34rem),
    radial-gradient(circle at 80% 10%, rgba(122, 183, 255, 0.18), transparent 28rem),
    linear-gradient(145deg, #071014 0%, #0d161b 46%, #091114 100%);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

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

.hero {
  position: relative;
  overflow: hidden;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)),
    rgba(8, 16, 19, 0.74);
  box-shadow: var(--shadow);
}

.hero::after {
  position: absolute;
  right: -120px;
  bottom: -160px;
  width: 360px;
  height: 360px;
  border-radius: 999px;
  background: rgba(126, 231, 135, 0.12);
  content: "";
  filter: blur(2px);
}

.topbar,
.brand,
.hero-grid,
.section-heading,
.backup-actions,
.list-item {
  display: flex;
  align-items: center;
}

.topbar {
  position: relative;
  z-index: 1;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  gap: 14px;
}

.brand-mark {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 18px;
  color: #071014;
  font-weight: 900;
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, var(--green), #d8ffad);
  box-shadow: 0 18px 42px rgba(126, 231, 135, 0.2);
}

.eyebrow,
.pill {
  margin: 0;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.3rem, 2vw, 2rem);
  letter-spacing: -0.04em;
}

h2 {
  max-width: 680px;
  margin: 16px 0;
  font-size: clamp(2.2rem, 7vw, 5.7rem);
  line-height: 0.88;
  letter-spacing: -0.075em;
}

h3 {
  margin-bottom: 0;
  font-size: clamp(1.2rem, 2vw, 1.6rem);
  letter-spacing: -0.04em;
}

.hero-grid {
  position: relative;
  z-index: 1;
  justify-content: space-between;
  gap: 24px;
  padding-top: 78px;
}

.hero-copy p:last-child,
.backup-panel p,
.month-card p,
.hint {
  color: var(--muted);
  line-height: 1.6;
}

.pill {
  display: inline-flex;
  padding: 8px 12px;
  border: 1px solid rgba(126, 231, 135, 0.28);
  border-radius: 999px;
  background: rgba(126, 231, 135, 0.08);
}

.month-card {
  min-width: min(100%, 320px);
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(18px);
}

label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  outline: none;
}

input:focus {
  border-color: rgba(126, 231, 135, 0.72);
  box-shadow: 0 0 0 4px rgba(126, 231, 135, 0.12);
}

input:disabled,
button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.install-button,
.entry-form button,
.login-form button,
.backup-actions button,
.file-button {
  min-height: 46px;
  padding: 0 16px;
  border-radius: 999px;
  color: #071014;
  font-weight: 900;
  background: linear-gradient(135deg, var(--green), #dbffa8);
}

.ghost-button,
.list-item button,
.icon-button {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.stats-grid,
.content-grid {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.sync-panel {
  margin-top: 18px;
}

.login-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.06);
}

.status-pill.is-online {
  border-color: rgba(126, 231, 135, 0.36);
  color: var(--green);
  background: rgba(126, 231, 135, 0.08);
}

.status-pill.is-error {
  border-color: rgba(255, 143, 163, 0.36);
  color: var(--rose);
  background: rgba(255, 143, 163, 0.08);
}

.session-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.045);
}

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

.content-grid {
  grid-template-columns: 1.18fr 1fr;
  align-items: start;
}

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

.panel {
  padding: 20px;
  border-radius: var(--radius-lg);
}

.stat-card {
  position: relative;
  overflow: hidden;
  display: block;
  width: 100%;
  padding: 18px;
  border-radius: var(--radius-lg);
  text-align: left;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.stat-card:hover,
.stat-card:focus-visible {
  border-color: rgba(126, 231, 135, 0.34);
  background: rgba(28, 45, 52, 0.88);
  transform: translateY(-3px);
}

.stat-card::before {
  display: block;
  width: 42px;
  height: 4px;
  margin-bottom: 26px;
  border-radius: 999px;
  background: currentColor;
  content: "";
}

.stat-card span,
.stat-card small {
  display: block;
  color: var(--muted);
}

.stat-card strong {
  display: block;
  margin: 10px 0 4px;
  font-size: clamp(1.7rem, 4vw, 2.8rem);
  letter-spacing: -0.06em;
}

.accent-green {
  color: var(--green);
}

.accent-amber {
  color: var(--amber);
}

.accent-blue {
  color: var(--blue);
}

.accent-white {
  color: var(--text);
}

.contributions-panel,
.backup-panel {
  grid-column: span 2;
}

.section-heading {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

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

.congregation-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.03));
}

.congregation-card input + label {
  margin-top: 14px;
}

.entry-form {
  display: grid;
  grid-template-columns: 1fr 150px auto;
  gap: 10px;
}

.list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.list-item {
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.045);
}

.list-item strong {
  display: block;
  margin-bottom: 4px;
}

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

.empty-state {
  margin: 0;
  padding: 14px;
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  color: var(--muted);
}

.backup-actions {
  flex-wrap: wrap;
  gap: 10px;
}

.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.hint {
  margin: 14px 0 0;
  font-size: 0.92rem;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.modal.is-open {
  display: flex;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 8, 10, 0.78);
  backdrop-filter: blur(14px);
}

.modal-card {
  position: relative;
  width: min(620px, 100%);
  max-height: min(760px, calc(100vh - 36px));
  overflow: auto;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 28px;
  background:
    radial-gradient(circle at top right, rgba(126, 231, 135, 0.13), transparent 18rem),
    var(--panel-strong);
  box-shadow: 0 30px 120px rgba(0, 0, 0, 0.62);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.detail-total {
  margin-bottom: 18px;
  font-size: clamp(2rem, 8vw, 4rem);
  font-weight: 900;
  letter-spacing: -0.07em;
}

.detail-body {
  display: grid;
  gap: 10px;
}

.detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
}

.detail-row strong {
  display: block;
  margin-bottom: 4px;
}

.detail-row span,
.detail-note {
  color: var(--muted);
}

.detail-amount {
  flex: 0 0 auto;
  font-size: 1.15rem;
  font-weight: 900;
}

.detail-note {
  margin: 0;
  padding: 14px;
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: 18px;
  line-height: 1.55;
}

@media (max-width: 880px) {
  .hero-grid,
  .topbar,
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .contributions-panel,
  .backup-panel {
    grid-column: auto;
  }

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

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

@media (max-width: 520px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 10px;
  }

  .hero,
  .panel {
    border-radius: 22px;
  }

  h2 {
    font-size: clamp(2rem, 15vw, 3.7rem);
  }
}
