:root {
  --app-bg: #f1e8dc;
  --bg: #f7f3ec;
  --bg-2: #efe4d5;
  --surface: #ffffff;
  --surface-soft: #f1e8dc;
  --surface-warm: #fbf7f0;
  --text: #1f2520;
  --muted: #667066;
  --border: #e2d8ca;
  --brand: #6f4e37;
  --brand-dark: #3f2d22;
  --brand-soft: #eadccd;
  --green: #496b4f;
  --orange: #d97941;
  --orange-dark: #bd6230;
  --danger: #b42318;
  --danger-soft: #fee4e2;
  --success: #28794f;
  --shadow: 0 18px 50px rgba(55, 39, 26, 0.12);
  --shadow-soft: 0 8px 24px rgba(55, 39, 26, 0.08);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --max-width: 1040px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--app-bg);
  min-height: 100%;
  height: auto;
  scroll-behavior: smooth;
  overflow-x: hidden;
  overflow-y: scroll;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  height: auto;
  position: relative;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(217, 121, 65, 0.12), transparent 28rem),
    linear-gradient(180deg, #fbf7f0 0%, var(--app-bg) 45%, #efe4d5 100%);
  overscroll-behavior-y: auto;
  color: var(--text);
  overflow-x: hidden;
  overflow-y: visible;
  -webkit-font-smoothing: antialiased;
}

/* PWA/iOS background fix:
   iOS can show the browser canvas during safe-area/rubber-band scrolling.
   This fixed layer keeps the installed app feeling native instead of flashing white. */
html.pwa-mode,
html.pwa-mode body {
  background: var(--app-bg);
}

html.pwa-mode body::before {
  content: "";
  position: fixed;
  z-index: -1;
  inset: -120px 0 -160px 0;
  pointer-events: none;
  background:
    radial-gradient(circle at top left, rgba(217, 121, 65, 0.12), transparent 28rem),
    linear-gradient(180deg, #fbf7f0 0%, var(--app-bg) 45%, #efe4d5 100%);
}

@supports (padding: max(0px)) {
  html.pwa-mode body {
    padding-top: env(safe-area-inset-top);
  }
}

img {
  max-width: 100%;
}

a {
  color: inherit;
}

.site-navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 0.8rem clamp(1rem, 3vw, 2rem);
  background: rgba(251, 247, 240, 0.86);
  border-bottom: 1px solid rgba(111, 78, 55, 0.12);
  backdrop-filter: blur(14px);
}

.site-navbar-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--brand-dark);
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  text-decoration: none;
}

.brand-logo {
  width: 38px;
  height: 38px;
  display: block;
  border-radius: 13px;
  object-fit: cover;
  box-shadow: var(--shadow-soft);
  background: var(--surface-soft);
}

.site-nav-links {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.site-nav-links a {
  padding: 0.6rem 0.85rem;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 750;
}

.site-nav-links a:hover {
  background: rgba(111, 78, 55, 0.08);
  color: var(--brand-dark);
}

.site-nav-links .nav-pill {
  background: var(--brand-dark);
  color: #fff;
}

.app-page {
  width: 100%;
  min-height: calc(100vh - 76px);
  height: auto;
  padding: clamp(1rem, 3vw, 2rem);
  overflow: visible;
}

.app-container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  height: auto;
  overflow: visible;
}

.app-hero {
  margin: 0 auto 1rem;
  padding: clamp(1.5rem, 5vw, 3.5rem);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.94), rgba(241, 232, 220, 0.92)),
    url("data:image/svg+xml,%3Csvg width='140' height='140' viewBox='0 0 140 140' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%236f4e37' stroke-opacity='0.07' stroke-width='1'%3E%3Cpath d='M0 70h140M70 0v140'/%3E%3C/g%3E%3C/svg%3E");
  border: 1px solid rgba(111, 78, 55, 0.12);
  box-shadow: var(--shadow);
}

.eyebrow,
.section-label {
  margin: 0 0 0.65rem;
  color: var(--orange-dark);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app-hero h1,
.page-title {
  margin: 0;
  color: var(--brand-dark);
  font-family: Merriweather, Georgia, serif;
  font-size: clamp(2.2rem, 7vw, 4.7rem);
  line-height: 1.03;
  letter-spacing: -0.045em;
}

.app-hero p,
.page-subtitle {
  max-width: 680px;
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 2.5vw, 1.16rem);
  line-height: 1.65;
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1rem;
}

.app-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(111, 78, 55, 0.14);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: clamp(1rem, 4vw, 2rem);
}

.card-header-row {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  margin-bottom: 1.2rem;
}

.card-icon {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: var(--surface-soft);
  font-size: 1.25rem;
}

