:root {
  --ink: #202723;
  --muted: #5e6862;
  --paper: #fffefa;
  --canvas: #f4f1e9;
  --line: #d8d5cc;
  --green: #225844;
  --green-dark: #163d2f;
  --green-soft: #e6efe9;
  --red: #9e352d;
  --red-soft: #f8e8e5;
  --amber: #7c5411;
  --amber-soft: #f6edd8;
  --blue-soft: #e8eef3;
  --focus: #0a66c2;
  --radius: 10px;
  --content: 1120px;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 18px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: Arial, "Segoe UI", sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

button,
a,
summary,
input {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: var(--green-dark);
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 10px;
  left: 10px;
  padding: 12px 16px;
  transform: translateY(-160%);
  color: #fff;
  background: var(--ink);
  border-radius: 6px;
  font-weight: 700;
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.header-inner,
.nav-inner,
.page-shell {
  width: min(calc(100% - 40px), var(--content));
  margin-inline: auto;
}

.header-inner {
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  flex-direction: column;
  color: var(--ink);
  text-decoration: none;
}

.brand span {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.15;
}

.brand small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.83rem;
}

.today {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.primary-nav {
  background: var(--green-dark);
}

.nav-inner {
  display: flex;
  align-items: stretch;
  gap: 4px;
}

.nav-link {
  min-height: 58px;
  padding: 15px 20px 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  border-bottom: 4px solid transparent;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 700;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.08);
}

.nav-link[aria-current="page"] {
  background: rgba(255, 255, 255, 0.12);
  border-bottom-color: #f1c66b;
}

.mobile-nav {
  display: none;
}

.page-shell {
  padding-block: 42px 64px;
}

.page-heading {
  max-width: 760px;
  margin-bottom: 30px;
}

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

h1,
h2,
h3,
p {
  overflow-wrap: break-word;
}

h1,
h2,
h3 {
  margin-top: 0;
  line-height: 1.2;
}

h1 {
  margin-bottom: 10px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

h2 {
  margin-bottom: 18px;
  font-size: 1.35rem;
}

h3 {
  margin-bottom: 8px;
  font-size: 1.05rem;
}

.lead {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.section-title h2,
.section-title p {
  margin: 0;
}

.section-link {
  white-space: nowrap;
  font-size: 0.9rem;
  font-weight: 700;
  text-underline-offset: 3px;
}

.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.panel-pad {
  padding: 26px;
}

.summary-strip {
  margin-bottom: 30px;
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) repeat(2, minmax(180px, 1fr));
  background: var(--green-dark);
  border-radius: var(--radius);
  color: #fff;
  overflow: hidden;
}

.summary-item {
  min-height: 142px;
  padding: 24px 26px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
}

.summary-item:first-child {
  border-left: 0;
}

.summary-label {
  margin: 0 0 7px;
  color: #dfe9e4;
  font-size: 0.88rem;
}

.summary-value {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
}

.summary-value.money {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 5vw, 2.7rem);
  line-height: 1;
}

.summary-note {
  margin: 6px 0 0;
  color: #dfe9e4;
  font-size: 0.8rem;
}

.home-grid,
.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(290px, 0.8fr);
  gap: 28px;
  align-items: start;
}

.stack {
  display: grid;
  gap: 28px;
}

