:root {
  --bg: #faf7f2;
  --bg-2: #ffffff;
  --bg-3: #f1ece4;
  --ink: #1d1a16;
  --ink-2: #4f4a42;
  --ink-3: #8a837a;
  --line: #e4ddd2;
  --accent: #0f6e6e;
  --accent-ink: #ffffff;
  --accent-soft: #dcefee;
  --warn: #9a5b00;
  --warn-soft: #fbeed7;
  --bad: #a33a2f;
  --bad-soft: #f9e2de;
  --good: #2f7a3a;
  --good-soft: #dff1e0;
  --star: #d99a06;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(29,26,22,.05), 0 8px 24px -12px rgba(29,26,22,.18);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15130f; --bg-2: #1e1b16; --bg-3: #26221c;
    --ink: #f1ece4; --ink-2: #c8c1b6; --ink-3: #8f877b; --line: #342f27;
    --accent: #5ec2bd; --accent-ink: #0b1f1f; --accent-soft: #143634;
    --warn: #f0b356; --warn-soft: #3b2a10; --bad: #f08c80; --bad-soft: #3d1c18;
    --good: #7fd08a; --good-soft: #163d1d; --star: #f2c14e;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
button { font: inherit; color: inherit; }
h1, h2, h3 { font-family: "Fraunces", Georgia, serif; font-weight: 700; letter-spacing: -.01em; margin: 0; }
.wrap { max-width: 1240px; margin: 0 auto; padding-inline: clamp(16px, 4vw, 40px); }

.hero { position: relative; padding-block: 44px 28px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, var(--bg-3), var(--bg)); }
.eyebrow { margin: 0 0 8px; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.hero h1 { font-size: clamp(38px, 6vw, 64px); line-height: 1; }
.lede { max-width: 720px; font-size: 17px; color: var(--ink-2); margin: 14px 0 22px; }
.stats { display: flex; flex-wrap: wrap; gap: 10px; }
.stat { background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; min-width: 120px; }
.stat b { display: block; font-family: "Fraunces", serif; font-size: 26px; line-height: 1.1; }
.stat span { font-size: 12px; color: var(--ink-3); }

.tabs { display: flex; gap: 4px; overflow-x: auto; padding-block: 12px; position: sticky; top: 0; background: var(--bg); z-index: 5; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.tab { flex: 0 0 auto; border: 1px solid transparent; background: transparent; padding: 8px 14px; border-radius: 999px; cursor: pointer; color: var(--ink-2); font-weight: 500; white-space: nowrap; }
.tab:hover { background: var(--bg-3); }
.tab.is-active { background: var(--ink); color: var(--bg); }
.pill { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; margin-left: 4px; }
.tab.is-active .pill { background: var(--bg); color: var(--ink); }

.tabpanel { display: none; padding-block: 24px 48px; }
.tabpanel.is-active { display: block; }
.section-title { font-size: 30px; margin-bottom: 6px; }
.section-sub { font-size: 20px; margin: 28px 0 12px; }
.muted { color: var(--ink-2); margin: 0 0 18px; max-width: 760px; }
.small { font-size: 13px; }

.layout { display: grid; grid-template-columns: 280px 1fr; gap: 28px; align-items: start; }
[hidden] { display: none !important; }
.filters { position: sticky; top: 62px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; max-height: calc(100vh - 80px); overflow: auto; }
.filters-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.filters h2 { font-size: 20px; }
.field { display: block; margin: 0 0 14px; padding: 0; border: 0; min-width: 0; }
.field > span, .field legend { display: block; font-size: 12px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; padding: 0; }
.field input[type=search], .field input[type=number], .field select {
  width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); color: var(--ink); font: inherit;
}
.field.two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.field.two label span { display: block; font-size: 12px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 5px 10px; font-size: 13px; cursor: pointer; background: var(--bg); }
.chip:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); }
.chip input { margin: 0; accent-color: var(--accent); }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; padding: 4px 0; cursor: pointer; }
.check input { accent-color: var(--accent); margin: 0; }
.stack { display: flex; flex-direction: column; }
.linkbtn { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 4px 0; font-weight: 600; }
.only-mobile { display: none; }