.card-title h2,
.card-title h3 {
  margin: 0;
  color: var(--brand-dark);
  font-size: clamp(1.25rem, 3vw, 1.65rem);
  letter-spacing: -0.03em;
}

.card-title p,
.muted {
  margin: 0.25rem 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.form-grid {
  display: grid;
  gap: 0.9rem;
}

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

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
}

.form-label,
.form-group label {
  color: var(--brand-dark);
  font-size: 0.86rem;
  font-weight: 850;
}

.form-control,
.form-select,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="file"],
select,
textarea {
  width: 100%;
  min-height: 52px;
  padding: 0 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

input[type="file"] {
  padding: 0.82rem 1rem;
}

textarea {
  min-height: 120px;
  padding-top: 0.9rem;
  resize: vertical;
}

.form-control:focus,
.form-select:focus,
input:focus,
select:focus,
textarea:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 4px rgba(217, 121, 65, 0.16);
}

.form-help {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.btn,
button.btn,
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 50px;
  padding: 0 1.15rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--orange), var(--orange-dark));
  color: #fff;
  text-decoration: none;
  font: inherit;
  font-size: 0.98rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(217, 121, 65, 0.24);
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.btn:hover,
.primary-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 34px rgba(217, 121, 65, 0.32);
  filter: brightness(1.02);
}

.btn-secondary {
  background: var(--brand-soft);
  color: var(--brand-dark);
  box-shadow: none;
}

.btn-dark {
  background: var(--brand-dark);
  color: #fff;
}

.btn-danger {
  background: linear-gradient(135deg, #dc2626, #991b1b);
  color: #fff;
}

.btn-outline {
  background: transparent;
  color: var(--brand-dark);
  border: 1px solid var(--border);
  box-shadow: none;
}

.btn-full {
  width: 100%;
}

.btn-small {
  min-height: 40px;
  padding: 0 0.9rem;
  font-size: 0.88rem;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1rem;
}

.flash-messages,
.flashes {
  max-width: var(--max-width);
  margin: 0 auto 1rem;
  padding: 0;
  list-style: none;
}

.alert,
.flash,
.flash-message {
  margin: 0 0 0.75rem;
  padding: 0.9rem 1rem;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.9);
  border: 1px solid var(--border);
  color: var(--brand-dark);
  box-shadow: var(--shadow-soft);
}

.mobile-app-nav {
  display: none;
}

.pwa-mode .site-navbar {
  display: none;
}

.pwa-mode body {
  padding-bottom: calc(88px + env(safe-area-inset-bottom));
}

.pwa-mode .mobile-app-nav {
  position: fixed;
  left: 14px;
  right: 14px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 9999;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.25rem;
  padding: 0.45rem;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(111, 78, 55, 0.13);
  border-radius: 26px;
  box-shadow: 0 18px 44px rgba(55, 39, 26, 0.18);
  backdrop-filter: blur(20px) saturate(1.25);
  -webkit-backdrop-filter: blur(20px) saturate(1.25);
}

.pwa-mode .mobile-app-nav a {
  min-width: 0;
  padding: 0.55rem 0.3rem 0.45rem;
  border-radius: 20px;
  text-decoration: none;
  color: rgba(63, 45, 34, 0.66);
  font-weight: 850;
  text-align: center;
  line-height: 1.05;
  -webkit-tap-highlight-color: transparent;
  tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.pwa-mode .mobile-app-nav a:hover {
  color: var(--brand-dark);
  background: rgba(111, 78, 55, 0.07);
}

.pwa-mode .mobile-app-nav a:active {
  transform: scale(0.97);
  background: rgba(111, 78, 55, 0.1);
}

.pwa-mode .mobile-app-nav a:focus-visible {
  outline: 2px solid rgba(217, 121, 65, 0.55);
  outline-offset: 2px;
}

.pwa-mode .mobile-app-nav a.active {
  color: var(--brand-dark);
  background: linear-gradient(145deg, rgba(234, 220, 205, 0.95), rgba(255, 255, 255, 0.88));
  box-shadow: inset 0 0 0 1px rgba(111, 78, 55, 0.11), 0 8px 18px rgba(55, 39, 26, 0.08);
}

.pwa-mode .mobile-app-nav svg {
  width: 21px;
  height: 21px;
  display: block;
  margin: 0 auto 0.2rem;
  fill: currentColor;
}

.pwa-mode .mobile-app-nav span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.64rem;
  letter-spacing: -0.01em;
}

