@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Sora:wght@500;600;700;800&display=swap");

:root {
  --bg: #ebe5da;
  --bg-2: #d9ece8;
  --paper: #fbfaf6;
  --panel: #ffffff;
  --ink: #162f3c;
  --ink-soft: #516673;
  --line: #d8d8cd;
  --accent: #165f7a;
  --accent-2: #0f3f51;
  --accent-soft: #dcedf3;
  --income: #1c9a76;
  --expense: #c05349;
  --net: #df8d3d;
  --families: #34557f;
  --shadow-xl: 0 30px 80px rgba(11, 45, 57, 0.16);
  --shadow-lg: 0 12px 34px rgba(16, 52, 64, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  width: 100%;
  overflow-x: hidden;
}

body {
  position: relative;
  font-family: "Manrope", "Avenir Next", "Trebuchet MS", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 16% 0%, rgba(255, 224, 172, 0.35), transparent 40%),
    radial-gradient(circle at 82% 98%, rgba(167, 221, 243, 0.42), transparent 43%),
    linear-gradient(150deg, var(--bg), var(--bg-2));
  padding: 1.2rem;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.15) 1px, transparent 1px);
  background-size: 42px 42px;
  opacity: 0.2;
}

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: max(0.75rem, env(safe-area-inset-top)) max(0.75rem, env(safe-area-inset-right))
    max(0.75rem, env(safe-area-inset-bottom)) max(0.75rem, env(safe-area-inset-left));
  background: linear-gradient(150deg, rgba(11, 40, 50, 0.62), rgba(23, 74, 88, 0.35));
  backdrop-filter: blur(7px);
}

.auth-card {
  width: min(520px, 100%);
  padding: 1.8rem;
  border-radius: 24px;
  background: linear-gradient(155deg, #ffffff, #f6fbff);
  border: 1px solid #d9e7ed;
  box-shadow: var(--shadow-xl);
}

.brand-logo {
  display: block;
  max-width: 100%;
  height: auto;
  object-fit: contain;
}

.auth-logo {
  width: min(300px, 74vw);
  margin: 0 auto 0.95rem;
  padding: 0.45rem 0.7rem;
  border-radius: 16px;
  border: 1px solid #deeaef;
  background: linear-gradient(180deg, #ffffff, #f5f8fa);
  box-shadow: 0 10px 24px rgba(16, 56, 68, 0.12);
}

.auth-card h1 {
  margin: 0;
  font-family: "Sora", "Manrope", sans-serif;
  font-size: clamp(1.7rem, 2.4vw, 2.15rem);
  letter-spacing: -0.03em;
}

.auth-card p {
  margin: 0.45rem 0 0.95rem;
  color: var(--ink-soft);
}

.auth-entry-note {
  margin: 0.2rem 0 0.95rem;
  padding: 0.5rem 0.62rem;
  border-radius: 10px;
  border: 1px solid #d9e4ea;
  background: #eff6fa;
  color: #244d5f;
  font-size: 0.84rem;
  font-weight: 700;
}

.auth-form {
  display: grid;
  gap: 0.68rem;
}

.auth-form label {
  display: grid;
  gap: 0.3rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: #305164;
}

.auth-show-password {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: -0.08rem;
  font-size: 0.82rem;
  color: #35586a;
  user-select: none;
}

.auth-form label.auth-show-password {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.auth-show-password input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  margin: 0;
  cursor: pointer;
  accent-color: var(--accent);
}

.auth-hint {
  margin-top: 0.7rem;
  font-size: 0.84rem;
  color: #2d5163;
}

.auth-meta {
  margin-top: 0.7rem;
  margin-bottom: 0;
  font-size: 0.84rem;
  color: #244a5b;
}

.decor-orb {
  position: fixed;
  z-index: 0;
  pointer-events: none;
  filter: blur(46px);
  opacity: 0.5;
}

.orb-one {
  width: 360px;
  height: 360px;
  top: -40px;
  right: -70px;
  background: rgba(243, 166, 86, 0.8);
}

.orb-two {
  width: 320px;
  height: 320px;
  left: -70px;
  bottom: -30px;
  background: rgba(38, 156, 130, 0.74);
}

.app-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1580px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 0.95rem;
  min-width: 0;
}

.sidebar {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 92vh;
  padding: 1.5rem 1.35rem;
  border-radius: 28px;
  color: #f9fdff;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background:
    linear-gradient(158deg, rgba(20, 83, 102, 0.97) 0%, rgba(10, 45, 58, 0.96) 100%);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
}

.sidebar::before {
  content: "";
  position: absolute;
  width: 190px;
  height: 190px;
  top: -45px;
  right: -45px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(245, 170, 96, 0.35), transparent 62%);
}

