:root {
  --ink: #1E2A2F;
  --muted: #627075;
  --page: #F8F8F5;
  --paper: #ffffff;
  --soft: #eef4ef;
  --line: #dedbd1;
  --brand: #0F5D52;
  --brand-dark: #0a4039;
  --accent: #D8B07B;
  --accent-strong: #916936;
  --accent-soft: #fbf1e1;
  --success: #4B7F52;
  --danger: #9d3c31;
  --shadow: 0 18px 45px rgba(30, 42, 47, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  padding-bottom: 78px;
  background: var(--page);
  color: var(--ink);
  font-family: "Segoe UI", Inter, Arial, sans-serif;
}

body.nav-open {
  overflow: hidden;
}

body:not(.is-authed) [data-protected],
body:not(.is-authed) .protected-link,
body:not(.is-authed) .authed-only {
  display: none !important;
}

body.is-authed .public-only,
body.is-authed .public-link {
  display: none !important;
}

a {
  color: inherit;
}

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

input,
select,
textarea {
  width: 100%;
  min-height: 48px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
}

textarea {
  min-height: 108px;
  padding: 12px;
  resize: vertical;
  line-height: 1.45;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -80px;
  z-index: 20;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--brand-dark);
  color: #fff;
  transition: top 160ms ease;
}

.skip-link:focus {
  top: 12px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid rgba(222, 219, 209, 0.86);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
}

.nav-shell,
.section-inner {
  width: min(1120px, calc(100% - 28px));
  margin: 0 auto;
}

.nav-shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 82px;
  gap: 14px;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  text-decoration: none;
}

.brand-lockup strong,
.brand-lockup small {
  display: block;
}

.brand-lockup strong {
  font-size: 1.1rem;
  line-height: 1.05;
}

.brand-lockup small {
  color: var(--accent-strong);
  font-size: 0.8rem;
  font-weight: 800;
}

.brand-logo-fallback,
.brand-logo {
  width: 58px;
  height: 58px;
  flex: 0 0 58px;
  border-radius: 10px;
}

.brand-logo-fallback {
  display: grid;
  place-items: center;
  background: var(--brand);
  color: #fff;
  font-weight: 900;
}

.brand-logo {
  position: relative;
  z-index: 1;
  object-fit: contain;
  background: transparent;
}

.nav-toggle {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
}

.nav-toggle span:not(.sr-only) {
  display: block;
  width: 20px;
  height: 2px;
  margin: 2px 0;
  background: var(--ink);
}

