:root {
  color-scheme: light;
  --ink: #24352e;
  --muted: #63736b;
  --forest: #234638;
  --coffee: #594537;
  --sand: #f4f0e7;
  --paper: #fffdf8;
  --line: #d9d8cc;
  --orange: #df7b22;
  --green: #9acd32;
  --red: #c9473a;
  --gold: #e3b547;
  --unknown: #9ca5a0;
  font-family: 'DM Sans', 'Noto Sans JP', system-ui, sans-serif;
  color: var(--ink);
  background: var(--sand);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { min-width: 320px; margin: 0; background: var(--sand); }
a { color: inherit; }
button { font: inherit; }
:focus-visible { outline: 3px solid #f2a13c; outline-offset: 3px; }

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 1rem;
  padding: .55rem clamp(1rem, 3vw, 2.5rem);
  color: #f9f7ef;
  background: var(--forest);
  min-height: 58px;
}
.brand { display: inline-flex; align-items: center; gap: .7rem; color: inherit; text-decoration: none; font-size: .76rem; font-weight: 800; letter-spacing: .1em; }
.brand b { color: #e7c775; }
.brand-mark { display: grid; place-items: center; width: 2.1rem; height: 2.1rem; color: var(--forest); background: #e7c775; border-radius: 50%; font-size: 1.05rem; font-weight: 800; }
.topbar-tools { display: flex; justify-content: flex-end; align-items: center; gap: .7rem; }
.site-tabs { display: flex; gap: .2rem; padding: .22rem; background: #142d24; border: 1px solid #ffffff2e; border-radius: .8rem; }
.site-tab { display: inline-flex; align-items: center; gap: .55rem; min-height: 2.5rem; padding: .3rem .95rem; color: #dce7df; background: transparent; border: 0; border-radius: .6rem; cursor: pointer; font-size: .86rem; font-weight: 800; letter-spacing: .01em; transition: background .15s ease, color .15s ease; }
.site-tab:hover { background: #ffffff14; }
.site-tab[aria-selected="true"] { color: #173127; background: #e7c775; box-shadow: 0 1px 5px #0004; }
.site-tab-count { padding: .12rem .42rem; color: #b9cdbf; background: #ffffff17; border-radius: 99px; font-size: .66rem; font-weight: 850; font-variant-numeric: tabular-nums; }
.site-tab-count.is-live { color: #fff; }
.site-tab[aria-selected="true"] .site-tab-count { color: #173127; background: #1731271f; }
.language-switcher { position: relative; display: grid; grid-template-columns: repeat(3, 2.2rem); isolation: isolate; padding: .2rem; background: #142d24; border: 1px solid #ffffff38; border-radius: 999px; }
.language-switcher button { position: relative; z-index: 1; min-height: 1.75rem; padding: 0; color: #dce7df; background: transparent; border: 0; border-radius: 999px; cursor: pointer; font-size: .66rem; font-weight: 900; letter-spacing: .04em; }
.language-switcher button[aria-checked="true"] { color: #173127; }
.language-thumb { position: absolute; z-index: 0; top: .2rem; left: .2rem; width: 2.2rem; height: 1.75rem; background: #e7c775; border-radius: 999px; box-shadow: 0 1px 5px #0004; transform: translateX(0); transition: transform .22s cubic-bezier(.2, .8, .2, 1); }
.language-switcher[data-current="sw"] .language-thumb { transform: translateX(2.2rem); }
.language-switcher[data-current="ja"] .language-thumb { transform: translateX(4.4rem); }
.snapshot-date { display: inline-flex; align-items: center; gap: .4rem; padding: .22rem .55rem; color: #5f7066; background: #f0efe7; border: 1px solid #dddcd0; border-radius: 99px; font-size: .64rem; font-weight: 850; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
.snapshot-date.is-live { color: #24603f; background: #e3f0e2; border-color: #bcd7bf; }
.snapshot-date.is-live::before { content: ""; width: .45rem; height: .45rem; background: #2f9a5a; border-radius: 50%; box-shadow: 0 0 0 3px #2f9a5a33; }
.snapshot-date.is-failed { color: #7a2c21; background: #f8e3de; border-color: #e6b2a6; }

.page-shell { width: min(100% - 2rem, 1720px); margin: 0 auto; padding: clamp(.6rem, 1vw, .9rem) 0 2rem; }
.intro { display: flex; justify-content: space-between; align-items: end; gap: 2rem; margin-bottom: 1.35rem; }
.eyebrow { margin: 0 0 .35rem; color: #67816d; font-size: .66rem; font-weight: 800; letter-spacing: .16em; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin: 0; color: var(--forest); font-size: clamp(1.5rem, 2.8vw, 2.15rem); line-height: 1.1; letter-spacing: -.03em; }
h1 span { color: var(--coffee); }
h2 { margin: 0; color: var(--forest); font-size: clamp(1.1rem, 2vw, 1.45rem); line-height: 1.25; }
h3 { margin-bottom: .65rem; color: var(--forest); font-size: .82rem; }
.intro-copy { max-width: 50rem; margin: 0; color: var(--muted); font-size: .92rem; line-height: 1.6; }
.intro-actions { display: flex; align-items: stretch; gap: .55rem; }
.source-link, .text-link { display: inline-flex; align-items: center; gap: .5rem; white-space: nowrap; color: var(--forest); font-size: .8rem; font-weight: 800; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.source-link { padding: .75rem 1rem; color: white; background: var(--forest); border: 1px solid var(--forest); border-radius: .55rem; text-decoration: none; transition: background .15s ease; }
.source-link:hover { background: #315d49; }

.summary-note { display: flex; flex-wrap: wrap; align-items: center; gap: .34rem; margin: 0 0 1.1rem; color: #5d6b62; font-size: .71rem; line-height: 1.65; }
.age-chip { display: inline-block; padding: .08rem .38rem; border: 1px solid #0002; border-radius: 99px; color: #172014; font-size: .65rem; font-weight: 900; }
.age-green { background: var(--green); }
.age-orange { color: #fff; background: var(--orange); }
.age-red { color: #fff; background: var(--red); }

.data-alert, .occupancy-alert { display: flex; align-items: flex-start; gap: .7rem; margin: 0 0 1rem; padding: .85rem 1rem; border-radius: .7rem; font-size: .82rem; font-weight: 650; line-height: 1.55; }
.data-alert { color: #315242; background: #e9f0e9; border: 1px solid #c6d8ca; }
.data-alert-warning { color: #594419; background: #fbf0d4; border-color: #ead4a0; }
.data-alert-error { color: #702c22; background: #f8e3de; border-color: #e6b2a6; }
.occupancy-alert { align-items: center; color: #fff; background: #a93529; border: 2px solid #6c1b14; box-shadow: 0 4px 16px #6c1b1430; font-size: clamp(.84rem, 2vw, 1rem); }
.alert-icon { flex: 0 0 1.3rem; display: grid; place-items: center; width: 1.3rem; height: 1.3rem; color: white; background: var(--orange); border-radius: 50%; font-size: .78rem; font-weight: 900; }
.occupancy-alert .alert-icon, .data-alert-error .alert-icon { background: #6c1b14; }

.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; margin-bottom: .75rem; }
.summary-card { min-height: 122px; padding: 1rem 1.1rem; background: var(--paper); border: 1px solid var(--line); border-top: 4px solid var(--forest); border-radius: .75rem; box-shadow: 0 3px 10px #3343320d; }
.summary-average { border-top-color: var(--gold); }
.summary-oldest { border-top-color: var(--orange); }
.summary-due { border-top-color: var(--red); }
.summary-label { display: block; color: #65756c; font-size: .63rem; font-weight: 800; letter-spacing: .11em; }
.summary-card strong { display: inline-block; margin: .48rem .35rem .15rem 0; color: var(--forest); font-size: clamp(2rem, 4vw, 2.65rem); font-variant-numeric: tabular-nums; line-height: 1; }
.summary-unit { color: var(--muted); font-size: .76rem; font-weight: 700; }
.summary-card small { display: block; color: #647168; font-size: .72rem; }


.panel { background: var(--paper); border: 1px solid var(--line); border-radius: .8rem; box-shadow: 0 3px 12px #3343320d; }
.map-panel { margin-bottom: .9rem; padding: clamp(.7rem, 1.2vw, 1rem); }
.map-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .65rem 1rem; margin-bottom: .65rem; }
.map-title-group { min-width: 0; }
.map-title-group .eyebrow { margin-bottom: .2rem; }
.map-title-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: .35rem .75rem; }
.map-actions { display: flex; align-items: stretch; gap: .45rem; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .85rem; }
.panel-heading .eyebrow { color: #74866f; }
.approx-badge, .count-badge { display: inline-flex; align-items: center; padding: .38rem .65rem; color: #576347; background: #edf1e7; border: 1px solid #d2dbc9; border-radius: 99px; font-size: .66rem; font-weight: 800; white-space: nowrap; }

/* The map takes the full window height left under the header and the hero title row. */
.hero { --hero-h: clamp(520px, calc(100vh - 152px), 1300px); --map-ratio: 1.488; }
.hero-body { display: grid; grid-template-columns: minmax(0, calc(var(--hero-h) * var(--map-ratio))) minmax(290px, 1fr); align-items: start; gap: .9rem; }
.hero-map { min-width: 0; width: 100%; max-width: calc(var(--hero-h) * var(--map-ratio)); }
.map-frame { position: relative; overflow: hidden; width: 100%; background: #69735f; border: 1px solid #596452; border-radius: .65rem; }
#yard-map { display: block; width: 100%; height: auto; aspect-ratio: 900 / 605; }
.site-ground { fill: #6c7763; }
.site-boundary { fill: #7f886f; stroke: #3d493d; stroke-width: 12; }
.site-boundary-line { fill: none; stroke: #fffdf5; stroke-width: 3.5; }
.north-label, .zone-label { fill: #f9f7e9; paint-order: stroke; stroke: #3f4a3e; stroke-width: 3px; stroke-linejoin: round; font-weight: 900; }
.north-label { font-size: 18px; text-anchor: middle; }
.zone-label { font-size: 12px; letter-spacing: .05em; }
.north-arrow { fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }

.bed-marker { cursor: pointer; }
.bed-marker:focus { outline: none; }
.bed-cell { stroke: #27352a; stroke-width: 1.7; vector-effect: non-scaling-stroke; transition: filter .15s ease, stroke-width .15s ease; }
.bed-cell.state-unknown { fill: var(--unknown); }
.bed-cell.state-empty { fill: #fffdf8; stroke-dasharray: 4 3; }
.bed-cell.state-invalid { fill: url(#invalid-hatch); }
.bed-cell.state-green { fill: var(--green); }
.bed-cell.state-orange { fill: var(--orange); }
.bed-cell.state-red { fill: var(--red); }
.bed-cell.state-confirm { stroke: #fff04f; stroke-width: 4; }
.bed-canopy-tint { fill: #33402e; opacity: .38; pointer-events: none; }
.bed-cell.selected { stroke: #111; stroke-width: 4.5; filter: drop-shadow(0 0 4px #fff); }
.bed-marker:hover .bed-cell, .bed-marker:focus .bed-cell { filter: brightness(1.14) drop-shadow(0 0 3px #fff); stroke-width: 3; }
.bed-number, .bed-state-icon, .bed-moisture-icon { pointer-events: none; text-anchor: middle; dominant-baseline: central; paint-order: stroke; stroke: #fff8; stroke-width: 1.2px; stroke-linejoin: round; }
.bed-number { fill: #172019; font-size: 9px; font-weight: 950; font-variant-numeric: tabular-nums; }
.bed-label-bg { fill: #fffdf8; pointer-events: none; }
.bed-label-bg.state-green { fill: var(--green); }
.bed-label-bg.state-orange { fill: var(--orange); }
.bed-label-bg.state-red { fill: var(--red); }
.bed-label-bg.state-unknown { fill: var(--unknown); }
.bed-label-bg.state-invalid { fill: #d8dde1; }
.bed-marker.bed-inferred .bed-label-bg { fill: #2c3628; }
.bed-marker.bed-inferred .bed-number { fill: #fff; stroke: #1d261bcc; stroke-width: 2px; }
.bed-state-icon { fill: #131a14; font-size: 7px; font-weight: 950; }
.bed-moisture-icon { fill: #123f2b; font-size: 8px; font-weight: 950; }
.bed-marker.state-red .bed-number, .bed-marker.state-red .bed-state-icon, .bed-marker.state-orange .bed-number, .bed-marker.state-orange .bed-state-icon { fill: #fff; stroke: #0006; }

.landmark { stroke: #26392f; stroke-width: 3; }
.skin-roof { fill: #e9eef0; }
.skin-roof-blue { fill: #9dbfce; stroke: #55798a; stroke-width: 2; }
.store-roof { fill: #63836f; }
.landmark-dam { fill: #4f706f; }
.dam-waterline { fill: none; stroke: #9bb6b2; stroke-width: 2; }
.factory-roof { fill: #64876f; }
.roof-ridge { stroke: #9fbaa5; stroke-width: 3; }
.long-roof { fill: #e3e1d9; stroke: #62645f; stroke-width: 3; }
.small-roof { fill: #64876f; }
.landmark-label, .landmark-label-outside, .long-roof-label, .minor-label { text-anchor: middle; dominant-baseline: central; font-weight: 900; paint-order: stroke; stroke-linejoin: round; }
.landmark-label { fill: #fff; stroke: #284034; stroke-width: 3px; font-size: 12px; }
.landmark-label-outside { fill: #fff; stroke: #39473d; stroke-width: 3px; font-size: 12px; }
.long-roof-label { fill: #263027; stroke: #f5f3eb; stroke-width: 3px; font-size: 10.5px; }
.minor-label { fill: #f4f3e9; stroke: #39473d; stroke-width: 3px; font-size: 11px; }
.yard { fill: #8f8470; opacity: .6; }
.clearing { fill: #7f886f; }
.parcel { fill: #85745d; stroke: #5b4f3e; stroke-width: 1.5; }
.track { fill: none; stroke: #b6ab90; stroke-width: 9; stroke-linecap: round; opacity: .85; }
.canopy { fill: #4b5943; opacity: .85; }
.hedge { fill: none; stroke: #3f5a3c; stroke-width: 6; stroke-linejoin: round; }
.hedge-line { fill: none; stroke: #3f5a3c; stroke-width: 7; stroke-linecap: round; }
.roof-light { fill: #b4b8ae; }
.roof-warm { fill: #94664f; }
.enclosure { fill: #8b8771; stroke: #3d493d; stroke-width: 2; }
.slab { fill: #7a6e5a; stroke: #4c4436; stroke-width: 1.5; }
.gravel { fill: url(#gravel-dots); stroke: #5f6457; stroke-width: 1.5; }
.tray { fill: #59634f; stroke: #f4f1e4; stroke-width: 1.5; stroke-dasharray: 6 4; }
.tray-label { fill: #f9f7e9; font-size: 11px; font-weight: 900; letter-spacing: .05em; }

.map-tooltip { position: absolute; z-index: 10; width: min(310px, calc(100% - 16px)); padding: .78rem .85rem; color: #f8f7f1; background: #17251fef; border: 1px solid #dfe8df88; border-radius: .6rem; box-shadow: 0 8px 24px #1118; pointer-events: none; font-size: .7rem; line-height: 1.45; }
.tooltip-title { display: block; margin-bottom: .15rem; color: #fff; font-size: .86rem; }
.tooltip-reason { display: block; margin-bottom: .55rem; color: #d4e3d6; }
.map-tooltip dl { display: grid; gap: .32rem; margin: 0; }
.map-tooltip dl div { display: grid; grid-template-columns: 7.2rem 1fr; gap: .5rem; }
.map-tooltip dt { color: #b9cabe; }
.map-tooltip dd { margin: 0; font-weight: 800; }
.map-tooltip dd small { display: block; color: #bac8bf; font-size: .58rem; font-weight: 500; }
.tooltip-badges, .detail-flags { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .6rem; }
.inline-status { display: inline-flex; padding: .18rem .42rem; border-radius: 99px; font-size: .62rem; font-weight: 900; }
.inline-status.confirm { color: #26180b; background: #ffe45c; }
.inline-status.reached { color: #16422f; background: #c9efc8; }

.map-legend { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .35rem .8rem; padding: .15rem 0 0; color: #526157; font-size: .65rem; font-weight: 750; }
.map-legend span { display: inline-flex; align-items: center; gap: .4rem; }
.legend-swatch { display: inline-grid; place-items: center; width: 1.28rem; height: 1.05rem; color: #172019; background: var(--unknown); border: 1px solid #3f4d42; border-radius: 3px; font-style: normal; font-size: .55rem; font-weight: 950; }
.legend-swatch.state-green { background: var(--green); }
.legend-swatch.state-orange { color: #fff; background: var(--orange); }
.legend-swatch.state-red, .legend-swatch.state-confirm { color: #fff; background: var(--red); }
.legend-swatch.state-confirm { border: 3px solid #ffe45c; }
.legend-swatch.state-empty { background: #fff; border-style: dashed; }
.legend-swatch.state-invalid { background: repeating-linear-gradient(135deg, #d8dde1 0 4px, #697580 4px 7px); }
.legend-swatch.legend-inferred { background: linear-gradient(#33402e61, #33402e61), var(--red); }
.legend-swatch.legend-unlocated { background: #59634f; border: 1.5px dashed #f4f1e4; outline: 1px solid #3f4d42; }
.map-notes { grid-column: 1 / -1; display: flex; align-items: center; gap: .55rem .75rem; margin: 0; }
.map-notes p { margin: 0; color: #708075; font-size: .7rem; line-height: 1.45; }
.map-panel .data-alert { grid-column: 1 / -1; margin: 0; padding: .5rem .65rem; font-size: .7rem; }
.map-footer { display: grid; gap: .5rem; margin-top: .65rem; }

.lower-grid { display: grid; align-items: start; grid-template-columns: minmax(300px, .88fr) minmax(0, 1.12fr); gap: .9rem; }
.detail-panel, .records-panel { min-width: 0; padding: 1.1rem; }
.compact-heading { align-items: flex-end; margin-bottom: .8rem; }
.state-badge { display: inline-flex; align-items: center; padding: .33rem .55rem; color: #27342d; background: #f0f0e9; border: 1px solid #d1d6cb; border-radius: 99px; font-size: .66rem; font-weight: 900; }
.state-badge.state-green { background: #dff0ad; border-color: #a7c656; }
.state-badge.state-orange { color: #fff; background: var(--orange); border-color: #ab5815; }
.state-badge.state-red { color: #fff; background: var(--red); border-color: #8c2f27; }
.state-badge.state-confirm { color: #26180b; background: #ffe45c; border-color: #8c2f27; box-shadow: inset 0 0 0 2px var(--red); }
.state-badge.state-empty { background: #fff; border-style: dashed; }
.state-badge.state-invalid { background: #d8dde1; border-color: #697580; }
.count-badge { color: #5d675f; background: #f3f3ee; }
.detail-body { min-height: 164px; padding: .9rem; background: #f8f7f1; border: 1px solid #e1e0d6; border-radius: .55rem; }
.empty-detail { margin: 0; color: #66756a; font-size: .8rem; line-height: 1.6; }
.status-reason { margin-bottom: .7rem; color: #53665a; font-size: .74rem; font-weight: 800; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; margin: 0; }
.detail-item { min-width: 0; }
.detail-wide { grid-column: 1 / -1; }
.detail-item dt { color: #748076; font-size: .64rem; font-weight: 700; }
.detail-item dd { margin: .2rem 0 0; overflow-wrap: anywhere; color: #33453a; font-size: .88rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.detail-item dd small { display: block; color: #7b857e; font-size: .58rem; font-weight: 600; }
.history-section { margin-top: .95rem; padding-top: .85rem; border-top: 1px solid #deded3; }
.history-list { display: grid; gap: .35rem; }
.history-row { display: grid; grid-template-columns: minmax(70px, .8fr) repeat(3, minmax(0, 1fr)); gap: .4rem; padding: .43rem .5rem; background: #fff; border: 1px solid #e3e3da; border-radius: .38rem; font-size: .61rem; }
.history-row strong { color: #365442; }
.history-row span { overflow-wrap: anywhere; color: #6d786f; }
.recent-records { display: grid; gap: .42rem; }
.record-row { display: grid; grid-template-columns: minmax(70px, .8fr) minmax(70px, .8fr) minmax(56px, .7fr) minmax(70px, 1fr) minmax(48px, .5fr); align-items: center; gap: .6rem; padding: .55rem .6rem; background: #f8f7f1; border: 1px solid #e7e6dd; border-radius: .42rem; font-size: .69rem; font-variant-numeric: tabular-nums; }
.record-row.header { padding: 0 .65rem .2rem; background: transparent; border: 0; color: #7a867d; font-size: .61rem; font-weight: 800; }
.record-row strong { overflow-wrap: anywhere; color: #395240; font-weight: 800; }
.record-row span { overflow-wrap: anywhere; color: #637168; }
.records-note { margin: .6rem 0 .75rem; color: #708075; font-size: .69rem; line-height: 1.55; }
.text-link { font-size: .74rem; }
.page-footer { display: flex; justify-content: space-between; gap: 1rem; margin-top: 1.25rem; color: #707d72; font-size: .66rem; }

@media (max-width: 1000px) {
  .hero[data-shape="landscape"] .hero-body { grid-template-columns: minmax(0, 1fr); }
  .hero[data-shape="landscape"] .hero-map { margin-inline: auto; }
  .hero[data-shape="portrait"] .hero-body { grid-template-columns: minmax(0, calc(var(--hero-h) * var(--map-ratio))) minmax(250px, 1fr); }
  .hero[data-shape="portrait"] .hero-rail { columns: 1; }
}
@media (max-width: 860px) {
  .topbar { grid-template-columns: minmax(0, 1fr) auto; row-gap: .6rem; }
  .site-tabs { grid-column: 1 / -1; grid-row: 2; }
  .site-tab { flex: 1 1 0; justify-content: center; min-width: 0; }
}
@media (max-width: 560px) {
  .site-tab { flex-direction: column; gap: .15rem; min-height: 3.1rem; padding: .35rem .25rem; font-size: .8rem; }
  .site-tab-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .site-tab-count { font-size: .62rem; }
}
@media (max-width: 800px) {
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lower-grid { grid-template-columns: 1fr; }
  .map-toolbar { grid-template-columns: 1fr; }
  .map-actions { grid-row: 2; }

}
@media (max-width: 560px) {
  .page-shell { width: min(100% - .7rem, 1440px); padding-top: .4rem; }
  .topbar { padding: .7rem .65rem; }
  .brand { gap: .45rem; font-size: .63rem; letter-spacing: .06em; }
  .brand-mark { width: 1.75rem; height: 1.75rem; }
  .language-switcher { grid-template-columns: repeat(3, 1.9rem); }
  .language-thumb { width: 1.9rem; }
  .language-switcher[data-current="sw"] .language-thumb { transform: translateX(1.9rem); }
  .language-switcher[data-current="ja"] .language-thumb { transform: translateX(3.8rem); }
  .snapshot-date { font-size: .6rem; }
  .intro { align-items: flex-start; flex-direction: column; gap: .8rem; }
  .intro-copy { font-size: .82rem; }
  .intro-actions { width: 100%; }
  .source-link { flex: 1; justify-content: center; }
  .summary-grid { gap: .55rem; }
  .summary-card { min-height: 104px; padding: .75rem; }
  .summary-card strong { font-size: 2rem; }
  .summary-note { font-size: .67rem; }
  .map-panel { padding: .45rem; }
  .map-toolbar { gap: .5rem; padding: .2rem; }
  .map-actions { width: 100%; }
  .map-actions .source-link { flex: 0 0 auto; }
  .panel-heading { align-items: flex-start; }
  .approx-badge { white-space: normal; text-align: center; }
  .map-frame { width: 100%; }
  .map-legend { gap: .5rem .75rem; font-size: .63rem; }
  .map-notes { align-items: flex-start; flex-direction: column; gap: .35rem; padding-inline: .2rem; }
  .map-tooltip { font-size: .65rem; }
  .map-tooltip dl div { grid-template-columns: 6.6rem 1fr; }
  .detail-panel, .records-panel { padding: .8rem; }
  .history-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .record-row { gap: .3rem; padding: .5rem .38rem; font-size: .61rem; }
  .record-row.header { padding-left: .38rem; padding-right: .38rem; font-size: .56rem; }
  .page-footer { flex-direction: column; gap: .25rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}

/* Mobile: tappable beds */
.view-controls { display: none; }
.bed-grid[hidden], .bed-sheet[hidden] { display: none; }
.bed-sheet { display: none; }
@media (max-width: 720px) {
  .view-controls { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin: 0 0 .5rem; }
  .view-switch { display: inline-grid; grid-template-columns: 1fr 1fr; overflow: hidden; border: 1px solid #9aab9e; border-radius: .65rem; background: var(--paper); }
  .view-switch button { min-height: 46px; padding: 0 1.3rem; color: var(--forest); background: transparent; border: 0; font: inherit; font-size: .85rem; font-weight: 850; cursor: pointer; }
  .view-switch button[aria-checked="true"] { color: #fff; background: var(--forest); }
  .zoom-controls { display: flex; gap: .4rem; }
  .zoom-controls[hidden] { display: none; }
  .zoom-controls button { width: 46px; height: 46px; color: var(--forest); background: var(--paper); border: 1px solid #9aab9e; border-radius: .65rem; font: inherit; font-size: 1.5rem; font-weight: 800; line-height: 1; cursor: pointer; }
  .map-frame { width: 100%; max-height: 72vh; overflow: auto; overscroll-behavior: contain; touch-action: pan-x pan-y; }
  .map-frame[hidden] { display: none; }
  #yard-map { width: calc(var(--zoom, 2) * 100%); max-width: none; }
  .bed-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .4rem; padding: .2rem 0 .6rem; }
  .grid-bed { display: grid; grid-template-rows: auto auto auto; place-items: center; gap: 0; min-height: 66px; padding: .3rem .1rem; color: #14201a; background: var(--unknown); border: 2px solid #0003; border-radius: .6rem; font: inherit; cursor: pointer; }
  .grid-bed strong { font-size: 1.15rem; line-height: 1.1; }
  .grid-bed small { font-size: .56rem; font-weight: 700; line-height: 1.1; }
  .grid-bed-icon { font-size: .6rem; font-weight: 900; }
  .grid-bed.state-green { background: var(--green); }
  .grid-bed.state-orange { color: #fff; background: var(--orange); }
  .grid-bed.state-red { color: #fff; background: var(--red); }
  .grid-bed.state-empty { background: #fffdf8; border-style: dashed; }
  .grid-bed.state-invalid { background: repeating-linear-gradient(135deg, #d8dde1 0 6px, #9aa5ad 6px 10px); }
  .grid-bed.state-confirm { box-shadow: inset 0 0 0 3px #ffe45c; }
  .bed-sheet { display: block; position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; max-height: 62vh; overflow: auto; padding: .9rem 1rem calc(1rem + env(safe-area-inset-bottom)); color: #f8f7f1; background: #17251ff5; border-top: 3px solid #dfe8df; border-radius: 1rem 1rem 0 0; box-shadow: 0 -10px 30px #0008; font-size: .8rem; line-height: 1.5; }
  .bed-sheet[hidden] { display: none; }
  .bed-sheet-close { position: absolute; top: .45rem; right: .55rem; width: 44px; height: 44px; color: #fff; background: transparent; border: 0; font-size: 1.8rem; cursor: pointer; }
  .bed-sheet dl { display: grid; gap: .4rem; margin: .5rem 0 0; }
  .bed-sheet dl div { display: grid; grid-template-columns: 7.4rem 1fr; gap: .5rem; }
  .bed-sheet dt { color: #b9cabe; }
  .bed-sheet dd { margin: 0; font-weight: 800; }
  .bed-sheet dd small { display: block; color: #bac8bf; font-size: .62rem; font-weight: 500; }
  .bed-sheet .tooltip-title { display: block; padding-right: 2.5rem; font-size: .95rem; }
  .map-tooltip { display: none; }
}

/* Hero rail: beds in use, due out (Date In + drying days), recent Date Out */
.hero-rail { columns: 3 260px; column-gap: .7rem; min-width: 0; }
.hero-rail > .rail-block { break-inside: avoid; margin-bottom: .7rem; }
.rail-block { container-type: inline-size; min-width: 0; padding: .85rem .9rem; background: #f8f7f1; border: 1px solid #e3e2d8; border-radius: .7rem; }
.rail-label { display: block; color: #65756c; font-size: .63rem; font-weight: 800; letter-spacing: .11em; }
.rail-big { display: flex; align-items: baseline; gap: .4rem; margin: .35rem 0 .55rem; }
.rail-big strong { color: var(--forest); font-size: clamp(2.2rem, 3.6vw, 2.9rem); font-variant-numeric: tabular-nums; line-height: 1; letter-spacing: -.02em; }
.rail-big span { color: var(--muted); font-size: .95rem; font-weight: 750; }
.rail-big em { margin-left: auto; padding: .15rem .5rem; color: #5a4416; background: #f6e7bd; border-radius: 99px; font-size: .72rem; font-style: normal; font-weight: 900; font-variant-numeric: tabular-nums; }
.state-bar { display: flex; gap: 2px; height: .72rem; overflow: hidden; background: #e6e5dc; border-radius: 99px; }
.state-bar-seg { min-width: 3px; background: var(--unknown); }
.state-bar-seg.state-green { background: var(--green); }
.state-bar-seg.state-orange { background: var(--orange); }
.state-bar-seg.state-red { background: var(--red); }
.state-bar-seg.state-invalid { background: repeating-linear-gradient(135deg, #d8dde1 0 3px, #697580 3px 5px); }
.state-bar-seg.state-empty { background: #fff; box-shadow: inset 0 0 0 1px #b9bdb1; }
.rail-note { margin: .45rem 0 .6rem; color: #6c7a70; font-size: .68rem; font-weight: 650; }
.state-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .3rem .6rem; margin: 0; padding: .6rem 0 0; border-top: 1px solid #e3e2d8; list-style: none; }
.state-row { display: grid; grid-template-columns: 1.35rem minmax(0, 1fr) auto; align-items: center; gap: .45rem; min-width: 0; }
.state-row-icon { display: grid; place-items: center; width: 1.35rem; height: 1.35rem; color: #192016; background: var(--unknown); border: 1px solid #0003; border-radius: .3rem; font-size: .62rem; font-weight: 950; }
.state-row.state-green .state-row-icon { background: var(--green); }
.state-row.state-orange .state-row-icon { color: #fff; background: var(--orange); }
.state-row.state-red .state-row-icon, .state-row.state-confirm .state-row-icon { color: #fff; background: var(--red); }
.state-row.state-confirm .state-row-icon { box-shadow: inset 0 0 0 2px #ffe45c; }
.state-row.state-empty .state-row-icon { background: #fff; border-style: dashed; }
.state-row-label { min-width: 0; color: #4f6055; font-size: .7rem; font-weight: 800; line-height: 1.25; }
.state-row-label small { display: block; color: #828c84; font-size: .56rem; font-weight: 600; }
.state-row strong { color: var(--forest); font-size: .98rem; font-variant-numeric: tabular-nums; }
.state-row.is-zero { opacity: .5; }
.rail-heading { display: grid; gap: .1rem; margin: 0 0 .55rem; color: var(--forest); font-size: .82rem; }
.rail-heading small { color: #788479; font-size: .62rem; font-weight: 650; }
.rail-empty { margin: 0; color: #6f7c73; font-size: .72rem; }
.rail-more { display: block; width: 100%; margin: .45rem 0 0; padding: .45rem .5rem; color: var(--forest); background: #fff; border: 1px dashed #b9c6b7; border-radius: .5rem; cursor: pointer; font-size: .7rem; font-weight: 850; }
.rail-more:hover { background: #eef3ea; }
.rail-total { margin: -.2rem 0 .5rem; color: #4f6055; font-size: .7rem; font-weight: 800; }
.rail-total.is-over { color: #9b3328; }
.event-list { display: grid; gap: .38rem; margin: 0; padding: 0; list-style: none; }
.event-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: .35rem .5rem; padding: .48rem .55rem; background: #fff; border: 1px solid #e5e4da; border-radius: .5rem; }
.event-dates { display: flex; align-items: baseline; gap: .35rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.event-arrow { color: #9aa59c; font-size: .7rem; }
.event-dates strong { color: #2f4a3a; font-size: .76rem; }
.event-dates span { color: #6e7b72; font-size: .7rem; font-weight: 700; }
.event-tag { padding: .16rem .45rem; border-radius: 99px; font-size: .62rem; font-weight: 900; white-space: nowrap; }
.event-tag.tone-neutral { color: #34503f; background: #e8ede4; }
.event-tag.tone-orange { color: #fff; background: var(--orange); }
.event-tag.tone-red { color: #fff; background: var(--red); }
.event-tag.tone-out { color: #24503a; background: #e1ece4; }
.event-tag.tone-invalid { color: #3b454c; background: #d8dde1; }
.event-beds { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .25rem; }
.bed-chip { min-width: 1.95rem; height: 1.6rem; padding: 0 .35rem; color: var(--forest); background: #f1f3ec; border: 1px solid #cfd8cb; border-radius: .4rem; cursor: pointer; font-size: .68rem; font-weight: 850; font-variant-numeric: tabular-nums; }
.bed-chip:hover { background: #e3eddf; border-color: #9fb59f; }
.bed-chip-more { align-self: center; color: #6f7c73; font-size: .64rem; font-weight: 800; }
@media (max-width: 720px) {
  .hero-map { max-width: none; }
  .hero-rail { columns: 1; }
  .bed-chip { min-width: 2.6rem; height: 2.4rem; font-size: .8rem; }
}

.hero-map { position: relative; }
.pan-hint { position: absolute; z-index: 5; top: .5rem; left: 50%; margin: 0; padding: .35rem .7rem; color: #fff; background: #17251fdd; border-radius: 99px; box-shadow: 0 3px 10px #0005; font-size: .72rem; font-weight: 800; white-space: nowrap; transform: translateX(-50%); pointer-events: none; }
@media (max-width: 720px) {
  .hero[data-shape] .hero-body { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .map-toolbar { grid-template-columns: minmax(0, 1fr) auto; align-items: end; }
  .map-actions { grid-row: auto; width: auto; }
  .map-actions .source-link { padding: .55rem .7rem; font-size: .72rem; }
}

@container (max-width: 280px) {
  .state-list { grid-template-columns: minmax(0, 1fr); }
}
:lang(ja) .state-row-label, :lang(ja) .rail-heading small, :lang(ja) .rail-note { word-break: keep-all; overflow-wrap: anywhere; }
.detail-body:has(> .empty-detail) { min-height: 0; }

@media (min-width: 721px) {
  .map-title-group .eyebrow { display: none; }
  .map-toolbar { margin-bottom: .5rem; }
  .map-actions .source-link { padding: .55rem .9rem; }
}
