:root {
  --ink: #17211d;
  --muted: #66756f;
  --line: #d8e0dc;
  --paper: #fbfcfa;
  --panel: #ffffff;
  --accent: #126c54;
  --accent-dark: #0a4b39;
  --warm: #f0b35b;
  --danger: #b33434;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
}

a {
  color: inherit;
}

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

button {
  border: 0;
  border-radius: 7px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  min-height: 42px;
  padding: 0 16px;
  font-weight: 700;
}

button:hover {
  background: var(--accent-dark);
}

.topbar {
  align-items: center;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  display: flex;
  height: 64px;
  justify-content: space-between;
  padding: 0 clamp(16px, 4vw, 48px);
  position: sticky;
  top: 0;
  z-index: 500;
}

.brand {
  align-items: center;
  display: flex;
  gap: 10px;
  font-weight: 800;
  text-decoration: none;
}

.brand-mark {
  align-items: center;
  background: var(--ink);
  border-radius: 7px;
  color: white;
  display: inline-flex;
  height: 34px;
  justify-content: center;
  width: 34px;
}

nav a {
  color: var(--accent-dark);
  font-weight: 700;
  text-decoration: none;
}

.shell {
  display: grid;
  gap: 18px;
  margin: 0 auto;
  max-width: 1440px;
  padding: 24px clamp(14px, 3vw, 36px) 36px;
}

.control-band {
  align-items: end;
  background: #e8f2ed;
  border: 1px solid #c9dbd4;
  border-radius: 8px;
  display: flex;
  gap: 24px;
  justify-content: space-between;
  padding: clamp(18px, 3vw, 32px);
}

.eyebrow {
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 8px;
  text-transform: uppercase;
}

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

h1 {
  font-size: clamp(1.8rem, 3vw, 3rem);
  line-height: 1.05;
  margin-bottom: 0;
  max-width: 860px;
}

.home-title {
  font-size: clamp(1.32rem, 2.1vw, 2.1rem);
  line-height: 1.2;
}

h2 {
  font-size: 1.1rem;
  margin-bottom: 0;
}

.title-block {
  align-items: center;
  display: grid;
  gap: 0;
  grid-template-columns: 1fr;
}

.title-image {
  display: block;
  height: auto;
  max-width: min(240px, 34vw);
  object-fit: contain;
}

.title-image-wide {
  max-width: min(620px, 58vw);
}

.week-picker,
label {
  display: grid;
  gap: 7px;
}

.week-picker {
  min-width: 280px;
}

.week-picker > span:first-child {
  justify-self: center;
  text-align: center;
  width: 100%;
}

.week-control {
  display: grid;
  gap: 9px;
  grid-template-columns: 42px minmax(170px, 1fr) 42px;
}

.week-step {
  align-items: center;
  display: inline-flex;
  font-size: 1.45rem;
  height: 42px;
  justify-content: center;
  min-height: 42px;
  padding: 0;
  touch-action: manipulation;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  width: 42px;
}

.week-step.is-limit {
  background: #89aaa0;
}

.week-display {
  align-items: center;
  background: white;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  display: inline-flex;
  font-weight: 900;
  justify-content: center;
  min-height: 42px;
  padding: 0 10px;
}

.week-display:hover {
  background: white;
  color: var(--ink);
}

.week-display #weekRangeText {
  white-space: nowrap;
}

.week-error {
  color: var(--danger);
  display: block;
  font-size: 0.86rem;
  font-weight: 800;
  min-height: 20px;
}

label span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

input,
select,
textarea {
  background: white;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  min-height: 42px;
  padding: 9px 11px;
  width: 100%;
}

textarea {
  resize: vertical;
}

.notice {
  background: #fff4da;
  border: 1px solid #e5c274;
  border-radius: 8px;
  padding: 14px 16px;
}

.hidden {
  display: none;
}

.config-panel details {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
}

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

.config-grid {
  align-items: end;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) auto;
  margin-top: 14px;
}

.content-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 420px);
  min-height: 680px;
}

.map-wrap,
.list-panel,
.admin-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.map-wrap {
  min-height: 680px;
  overflow: hidden;
}

#map {
  height: 100%;
  min-height: 680px;
  width: 100%;
}

#map .leaflet-tile-pane {
  filter: saturate(1.2) contrast(1.04);
}

.house-map-marker {
  background: transparent;
  border: 0;
}

.house-map-marker span {
  background: var(--accent);
  border: 3px solid white;
  border-radius: 50% 50% 50% 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.28);
  display: block;
  height: 28px;
  transform: rotate(-45deg);
  width: 28px;
}

.house-map-marker span::after {
  background: white;
  border-radius: 50%;
  content: "";
  display: block;
  height: 8px;
  left: 7px;
  position: relative;
  top: 7px;
  width: 8px;
}

.list-panel {
  display: flex;
  flex-direction: column;
  max-height: 680px;
  min-height: 0;
  overflow: hidden;
}

.list-head {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: 16px;
}

