
:root {
  --burgundy: #801302;
  --burgundy-deep: #5c0e02;
  --ink: #231f20;
  --text: #252525;
  --muted: #707070;
  --taupe: #a49e8d;
  --sand: #d2cfc7;
  --paper: #f7f5f2;
  --white: #ffffff;
  --line: #e4e0d8;
  --hero: #231f20;
  color-scheme: light;
  font-family: "Source Sans 3", "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--paper);
  color: var(--text);
  min-height: 100vh;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--burgundy); }

button, input, select { font: inherit; }

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

.staging {
  position: sticky;
  top: 0;
  z-index: 40;
  margin: 0;
  background: var(--burgundy);
  color: var(--white);
  text-align: center;
  font-family: Oswald, "Arial Narrow", sans-serif;
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  line-height: 1.2;
  padding: 10px 12px;
}

.login-page {
  padding: 20px 16px 32px;
}

.login-card {
  width: min(100%, 440px);
  margin: 0 auto;
}

.login-logo {
  width: min(240px, 70%);
  margin: 8px auto 20px;
}

h1, h2, h3 {
  font-family: Oswald, "Arial Narrow", sans-serif;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--ink);
  margin: 0;
}

.login-card h1 {
  font-size: 2rem;
  line-height: 1.1;
}

.lede {
  margin: 6px 0 18px;
  color: var(--muted);
}

.card, .form-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
}

.form-card { padding: 18px 16px 16px; }

label {
  display: block;
  font-weight: 600;
  margin: 14px 0 6px;
}

label:first-child { margin-top: 0; }

input[type="checkbox"] {
  width: 1.25rem;
  min-height: 1.25rem;
  margin: 0;
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-weight: 600;
}

input, select {
  display: block;
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border: 1px solid var(--sand);
  border-radius: 12px;
  background: var(--white);
  color: var(--ink);
}

select { appearance: auto; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 52px;
  margin-top: 18px;
  border: 0;
  border-radius: 12px;
  background: var(--burgundy);
  color: var(--white);
  font-family: Oswald, "Arial Narrow", sans-serif;
  font-size: 1.15rem;
  letter-spacing: 0.04em;
  text-decoration: none;
  cursor: pointer;
}

.button:active { background: var(--burgundy-deep); }

.button.secondary {
  background: var(--white);
  color: var(--burgundy);
  border: 1px solid var(--burgundy);
}

.form-error {
  margin: 14px 0 0;
  color: var(--burgundy);
  font-weight: 600;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px 0;
}

.top-logo { width: 120px; flex: 0 0 auto; }

.signout {
  flex: 0 0 auto;
  min-height: 44px;
  margin: 0;
  width: auto;
  padding: 0 14px;
  background: transparent;
  color: var(--burgundy);
  border: 1px solid var(--burgundy);
  font-size: 1rem;
}

.page {
  padding: 16px 16px calc(84px + env(safe-area-inset-bottom));
}

.welcome h1 {
  font-size: clamp(1.8rem, 8vw, 2.4rem);
  line-height: 1.05;
}

.welcome p, .section-note, .help p, .doc p, .how-to p {
  margin: 4px 0 0;
  color: var(--muted);
}

.stack { display: grid; gap: 14px; margin-top: 16px; }

.pay-hero {
  background: var(--hero);
  color: var(--white);
  border-radius: 16px;
  padding: 18px 16px 16px;
}

.pay-hero h2, .eyebrow {
  color: var(--sand);
  font-family: Oswald, "Arial Narrow", sans-serif;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.95rem;
  margin: 0;
}

.period { margin: 8px 0 0; color: var(--white); }

.amount {
  margin: 8px 0 12px;
  font-family: Oswald, "Arial Narrow", sans-serif;
  font-size: clamp(2.6rem, 14vw, 3.6rem);
  font-weight: 500;
  line-height: 0.95;
  letter-spacing: 0.01em;
}

.pill {
  display: inline-block;
  margin: 0;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--burgundy);
  color: var(--white);
  font-size: 0.92rem;
  font-weight: 600;
}

.card h2 { font-size: 1.45rem; }

.actions { display: grid; gap: 10px; margin-top: 12px; }

.action {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  color: inherit;
  text-decoration: none;
}

.action strong { display: block; color: var(--ink); }

.action small { color: var(--muted); }

.action-icon {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--white);
  color: var(--burgundy);
}

.action-icon svg { width: 22px; height: 22px; fill: currentColor; }

.pay-wrap { margin-top: 12px; }

.pay-table, .pay-table tbody { display: block; width: 100%; }
.pay-table { border-collapse: collapse; }

.pay-table th {
  text-align: left;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 0 8px;
}

.pay-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.pay-table tr {
  display: block;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px 12px;
  margin-bottom: 10px;
}

.pay-table td {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 6px 0;
  border: 0;
}

.pay-table td::before {
  content: attr(data-label);
  color: var(--muted);
  font-size: 0.85rem;
  flex: 0 0 auto;
  text-align: left;
}

