/* 價租地圖: the approved design (Claude Design canvas, issue #65) as classes. */
:root {
  --bg: #F4F3EF; --card: #FFFFFF; --ink: #1A1D23; --ink-2: #4A4F57; --muted: #6B7078;
  --line: #DEDCD5; --line-2: #C9C6BD; --line-3: #ECEAE4; --field: #FAFAF8; --pill: #EEEDE8;
  --sale: #1C4A8A; --sale-bg: #EDF3FA; --sale-ink: #0F2F5C; --sale-bar: #3A72B8;
  --rent: #8A3D0E; --rent-bg: #FCF0E6; --rent-ink: #6B2E08; --rent-bar: #CF6A24;
  --yld: #145C52; --yld-bg: #E8F4F1; --yld-ink: #0E443C;
  --mono: 'IBM Plex Mono', monospace; --tc: 'Noto Sans TC', sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: 'IBM Plex Sans', 'Noto Sans TC', sans-serif; }
a { color: var(--sale); } a:hover { color: var(--sale-ink); }
button { font: inherit; cursor: pointer; }
input::placeholder { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Header */
.top { background: var(--card); border-bottom: 1px solid var(--line); }
.top-in { max-width: 1360px; margin: 0 auto; padding: 14px 32px; display: flex; flex-wrap: wrap; align-items: center; gap: 16px 28px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand span { font-family: var(--tc); font-weight: 700; font-size: 21px; letter-spacing: 0.04em; }
.search { flex: 1 1 360px; display: flex; min-width: 0; }
.search input { flex: 1; min-width: 0; height: 44px; border: 1px solid var(--line-2); border-right: 0; border-radius: 8px 0 0 8px; padding: 0 14px; font-size: 16px; font-family: inherit; background: var(--field); color: var(--ink); }
.search button { height: 44px; padding: 0 18px; border: 0; border-radius: 0 8px 8px 0; background: var(--ink); color: #fff; font-size: 15px; }
.search-msg { flex-basis: 100%; margin: -8px 0 0; font-size: 13px; color: var(--rent); }
.nav { display: flex; gap: 22px; font-size: 15px; }
.nav a { color: var(--ink-2); text-decoration: none; padding: 10px 0; }
.nav a[aria-current="page"] { color: var(--ink); font-weight: 600; border-bottom: 2px solid var(--ink); }

/* Page */
main { max-width: 1360px; width: 100%; margin: 0 auto; padding: 28px 32px 40px; display: flex; flex-direction: column; gap: 22px; }
.head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.head h1 { margin: 0; font-family: var(--tc); font-size: 30px; font-weight: 700; letter-spacing: 0.02em; }
.head p { margin: 6px 0 0; color: var(--ink-2); font-size: 15px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; }
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink-2); }
.filters select { height: 44px; min-width: 132px; border: 1px solid var(--line-2); border-radius: 8px; padding: 0 10px; font-size: 15px; font-family: inherit; background: var(--card); color: var(--ink); }
.row { display: flex; flex-wrap: wrap; gap: 22px; align-items: flex-start; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 22px; display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.card h2 { margin: 0; font-family: var(--tc); font-size: 20px; }
.wide { flex: 999 1 560px; }
.side { flex: 1 1 380px; }
.note { font-size: 13px; color: var(--ink-2); }
.status { padding: 24px 0; color: var(--ink-2); font-size: 14px; text-align: center; }
.status.err { color: var(--rent); }

/* Metric switch */
.seg { display: inline-flex; background: var(--pill); border-radius: 10px; padding: 4px; gap: 4px; }
.seg button { min-height: 40px; padding: 0 14px; border: 0; border-radius: 7px; font-size: 14px; background: transparent; color: var(--ink-2); }
.seg .short { display: none; }
.seg button[aria-selected="true"] { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,0.12); }
.bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }

