:root {
  --bg: #f6f3ee;
  --card: #ffffff;
  --text: #1d2b2a;
  --muted: #5a6b6a;

  --green-900: #2f5b4f;
  --green-800: #356658;

  --danger: #b42318;
  --danger-bg: rgba(180, 35, 24, 0.08);

  --line: rgba(0, 0, 0, 0.06);

  --radius-lg: 3px;
  --shadow-soft: 0 8px 18px rgba(0, 0, 0, 0.05);
  --shadow: 0 10px 24px rgba(0, 0, 0, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: radial-gradient(circle at 15% 0%, rgba(47, 91, 79, 0.14), transparent 44%),
              radial-gradient(circle at 90% 15%, rgba(47, 91, 79, 0.1), transparent 42%),
              var(--bg);
  color: var(--text);
  font-family: ui-serif, Georgia, "Times New Roman", Times, serif;
  line-height: 1.4;
}

.container {
  width: min(980px, calc(100% - 40px));
  margin: 0 auto;
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 14px 0 12px;
  background: rgba(246, 243, 238, 0.7);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.app-header .container {
  display: grid;
  gap: 10px;
  justify-items: center;
}

.brand-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 3px;
  background: var(--green-900);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-soft);
}

.brand-icon svg { width: 20px; height: 20px; }

.brand-text { display: grid; gap: 2px; }

.brand-title {
  font-weight: 800;
  letter-spacing: -0.2px;
  font-family: ui-serif, Georgia, "Times New Roman", Times, serif;
  font-size: 20px;
}

h1 { font-family: ui-serif, Georgia, "Times New Roman", Times, serif; }
.section-title { font-family: ui-serif, Georgia, "Times New Roman", Times, serif; }

.brand-subtitle {
  font-size: 12px;
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}

.top-nav {
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 8px 10px;
  display: inline-flex;
  gap: 10px;
  box-shadow: var(--shadow-soft);
}

.nav-btn {
  border: 0;
  background: transparent;
  width: 44px;
  height: 34px;
  border-radius: 2px;
  display: grid;
  place-items: center;
  color: var(--green-900);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.06s ease;
}

.nav-btn:hover { background: rgba(47, 91, 79, 0.08); }
.nav-btn:active { transform: translateY(1px); }
.nav-btn svg { width: 18px; height: 18px; }

.nav-btn--active { background: rgba(47, 91, 79, 0.14); }

/* Page */
.page { padding: 18px 0 44px; }

.hero {
  display: grid;
  justify-items: start;
  text-align: left;
  gap: 10px;
  padding-top: 10px;
}

h1 {
  margin: 8px 0 0;
  font-size: 34px;
  letter-spacing: -0.4px;
}

.page-subtitle {
  margin: 0;
  color: var(--muted);
  max-width: 560px;
}

.footer-note {
  margin: 30px auto 0;
  max-width: 520px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

/* Buttons */
.btn {
  border: 0;
  cursor: pointer;
  border-radius: 2px;
  padding: 11px 14px;
  font-weight: 750;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform 0.06s ease, box-shadow 0.18s ease, background 0.18s ease;
  user-select: none;
  min-height: 44px;
}

.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--green-900);
  color: #fff;
  box-shadow: var(--shadow-soft);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.7);
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(180, 35, 24, 0.25);
  box-shadow: var(--shadow-soft);
}

.btn-danger:hover {
  background: rgba(180, 35, 24, 0.12);
}

.btn-wide {
  min-width: 220px;
  margin-top: 8px;
}
.btn-plus { font-size: 16px; line-height: 1; }

/* ---- Commute panel (Distance to work) ---- */
.commute-panel {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.commute-map-wrap {
  position: relative;
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(0,0,0,0.03);
}

.commute-map {
  width: 100%;
  height: 220px;
}

.commute-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.seg-btn {
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.75);
  border-radius: 2px;
  padding: 10px 12px;
  font-weight: 800;
  cursor: pointer;
  color: var(--text);
}

.seg-btn--active {
  background: rgba(47, 91, 79, 0.14);
  border-color: rgba(47, 91, 79, 0.35);
  color: var(--green-900);
}

.commute-times {
  display: grid;
  gap: 4px;
  font-size: 13px;
}

.commute-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}

.commute-label { color: var(--muted); font-weight: 800; }
.commute-time { font-weight: 900; color: var(--green-900); }

.commute-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
}

.commute-info {
  width: 18px;
  height: 18px;
  border-radius: 3px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(0,0,0,0.14);
  font-weight: 900;
  font-size: 12px;
  line-height: 1;
  color: var(--green-900);
  background: rgba(255,255,255,0.8);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: grid;
  place-items: center;
  padding: 18px;
  z-index: 50;
}