.sidebar-logo {
  width: min(220px, 100%);
  margin: 0 auto 0.9rem;
  padding: 0.55rem 0.65rem;
  border-radius: 16px;
  border: 1px solid rgba(236, 247, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04), 0 10px 24px rgba(0, 0, 0, 0.2);
}

.sidebar h1 {
  position: relative;
  margin: 0;
  font-family: "Sora", "Manrope", sans-serif;
  font-size: 2.08rem;
  line-height: 0.9;
  letter-spacing: 0.02em;
}

.sidebar p {
  position: relative;
  margin-top: 0.92rem;
  color: rgba(227, 243, 249, 0.92);
  font-size: 0.94rem;
}

.reference-note {
  margin-top: 0.55rem;
  padding: 0.5rem 0.62rem;
  border: 1px solid rgba(228, 242, 247, 0.24);
  border-radius: 10px;
  font-size: 0.78rem;
  color: #d8edf5;
  background: rgba(255, 255, 255, 0.08);
}

.sidebar nav {
  margin-top: 1.4rem;
  display: grid;
  gap: 0.52rem;
}

.cashier-badge {
  margin-top: auto;
  border-radius: 12px;
  border: 1px solid rgba(226, 241, 248, 0.3);
  background: rgba(255, 255, 255, 0.09);
  color: #e4f2f8;
  padding: 0.66rem 0.72rem;
  font-size: 0.82rem;
}

.cashier-badge strong {
  color: #ffd59a;
  font-weight: 800;
}

.nav-btn {
  border: 0;
  text-align: left;
  border-radius: 12px;
  padding: 0.72rem 0.9rem;
  color: #dff2f8;
  background: rgba(255, 255, 255, 0.1);
  font-weight: 700;
  font-size: 0.89rem;
  letter-spacing: 0.015em;
  cursor: pointer;
  transition: transform 180ms ease, background-color 180ms ease;
}

.nav-btn:hover {
  transform: translateX(4px);
  background: rgba(255, 255, 255, 0.18);
}

.nav-btn.is-active {
  color: #113748;
  background: linear-gradient(135deg, #f9b768, #e38c2f);
}

.main-panel {
  border-radius: 28px;
  padding: 1.15rem;
  border: 1px solid rgba(255, 255, 255, 0.62);
  background: linear-gradient(168deg, rgba(255, 255, 255, 0.95), rgba(246, 250, 248, 0.92));
  box-shadow: var(--shadow-xl);
  min-width: 0;
  overflow-x: hidden;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  padding: 0.2rem 0.2rem 0.55rem;
  border-bottom: 1px solid #dee7eb;
}

.topbar h2 {
  margin: 0;
  font-family: "Sora", "Manrope", sans-serif;
  font-size: clamp(1.55rem, 2.8vw, 2.1rem);
  letter-spacing: -0.03em;
}

.topbar p {
  margin: 0.24rem 0 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 600;
}

.topbar-right {
  display: grid;
  gap: 0.5rem;
  justify-items: end;
}

.mobile-controls-toggle {
  display: none;
}

.period-controls,
.user-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.43rem;
  justify-content: flex-end;
}

select,
input,
textarea,
button {
  font: inherit;
  min-height: 42px;
}