.item-list {
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.list-row {
  min-height: 88px;
  padding: 18px 22px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: center;
  border-top: 1px solid var(--line);
}

.list-row:first-child {
  border-top: 0;
}

.row-title {
  margin: 0 0 3px;
  font-weight: 800;
}

.row-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.row-side {
  text-align: right;
}

.amount {
  margin: 0;
  white-space: nowrap;
  font-size: 1.1rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.amount.paid {
  color: var(--green);
}

.amount.pending {
  color: var(--red);
}

.status {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
}

.status.pending {
  color: #7b2721;
  background: var(--red-soft);
}

.status.paid {
  color: var(--green-dark);
  background: var(--green-soft);
}

.status.upcoming {
  color: var(--amber);
  background: var(--amber-soft);
}

.plain-block {
  padding: 22px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.last-payment {
  padding-left: 18px;
  border-left: 5px solid var(--green);
}

.last-payment p {
  margin: 3px 0;
}

.last-payment .amount {
  margin-top: 8px;
  font-size: 1.45rem;
}

.reminder-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.reminder-list li {
  padding: 15px 0;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 14px;
  border-top: 1px solid var(--line);
}

.reminder-list li:first-child {
  padding-top: 0;
  border-top: 0;
}

.date-box {
  min-height: 54px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--green-dark);
  background: var(--green-soft);
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.1;
  text-transform: uppercase;
}

.date-box strong {
  font-size: 1.15rem;
}

.reminder-copy p {
  margin: 0;
}

.reminder-copy .row-meta {
  margin-top: 2px;
}

.quick-actions {
  margin-top: 30px;
  padding: 24px 26px;
  background: var(--paper);
  border-top: 4px solid var(--green);
  border-radius: var(--radius);
}

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

.button {
  min-height: 52px;
  padding: 12px 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #fff;
  background: var(--green);
  border: 2px solid var(--green);
  border-radius: 8px;
  text-align: center;
  text-decoration: none;
  font-weight: 800;
  line-height: 1.2;
}

.button:hover {
  background: var(--green-dark);
  border-color: var(--green-dark);
}

.button.secondary {
  color: var(--green-dark);
  background: var(--paper);
}

.button.secondary:hover {
  background: var(--green-soft);
}

.button.small {
  min-height: 44px;
  padding: 9px 14px;
  font-size: 0.87rem;
}

.page-actions {
  margin-bottom: 26px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.filter-bar {
  margin-bottom: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.filter-button {
  min-height: 46px;
  padding: 9px 16px;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: 999px;
  font-weight: 700;
}

.filter-button:hover {
  border-color: var(--green);
}

.filter-button[aria-pressed="true"] {
  color: #fff;
  background: var(--green-dark);
  border-color: var(--green-dark);
}

.search-field {
  margin-bottom: 18px;
}

.search-field label {
  display: block;
  margin-bottom: 7px;
  font-weight: 800;
}

.search-field input {
  width: min(100%, 560px);
  min-height: 54px;
  padding: 10px 14px;
  background: var(--paper);
  border: 2px solid #a9aea9;
  border-radius: 8px;
}

.search-field input::placeholder {
  color: #6c746f;
}

.empty-state {
  display: none;
  padding: 24px;
  color: var(--muted);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.document-row {
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.file-type {
  min-width: 54px;
  padding: 6px 8px;
  color: var(--muted);
  background: var(--blue-soft);
  border-radius: 5px;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 800;
}

.payment-summary {
  margin-bottom: 30px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow: hidden;
}

.payment-stat {
  min-height: 126px;
  padding: 22px 24px;
  border-left: 1px solid var(--line);
}

.payment-stat:first-child {
  border-left: 0;
}

.payment-stat p {
  margin: 0;
}

.payment-stat .stat-label {
  color: var(--muted);
  font-size: 0.85rem;
}

.payment-stat .stat-value {
  margin-top: 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1.15;
}

.subsection {
  margin-top: 36px;
}

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

.installment {
  padding: 22px;
}

.installment p {
  margin: 5px 0 0;
}

.progress {
  height: 10px;
  margin: 16px 0 8px;
  background: #e1e2dc;
  border-radius: 999px;
  overflow: hidden;
}

.progress span {
  height: 100%;
  display: block;
  background: var(--green);
  border-radius: inherit;
}

.week-strip {
  margin-bottom: 28px;
  padding: 18px;
  display: grid;
  grid-template-columns: repeat(7, minmax(70px, 1fr));
  gap: 8px;
  overflow-x: auto;
}

.day {
  min-height: 76px;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 2px solid transparent;
  border-radius: 7px;
  font-size: 0.78rem;
}

.day strong {
  font-size: 1.15rem;
}

.day.today-day {
  color: #fff;
  background: var(--green-dark);
}

.day.has-event:not(.today-day) {
  background: var(--amber-soft);
  border-color: #d9bd80;
}

.timeline-group {
  margin-top: 30px;
}

.timeline-group h2 {
  margin-bottom: 12px;
}

.reminder-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.reminder-row.is-done {
  background: #f2f3ef;
}

.reminder-row.is-done .row-title,
.reminder-row.is-done .row-meta {
  color: #6e756f;
  text-decoration: line-through;
}

.done-button {
  min-width: 154px;
}

.note-list {
  display: grid;
  gap: 16px;
}

details.note {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

details.note[open] {
  border-color: #a8b8ae;
}

details.note summary {
  min-height: 82px;
  padding: 18px 52px 18px 22px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  list-style: none;
  cursor: pointer;
}

details.note summary::-webkit-details-marker {
  display: none;
}

details.note summary::after {
  content: "+";
  position: absolute;
  top: 50%;
  right: 22px;
  transform: translateY(-50%);
  color: var(--green);
  font-size: 1.5rem;
  font-weight: 700;
}

details.note[open] summary::after {
  content: "−";
}

.note-title {
  font-weight: 800;
}

.note-date {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.82rem;
}

.note-body {
  padding: 0 22px 22px;
  border-top: 1px solid var(--line);
}

.note-body p,
.note-body ul {
  margin-bottom: 0;
}

.important-note {
  border-left: 5px solid var(--amber) !important;
}

.demo-note {
  margin-top: 42px;
  padding-top: 18px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 0.82rem;
}

.site-footer {
  color: var(--muted);
  background: var(--paper);
  border-top: 1px solid var(--line);
}

.footer-inner {
  width: min(calc(100% - 40px), var(--content));
  min-height: 78px;
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  font-size: 0.82rem;
}

.footer-inner p {
  margin: 0;
}

dialog {
  width: min(calc(100% - 32px), 520px);
  padding: 0;
  color: var(--ink);
  background: var(--paper);
  border: 0;
  border-radius: 12px;
  box-shadow: 0 18px 60px rgba(20, 30, 24, 0.28);
}

dialog::backdrop {
  background: rgba(16, 24, 20, 0.62);
}

.dialog-content {
  padding: 30px;
}

.dialog-content h2 {
  margin-bottom: 12px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.7rem;
}

.dialog-content p {
  margin: 0 0 24px;
  color: var(--muted);
}

[hidden] {
  display: none !important;
}

@media (max-width: 820px) {
  html {
    font-size: 17px;
  }

  body {
    padding-bottom: 76px;
  }

  .header-inner,
  .page-shell,
  .footer-inner {
    width: min(calc(100% - 28px), var(--content));
  }

  .header-inner {
    min-height: 78px;
  }

  .brand span {
    font-size: 1.35rem;
  }

  .brand small {
    display: none;
  }

  .today {
    max-width: 150px;
    text-align: right;
    font-size: 0.78rem;
  }

  .primary-nav {
    display: none;
  }

  .mobile-nav {
    position: fixed;
    z-index: 50;
    bottom: 0;
    left: 0;
    right: 0;
    min-height: 72px;
    padding-bottom: env(safe-area-inset-bottom);
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    background: var(--paper);
    border-top: 2px solid var(--line);
    box-shadow: 0 -4px 18px rgba(20, 30, 24, 0.08);
  }

  .mobile-nav a {
    min-width: 0;
    min-height: 72px;
    padding: 10px 3px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    border-top: 4px solid transparent;
    text-align: center;
    text-decoration: none;
    font-size: clamp(0.78rem, 3.2vw, 0.86rem);
    font-weight: 800;
    line-height: 1.1;
  }

  .mobile-nav a[aria-current="page"] {
    color: var(--green-dark);
    background: var(--green-soft);
    border-top-color: var(--green);
  }

  .page-shell {
    padding-block: 28px 42px;
  }

  .page-heading {
    margin-bottom: 24px;
  }

  h1 {
    font-size: 2rem;
  }

  .summary-strip,
  .payment-summary {
    grid-template-columns: 1fr;
  }

  .summary-item,
  .payment-stat {
    min-height: 0;
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    border-left: 0;
  }

  .summary-item:first-child,
  .payment-stat:first-child {
    border-top: 0;
  }

  .payment-stat {
    border-top-color: var(--line);
  }

  .summary-item:first-child {
    padding-block: 24px;
  }

  .home-grid,
  .two-column {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .action-buttons,
  .installment-grid {
    grid-template-columns: 1fr;
  }

  .quick-actions {
    padding: 22px 18px;
  }

  .button {
    min-height: 56px;
  }

  .document-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .document-row .file-type {
    display: none;
  }

  .footer-inner {
    padding-block: 18px;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
  }
}

@media (max-width: 480px) {
  .header-inner,
  .page-shell,
  .footer-inner {
    width: min(calc(100% - 22px), var(--content));
  }

  .today {
    display: none;
  }

  .page-shell {
    padding-top: 24px;
  }

  .lead {
    font-size: 1rem;
  }

  .section-title {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .list-row,
  .reminder-row {
    min-height: 0;
    padding: 17px;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .row-side {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    text-align: left;
  }

  .document-row {
    grid-template-columns: 1fr auto;
  }

  .document-row .row-side {
    display: block;
  }

  .done-button {
    width: 100%;
  }

  .panel-pad,
  .plain-block {
    padding: 20px 17px;
  }

  .dialog-content {
    padding: 24px 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}

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

  .primary-nav,
  .mobile-nav,
  .page-actions,
  .quick-actions,
  .site-footer,
  .demo-note,
  .filter-bar {
    display: none !important;
  }

  .page-shell {
    width: 100%;
    padding: 20px;
  }
}