.modal-backdrop[hidden] { display: none !important; }

.modal {
  width: min(680px, 100%);
  background: #fff;
  border-radius: 3px;
  box-shadow: var(--shadow);
  padding: 14px;
}

.modal-tall {
  max-height: min(86vh, 780px);
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.modal-title { font-weight: 900; font-size: 16px; }

.icon-close {
  border: 0;
  background: rgba(0, 0, 0, 0.04);
  width: 36px;
  height: 36px;
  border-radius: 2px;
  cursor: pointer;
}

.modal-actions .btn {
  min-height: 36px;
  padding: 8px 14px;
  font-size: 13px;
  border-radius: 2px;
}

.modal-actions .btn-primary {
  min-width: 118px;
}

.modal-actions .btn-danger {
  min-width: 92px;
}

#saveBtn {
  margin-left: auto;
}

.modal-body {
  overflow: auto;
  padding-right: 2px;
}

.field {
  display: grid;
  gap: 6px;
  margin: 10px 0;
}

.field--compact { margin: 8px 0; }

.label {
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
}

input[type="text"], textarea {
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 2px;
  padding: 12px 12px;
  font-size: 14px;
  outline: none;
  resize: vertical;
}

input[type="text"]:focus, textarea:focus {
  border-color: rgba(47, 91, 79, 0.55);
  box-shadow: 0 0 0 4px rgba(47, 91, 79, 0.12);
}

.section-title {
  margin: 14px 0 8px;
  font-weight: 900;
}

.score-list {
  display: grid;
  gap: 10px;
  padding-bottom: 8px;
}

.score-row {
  background: rgba(0,0,0,0.02);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 12px;
}

/* ── 1-5 Score boxes ───────────────────────────────────────────────────── */
.score-boxes {
  display: flex;
  gap: 6px;
  margin: 8px 0 4px;
}

.score-box {
  flex: 1;
  height: 38px;
  border-radius: 3px;
  border: none;
  background: rgba(47, 91, 79, 0.08);
  color: var(--muted);
  font-weight: 800;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.1s, color 0.1s, transform 0.08s;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.score-box--filled {
  background: var(--green-900);
  border-color: var(--green-900);
  color: #fff;
}

.score-box--half {
  background: rgba(47, 91, 79, 0.38);
  border-color: var(--green-900);
  color: #fff;
}

.score-box:active {
  transform: scale(0.92);
}

/* ── Collapsible notes ─────────────────────────────────────────────────── */
.score-note-details {
  margin-top: 8px;
}

.score-note-toggle {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 5px;
}

.score-note-toggle::-webkit-details-marker { display: none; }

.score-note-toggle::before {
  content: "+";
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  width: 14px;
  display: inline-block;
  text-align: center;
}

.score-note-details[open] .score-note-toggle::before {
  content: "−";
}

.score-note-field {
  margin-top: 6px;
}

.score-note-input {
  min-height: 60px;
  resize: vertical;
}

.score-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
}

.score-left {
  display: grid;
  gap: 2px;
}

.score-title { font-weight: 900; font-size: 13px; }
.score-sub { color: var(--muted); font-size: 12px; }
.score-val { font-weight: 900; color: var(--green-900); }

.range-wrap { display: grid; gap: 6px; }

input[type="range"] {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 8px;
  border-radius: 999px;
  background: rgba(47, 91, 79, 0.12);
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #ffffff;
  border: 3px solid var(--green-900);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12);
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #ffffff;
  border: 3px solid var(--green-900);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12);
  cursor: pointer;
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
}

.modal-actions .btn {
  min-height: 36px;
  padding: 8px 14px;
  font-size: 13px;
  border-radius: 2px;
  min-width: auto;
}

.modal-actions .btn-primary {
  min-width: 118px;
}

.modal-actions .btn-danger {
  min-width: 92px;
}

/* Bottom pager arrows */
.pager {
  margin: 16px auto 0;
  display: flex;
  justify-content: center;
  gap: 8px;
}

.pager-item {
  display: grid;
  justify-items: center;
  gap: 8px;
}

.pager-btn {
  width: 54px;
  height: 54px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(47, 91, 79, 0.12);
  border: 1px solid rgba(47, 91, 79, 0.28);
  color: var(--green-900);
  text-decoration: none;
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  transition: background 0.15s ease,
              transform 0.06s ease,
              box-shadow 0.15s ease;
}