#resultCount {
  align-items: center;
  background: var(--warm);
  border-radius: 999px;
  color: #2d220d;
  display: inline-flex;
  font-weight: 900;
  height: 28px;
  justify-content: center;
  min-width: 28px;
  padding: 0 9px;
}

.house-list {
  display: grid;
  gap: 12px;
  overflow: auto;
  padding: 14px;
}

.house-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 14px;
  padding: 14px;
}

.house-card-head,
.auction-title-row,
.recent-row {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: auto 1fr;
}

.house-image {
  aspect-ratio: 1;
  border-radius: 8px;
  height: 64px;
  object-fit: cover;
  width: 64px;
}

.auction-thumb,
.recent-thumb {
  aspect-ratio: 1;
  border-radius: 7px;
  height: 42px;
  object-fit: cover;
  width: 42px;
}

.popup-image,
.auction-image {
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  display: block;
  margin-bottom: 10px;
  object-fit: cover;
  width: 100%;
}

.auction-image {
  margin-bottom: 8px;
}

.house-card p,
.popup p {
  color: var(--muted);
  margin-bottom: 0;
}

.house-card h3,
.popup h3 {
  margin-bottom: 4px;
}

.house-card h4,
.popup h4 {
  font-size: 1.05rem;
  line-height: 1.2;
  margin-bottom: 0;
}

.entity-link {
  color: var(--accent-dark);
  text-decoration: none;
}

.entity-link:hover {
  text-decoration: underline;
}

.viewing-row {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: auto 1fr;
  padding: 0;
}

.viewing-row + .viewing-row {
  margin-top: 1px;
}

.viewing-time {
  align-items: baseline;
  color: var(--muted);
  display: grid;
  font-size: 0.9rem;
  font-weight: 700;
  column-gap: 2px;
  grid-template-columns: 80px 44px 8px 44px;
  white-space: nowrap;
}

.viewing-date {
  display: grid;
  gap: 5px;
  grid-template-columns: 24px 17px 29px;
}

.viewing-day {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.viewing-time-long {
  display: block;
  white-space: normal;
}

.viewing-start,
.viewing-end {
  font-variant-numeric: tabular-nums;
}

.viewing-start,
.viewing-separator,
.viewing-end {
  color: var(--ink);
}

.calendar-button {
  align-items: center;
  display: inline-flex;
  height: 28px;
  justify-content: center;
  min-height: 28px;
  padding: 0;
  width: 28px;
}

.calendar-placeholder {
  display: block;
  height: 28px;
  width: 28px;
}

.calendar-button svg {
  fill: none;
  height: 15px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 15px;
}

.disclaimer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.6;
  padding-top: 16px;
}

.disclaimer p {
  margin-bottom: 0;
}

.empty {
  color: var(--muted);
  margin: 0;
  padding: 4px;
}

.popup {
  min-width: 260px;
}

.popup-auction {
  border-top: 1px solid var(--line);
  margin-top: 12px;
  padding-top: 12px;
}

.admin-shell {
  max-width: 1180px;
}

.admin-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.admin-card {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.split {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr 1fr;
}

.recent-card {
  margin-bottom: 32px;
}

.recent-list {
  display: grid;
  gap: 10px;
}

.recent-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.recent-row > div {
  display: grid;
  gap: 4px;
}

.recent-item span {
  display: block;
  color: var(--muted);
}

.status-line {
  color: var(--accent-dark);
  min-height: 20px;
}

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

@media (max-width: 980px) {
  .control-band,
  .content-grid,
  .admin-grid,
  .config-grid {
    grid-template-columns: 1fr;
  }

  .control-band {
    align-items: stretch;
    display: grid;
  }

  .title-image {
    max-width: min(220px, 45vw);
  }

  .title-image-wide {
    max-width: min(560px, 84vw);
  }

  .content-grid {
    min-height: 0;
  }

  .map-wrap,
  #map {
    min-height: 460px;
  }

  .list-panel {
    max-height: none;
  }
}

@media (max-width: 560px) {
  .shell {
    gap: 10px;
    padding-top: 12px;
  }

  .control-band {
    gap: 10px;
    padding: 12px;
  }

  .title-block {
    justify-items: center;
  }

  .topbar {
    height: auto;
    min-height: 60px;
  }

  .brand span:last-child {
    display: none;
  }

  .split,
  .house-card-head,
  .auction-title-row,
  .recent-row {
    grid-template-columns: 1fr;
  }

  .viewing-row .calendar-button {
    justify-self: start;
    width: 28px;
  }

  .week-picker {
    justify-self: center;
    min-width: 0;
    width: min(100%, 330px);
  }

  .title-block {
    grid-template-columns: 1fr;
  }

  .title-image {
    max-width: min(230px, 72vw);
  }

  .title-image-wide {
    max-width: min(300px, 64vw);
  }

  .week-control {
    grid-template-columns: 42px minmax(0, 1fr) 42px;
  }

  .week-error {
    min-height: 0;
  }

  .week-display {
    padding: 0 8px;
  }
}