.nav-links {
  position: fixed;
  inset: 82px 0 auto 0;
  display: none;
  grid-template-columns: 1fr;
  gap: 6px;
  padding: 14px 16px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.nav-open .nav-links {
  display: grid;
}

.nav-links a {
  padding: 14px 12px;
  border-radius: 12px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
}

.nav-links a:hover,
.nav-links a:focus {
  background: var(--accent-soft);
}

.logout-button,
.text-button {
  border: 0;
  background: transparent;
  color: var(--brand);
  cursor: pointer;
  font-weight: 900;
}

.logout-button {
  padding: 14px 12px;
  border-radius: 12px;
  text-align: left;
}

.logout-button:hover,
.logout-button:focus {
  background: var(--accent-soft);
}

.app-screen {
  padding: 54px 0;
  scroll-margin-top: 92px;
}

.app-screen.muted {
  background: var(--soft);
}

.hero {
  padding-top: 34px;
  background:
    linear-gradient(145deg, rgba(15, 93, 82, 0.92), rgba(248, 248, 245, 0.88)),
    url("https://images.unsplash.com/photo-1560518883-ce09059eeffa?auto=format&fit=crop&w=1400&q=80") center / cover;
  color: var(--ink);
}

.hero-grid,
.split-layout,
.auth-grid {
  display: grid;
  gap: 22px;
}

.eyebrow,
.panel-kicker {
  margin: 0 0 8px;
  color: var(--accent-strong);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 12px;
  font-size: 2.38rem;
  line-height: 1.04;
}

h2 {
  margin-bottom: 12px;
  font-size: 1.72rem;
  line-height: 1.12;
}

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

h4 {
  margin-bottom: 8px;
  font-size: 1rem;
}

p {
  color: var(--muted);
  line-height: 1.58;
}

.hero p,
.welcome-panel p {
  color: rgba(30, 42, 47, 0.82);
}

.hero-subtitle,
.section-lead {
  max-width: 660px;
  font-size: 1.05rem;
}

.hero-tagline {
  margin: 16px 0 0;
  color: var(--brand);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.28rem;
  font-weight: 700;
}

.hero-call-row,
.button-stack {
  display: grid;
  gap: 10px;
}

.hero-call-row {
  margin-top: 24px;
}

.action-button,
.card-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 16px;
  border: 1px solid rgba(15, 93, 82, 0.25);
  border-radius: 12px;
  background: #fff;
  color: var(--brand-dark);
  font-weight: 900;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.action-button.primary,
.card-button {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.wide {
  width: 100%;
}

.welcome-panel,
.resource-card,
.notice-card,
.guardian-card,
.document-card,
.contact-card,
.owner-upload-note,
details {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
  box-shadow: 0 10px 28px rgba(30, 42, 47, 0.06);
}

.welcome-panel {
  padding: 22px;
  border-color: rgba(216, 176, 123, 0.55);
  background: rgba(255, 255, 255, 0.93);
  box-shadow: 0 22px 46px rgba(30, 42, 47, 0.14);
}

.mini-contact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid rgba(216, 176, 123, 0.45);
  border-radius: 12px;
  background: var(--accent-soft);
  font-weight: 800;
}

.mini-contact span {
  color: var(--muted);
  font-size: 0.86rem;
}

.mini-contact a {
  color: var(--brand);
  text-decoration: none;
}

.auth-status {
  margin: 14px 0 0;
  color: var(--brand);
  font-weight: 900;
}

.auth-section {
  background: #fff;
}

.emergency-public {
  padding: 24px 0;
  background: #fff7f4;
}

.emergency-public-card {
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid #ecc8be;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(30, 42, 47, 0.08);
}

.emergency-public-card h2 {
  font-size: 1.42rem;
}

.auth-card {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid rgba(216, 176, 123, 0.5);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(30, 42, 47, 0.08);
}

.auth-card label {
  color: var(--ink);
  font-weight: 900;
}

.form-status {
  min-height: 22px;
  margin: 0;
  color: var(--success);
  font-weight: 800;
}

.form-status.is-error {
  color: var(--danger);
}

.role-badge {
  display: inline-flex;
  width: fit-content;
  margin: 0;
  padding: 8px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--brand-dark);
  font-size: 0.86rem;
  font-weight: 900;
}

.auth-not-configured .auth-card {
  border-color: #ecc8be;
}

.text-button {
  justify-self: center;
  min-height: 38px;
  padding: 0 8px;
}

.centered-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.quick-strip {
  padding: 32px 0;
  background: linear-gradient(180deg, #fff, var(--page));
}

.quick-heading {
  margin-bottom: 16px;
}

.quick-heading h2 {
  margin-bottom: 0;
  font-size: 1.45rem;
}

.app-card-grid,
.quick-grid,
.card-grid,
.document-grid,
.contact-card-grid,
.install-steps {
  display: grid;
  gap: 12px;
}

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

.quick-grid a,
.owner-actions a {
  display: grid;
  gap: 12px;
  min-height: 128px;
  padding: 16px;
  border: 1px solid rgba(216, 176, 123, 0.36);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 12px 26px rgba(30, 42, 47, 0.08);
  text-decoration: none;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.quick-grid a:hover,
.quick-grid a:focus,
.owner-actions a:hover,
.owner-actions a:focus {
  border-color: var(--accent);
  box-shadow: 0 16px 34px rgba(30, 42, 47, 0.12);
  transform: translateY(-2px);
}

.quick-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--brand);
}

.quick-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.quick-grid strong {
  align-self: end;
  line-height: 1.25;
}

.quick-helper {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.38;
}

.routing-list {
  display: grid;
  gap: 8px;
  margin: 14px 0 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.45;
}