.pager-btn:hover {
  background: rgba(47, 91, 79, 0.18);
  box-shadow: var(--shadow);
}

.pager-btn:active { transform: translateY(1px); }

.pager-btn svg {
  width: 22px;
  height: 22px;
  stroke: var(--green-900);
  stroke-width: 2.4;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pager-caption {
  margin: 0;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.2;
  max-width: 84px;
  text-align: center;
  text-transform: lowercase;
}

/* Saved properties tiles */
.props-section { margin-top: 6px; width: 100%; }

/* Banner stretches to match the props-grid width */
.hero #partnerInviteBanner { width: 100%; }

/* Props grid: outer column of date groups */
.props-grid {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── Date group ─── */
.props-date-group {
  display: grid;
  gap: 10px;
}

.props-date-heading {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}

/* Inner tile grid (3-column, same as the old .props-grid) */
.props-date-tiles {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
}

@media (max-width: 860px) {
  .props-date-tiles { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 520px) {
  .props-date-tiles { grid-template-columns: 1fr; }

  .btn-wide {
    width: 100%;
    min-width: 0;
  }
}

.prop-tile {
  position: relative;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--line);
  border-radius: 3px;
  box-shadow: var(--shadow-soft);
  padding: 12px 12px 12px;
  cursor: pointer;
  transition: transform 0.06s ease, box-shadow 0.18s ease, background 0.18s ease;

  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;

  min-height: 108px;
  max-width: 100%;
  width: 100%;
  justify-self: stretch;
}

.prop-tile--empty {
  grid-column: 1 / -1;
  justify-self: center;
  align-self: flex-start;
  margin: 0 auto;
  width: min(100%, 400px);
  max-width: 400px;
  cursor: default;
}

.prop-tile--empty:hover {
  background: rgba(255, 255, 255, 0.75);
  box-shadow: var(--shadow-soft);
}

.prop-address {
  font-weight: 900;
  margin: 0;
  align-self: stretch;
  display: block;
  overflow: visible;
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.25;
  padding: 0 28px;
  text-align: center;
}

.prop-address--empty {
  padding: 0;
  margin-bottom: 6px;
}

.prop-tile:hover {
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.prop-tile:active { transform: translateY(1px); }


.prop-meta {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
  text-align: center;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.prop-meta--price {
  color: rgba(90, 107, 106, 0.82);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.prop-quick-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.05);
  color: var(--muted);
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.06s ease;
}

.prop-quick-delete:hover {
  background: rgba(180, 35, 24, 0.12);
  color: var(--danger);
}

.prop-quick-delete:active {
  transform: translateY(1px);
}

/* Price guide field spacing inside a score card */
.price-guide-field {
  margin-top: 10px;
  margin-bottom: 8px;
}

/* ── Feeling emoji badge on property tiles ─── */
.prop-feeling {
  display: block;
  text-align: center;
  font-size: 20px;
  line-height: 1;
  margin-top: 8px;
  pointer-events: none;
  user-select: none;
}

/* ── Feeling picker (inside score modal) ─── */
.feeling-picker-row {
  margin-top: 10px;
  background: rgba(0, 0, 0, 0.02);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 14px 12px;
  display: grid;
  gap: 12px;
}

.feeling-picker-label {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  text-align: center;
}

.feeling-picker-btns {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.feeling-btn {
  border: 2px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  width: 54px;
  height: 54px;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.08s ease;
  display: grid;
  place-items: center;
}

.feeling-btn:hover {
  background: rgba(255, 255, 255, 0.95);
  transform: scale(1.06);
}

.feeling-btn--active {
  border-color: var(--green-900);
  background: rgba(47, 91, 79, 0.1);
  transform: scale(1.12);
}

/* ═══════════════════════════════════════════════════════════════════════════
   COMMUTE MAP — empty state
   Shown when no address has been saved under the "Distance to work"
   preference, so there is nothing to route to.
   ═══════════════════════════════════════════════════════════════════════════ */
.commute-map-empty {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  text-align: center;
  background: rgba(246, 243, 238, 0.86);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.commute-map-empty[hidden] { display: none; }

.commute-map-empty-text {
  margin: 0;
  max-width: 30ch;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--muted);
}

.commute-map-empty-link {
  font-size: 12px;
  font-weight: 700;
  color: var(--green-800, #27564A);
  text-decoration: underline;
}

/* Grey the map itself so it reads as unavailable rather than just covered */
.commute-map-wrap--empty .commute-map {
  filter: grayscale(1);
  opacity: 0.45;
  pointer-events: none;
}

/* Travel-mode buttons are meaningless with no destination */
.seg-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}
