:root {
  --app-ink: #18241f;
  --app-muted: #718078;
  --app-forest: #183027;
  --app-paper: #fbfaf7;
  --app-soft: #eef1ec;
  --app-line: #dde0da;
  --app-serif: "Instrument Serif", Georgia, serif;
  --app-sans: "DM Sans", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--app-paper); }
body { background: var(--app-paper); color: var(--app-ink); font-family: var(--app-sans); margin: 0; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input { color: inherit; font: inherit; }
button { cursor: pointer; }
svg { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; }

.app-page-header {
  align-items: center;
  background: rgba(251,250,247,.96);
  border-bottom: 1px solid var(--app-line);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  height: 58px;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 80;
}

.app-page-header .brand { align-items: center; display: flex; font-size: 16px; font-weight: 600; gap: 8px; letter-spacing: -.04em; width: fit-content; }
.app-page-header .brand-mark { align-items: center; background: var(--app-forest); border-radius: 50%; color: #f6f2e9; display: flex; height: 27px; justify-content: center; width: 27px; }
.app-page-header .brand-mark svg { height: 17px; width: 17px; }
.app-page-title { font-size: 12px; font-weight: 600; letter-spacing: .02em; }
.app-page-header-actions { align-items: center; display: flex; gap: 10px; justify-content: flex-end; }
.header-round-link { align-items: center; border: 1px solid var(--app-line); border-radius: 50%; display: flex; height: 34px; justify-content: center; width: 34px; }
.header-round-link svg { height: 16px; width: 16px; }
.header-avatar { align-items: center; background: #dfcfbb; border-radius: 50%; display: flex; font-size: 10px; font-weight: 600; height: 34px; justify-content: center; width: 34px; }

.app-page-main { margin: 0 auto; max-width: 1180px; min-height: calc(100vh - 58px); padding: 44px 28px 90px; }
.page-eyebrow { color: #718078; display: block; font-size: 10px; font-weight: 600; letter-spacing: .13em; text-transform: uppercase; }
.page-heading { align-items: flex-end; display: flex; justify-content: space-between; }
.page-heading h1 { font-family: var(--app-serif); font-size: clamp(44px, 5vw, 66px); font-weight: 400; letter-spacing: -.035em; line-height: .95; margin: 10px 0 0; }
.page-heading p { color: var(--app-muted); font-size: 13px; line-height: 1.6; margin: 0; max-width: 380px; text-align: right; }

.favorites-grid { display: grid; gap: 22px; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 36px; }
.favorite-card { min-width: 0; position: relative; }
.favorite-card-image { display: block; height: 255px; overflow: hidden; position: relative; }
.favorite-card-image::after { background: linear-gradient(180deg, transparent 55%, rgba(11,25,19,.36)); content: ""; inset: 0; position: absolute; }
.favorite-card-image img { height: 100%; object-fit: cover; transition: transform 400ms ease; width: 100%; }
.favorite-card:hover img { transform: scale(1.025); }
.favorite-match { background: rgba(255,255,255,.92); font-size: 9px; left: 10px; padding: 6px 8px; position: absolute; top: 10px; z-index: 2; }
.favorite-remove { align-items: center; background: rgba(255,255,255,.94); border: 0; border-radius: 50%; color: #875f53; display: flex; height: 34px; justify-content: center; position: absolute; right: 10px; top: 10px; width: 34px; z-index: 3; }
.favorite-remove svg { fill: currentColor; height: 16px; width: 16px; }
.favorite-card-copy { padding-top: 12px; }
.favorite-card-title { align-items: flex-start; display: flex; justify-content: space-between; }
.favorite-card h2 { font-family: var(--app-serif); font-size: 24px; font-weight: 400; line-height: 1; margin: 0; }
.favorite-card-title span { font-size: 10px; }
.favorite-card-copy > p { color: var(--app-muted); font-size: 10px; margin: 6px 0 0; }
.favorite-card-footer { align-items: center; border-bottom: 1px solid var(--app-line); display: flex; justify-content: space-between; padding: 12px 0 14px; }
.favorite-card-footer span { color: var(--app-muted); font-size: 9px; }
.favorite-card-footer strong { font-size: 13px; }
.empty-state { align-items: center; border: 1px solid var(--app-line); display: flex; flex-direction: column; margin-top: 35px; min-height: 370px; padding: 50px 24px; text-align: center; }
.empty-state-icon { align-items: center; background: var(--app-soft); border-radius: 50%; color: #50655b; display: flex; height: 58px; justify-content: center; width: 58px; }
.empty-state-icon svg { height: 25px; width: 25px; }
.empty-state h2 { font-family: var(--app-serif); font-size: 34px; font-weight: 400; margin: 18px 0 8px; }
.empty-state p { color: var(--app-muted); font-size: 12px; line-height: 1.7; margin: 0; max-width: 380px; }
.primary-link { background: var(--app-forest); color: white; display: inline-flex; font-size: 12px; font-weight: 600; margin-top: 22px; padding: 13px 19px; }

.map-page-main { height: calc(100vh - 58px); max-width: none; padding: 0; }
.map-page-shell { height: 100%; overflow: hidden; position: relative; }
.map-page-toolbar { background: rgba(251,250,247,.94); box-shadow: 0 12px 32px rgba(20,38,31,.12); left: 24px; padding: 15px 17px; position: absolute; top: 22px; width: min(350px, calc(100% - 48px)); z-index: 5; }
.map-page-toolbar span { color: var(--app-muted); font-size: 9px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.map-page-toolbar h1 { font-family: var(--app-serif); font-size: 30px; font-weight: 400; margin: 4px 0 11px; }
.map-search-link { align-items: center; border: 1px solid var(--app-line); display: flex; font-size: 11px; gap: 9px; padding: 10px 11px; }
.map-search-link svg { height: 14px; width: 14px; }
.map-page-shell .map-note { bottom: 22px; }

.booking-layout { display: grid; gap: 28px; grid-template-columns: minmax(0, 1.5fr) minmax(280px, .75fr); margin-top: 35px; }
.booking-card { background: #f0f2ed; min-height: 350px; padding: 34px; }
.booking-card .empty-state { border: 0; margin: 0; min-height: 282px; padding: 25px; }
.booking-help { border: 1px solid var(--app-line); padding: 28px; }
.booking-help h2 { font-family: var(--app-serif); font-size: 28px; font-weight: 400; margin: 0; }
.booking-help > p { color: var(--app-muted); font-size: 11px; line-height: 1.65; margin: 9px 0 22px; }
.booking-step { align-items: flex-start; border-top: 1px solid var(--app-line); display: grid; gap: 11px; grid-template-columns: 28px 1fr; padding: 15px 0; }
.booking-step > span { align-items: center; background: var(--app-forest); border-radius: 50%; color: white; display: flex; font-size: 9px; height: 24px; justify-content: center; width: 24px; }
.booking-step strong { display: block; font-size: 11px; }
.booking-step small { color: var(--app-muted); display: block; font-size: 9px; line-height: 1.5; margin-top: 4px; }

.profile-hero { align-items: center; background: #edf0eb; display: grid; gap: 22px; grid-template-columns: auto 1fr auto; margin-top: 30px; padding: 28px 30px; }
.profile-avatar-large { align-items: center; background: var(--app-forest); border-radius: 50%; color: #f8f2e8; display: flex; font-family: var(--app-serif); font-size: 28px; height: 72px; justify-content: center; width: 72px; }
.profile-identity h2 { font-family: var(--app-serif); font-size: 34px; font-weight: 400; line-height: 1; margin: 0; }
.profile-identity p { color: var(--app-muted); font-size: 11px; margin: 7px 0 0; }
.secondary-button { align-items: center; background: transparent; border: 1px solid #bac3bd; display: inline-flex; font-size: 11px; gap: 8px; padding: 11px 14px; }
.secondary-button svg { height: 14px; width: 14px; }
.profile-stats { border-bottom: 1px solid var(--app-line); display: grid; grid-template-columns: repeat(3,1fr); }
.profile-stat { padding: 21px 4px; }
.profile-stat + .profile-stat { border-left: 1px solid var(--app-line); padding-left: 25px; }
.profile-stat strong { display: block; font-family: var(--app-serif); font-size: 27px; font-weight: 400; }
.profile-stat span { color: var(--app-muted); font-size: 10px; }
.profile-dashboard { display: grid; gap: 28px; grid-template-columns: minmax(0,1.25fr) minmax(300px,.75fr); margin-top: 32px; }
.dashboard-section { border: 1px solid var(--app-line); padding: 26px; }
.dashboard-section + .dashboard-section { margin-top: 20px; }
.dashboard-section-header { align-items: center; display: flex; justify-content: space-between; margin-bottom: 18px; }
.dashboard-section-header h2 { font-family: var(--app-serif); font-size: 28px; font-weight: 400; margin: 0; }
.text-button { background: transparent; border: 0; color: #52675d; font-size: 10px; text-decoration: underline; text-underline-offset: 4px; }
.profile-detail-row { align-items: center; border-top: 1px solid var(--app-line); display: grid; gap: 14px; grid-template-columns: 32px 1fr; padding: 15px 0; }
.profile-detail-row > svg { color: #718078; height: 17px; width: 17px; }
.profile-detail-row span { color: var(--app-muted); display: block; font-size: 9px; margin-bottom: 3px; }
.profile-detail-row strong { display: block; font-size: 11px; font-weight: 500; }
.preference-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.preference-chip { background: white; border: 1px solid #cfd5cf; border-radius: 30px; font-size: 10px; padding: 9px 12px; }
.preference-chip.is-selected { background: var(--app-forest); border-color: var(--app-forest); color: white; }
.settings-list { display: grid; }
.setting-link, .setting-toggle { align-items: center; background: transparent; border: 0; border-top: 1px solid var(--app-line); display: grid; gap: 11px; grid-template-columns: 28px 1fr auto; min-height: 58px; padding: 10px 0; text-align: left; width: 100%; }
.setting-link > svg, .setting-toggle > svg { color: #718078; height: 17px; width: 17px; }
.setting-link strong, .setting-toggle strong { display: block; font-size: 11px; }
.setting-link small, .setting-toggle small { color: var(--app-muted); display: block; font-size: 9px; margin-top: 3px; }
.setting-link > svg:last-child { height: 14px; width: 14px; }
.switch { background: #cbd1cc; border-radius: 30px; height: 22px; padding: 3px; transition: background 150ms ease; width: 38px; }
.switch::after { background: white; border-radius: 50%; box-shadow: 0 1px 4px rgba(0,0,0,.16); content: ""; display: block; height: 16px; transition: transform 150ms ease; width: 16px; }
.setting-toggle[aria-pressed="true"] .switch { background: #39765d; }
.setting-toggle[aria-pressed="true"] .switch::after { transform: translateX(16px); }
.admin-link { background: var(--app-forest); color: white; display: grid; gap: 11px; grid-template-columns: 34px 1fr 15px; margin-top: 20px; padding: 17px; }
.admin-link > span:first-child { align-items: center; background: rgba(255,255,255,.13); border-radius: 50%; display: flex; height: 34px; justify-content: center; width: 34px; }
.admin-link svg { height: 16px; width: 16px; }
.admin-link strong { display: block; font-size: 11px; }
.admin-link small { color: rgba(255,255,255,.7); display: block; font-size: 9px; margin-top: 3px; }

.profile-editor { background: rgba(18,31,26,.38); border: 0; height: 100%; inset: 0; max-height: none; max-width: none; padding: 0; position: fixed; width: 100%; z-index: 220; }
.profile-editor::backdrop { background: transparent; }
.profile-editor-panel { background: var(--app-paper); box-shadow: -24px 0 65px rgba(13,27,21,.2); height: 100%; margin-left: auto; max-width: 430px; padding: 30px; width: 100%; }
.profile-editor-header { align-items: center; display: flex; justify-content: space-between; }
.profile-editor h2 { font-family: var(--app-serif); font-size: 34px; font-weight: 400; margin: 0; }
.profile-editor-close { align-items: center; background: transparent; border: 1px solid var(--app-line); border-radius: 50%; display: flex; height: 36px; justify-content: center; width: 36px; }
.profile-editor-close svg { height: 16px; width: 16px; }
.profile-form { display: grid; gap: 15px; margin-top: 28px; }
.profile-form label { color: var(--app-muted); display: grid; font-size: 9px; font-weight: 600; gap: 7px; letter-spacing: .06em; text-transform: uppercase; }
.profile-form input { background: white; border: 1px solid var(--app-line); font-size: 12px; outline: none; padding: 13px; text-transform: none; }
.profile-form input:focus { border-color: #73867c; }
.profile-form-actions { display: flex; gap: 9px; justify-content: flex-end; margin-top: 10px; }
.profile-form-actions button { border: 1px solid var(--app-line); font-size: 11px; padding: 11px 15px; }
.profile-form-actions button[type="submit"] { background: var(--app-forest); border-color: var(--app-forest); color: white; }
.app-toast { background: var(--app-forest); bottom: 28px; color: white; font-size: 11px; left: 50%; opacity: 0; padding: 11px 15px; pointer-events: none; position: fixed; transform: translate(-50%, 10px); transition: opacity 160ms ease, transform 160ms ease; z-index: 260; }
.app-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 820px) {
  .favorites-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .booking-layout, .profile-dashboard { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  body { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
  .app-page-header { grid-template-columns: 1fr auto; height: 44px; padding: 0 12px; }
  .app-page-header .brand { font-size: 14px; }
  .app-page-header .brand-mark { height: 22px; width: 22px; }
  .app-page-header .brand-mark svg { height: 14px; width: 14px; }
  .app-page-title { display: none; }
  .header-round-link { height: 30px; width: 30px; }
  .header-avatar { height: 30px; width: 30px; }
  .app-page-main { min-height: calc(100dvh - 44px - 66px); padding: 26px 14px 40px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .page-heading h1 { font-size: 44px; }
  .page-heading p { font-size: 11px; margin-top: 10px; max-width: 310px; text-align: left; }
  .favorites-grid { gap: 20px 8px; grid-template-columns: repeat(2, minmax(0,1fr)); margin-top: 25px; }
  .favorite-card-image { aspect-ratio: 1 / 1.08; height: auto; }
  .favorite-match { font-size: 8px; left: 6px; padding: 5px 6px; top: 6px; }
  .favorite-remove { height: 29px; right: 6px; top: 6px; width: 29px; }
  .favorite-card h2 { font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .favorite-card-title span { font-size: 9px; }
  .favorite-card-copy > p { font-size: 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .favorite-card-footer { padding-top: 8px; }
  .favorite-card-footer span { display: none; }
  .favorite-card-footer strong { font-size: 12px; }
  .empty-state { margin-top: 25px; min-height: 420px; }
  .map-page-main { height: calc(100dvh - 44px - 66px - env(safe-area-inset-bottom)); padding: 0; }
  .map-page-toolbar { left: 10px; padding: 12px 13px; top: 10px; width: calc(100% - 20px); }
  .map-page-toolbar h1 { font-size: 25px; margin-bottom: 9px; }
  .map-page-shell .map-note { bottom: 12px; font-size: 8px; max-width: calc(100% - 20px); white-space: normal; }
  .booking-layout { gap: 16px; margin-top: 24px; }
  .booking-card { min-height: 390px; padding: 12px; }
  .booking-help { padding: 22px 18px; }
  .profile-hero { gap: 14px; grid-template-columns: auto 1fr; margin-top: 24px; padding: 20px 17px; }
  .profile-avatar-large { font-size: 22px; height: 58px; width: 58px; }
  .profile-identity h2 { font-size: 28px; }
  .profile-hero .secondary-button { grid-column: 1 / -1; justify-content: center; width: 100%; }
  .profile-stat { padding: 16px 4px; }
  .profile-stat + .profile-stat { padding-left: 14px; }
  .profile-stat strong { font-size: 23px; }
  .profile-stat span { font-size: 8px; }
  .profile-dashboard { gap: 18px; margin-top: 23px; }
  .dashboard-section { padding: 20px 17px; }
  .dashboard-section + .dashboard-section { margin-top: 14px; }
  .profile-editor { padding-top: 64px; }
  .profile-editor-panel { border-radius: 22px 22px 0 0; height: calc(100% - 64px); padding: 24px 18px; }
  .app-toast { bottom: calc(78px + env(safe-area-inset-bottom)); }
}

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