*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  background: var(--bg, #f7f2ea);
  color: var(--text, #182231);
}

img,
svg,
video,
canvas,
iframe {
  max-width: 100%;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: .5rem;
  z-index: 2000;
  background: #fff;
  color: #111827;
  padding: .6rem .8rem;
  border-radius: .5rem;
}

.skip-link:focus {
  left: .5rem;
}

.hem-site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--card, #fff) 96%, transparent);
  border-bottom: 1px solid var(--line, #e7ded3);
  box-shadow: 0 6px 24px rgba(15, 23, 42, .06);
}

.hem-beta-bar {
  display: flex;
  justify-content: center;
  gap: .75rem;
  padding: .45rem 1rem;
  font-size: .9rem;
  color: var(--muted, #475467);
  background: var(--sand, #f1e7da);
}

.hem-beta-bar a {
  font-weight: 800;
}

.hem-header-row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto minmax(150px, 1fr);
  align-items: center;
  gap: 1rem;
  padding: .85rem clamp(1rem, 4vw, 2.25rem);
}

.hem-mode-shortcuts,
.hem-header-actions {
  display: flex;
  align-items: center;
  gap: .55rem;
  min-width: 0;
}

.hem-header-actions {
  justify-content: flex-end;
}

.hem-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .65rem;
  font-weight: 950;
  text-decoration: none;
  white-space: nowrap;
}

.hem-brand-mark {
  display: grid;
  place-items: center;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: .65rem;
  background: var(--brand, #1b3a4b);
  color: #fff;
}

.hem-mode-pill,
.hem-theme-toggle,
.hem-menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.45rem;
  padding: .6rem .85rem;
  border: 1px solid var(--line, #e7ded3);
  border-radius: 999px;
  background: var(--card, #fff);
  color: var(--text, #182231);
  font-weight: 850;
  text-decoration: none;
  cursor: pointer;
}

.hem-mode-buy {
  color: #9a3412;
}

.hem-desktop-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: .25rem .75rem;
  padding: .55rem 1rem .85rem;
}

.hem-desktop-nav a,
.hem-desktop-nav button {
  border: 0;
  border-radius: .7rem;
  background: transparent;
  color: var(--text, #182231);
  font-weight: 850;
  text-decoration: none;
  padding: .55rem .7rem;
}

.hem-desktop-nav a:hover,
.hem-desktop-nav button:hover,
.hem-mobile-menu a:hover,
.hem-mobile-menu button:hover {
  background: var(--sand, #f1e7da);
}

.hem-logout-form,
.hem-mobile-logout-form {
  margin: 0;
}

.hem-mobile-menu {
  position: absolute;
  top: calc(100% + .4rem);
  right: clamp(.75rem, 3vw, 1.5rem);
  width: min(420px, calc(100vw - 1.5rem));
  display: grid;
  gap: .25rem;
  padding: .75rem;
  border: 1px solid var(--line, #e7ded3);
  border-radius: .9rem;
  background: var(--card, #fff);
  box-shadow: 0 20px 50px rgba(15, 23, 42, .18);
}

.hem-mobile-menu[hidden] {
  display: none !important;
}

.hem-mobile-menu a,
.hem-mobile-menu button {
  width: 100%;
  display: block;
  border: 0;
  border-radius: .65rem;
  background: transparent;
  color: var(--text, #182231);
  font-weight: 850;
  text-align: left;
  text-decoration: none;
  padding: .75rem .85rem;
}

.hem-page-shell {
  max-width: 1220px;
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 2.5rem);
  min-width: 0;
}

.hem-site-footer {
  max-width: 1220px;
  margin: 1rem auto 0;
  padding: 1.5rem clamp(1rem, 3vw, 2rem);
  border-top: 1px solid var(--line, #e7ded3);
  color: var(--muted, #475467);
}

.hem-site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem 1rem;
}

.hem-field {
  display: grid;
  gap: .35rem;
}

.hem-required-star {
  color: #dc2626;
  font-weight: 950;
}

.hem-invalid,
input.input-validation-error,
select.input-validation-error,
textarea.input-validation-error,
[aria-invalid="true"] {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, .15) !important;
}

.text-danger,
.field-validation-error,
.validation-summary-errors,
.hem-validation-summary:not([hidden]) {
  color: #b91c1c;
  font-weight: 750;
}

.hem-validation-summary:not([hidden]),
.hem-server-validation.validation-summary-errors {
  border: 1px solid #fecaca;
  border-radius: .8rem;
  background: #fef2f2;
  padding: .85rem 1rem;
}

form:not([data-hem-validate="create-listing"]):not([data-hem-validate="profile"]) .hem-validation-summary {
  display: none !important;
}

.home-hero {
  margin: 0 0 2rem;
}

.home-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr);
  gap: 1.25rem;
  align-items: stretch;
  border: 1px solid var(--line, #e7ded3);
  border-radius: 1.25rem;
  background:
    linear-gradient(135deg, rgba(255,255,255,.92), rgba(241,231,218,.94)),
    url("https://images.unsplash.com/photo-1560518883-ce09059eeffa?auto=format&fit=crop&w=1800&q=80") center/cover;
  padding: clamp(1.25rem, 4vw, 2.5rem);
  box-shadow: var(--shadow, 0 18px 50px rgba(27,58,75,.10));
}

.home-copy {
  max-width: 680px;
}

.home-copy h1 {
  max-width: 720px;
  margin: .25rem 0 1rem;
  font-size: clamp(2.4rem, 6vw, 5rem);
  line-height: .96;
}

.home-actions,
.filter-actions,
.compare-empty-actions {
  display: flex;
  gap: .7rem;
  flex-wrap: wrap;
}

.home-search-panel {
  display: grid;
  gap: 1rem;
  align-self: start;
  border: 1px solid var(--line, #e7ded3);
  border-radius: 1rem;
  background: rgba(255,255,255,.96);
  padding: 1rem;
}

.home-search-panel h2 {
  margin: 0;
}

.home-search-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .8rem;
}

.home-search-grid .wide {
  grid-column: 1 / -1;
}

.home-paths {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.home-paths article,
.form-step,
.hem-create-quality-check,
.flow-note {
  border: 1px solid var(--line, #e7ded3);
  border-radius: 1rem;
  background: var(--card, #fff);
  padding: 1rem;
}

.flow-note {
  background: var(--sand, #f1e7da);
  color: var(--text, #182231);
  margin-top: .75rem;
}

.filter-section {
  display: grid;
  gap: .45rem;
}

.filter-label,
.filter-section label,
.home-search-grid label,
.hem-profile-form label,
.editor-form label {
  font-weight: 850;
}

.filter-section select,
.filter-grid input,
.home-search-grid input,
.home-search-grid select,
.hem-profile-form input,
.editor-form input,
.editor-form select,
.editor-form textarea {
  width: 100%;
}

.filter-actions {
  align-items: end;
}

.purpose-switch.compact-switch {
  justify-content: flex-start;
}

.purpose-tab.active {
  color: #fff;
}

.purpose-tab.active[data-purpose-button="Rent"] {
  background: var(--rent, #0f766e);
}

.purpose-tab.active[data-purpose-button="Buy"] {
  background: var(--buy, #9a3412);
}

.hem-create-quality-check {
  margin-bottom: 1rem;
}

.hem-required-note {
  color: var(--muted, #475467);
}

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

.hem-profile-card {
  border: 1px solid var(--line, #e7ded3);
  border-radius: 1rem;
  background: var(--card, #fff);
  padding: 1rem;
}

.hem-profile-account {
  grid-column: 1 / -1;
}

.hem-profile-form {
  display: grid;
  gap: .8rem;
}

.hem-profile-form .form-group {
  display: grid;
  gap: .35rem;
}

.alert,
.notice {
  border-radius: .85rem;
  padding: .8rem 1rem;
  font-weight: 800;
}

.alert-success,
.notice.success {
  background: #ecfdf3;
  color: #027a48;
}

.alert-danger {
  background: #fef2f2;
  color: #b91c1c;
}

.compare-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.hem-status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: .25rem .6rem;
  font-size: .82rem;
  font-weight: 900;
  background: var(--sand, #f1e7da);
}

.hem-status-pending {
  background: #fef3c7;
  color: #92400e;
}

.hem-status-published {
  background: #dcfce7;
  color: #166534;
}

.hem-status-needschanges,
.hem-status-rejected {
  background: #fee2e2;
  color: #991b1b;
}

.hem-admin-list {
  display: grid;
  gap: 1rem;
}

.hem-admin-listing {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 1rem;
  border: 1px solid var(--line, #e7ded3);
  border-radius: 1rem;
  background: var(--card, #fff);
  padding: 1rem;
}

.hem-admin-actions {
  display: grid;
  gap: .7rem;
}

.hem-admin-actions textarea,
.hem-admin-actions select {
  width: 100%;
}

.compare-picker {
  display: grid;
  gap: .5rem;
  margin: 1rem 0;
}

.compare-empty-actions {
  display: flex;
  gap: .7rem;
  flex-wrap: wrap;
}

@media (min-width: 1181px) {
  .hem-menu-toggle,
  .hem-mobile-menu {
    display: none !important;
  }
}

@media (max-width: 1180px) {
  .hem-desktop-nav {
    display: none !important;
  }
}

@media (max-width: 760px) {
  .hem-beta-bar {
    display: none;
  }

  .hem-header-row {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "brand actions"
      "modes modes";
    gap: .65rem;
  }

  .hem-brand {
    grid-area: brand;
    justify-content: flex-start;
    min-width: 0;
  }

  .hem-brand-text {
    overflow-wrap: anywhere;
    white-space: normal;
  }

  .hem-header-actions {
    grid-area: actions;
  }

  .hem-mode-shortcuts {
    grid-area: modes;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .hem-theme-toggle {
    display: none;
  }

  .hem-page-shell {
    padding: 1rem;
  }

  .hem-admin-listing,
  .owner-row,
  .hem-profile-grid,
  .home-hero-grid,
  .home-search-grid,
  .home-paths {
    grid-template-columns: 1fr !important;
  }

  .home-search-grid .wide,
  .hem-profile-account {
    grid-column: auto;
  }

  .home-copy h1 {
    font-size: 2.45rem;
  }

  .home-actions .button,
  .filter-actions .button {
    width: 100%;
  }
}