.pay-table td[data-label="Period"],
.pay-table td[data-label="Example amount"] {
  justify-content: flex-start;
  text-align: left;
  font-weight: 700;
}

.pay-table td[data-label="Period"]::before,
.pay-table td[data-label="Example amount"]::before {
  content: none;
}

.pay-table td[data-label="Note"] {
  align-items: flex-start;
}

.pay-table td[data-label="Note"] > span,
.pay-table td {
  text-align: right;
}

.money {
  font-family: Oswald, "Arial Narrow", sans-serif;
  font-size: 1.35rem;
  color: var(--ink);
}

.empty {
  margin: 12px 0 0;
  padding: 16px;
  border: 1px dashed var(--sand);
  border-radius: 14px;
  color: var(--muted);
}

.docs { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 10px; }

.docs li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--paper);
}

.docs li.installer {
  flex-direction: column;
  align-items: stretch;
}

.view-as {
  width: 100%;
  min-height: 44px;
  margin-top: 8px;
  padding: 8px 14px;
}

.preview-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid var(--burgundy);
  border-radius: 12px;
  background: var(--paper);
}

.preview-bar p { margin: 0; }

.preview-bar .button {
  width: auto;
  min-height: 44px;
  margin-top: 0;
  padding: 8px 14px;
}

.docs strong, .docs small { display: block; }
.docs small { color: var(--muted); font-weight: 400; }

.docs span {
  flex: 0 0 auto;
  color: var(--burgundy);
  font-weight: 700;
  font-size: 0.85rem;
}

.how-to ol { margin: 12px 0 0; padding-left: 1.2rem; }

.how-to li { margin: 8px 0; }

.profile-list { margin: 12px 0 0; padding: 0; list-style: none; }

.profile-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

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

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  background: var(--white);
  border-top: 1px solid var(--line);
  padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
}

.tabbar a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 52px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.72rem;
  font-weight: 600;
}

.tabbar a[aria-current="page"] { color: var(--burgundy); }

.tabbar svg { width: 22px; height: 22px; fill: currentColor; }

.sidebar { display: none; }

.narrow-note { display: none; }

#pay, #documents, #how-to, #profile { scroll-margin-top: 52px; }

@media (min-width: 960px) {
  .tabbar { display: none; }

  .app {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    align-items: start;
    min-height: calc(100vh - 42px);
  }

  .sidebar {
    display: flex;
    flex-direction: column;
    gap: 18px;
    position: sticky;
    top: 42px;
    height: calc(100vh - 42px);
    overflow: auto;
    padding: 22px 16px 16px;
    background: var(--ink);
    color: var(--white);
  }

  .brand-name {
    margin: 0;
    font-family: Oswald, "Arial Narrow", sans-serif;
    font-size: 1.7rem;
    letter-spacing: 0.03em;
  }

  .brand-sub {
    margin: 2px 0 0;
    color: var(--sand);
    font-size: 0.78rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
  }

  .side-nav { display: grid; gap: 4px; }

  .side-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 8px 12px;
    border-radius: 10px;
    color: var(--white);
    text-decoration: none;
    font-weight: 600;
  }

  .side-nav a[aria-current="page"] {
    background: var(--white);
    color: var(--burgundy);
  }

  .side-nav svg { width: 18px; height: 18px; fill: currentColor; }

  .side-foot { margin-top: auto; display: grid; gap: 12px; }

  .logo-plate {
    background: var(--white);
    border-radius: 12px;
    padding: 10px;
  }

  .help {
    border: 1px solid rgb(255 255 255 / 20%);
    border-radius: 12px;
    padding: 12px;
  }

  .help p, .help .help-title { color: var(--sand); margin: 0; }

  .help .help-title {
    color: var(--white);
    font-family: Oswald, "Arial Narrow", sans-serif;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
  }

  .topbar { padding: 22px 32px 0; }

  .page { padding: 8px 32px 40px; }

  .hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.8fr);
    gap: 16px;
  }

  .lower {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.8fr);
    gap: 16px;
    align-items: start;
  }

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

  .pay-table thead { position: static; width: auto; height: auto; overflow: visible; clip: auto; }

  .pay-table { display: table; width: 100%; }
  .pay-table tbody { display: table-row-group; }

  .pay-table tr { display: table-row; border: 0; border-radius: 0; padding: 0; margin: 0; }

  .pay-table td, .pay-table th {
    display: table-cell;
    padding: 12px 10px;
    border-bottom: 1px solid var(--line);
  }

  .pay-table td::before { content: none; }
  .pay-table td[data-label="Period"],
  .pay-table td[data-label="Example amount"],
  .pay-table td[data-label="Status"] { white-space: nowrap; font-weight: 400; }
  .pay-table td[data-label="Example amount"] { font-weight: 500; }

  .pay-table tr:last-child td { border-bottom: 0; }
}