select,
input,
textarea {
  background: #fff;
  border: 1px solid #d5dde2;
  color: #1a3643;
  border-radius: 11px;
  padding: 0.53rem 0.64rem;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

select:focus,
input:focus,
textarea:focus {
  outline: 0;
  border-color: #2d86a8;
  box-shadow: 0 0 0 3px rgba(45, 134, 168, 0.14);
}

textarea {
  width: 100%;
  resize: vertical;
  min-height: 92px;
  line-height: 1.35;
}

button {
  border: 0;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #f8fcff;
  font-weight: 700;
  letter-spacing: 0.01em;
  padding: 0.56rem 0.9rem;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(18, 77, 96, 0.25);
}

button.secondary {
  background: linear-gradient(135deg, #2b6d86, #20556a);
}

button.secondary.danger-soft {
  background: linear-gradient(135deg, #b0584e, #8f423a);
}

button.ghost {
  color: #22485a;
  background: linear-gradient(180deg, #ffffff, #edf4f7);
  border: 1px solid #d3e0e6;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.31rem 0.64rem;
  font-size: 0.78rem;
  font-weight: 700;
  border: 1px solid #d3e2e8;
  background: #eef6fa;
  color: #174457;
}

.badge.role {
  background: #fff1df;
  border-color: #f1d1a5;
  color: #885321;
}

.hidden {
  display: none !important;
}

.error-banner,
.readonly-banner {
  margin-top: 0.78rem;
  padding: 0.72rem 0.82rem;
  border-radius: 12px;
  border: 1px solid;
  font-size: 0.88rem;
}

.error-banner {
  color: #8f2c27;
  background: #fde8e5;
  border-color: #efc0bb;
}

.readonly-banner {
  color: #825717;
  background: #fff4e2;
  border-color: #ecd5ae;
}

.view {
  display: none;
  margin-top: 0.95rem;
  min-width: 0;
}

.view.is-visible {
  display: block;
  animation: fadeUp 320ms ease;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.kpis {
  display: grid;
  gap: 0.72rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.kpi-card {
  position: relative;
  overflow: hidden;
  color: #fff;
  border-radius: 16px;
  padding: 0.9rem;
  box-shadow: var(--shadow-lg);
  transform: translateY(6px);
  opacity: 0;
  animation: kpiIn 520ms ease forwards;
}

.kpi-card::after {
  content: "";
  position: absolute;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  right: -35px;
  top: -40px;
  background: rgba(255, 255, 255, 0.2);
}

.kpi-card:nth-child(2) {
  animation-delay: 90ms;
}
.kpi-card:nth-child(3) {
  animation-delay: 160ms;
}
.kpi-card:nth-child(4) {
  animation-delay: 230ms;
}

@keyframes kpiIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.kpi-card span {
  position: relative;
  z-index: 1;
  font-size: 0.82rem;
  letter-spacing: 0.015em;
}

.kpi-card strong {
  position: relative;
  z-index: 1;
  display: block;
  margin-top: 0.44rem;
  font-size: 1.47rem;
  font-weight: 800;
}

.kpi-card small {
  position: relative;
  z-index: 1;
  display: block;
  margin-top: 0.28rem;
  font-size: 0.76rem;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.9);
}

.kpi-card.income {
  background: linear-gradient(150deg, #1f9b79, #126a53);
}
.kpi-card.expense {
  background: linear-gradient(150deg, #c2554c, #8c3b35);
}
.kpi-card.net {
  background: linear-gradient(150deg, #e89a47, #cc6e24);
}
.kpi-card.families {
  background: linear-gradient(150deg, #3b5f92, #264064);
}
.kpi-card.available {
  background: linear-gradient(150deg, #23647f, #143d53);
}

.grid {
  display: grid;
  gap: 0.73rem;
  margin-top: 0.74rem;
}

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

.card {
  border-radius: 15px;
  padding: 0.86rem;
  border: 1px solid #d8e2e5;
  background: linear-gradient(170deg, #ffffff, #f8fbfc);
  box-shadow: 0 5px 16px rgba(33, 63, 74, 0.06);
  min-width: 0;
}

.card h3 {
  margin: 0 0 0.6rem;
  font-family: "Sora", "Manrope", sans-serif;
  letter-spacing: -0.02em;
  font-size: 1.02rem;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  margin-bottom: 0.55rem;
}

.card-head h3 {
  margin: 0;
}

.card-head .secondary {
  white-space: nowrap;
  font-size: 0.77rem;
  padding: 0.35rem 0.58rem;
}

.inline-select-control {
  display: inline-flex;
  align-items: center;
  gap: 0.44rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: #355666;
  white-space: nowrap;
}

.inline-select-control select {
  min-height: 32px;
  padding: 0.22rem 0.5rem;
  border: 1px solid #c5d7de;
  border-radius: 8px;
  background: #ffffff;
  color: #1f4252;
  font-weight: 700;
}

.transactions-history-filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(170px, 1fr)) auto auto;
  gap: 0.6rem;
  align-items: end;
  margin-bottom: 0.65rem;
}

.transactions-history-filters label {
  display: grid;
  gap: 0.28rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: #355666;
}

.transactions-history-filters input {
  min-height: 38px;
  padding: 0.42rem 0.58rem;
  border: 1px solid #c5d7de;
  border-radius: 10px;
  background: #ffffff;
  color: #1f4252;
  font-weight: 700;
}

.transactions-history-presets,
.transactions-history-actions {
  display: flex;
  gap: 0.42rem;
  flex-wrap: wrap;
  align-items: center;
}

.transactions-history-presets .mini-btn.is-active {
  background: linear-gradient(135deg, #1d6884, #18566d);
  color: #ffffff;
  border-color: #1d6884;
}

.meta-line {
  margin: 0 0 0.65rem;
  font-size: 0.84rem;
  color: #466270;
  font-weight: 600;
}

.field-inline-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

.field-inline-tools .meta-line {
  margin: 0;
  font-size: 0.8rem;
}

.qr-member-card {
  display: grid;
  gap: 0.7rem;
  justify-items: start;
}

.member-qr-image {
  width: min(320px, 100%);
  border-radius: 12px;
  border: 1px solid #d8e2e8;
  background: #fff;
  padding: 0.45rem;
}

.qr-member-actions {
  display: flex;
  gap: 0.48rem;
  flex-wrap: wrap;
}

.qr-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border-radius: 10px;
  padding: 0.45rem 0.8rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.qr-link-btn.secondary {
  color: #f8fcff;
  background: linear-gradient(135deg, #2b6d86, #20556a);
}

.qr-link-btn.ghost {
  color: #22485a;
  background: linear-gradient(180deg, #ffffff, #edf4f7);
  border: 1px solid #d3e0e6;
}

#member-contrib-card {
  margin-top: 0.74rem;
}

.member-encouragement-card {
  margin-bottom: 0.72rem;
  border-color: #d5e3d2;
  background: linear-gradient(160deg, #fffef8, #f5fbf3);
}

.member-verse {
  margin: 0.38rem 0 0;
  font-size: 0.92rem;
  line-height: 1.5;
  color: #24495d;
  font-weight: 700;
}

.member-verse-ref {
  margin: 0.38rem 0 0;
  font-size: 0.76rem;
  color: #4a6979;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.member-pay-actions {
  margin-top: 0.64rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.projects-hero {
  background: linear-gradient(160deg, #f3f9fc, #fdfaf2);
  border-color: #d2e3ea;
}

.projects-hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
  margin-top: 0.62rem;
}

.projects-hero-stat {
  border-radius: 12px;
  border: 1px solid #d5e4ea;
  background: #ffffff;
  padding: 0.58rem 0.62rem;
  text-align: center;
}

.projects-hero-stat strong {
  display: block;
  font-family: "Sora", "Manrope", sans-serif;
  font-size: 1.18rem;
  color: #18445a;
}

.projects-hero-stat span {
  font-size: 0.75rem;
  color: #4c6470;
  font-weight: 700;
}

.projects-hero-note {
  margin: 0.7rem 0 0;
  font-size: 0.82rem;
  color: #345664;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.72rem;
  margin-top: 0.72rem;
}

.project-card {
  border-left: 4px solid #2e7a96;
}

.project-card.featured {
  border-left-color: #d18a39;
  background: linear-gradient(160deg, #ffffff, #fff8ee);
}

.project-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.6rem;
}

.project-card-head h3 {
  margin: 0;
  font-size: 1rem;
}

.project-card-badges {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.33rem;
}

.project-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.2rem 0.5rem;
  font-size: 0.68rem;
  font-weight: 800;
  border: 1px solid transparent;
}

.project-chip.featured {
  background: #fff1dd;
  color: #8a5720;
  border-color: #efce9f;
}

.project-chip.status-open {
  background: #dff5eb;
  color: #1b5f48;
  border-color: #b4e5d2;
}

.project-chip.status-progress {
  background: #e0f0fb;
  color: #1f5070;
  border-color: #b9d8ed;
}

.project-chip.status-planning {
  background: #f3ecff;
  color: #553f8f;
  border-color: #d7c8f5;
}

.project-chip.status-done {
  background: #e7e9ed;
  color: #44505d;
  border-color: #ced4dd;
}

.project-summary {
  margin: 0.58rem 0 0.62rem;
  font-size: 0.84rem;
  color: #314f5d;
  line-height: 1.45;
}

.project-facts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.33rem;
}

.project-facts li {
  display: flex;
  justify-content: space-between;
  gap: 0.58rem;
  align-items: baseline;
  border: 1px solid #dce8ed;
  border-radius: 10px;
  padding: 0.4rem 0.48rem;
  background: #f8fbfc;
}

.project-facts span {
  font-size: 0.74rem;
  color: #4f6673;
  font-weight: 700;
}

.project-facts strong {
  font-size: 0.76rem;
  color: #1f4454;
  text-align: right;
}

.project-cta {
  margin: 0.6rem 0 0;
  font-size: 0.81rem;
  color: #2f505f;
  line-height: 1.45;
}

.project-card-empty {
  grid-column: 1 / -1;
}

.project-card-actions {
  margin-top: 0.62rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.project-admin-actions {
  display: inline-flex;
  gap: 0.34rem;
}

.toggle-field {
  display: flex !important;
  align-items: center;
  gap: 0.52rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: #2f5261 !important;
}

.toggle-field input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-height: 18px;
}

#payment-project-row.hidden {
  display: none;
}

.payment-side-card {
  background: linear-gradient(165deg, #f8fbfd, #f0f5f8);
}

.payment-info {
  margin-top: 0.75rem;
  padding: 0.52rem 0.6rem;
  border-radius: 10px;
  border: 1px solid #d6e3ea;
  background: #ffffff;
}

.portal-user {
  font-size: 0.8rem;
  font-weight: 700;
  color: #214b5d;
}

.list-stats {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.46rem;
}

.list-stats li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid #d9e6eb;
  background: #f6fafb;
  border-radius: 10px;
  padding: 0.47rem 0.57rem;
  font-size: 0.84rem;
}

.table-card {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

#view-finance .table-card > table {
  width: max-content;
  min-width: 100%;
}

#view-finance .table-card th:last-child,
#view-finance .table-card td:last-child {
  min-width: 190px;
}

#view-finance .table-actions {
  flex-wrap: nowrap;
}

#view-collections .table-card > table {
  width: max-content;
  min-width: 100%;
}

#view-collections th:nth-child(7),
#view-collections td:nth-child(7) {
  min-width: 180px;
}

#view-collections th:nth-child(8),
#view-collections td:nth-child(8) {
  min-width: 280px;
}

#view-collections .table-card th:last-child,
#view-collections .table-card td:last-child {
  min-width: 150px;
}

.income-monitor-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.42rem;
  margin-top: 0.7rem;
}

.income-monitor-tabs .mini-btn {
  background: linear-gradient(135deg, #eef6fa, #e0edf4);
  color: #244d5f;
  border: 1px solid #c6dce7;
}

.income-monitor-tabs .mini-btn.is-active {
  background: linear-gradient(135deg, #1d6884, #18566d);
  color: #ffffff;
  border-color: #1d6884;
}

.collections-note {
  margin-top: 0.72rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

thead {
  background: linear-gradient(180deg, #d9ebf3, #cae1eb);
}

th,
td {
  border-bottom: 1px solid #dce6ea;
  padding: 0.44rem;
  white-space: nowrap;
  text-align: left;
}

tbody tr:hover {
  background: #f3f8fa;
}

.contrib-table td {
  vertical-align: top;
}

.contrib-table {
  width: max-content;
  min-width: 100%;
}

.status-chip {
  display: inline-block;
  border-radius: 999px;
  padding: 0.19rem 0.47rem;
  font-size: 0.71rem;
  font-weight: 800;
}

.status-chip.paid {
  color: #14553e;
  background: #daf3e8;
}

.status-chip.partial {
  color: #805a11;
  background: #fff0cf;
}

.status-chip.missing {
  color: #8b2f29;
  background: #fde5e2;
}

.status-amount {
  margin-top: 0.18rem;
  font-size: 0.73rem;
  color: #58707c;
}

.contrib-cell-actions {
  margin-top: 0.24rem;
  display: flex;
  justify-content: center;
}

.contrib-cell-actions .mini-btn {
  padding: 0.24rem 0.44rem;
  font-size: 0.67rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.58rem;
}

.form-grid label {
  display: grid;
  gap: 0.28rem;
  font-size: 0.81rem;
  font-weight: 700;
  color: #305364;
}

.form-grid .wide {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  gap: 0.42rem;
  flex-wrap: wrap;
}

.form-grid button {
  margin-top: 0.2rem;
}

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

.mini-btn {
  border-radius: 8px;
  padding: 0.32rem 0.52rem;
  font-size: 0.73rem;
}

.mini-btn.warn {
  background: linear-gradient(135deg, #ad4f46, #8d3f39);
}

.mini-btn.danger {
  background: linear-gradient(135deg, #883832, #6c2824);
}

.action-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: grid;
  place-items: center;
  background: rgba(12, 34, 42, 0.45);
  backdrop-filter: blur(4px);
}

.action-modal {
  width: min(460px, 92vw);
  border-radius: 16px;
  border: 1px solid #d7e2e8;
  background: linear-gradient(155deg, #ffffff, #f4f9fc);
  box-shadow: var(--shadow-xl);
  padding: 1rem 1rem 0.9rem;
}

.action-modal h3 {
  margin: 0;
  font-family: "Sora", "Manrope", sans-serif;
  font-size: 1.15rem;
  color: #173846;
}

.action-modal p {
  margin: 0.52rem 0 0.82rem;
  font-size: 0.9rem;
  color: #3c5967;
}

.modal-field {
  display: grid;
  gap: 0.34rem;
  margin-bottom: 0.82rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: #2d5161;
}

.modal-field input {
  width: 100%;
}

.action-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

body.modal-open {
  overflow: hidden;
}

.annual-bars {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  align-items: end;
  gap: 0.3rem;
  min-height: 240px;
}

.bar-item {
  display: grid;
  justify-items: center;
  gap: 0.24rem;
}

.bar-net {
  width: 100%;
  min-height: 6px;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, #1f9b79, #16755e);
  transition: height 280ms ease;
}

.bar-net.negative {
  background: linear-gradient(180deg, #c4594f, #983b34);
}

.bar-label {
  font-size: 0.68rem;
  color: #58707d;
}

@media (max-width: 1280px) {
  .topbar {
    flex-direction: column;
  }

  .topbar-right {
    width: 100%;
    justify-items: start;
  }

  .period-controls,
  .user-controls {
    justify-content: flex-start;
  }
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    min-height: auto;
  }

  .sidebar nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .nav-btn {
    text-align: center;
  }

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

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

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

@media (max-width: 920px) {
  body::before,
  .decor-orb {
    display: none;
  }

  body {
    padding: 0.5rem;
    background: linear-gradient(165deg, #ecebe2, #d9e9e6);
  }

  .app-shell {
    gap: 0.5rem;
    max-width: 100%;
  }

  .sidebar {
    min-height: auto;
    padding: 0.7rem;
    border-radius: 16px;
    box-shadow: 0 8px 18px rgba(17, 46, 56, 0.16);
  }

  .sidebar-logo {
    width: 92px;
    margin-bottom: 0.36rem;
  }

  .sidebar h1 {
    font-size: 1.1rem;
  }

  .sidebar p {
    display: none;
  }

  .reference-note,
  .cashier-badge {
    display: none;
  }

  .sidebar nav {
    margin-top: 0;
    display: flex;
    flex-wrap: nowrap;
    gap: 0.34rem;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 0.08rem;
    scrollbar-width: none;
    grid-template-columns: unset;
  }

  .sidebar nav::-webkit-scrollbar {
    display: none;
  }

  .nav-btn {
    flex: 0 0 auto;
    min-width: max-content;
    font-size: 0.76rem;
    border-radius: 999px;
    padding: 0.42rem 0.6rem;
  }

  .main-panel {
    border-radius: 16px;
    padding: 0.82rem;
    box-shadow: 0 8px 18px rgba(17, 46, 56, 0.12);
  }

  .topbar {
    gap: 0.5rem;
  }
}

@media (max-width: 720px) {
  body {
    padding: 0.3rem;
    background: linear-gradient(170deg, #eef3f1, #dde8ec);
  }

  .app-shell {
    gap: 0.38rem;
    max-width: 100%;
  }

  .main-panel,
  .sidebar {
    border-radius: 12px;
    box-shadow: 0 5px 14px rgba(20, 48, 58, 0.1);
  }

  .sidebar {
    display: grid;
    grid-template-columns: 74px minmax(0, 1fr);
    align-items: center;
    gap: 0.42rem;
    padding: 0.56rem 0.6rem;
    background: linear-gradient(158deg, rgba(22, 91, 111, 0.97), rgba(12, 60, 77, 0.97));
  }

  .sidebar::before {
    display: none;
  }

  .sidebar-logo {
    width: 74px;
    margin: 0;
    padding: 0.14rem;
    border-radius: 9px;
  }

  .sidebar h1 {
    display: block;
    margin: 0;
    font-size: 0.96rem;
    line-height: 1;
    letter-spacing: 0.01em;
  }

  .sidebar > p,
  .reference-note,
  .cashier-badge,
  .sidebar::before {
    display: none;
  }

  .sidebar nav {
    grid-column: 1 / -1;
    margin-top: 0.06rem;
    display: flex;
    flex-wrap: nowrap;
    gap: 0.3rem;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 0.08rem;
    scrollbar-width: none;
    grid-template-columns: unset;
  }

  .sidebar nav::-webkit-scrollbar {
    display: none;
  }

  .nav-btn {
    flex: 0 0 auto;
    min-width: max-content;
    font-size: 0.73rem;
    text-align: center;
    border-radius: 999px;
    padding: 0.42rem 0.58rem;
    white-space: nowrap;
  }

  .nav-btn:hover {
    transform: none;
  }

  .main-panel {
    padding: 0.72rem;
    background: #ffffff;
    border-color: #dce5e9;
  }

  .topbar {
    gap: 0.42rem;
    padding: 0 0 0.32rem;
    border-bottom-color: #dde6ea;
  }

  .transactions-history-card .card-head {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .transactions-history-card .inline-select-control {
    width: 100%;
    justify-content: space-between;
  }

  .transactions-history-filters {
    grid-template-columns: 1fr;
  }

  .topbar h2 {
    font-size: 1.18rem;
    line-height: 1.12;
  }

  .topbar p {
    margin-top: 0.12rem;
    font-size: 0.76rem;
  }

  .mobile-controls-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 38px;
    font-size: 0.79rem;
    padding: 0.44rem 0.6rem;
  }

  .topbar-right {
    display: none;
    width: 100%;
    justify-items: stretch;
    gap: 0.34rem;
    border: 1px solid #d8e3e8;
    border-radius: 10px;
    background: #f7fbfd;
    padding: 0.44rem;
  }

  .topbar-right.is-open {
    display: grid;
  }

  .period-controls {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.42rem;
    align-items: stretch;
  }

  .period-controls > * {
    width: 100%;
    min-height: 36px;
  }

  #refresh-dashboard,
  #export-monthly,
  #export-annual {
    grid-column: 1 / -1;
  }

  .user-controls {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.42rem;
    align-items: stretch;
  }

  .user-controls .badge {
    width: 100%;
    justify-content: flex-start;
    padding-inline: 0.48rem;
  }

  #admin-member-preview-btn,
  #change-password-btn,
  #logout-btn {
    width: 100%;
    min-height: 36px;
  }

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

  .kpis {
    gap: 0.42rem;
  }

  .kpi-card {
    border-radius: 10px;
    padding: 0.62rem;
    box-shadow: none;
    transform: none;
    opacity: 1;
    animation: none;
  }

  .kpi-card::after {
    display: none;
  }

  .kpi-card span {
    font-size: 0.73rem;
  }

  .kpi-card strong {
    margin-top: 0.28rem;
    font-size: 1.1rem;
  }

  .kpi-card small {
    margin-top: 0.18rem;
    font-size: 0.68rem;
  }

  .card {
    border-radius: 10px;
    padding: 0.62rem;
    box-shadow: none;
    background: #ffffff;
  }

  .card h3 {
    font-size: 0.9rem;
    margin-bottom: 0.4rem;
  }

  .meta-line {
    font-size: 0.75rem;
    margin-bottom: 0.42rem;
  }

  .projects-hero-stats {
    grid-template-columns: 1fr;
    gap: 0.34rem;
  }

  .projects-hero-stat {
    text-align: left;
  }

  .projects-hero-stat strong {
    font-size: 1rem;
  }

  .projects-hero-note {
    font-size: 0.74rem;
    margin-top: 0.5rem;
  }

  .projects-grid {
    gap: 0.52rem;
  }

  .project-card {
    border-left-width: 3px;
  }

  .project-card-head {
    flex-direction: column;
    gap: 0.28rem;
  }

  .project-card-badges {
    justify-content: flex-start;
  }

  .project-summary {
    margin: 0.46rem 0 0.5rem;
    font-size: 0.78rem;
  }

  .project-facts li {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.16rem;
  }

  .project-facts span,
  .project-facts strong {
    font-size: 0.72rem;
    text-align: left;
  }

  .project-cta {
    font-size: 0.75rem;
    margin-top: 0.5rem;
  }

  .project-card-actions {
    margin-top: 0.5rem;
    gap: 0.3rem;
  }

  .member-pay-actions button {
    width: 100%;
  }

  .project-admin-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .toggle-field {
    font-size: 0.76rem;
  }

  .payment-info {
    margin-top: 0.55rem;
    font-size: 0.73rem;
  }

  .table-card {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    font-size: 0.74rem;
    min-width: 540px;
  }

  .contrib-table {
    min-width: 860px;
  }

  th,
  td {
    padding: 0.36rem;
  }

  .table-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.3rem;
  }

  #view-finance .table-actions {
    grid-template-columns: 1fr;
  }

  .mini-btn {
    font-size: 0.68rem;
    padding: 0.3rem 0.42rem;
  }

  .action-modal {
    width: min(92vw, 420px);
    padding: 0.9rem 0.85rem 0.82rem;
  }

  .view.is-visible {
    animation: none;
  }
}

@media (max-height: 820px) {
  .auth-overlay {
    align-items: flex-start;
  }
}