.content-layout {
  display: grid;
  gap: 24px;
}

.content-layout > div:first-child,
.split-layout > div:first-child {
  max-width: 720px;
}

.resource-card,
.document-card,
.contact-card,
.owner-upload-note {
  padding: 18px;
}

.resource-card p,
.document-card p,
.contact-card p,
.owner-upload-note p {
  margin-bottom: 14px;
}

.owner-actions a {
  min-height: 116px;
  color: var(--ink);
}

.owner-actions span {
  color: var(--muted);
  line-height: 1.4;
}

.notice-card {
  padding: 16px;
}

.notice-card strong {
  display: block;
  margin-bottom: 6px;
  color: var(--danger);
}

.notice-card p {
  margin-bottom: 0;
}

.notice-card.urgent {
  border-color: #ecc8be;
  background: #fff7f4;
}

.emergency-actions {
  margin-top: 14px;
}

.guardian-card {
  padding: 20px;
  border-color: rgba(75, 127, 82, 0.32);
}

.guardian-card img,
.guardian-contact img {
  display: block;
  max-width: 210px;
  max-height: 82px;
  object-fit: contain;
  margin-bottom: 14px;
}

.guardian-card a,
.contact-card a {
  color: var(--brand);
  overflow-wrap: anywhere;
}

.document-category {
  margin-top: 24px;
}

.document-category h3 {
  margin-bottom: 12px;
  color: var(--brand-dark);
}

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

.new-tab-note {
  display: block;
  margin-top: 9px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.owner-upload-note {
  margin-top: 22px;
  border-color: rgba(216, 176, 123, 0.5);
  background: #fffdf9;
}

.faq-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

details {
  padding: 16px;
}

summary {
  cursor: pointer;
  font-weight: 900;
}

details p {
  margin: 12px 0 0;
}

.contact-section {
  background: #fff;
}

.contact-card-grid {
  margin-top: 18px;
}

.install-steps ol {
  margin: 12px 0 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.6;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 12;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(222, 219, 209, 0.9);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
  box-shadow: 0 -12px 30px rgba(30, 42, 47, 0.08);
}

.bottom-nav a {
  display: grid;
  place-items: center;
  min-height: 44px;
  border-radius: 14px;
  color: var(--brand-dark);
  font-size: 0.76rem;
  font-weight: 900;
  text-decoration: none;
}

.bottom-nav a:hover,
.bottom-nav a:focus {
  background: var(--accent-soft);
}

.site-footer {
  padding: 28px 0 calc(28px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--brand-dark);
  color: #fff;
}

.footer-grid {
  display: grid;
  gap: 12px;
}

.site-footer p {
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.78);
}

.site-footer strong {
  color: #fff;
}

@media (min-width: 720px) {
  body {
    padding-bottom: 0;
  }

  .bottom-nav {
    display: none;
  }

  .nav-toggle {
    display: none;
  }

  .nav-links {
    position: static;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .nav-links a {
    padding: 10px 9px;
    font-size: 0.86rem;
  }

  .app-screen {
    padding: 72px 0;
  }

  .hero {
    min-height: 620px;
    display: grid;
    align-items: center;
  }

  h1 {
    font-size: 4rem;
  }

  h2 {
    font-size: 2.2rem;
  }

  .hero-call-row {
    grid-template-columns: repeat(2, minmax(0, 240px));
  }

  .emergency-public-card {
    grid-template-columns: minmax(0, 1fr) 300px;
    align-items: center;
  }

  .quick-grid,
  .owner-actions,
  .card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .document-grid,
  .contact-card-grid,
  .install-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .split-layout {
    grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
    align-items: start;
  }

  .auth-grid {
    grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
    align-items: start;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr 1.3fr;
  }
}

@media (min-width: 980px) {
  .hero-grid {
    grid-template-columns: minmax(0, 1.2fr) 390px;
    align-items: center;
  }

  .content-layout {
    grid-template-columns: 300px 1fr;
    align-items: start;
  }

  .nav-links a {
    padding-inline: 12px;
  }
}