@media (max-width: 860px) {
  .site-navbar-inner {
    align-items: flex-start;
    flex-direction: column;
  }

  .site-nav-links {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 0.2rem;
  }

  .site-nav-links a {
    white-space: nowrap;
  }

  .app-page {
    padding: 0.75rem;
  }

  .app-hero {
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  }

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

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

  .button-row {
    flex-direction: column;
  }

  .button-row .btn,
  .button-row form {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .app-card {
    padding: 1rem;
  }

  .app-hero {
    padding: 1.35rem;
  }

  .card-header-row {
    gap: 0.75rem;
  }

  .card-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
  }
}

/* Subtle app install guide */
.get-app-footer {
  margin-top: 0.85rem;
  padding-bottom: 0.25rem;
}

.get-app-card {
  width: 100%;
  border: 1px solid rgba(111, 78, 55, 0.12);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.64);
  box-shadow: var(--shadow-soft);
  padding: 0.78rem 0.85rem;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.78rem;
  text-align: left;
  cursor: pointer;
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.get-app-card:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.82);
  border-color: rgba(217, 121, 65, 0.25);
}

.get-app-card:active {
  transform: scale(0.99);
}

.get-app-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 8px 18px rgba(55, 39, 26, 0.14);
  background: var(--surface-soft);
  flex: 0 0 auto;
}

.get-app-icon img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.get-app-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.get-app-label {
  color: var(--orange-dark);
  font-size: 0.67rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.get-app-copy strong {
  color: var(--brand-dark);
  font-size: 0.95rem;
  line-height: 1.18;
}

.get-app-copy small {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.25;
}

.get-app-arrow {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  color: var(--brand-dark);
  font-weight: 900;
}

body.modal-open {
  overflow: hidden;
  height: 100vh;
}

html:has(body.modal-open) {
  overflow: hidden;
}

.app-guide-modal[hidden] {
  display: none;
}

.app-guide-modal {
  position: fixed;
  inset: 0;
  z-index: 20000;
  display: grid;
  place-items: end center;
  padding: 1rem;
}

.app-guide-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(31, 37, 32, 0.42);
  backdrop-filter: blur(8px);
}

.app-guide-sheet {
  position: relative;
  z-index: 1;
  width: min(680px, 100%);
  max-height: min(84vh, 720px);
  overflow: auto;
  border-radius: 30px;
  background:
    radial-gradient(circle at top left, rgba(217, 121, 65, 0.12), transparent 18rem),
    rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(111, 78, 55, 0.14);
  box-shadow: 0 28px 80px rgba(31, 37, 32, 0.26);
  padding: 1.2rem;
}

.app-guide-close {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--brand-dark);
  font-size: 1.25rem;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.app-guide-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.9rem;
  align-items: center;
  padding: 0.35rem 2.2rem 1rem 0.1rem;
}

.app-guide-header img {
  width: 58px;
  height: 58px;
  border-radius: 17px;
  box-shadow: 0 10px 22px rgba(55, 39, 26, 0.16);
}

.app-guide-header h2 {
  margin: 0;
  color: var(--brand-dark);
  font-family: Merriweather, Georgia, serif;
  font-size: clamp(1.55rem, 5vw, 2.25rem);
  letter-spacing: -0.045em;
  line-height: 1.04;
}

.app-guide-header p:not(.section-label) {
  margin: 0.4rem 0 0;
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.92rem;
}

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

.app-guide-platform {
  padding: 1rem;
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  border: 1px solid var(--border);
}

.platform-pill {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 0.65rem;
  padding: 0.32rem 0.55rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  color: var(--orange-dark);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.app-guide-platform h3 {
  margin: 0 0 0.55rem;
  color: var(--brand-dark);
  font-size: 1.05rem;
}

.app-guide-platform ol {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.9rem;
}

.app-guide-platform li + li {
  margin-top: 0.35rem;
}

.app-guide-platform strong {
  color: var(--brand-dark);
}

@media (max-width: 640px) {
  .get-app-card {
    padding: 0.72rem;
    gap: 0.65rem;
  }

  .get-app-icon {
    width: 40px;
    height: 40px;
    border-radius: 13px;
  }

  .get-app-copy strong {
    font-size: 0.88rem;
  }

  .get-app-copy small {
    font-size: 0.73rem;
  }

  .get-app-arrow {
    width: 28px;
    height: 28px;
  }

  .app-guide-modal {
    padding: 0.75rem;
    align-items: end;
  }

  .app-guide-sheet {
    border-radius: 28px 28px 22px 22px;
    padding: 1rem;
  }

  .app-guide-header {
    grid-template-columns: 1fr;
    gap: 0.7rem;
    padding-right: 2.2rem;
  }

  .app-guide-header img {
    width: 52px;
    height: 52px;
  }

  .app-guide-grid {
    grid-template-columns: 1fr;
  }
}