/* Tile map */
.tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); grid-auto-rows: 112px; gap: 8px; max-width: 720px; width: 100%; align-self: center; }
.tile { border: 3px solid transparent; border-radius: 10px; display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; padding: 10px 12px; text-align: left; min-width: 0; color: var(--ink); }
.tile.dark { color: #fff; }
.tile.thin { background: repeating-linear-gradient(135deg, #F1F0EC 0 6px, #E6E4DE 6px 12px); color: var(--ink-2); }
.tile[aria-pressed="true"] { border-color: var(--ink); box-shadow: 0 0 0 2px #fff inset; }
.tile .t { font-family: var(--tc); font-size: 16px; font-weight: 700; }
.tile .v { font-family: var(--mono); font-size: 20px; font-weight: 500; }
.tile .n { font-size: 11px; opacity: 0.85; }
.tile .short { display: none; }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-2); }
.legend .sw { display: flex; gap: 2px; }
.legend .sw div { display: flex; flex-direction: column; gap: 4px; }
.legend .sw i { display: block; width: 64px; height: 12px; border-radius: 3px; }
.legend .sw span { font-family: var(--mono); font-size: 11px; }
.legend .aside { margin-left: auto; }

/* KPI boxes (home side panel) */
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.kpi { border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.kpi .k { font-size: 12px; display: flex; align-items: center; gap: 2px; }
.kpi .v { font-family: var(--mono); font-size: 22px; font-weight: 500; }
.kpi .s { font-size: 11px; }
.kpi.sale { background: var(--sale-bg); } .kpi.sale .k { color: var(--sale); } .kpi.sale .v { color: var(--sale-ink); } .kpi.sale .s { color: #3E4A5C; }
.kpi.rent { background: var(--rent-bg); } .kpi.rent .k { color: var(--rent); } .kpi.rent .v { color: var(--rent-ink); } .kpi.rent .s { color: #5C4232; }
.kpi.yld { background: var(--yld-bg); } .kpi.yld .k { color: var(--yld); } .kpi.yld .v { color: var(--yld-ink); } .kpi.yld .s { color: #34524D; }
.thin-note { color: var(--rent); font-weight: 600; }

/* ⓘ popover */
.tip { display: inline-block; position: relative; vertical-align: middle; }
.tip summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; margin: -4px 0; border-radius: 50%; color: var(--rent); font-size: 13px; font-weight: 600; }
.tip summary::-webkit-details-marker { display: none; }
.tip div { position: absolute; left: -90px; top: 26px; z-index: 10; width: 240px; padding: 10px 12px; border-radius: 8px; background: var(--ink); color: #fff; font-size: 12px; font-weight: 400; line-height: 1.6; box-shadow: 0 4px 12px rgba(0,0,0,0.25); }

/* Tabs and lists */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); }
.tabs button { min-height: 44px; padding: 0 12px; border: 0; background: transparent; font-size: 15px; margin-bottom: -1px; color: var(--ink-2); border-bottom: 2px solid transparent; }
.tabs button[aria-selected="true"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--ink); }
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.list li { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-3); }
.list .l { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.list .a { font-size: 15px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .m { font-size: 12px; color: var(--ink-2); }
.list .r { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex-shrink: 0; }
.list .p { font-family: var(--mono); font-size: 15px; font-weight: 500; }
.btn { display: flex; justify-content: center; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 8px; background: var(--ink); color: #fff; text-decoration: none; font-size: 15px; font-weight: 500; border: 0; }
.btn:hover { color: #fff; }
.btn.ghost { background: var(--card); color: var(--ink); border: 1px solid var(--line-2); font-weight: 400; }
.btn.ghost:hover { color: var(--ink); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.side .btn.ghost { margin-top: -8px; }

/* District page */
.crumbs { font-size: 14px; color: var(--ink-2); display: flex; gap: 8px; flex-wrap: wrap; }
.big { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.big .box { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px; display: flex; flex-direction: column; gap: 6px; }
.big .k { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 2px; color: var(--ink-2); }
.big .k.sale { color: var(--sale); } .big .k.rent { color: var(--rent); } .big .k.yld { color: var(--yld); }
.big .v { font-family: var(--mono); font-size: 34px; font-weight: 500; }
.big .v small { font-size: 15px; color: var(--ink-2); }
.big .s { font-size: 13px; color: var(--ink-2); }
.calc { max-width: 560px; }
.calc label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--ink-2); }
.calc input { height: 44px; border: 1px solid var(--line-2); border-radius: 8px; padding: 0 12px; font-size: 17px; font-family: var(--mono); color: var(--ink); background: var(--field); }
.calc .out { background: var(--yld-bg); border-radius: 10px; padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.calc .out .k { font-size: 13px; color: var(--yld); }
.calc .out .v { font-family: var(--mono); font-size: 32px; font-weight: 500; color: var(--yld-ink); }
.calc .out .s { font-size: 13px; color: #34524D; }
.calc p { margin: 0; font-size: 12px; color: var(--ink-2); line-height: 1.6; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button { min-height: 36px; padding: 0 14px; border-radius: 18px; font-size: 13px; background: var(--card); color: var(--ink); border: 1px solid var(--line-2); }
.chips button[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.scroll { overflow-x: auto; }
table { width: 100%; min-width: 760px; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--ink-2); font-size: 13px; padding: 10px 8px; border-bottom: 1px solid var(--line-2); font-weight: 500; }
td { padding: 12px 8px; border-bottom: 1px solid var(--line-3); }
th.num, td.num { text-align: right; }
td.num, td.date { font-family: var(--mono); white-space: nowrap; }
td.date { font-size: 13px; }
.tag { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 4px; background: var(--pill); color: var(--ink-2); font-size: 11px; }
.more { align-self: center; }

.about { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; font-size: 13px; color: var(--ink-2); line-height: 1.6; }
.about p { margin: 0; }
.about strong { color: var(--ink); }

/* Phones (the 390-wide design) */
@media (max-width: 720px) {
  .top-in { padding: 12px 16px; gap: 12px; }
  .brand span { font-size: 19px; }
  .nav { width: 100%; gap: 18px; overflow-x: auto; }
  main { padding: 18px 16px 32px; gap: 16px; }
  .head h1 { font-size: 23px; }
  .head p { font-size: 13px; }
  .filters, .filters label { flex: 1; min-width: 0; }
  .filters select { min-width: 0; width: 100%; }
  .card { padding: 16px; gap: 12px; }
  .seg .full { display: none; } .seg .short { display: inline; }
  .seg { display: flex; } .seg button { flex: 1; min-height: 44px; font-size: 15px; padding: 0 6px; }
  .tiles { grid-auto-rows: 76px; gap: 5px; }
  .tile { border-radius: 8px; padding: 6px; }
  .tile .t { display: none; } .tile .short { display: block; font-family: var(--tc); font-size: 13px; font-weight: 700; }
  .tile .v { font-size: 13px; } .tile .n { display: none; }
  .legend .sw { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); width: 100%; }
  .legend .sw i { width: auto; height: 10px; }
  .legend .aside { margin-left: 0; font-size: 12px; }
  .kpis { grid-template-columns: 1fr; gap: 0; }
  .kpi { flex-direction: row; flex-wrap: wrap; align-items: baseline; justify-content: space-between; border-radius: 0; background: none !important; padding: 10px 0; border-bottom: 1px solid var(--line-3); }
  .kpi .k { font-size: 14px; } .kpi .v { font-size: 18px; margin-left: auto; } .kpi .s { flex-basis: 100%; text-align: right; }
  .tip div { left: 0; }
  .big .v { font-size: 28px; }
}