.results-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 12px; }
.results-head p { margin: 0; color: var(--ink-2); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.empty { color: var(--ink-3); text-align: center; padding: 40px 0; }

.card { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow); position: relative; }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.price { font-family: "Fraunces", serif; font-size: 28px; font-weight: 700; line-height: 1; }
.price small { font-family: "Inter", sans-serif; font-size: 12px; font-weight: 500; color: var(--ink-3); margin-left: 2px; }
.score { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--bg-3); color: var(--ink-2); }
.score.hi { background: var(--good-soft); color: var(--good); }
.score.mid { background: var(--accent-soft); color: var(--accent); }
.card-right { display: flex; gap: 8px; align-items: center; }
.star { border: 0; background: none; cursor: pointer; font-size: 22px; line-height: 1; color: var(--ink-3); padding: 2px; }
.star.on { color: var(--star); }
.where { font-size: 13px; color: var(--ink-3); }
.where b { color: var(--ink); font-weight: 600; }
.title { font-size: 16px; font-weight: 600; line-height: 1.3; margin: 0; }
.title a { color: inherit; text-decoration: none; }
.title a:hover { text-decoration: underline; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tag { font-size: 11.5px; font-weight: 600; padding: 3px 8px; border-radius: 6px; background: var(--bg-3); color: var(--ink-2); }
.tag.good { background: var(--good-soft); color: var(--good); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.bad { background: var(--bad-soft); color: var(--bad); }
.tag.acc { background: var(--accent-soft); color: var(--accent); }
.desc { margin: 0; color: var(--ink-2); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card.open .desc { display: block; }
.notes { margin: 0; font-size: 13px; color: var(--ink-3); border-left: 3px solid var(--line); padding-left: 8px; }
.card-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: auto; padding-top: 6px; border-top: 1px dashed var(--line); font-size: 13px; }
.src { color: var(--ink-3); }
.more { color: var(--ink-3); background: none; border: 0; cursor: pointer; font-size: 13px; padding: 0; }
.open-link { font-weight: 600; text-decoration: none; }
.open-link::after { content: " ↗"; }
.tracker { display: grid; grid-template-columns: 1fr; gap: 6px; }
.tracker select, .tracker input { width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); font: inherit; font-size: 13px; }

.picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.pick { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.pick .rank { font-family: "Fraunces", serif; font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); font-weight: 700; }
.pick h3 { font-family: "Inter", sans-serif; font-size: 16px; margin: 6px 0 4px; }
.pick .why { font-size: 14px; color: var(--ink-2); margin: 6px 0 10px; }
.pick .line { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }

.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-2); }
table.suburbs { border-collapse: collapse; width: 100%; min-width: 860px; font-size: 14px; }
.suburbs th, .suburbs td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.suburbs th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); background: var(--bg-3); position: sticky; top: 0; }
.suburbs td:first-child { font-weight: 600; white-space: nowrap; }
.fit { display: inline-block; letter-spacing: 1px; color: var(--star); }
.count-link { color: var(--accent); font-weight: 600; text-decoration: none; }

.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.links { padding-left: 20px; margin: 0; }
.links li { margin: 0 0 8px; }
.links a { font-weight: 600; text-decoration: none; }
.links a:hover { text-decoration: underline; }
.links .note { color: var(--ink-3); font-size: 13px; }
.table-wrap { overflow-x: auto; }
.guide { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 620px; }
.guide th, .guide td { text-align: left; vertical-align: top; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.guide thead th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); }
.guide caption { caption-side: bottom; text-align: left; padding-top: 8px; font-size: 12px; color: var(--ink-3); }
.tipbox { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.tipbox h3 { font-family: "Inter", sans-serif; font-size: 16px; margin: 0 0 8px; }
.tipbox ul { margin: 0; padding-left: 18px; }
.tipbox li { margin-bottom: 6px; font-size: 14px; color: var(--ink-2); }

.foot { padding-block: 20px 40px; color: var(--ink-3); font-size: 13px; border-top: 1px solid var(--line); }

.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: 14px; opacity: 0; transition: opacity .2s; pointer-events: none; }
.toast.show { opacity: 1; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .filters { position: static; max-height: none; display: none; }
  .filters.show { display: block; }
  .only-mobile { display: inline-block; }
  .cols { grid-template-columns: 1fr; }
}

.hide { border: 0; background: none; cursor: pointer; font-size: 16px; line-height: 1; color: var(--ink-3); padding: 2px 4px; }
.hide:hover { color: var(--bad); }

.price .sub { font-family: "Inter", sans-serif; font-size: 12px; font-weight: 500; color: var(--ink-3); margin-top: 2px; }

.modal[hidden] { display: none !important; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal-box { background: var(--bg-2); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; max-width: 420px; width: 100%; box-shadow: var(--shadow); }
.modal-box h3 { font-family: "Inter", sans-serif; font-size: 18px; margin: 0 0 8px; }
.modal-box p { margin: 0 0 18px; color: var(--ink-2); font-size: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.btn { border: 1px solid var(--line); background: var(--bg); color: var(--ink); padding: 8px 14px; border-radius: 9px; cursor: pointer; font-weight: 600; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }

.persona { position: absolute; top: 16px; right: clamp(16px, 4vw, 40px); display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg-2); box-shadow: var(--shadow); z-index: 6; }
.persona a { padding: 6px 14px; border-radius: 999px; text-decoration: none; color: var(--ink-2); font-weight: 600; font-size: 13px; }
.persona a:hover { background: var(--bg-3); }
.persona a.is-active { background: var(--ink); color: var(--bg); }
.hero .wrap { position: relative; }
@media (max-width: 600px) { .persona { position: static; margin-bottom: 14px; } }

.tag.new { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; margin-right: 4px; }
#newGroups .grid { margin-bottom: 8px; }
