:root {
  --bg: #f6f2e8;
  --panel: rgba(255, 252, 246, 0.88);
  --panel-strong: #fffdf8;
  --text: #26190f;
  --muted: #715d4c;
  --accent: #b86a2d;
  --accent-dark: #874a17;
  --accent-soft: rgba(184, 106, 45, 0.12);
  --line: rgba(76, 48, 27, 0.12);
  --success: #2f7d4d;
  --danger: #a34732;
  --shadow: 0 20px 60px rgba(78, 47, 19, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Plus Jakarta Sans", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 220, 166, 0.7), transparent 28%),
    radial-gradient(circle at top right, rgba(196, 226, 197, 0.6), transparent 24%),
    linear-gradient(180deg, #fcf8f1 0%, var(--bg) 100%);
}

.app-shell {
  width: min(1180px, calc(100% - 24px));
  margin: 0 auto;
  padding: 20px 0 40px;
}

.hero {
  display: grid;
  grid-template-columns: 1.35fr minmax(240px, 320px);
  gap: 18px;
  align-items: stretch;
  margin-bottom: 18px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--accent-dark);
}

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

h1 {
  font-size: clamp(2rem, 4vw, 3.8rem);
  line-height: 1;
  margin-bottom: 12px;
}

.hero-copy {
  max-width: 62ch;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.65;
}

.hero-card,
.panel,
.stat-card,
.top-nav {
  backdrop-filter: blur(10px);
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: var(--shadow);
}

.hero-card {
  border-radius: 28px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  background:
    linear-gradient(145deg, rgba(184, 106, 45, 0.96), rgba(112, 57, 20, 0.96));
  color: #fff9f0;
}

.hero-card strong {
  font-size: 1.8rem;
  margin: 6px 0;
}

.hero-label {
  margin-bottom: 2px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.76rem;
  opacity: 0.82;
}

.hero-badge {
  align-self: flex-start;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 0.82rem;
  font-weight: 800;
}

.top-nav {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  padding: 10px;
  border-radius: 24px;
  margin-bottom: 18px;
  position: sticky;
  top: 10px;
  z-index: 10;
}

.nav-tab {
  border: 1px solid transparent;
  border-radius: 18px;
  padding: 14px 12px;
  font-weight: 800;
  color: var(--accent-dark);
  background: transparent;
  box-shadow: none;
}

.nav-tab.is-active {
  color: #fff8f1;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  box-shadow: 0 14px 24px rgba(135, 74, 23, 0.22);
}

.views {
  display: block;
}

.view-panel {
  display: none;
  gap: 18px;
}

.view-panel.is-active {
  display: grid;
}

.panel {
  border-radius: 28px;
  padding: 22px;
}

.narrow-panel {
  max-width: 560px;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.admin-auth-block {
  display: grid;
  gap: 16px;
}

.success-box {
  border-style: solid;
  border-color: rgba(47, 125, 77, 0.2);
  background: rgba(235, 250, 241, 0.9);
  color: #1f5a36;
}

.danger-button {
  background: linear-gradient(135deg, #b25138, #8b392a);
}

.hidden {
  display: none !important;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 18px;
}

.section-heading.inline {
  margin: 0 0 12px;
  align-items: center;
}

.section-heading h2,
.section-heading h3 {
  margin-bottom: 0;
}

.stack-form {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}

.stack-form.compact {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

label {
  display: grid;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 600;
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  color: var(--text);
  border-radius: 16px;
  padding: 14px 16px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(184, 106, 45, 0.75);
  box-shadow: 0 0 0 4px rgba(184, 106, 45, 0.12);
}

button {
  border: none;
  border-radius: 16px;
  padding: 14px 20px;
  font-weight: 800;
  color: #fff8f1;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
  box-shadow: 0 14px 24px rgba(135, 74, 23, 0.22);
}

button:hover {
  transform: translateY(-1px);
}

button:disabled,
input:disabled,
textarea:disabled,
select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.ghost-button {
  color: var(--accent-dark);
  background: var(--accent-soft);
  box-shadow: none;
}

.note-box {
  border-radius: 18px;
  padding: 16px;
  color: var(--muted);
  background: rgba(255, 251, 245, 0.74);
  border: 1px dashed rgba(113, 93, 76, 0.25);
}

.pill {
  background: var(--accent-soft);
  color: var(--accent-dark);
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  border-radius: 22px;
  padding: 18px;
}

.stat-card span {
  display: block;
  font-size: 0.86rem;
  color: var(--muted);
  margin-bottom: 12px;
}

.stat-card strong {
  font-size: clamp(1.3rem, 2vw, 2rem);
}

.report-layout {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 18px;
}

.meeting-list {
  display: grid;
  gap: 14px;
}

.meeting-card {
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(100, 71, 43, 0.1);
}

.meeting-card h3 {
  margin-bottom: 8px;
}

.meeting-meta {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.meeting-card p {
  white-space: pre-line;
  color: var(--text);
  line-height: 1.65;
  margin-bottom: 0;
}

.print-report {
  display: none;
}

.print-sheet {
  color: #111;
  background: #fff;
}

.print-header h1,
.print-sheet h2 {
  margin-bottom: 8px;
}

.print-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0 22px;
}

.print-stats div {
  border: 1px solid #ccc;
  padding: 10px 12px;
}

.print-stats strong,
.print-stats span {
  display: block;
}

.print-table {
  width: 100%;
  min-width: 0;
  margin-bottom: 22px;
}

.print-table th,
.print-table td {
  border: 1px solid #bbb;
  padding: 8px 10px;
  font-size: 0.86rem;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  -webkit-overflow-scrolling: touch;
}

#monthlyTable {
  position: relative;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}

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

th {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

#monthlyTable th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #f8f1e4;
}

#monthlyTable th:first-child,
#monthlyTable td:first-child {
  position: -webkit-sticky;
  position: sticky;
  left: 0;
  z-index: 10;
  background: #fff9ef;
  box-shadow: inset -2px 0 0 rgba(76, 48, 27, 0.12);
}

#monthlyTable th:first-child {
  z-index: 12;
  background: #f1e3c8;
}

.cell-paid,
.cell-due {
  min-width: 110px;
}

.cell-paid {
  background: rgba(47, 125, 77, 0.08);
}

.cell-due {
  background: rgba(163, 71, 50, 0.08);
}

.pay-toggle {
  width: 100%;
  padding: 10px 14px;
  border-radius: 12px;
  box-shadow: none;
  background: linear-gradient(135deg, #b25138, #8b392a);
}

.pay-toggle.is-paid {
  background: linear-gradient(135deg, #2f7d4d, #245f3b);
}

.payment-tag {
  margin-top: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(29, 17, 10, 0.45);
  z-index: 50;
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: min(460px, 100%);
  padding: 24px;
  border-radius: 24px;
  background: var(--panel-strong);
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.75);
}

.modal-copy {
  margin-bottom: 16px;
  color: var(--muted);
  line-height: 1.6;
}

.status-paid {
  color: var(--success);
  font-weight: 700;
}

.status-due {
  color: var(--danger);
  font-weight: 700;
}

@media (max-width: 920px) {
  .app-shell {
    width: min(100%, calc(100% - 16px));
    padding-top: 16px;
  }

  .hero,
  .report-layout,
  .stats-grid,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .top-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    top: 8px;
  }

  .panel,
  .modal-card {
    padding: 18px;
    border-radius: 22px;
  }

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

  .section-heading {
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  h1 {
    font-size: 2rem;
  }

  .nav-tab,
  button,
  input,
  select {
    min-height: 48px;
  }

  th,
  td {
    padding: 12px 12px;
    font-size: 0.88rem;
  }

  table {
    min-width: 560px;
  }

  #monthlyTable th,
  #monthlyTable td {
    white-space: nowrap;
  }
}

@media print {
  body {
    background: #fff;
  }

  .app-shell,
  .modal {
    display: none !important;
  }

  .print-report {
    display: block !important;
    padding: 0;
  }

  .print-sheet {
    display: block;
    padding: 20px;
  }
}

/* Row Total Styling */
.row-total td {
  background: #fdfaf3 !important;
  color: var(--accent-dark);
  font-weight: 800;
  border-top: 2px solid var(--accent);
  position: sticky;
  bottom: 0;
  z-index: 5;
}

tfoot {
  position: sticky;
  bottom: 0;
  z-index: 5;
}

.row-total td:first-child {
  position: -webkit-sticky !important;
  position: sticky !important;
  left: 0;
  z-index: 15 !important;
}
