:root {
  --bg: #f6f8f3;
  --surface: #ffffff;
  --ink: #1f2a24;
  --muted: #66736b;
  --line: #d9e1d5;
  --green: #1f6f54;
  --green-soft: #dcece5;
  --gold: #a76a1d;
  --danger: #b42318;
  --shadow: 0 18px 45px rgba(31, 42, 36, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  font-size: 16px;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

.shell {
  width: min(100% - 32px, 1120px);
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  border-bottom: 1px solid var(--line);
  background: rgba(246, 248, 243, 0.94);
  backdrop-filter: blur(14px);
}

.topbar {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  background: var(--green);
  color: #ffffff;
  font-size: 0.86rem;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  flex-wrap: wrap;
}

.nav-link-plain,
.inline-action,
.text-action {
  border: 0;
  background: transparent;
  color: var(--green);
  font-weight: 700;
  text-decoration: none;
}

.top-actions .nav-link-plain {
  padding: 6px 10px;
  border-radius: 999px;
}

.top-actions .nav-link-plain.active {
  background: var(--green);
  color: #ffffff;
}

.text-action {
  padding: 0;
  cursor: pointer;
}

.site-main {
  padding: 28px 0 40px;
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 22px 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.public-home {
  min-height: calc(100vh - 180px);
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 14px;
  padding: 34px 0 70px;
}

.public-home h1,
.page-heading h1,
.access-panel h1 {
  margin: 0;
  max-width: 720px;
  line-height: 1.05;
  font-size: clamp(2rem, 8vw, 4rem);
  letter-spacing: 0;
}

.lead-text {
  max-width: 650px;
  margin: 0;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.65;
}

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

.page-heading {
  display: grid;
  gap: 8px;
  margin-bottom: 24px;
}

.page-heading h1,
.access-panel h1 {
  font-size: clamp(1.9rem, 5vw, 3rem);
}

.muted,
.notice {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.notice {
  max-width: 680px;
  color: var(--gold);
  font-weight: 700;
}

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

.summary-card {
  min-height: 126px;
  display: grid;
  align-content: space-between;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 18px;
  box-shadow: var(--shadow);
}

.summary-card span {
  color: var(--muted);
  font-size: 0.95rem;
}

.summary-card strong {
  overflow-wrap: anywhere;
  font-size: 1.85rem;
  line-height: 1.1;
  letter-spacing: 0;
}

.summary-card.success {
  border-color: #b8dccd;
  background: var(--green-soft);
}

.summary-card.warning {
  border-color: #ead1a9;
  background: #fff7e8;
}

.summary-card.balance {
  border-color: #bed4e5;
  background: #edf6fc;
}

.access-page {
  min-height: calc(100vh - 190px);
  display: grid;
  place-items: center;
}

.access-panel {
  width: min(100%, 430px);
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 24px;
  box-shadow: var(--shadow);
}

.simple-form {
  display: grid;
  gap: 16px;
  margin-top: 4px;
}

.field-group {
  display: grid;
  gap: 7px;
}

.field-group label {
  color: var(--muted);
  font-weight: 700;
}

.field-group input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  color: var(--ink);
  padding: 10px 12px;
}

.field-group input:focus,
.primary-action:focus-visible,
.nav-link-plain:focus-visible,
.text-action:focus-visible,
.inline-action:focus-visible {
  outline: 3px solid rgba(31, 111, 84, 0.22);
  outline-offset: 2px;
}

.primary-action {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  background: var(--green);
  color: #ffffff;
  font-weight: 800;
  cursor: pointer;
}

.primary-action:disabled {
  background: #aab5ad;
  cursor: not-allowed;
}

.field-error,
.form-errors {
  color: var(--danger);
  font-size: 0.92rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
}

.search-form {
  display: flex;
  gap: 8px;
  flex: 1 1 260px;
}

.search-form input {
  flex: 1 1 auto;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  color: var(--ink);
  padding: 8px 12px;
}

.secondary-action {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--green);
  border-radius: 8px;
  background: transparent;
  color: var(--green);
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.flash-message {
  margin-bottom: 18px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--green-soft);
  color: var(--green);
  font-weight: 700;
}

.flash-message.error {
  border-color: #eec2bb;
  background: #fdece9;
  color: var(--danger);
}

.record-list {
  display: grid;
  gap: 12px;
}

.record-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 16px;
  box-shadow: var(--shadow);
}

.record-info {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.record-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.05rem;
}

.record-meta {
  color: var(--muted);
  font-size: 0.92rem;
}

.record-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  background: var(--green-soft);
  color: var(--green);
}

.status-badge.inactive {
  background: #f1e8e6;
  color: var(--danger);
}

.status-badge.pending {
  background: #fff7e8;
  color: var(--gold);
}

.month-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.month-nav strong {
  min-width: 150px;
  text-align: center;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 28px;
  text-align: center;
  color: var(--muted);
}

.field-group select,
.field-group textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  color: var(--ink);
  padding: 10px 12px;
}

.field-group textarea {
  min-height: 90px;
  resize: vertical;
}

.form-panel {
  max-width: 560px;
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 24px;
  box-shadow: var(--shadow);
}

@media (max-width: 560px) {
  .shell {
    width: min(100% - 24px, 1120px);
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 0;
  }

  .top-actions {
    width: 100%;
    justify-content: flex-start;
    gap: 6px 10px;
  }

  .top-actions .nav-link-plain {
    padding: 5px 8px;
  }

  .top-actions form {
    margin-left: auto;
  }

  .summary-card {
    min-height: 112px;
  }

  .access-panel {
    padding: 20px;
  }
}
