* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font: 14px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; color: #1d1f23; background: #f3f3f1; }
body { display: grid; grid-template-rows: auto 1fr auto; }

.bar { display: flex; flex-wrap: wrap; gap: 10px 22px; align-items: center; padding: 10px 14px; background: #fff; border-bottom: 1px solid #ddd; }
#search { display: flex; gap: 6px; flex: 1 1 360px; }
#q { flex: 1; padding: 7px 10px; border: 1px solid #bbb; border-radius: 6px; font: inherit; }
button { padding: 7px 14px; border: 0; border-radius: 6px; background: #b3261e; color: #fff; font: inherit; cursor: pointer; }
button:disabled { opacity: .5; cursor: wait; }
.ctl { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.ctl output { min-width: 4.5em; font-variant-numeric: tabular-nums; color: #555; }
.sun input[type=range] { width: 160px; }
.sun input[type=date] { font: inherit; padding: 3px 4px; }

main { display: grid; grid-template-columns: 1fr 340px; min-height: 0; }
#view { position: relative; min-height: 0; overflow: hidden; }
#view canvas { display: block; width: 100%; height: 100%; }
.status { position: absolute; left: 12px; top: 12px; max-width: 70%; padding: 6px 10px; border-radius: 6px; background: rgba(255,255,255,.92); box-shadow: 0 1px 4px rgba(0,0,0,.15); pointer-events: none; }
.status.error { background: #fde8e6; color: #8c1d18; }
.status:empty { display: none; }
#compass { position: absolute; right: 14px; top: 14px; width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,.9); box-shadow: 0 1px 4px rgba(0,0,0,.2); display: grid; place-items: center; }
#compass span { font-weight: 700; color: #b3261e; display: inline-block; }
#compass span::before { content: "▲"; display: block; font-size: 10px; line-height: 8px; text-align: center; }
.legend { position: absolute; left: 12px; bottom: 104px; transition: bottom .15s; display: flex; gap: 12px; padding: 5px 9px; border-radius: 6px; background: rgba(255,255,255,.88); font-size: 12px; }
.sw { display: inline-block; width: 11px; height: 11px; margin-right: 4px; vertical-align: -1px; border-radius: 2px; }
.sw.target { background: #d2452f; } .sw.sel { background: #2f6fd2; } .sw.wall { background: #d9d9d6; } .sw.roof { background: #8b8f96; } .sw.sa { background: #e0c26a; }

#panel { overflow: auto; padding: 14px 16px; background: #fff; border-left: 1px solid #ddd; }
#panel h2 { margin: 0 0 4px; font-size: 17px; }
#panel h3 { margin: 16px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: #777; }
#panel dl { display: grid; grid-template-columns: 42% 1fr; gap: 4px 10px; margin: 0; }
#panel dt { color: #666; }
#panel dd { margin: 0; font-variant-numeric: tabular-nums; word-break: break-word; }
#panel .na { color: #aaa; }
#panel .tag { display: inline-block; padding: 1px 6px; border-radius: 4px; background: #d2452f; color: #fff; font-size: 11px; vertical-align: 2px; }
.muted { color: #888; }
.note { font-size: 12px; color: #777; margin-top: 14px; }

footer { padding: 6px 14px; font-size: 12px; color: #555; background: #fff; border-top: 1px solid #ddd; }
footer a { color: inherit; }

@media (max-width: 860px) {
  main { grid-template-columns: 1fr; grid-template-rows: 60vh auto; }
  #panel { border-left: 0; border-top: 1px solid #ddd; }
}

.sa-img { width: 100%; max-height: 170px; object-fit: cover; border-radius: 6px; margin: 2px 0 8px; }
.vacancy { margin: 10px 0 6px; padding: 7px 9px; border-radius: 6px; background: #fff6d6; border: 1px solid #f2d27a; font-size: 13px; }
.vacancy:empty { display: none; }
label.floors { display: block; margin-top: 8px; font-size: 13px; }

/* ---------- Sonnenleiste ---------- */
#sunbar { position: absolute; left: 12px; right: 12px; bottom: 12px; padding: 8px 12px 6px; border-radius: 10px;
  background: rgba(255,255,255,.94); box-shadow: 0 2px 10px rgba(0,0,0,.18); font-size: 13px; user-select: none; }
#sunbar.off .sun-track, #sunbar.off .presets, #sunbar.off #sunDate, #sunbar.off #sunPlay { opacity: .35; pointer-events: none; }
.sun-row { display: flex; align-items: center; gap: 10px; flex-wrap: nowrap; min-width: 0; }
.sun-toggle { white-space: nowrap; font-weight: 600; }
#sunbar button { padding: 3px 8px; background: #f1f1ef; color: #222; border: 1px solid #d5d5d0; border-radius: 5px; font-size: 12px; }
#sunbar button.active { background: #b3261e; border-color: #b3261e; color: #fff; }
#sunbar button.icon { width: 30px; padding: 3px 0; font-size: 13px; }
#sunDate { font: inherit; padding: 2px 4px; }
.presets { display: flex; gap: 4px; }
.sun-readout { margin-left: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #555; font-variant-numeric: tabular-nums; }
#sunClock { display: inline-block; width: 3.2em; font-size: 16px; color: #1d1f23; text-align: right; }
#sunInfo { display: inline-block; width: 36em; max-width: 100%; vertical-align: bottom; overflow: hidden; text-overflow: ellipsis; }
.sun-track { position: relative; margin-top: 6px; }
#sunTime { width: 100%; margin: 0; height: 22px; -webkit-appearance: none; appearance: none; background: transparent; cursor: pointer; }
#sunTime::-webkit-slider-runnable-track { height: 10px; border-radius: 5px; background: var(--daygrad, #ddd); }
#sunTime::-moz-range-track { height: 10px; border-radius: 5px; background: var(--daygrad, #ddd); }
#sunTime::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -4px; border-radius: 50%; background: #f2b705; border: 2px solid #fff; box-shadow: 0 0 0 1px #b48700, 0 1px 3px rgba(0,0,0,.3); }
#sunTime::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: #f2b705; border: 2px solid #fff; box-shadow: 0 0 0 1px #b48700; }
.sun-scale { display: flex; justify-content: space-between; padding: 0 7px; font-size: 10px; color: #888; font-variant-numeric: tabular-nums; }
@media (max-width: 1100px) { .presets { display: none; } #sunInfo { width: 22em; } }

/* ---------- Zeitleiste (Time-Slider) ---------- */
.sw.hist { background: #9b7fc9; }
.legend .tl-only { display: none; }
body.timeline-on .legend .tl-only { display: inline; }
body.has-timeline .legend { bottom: 156px; }
#timebar { position: absolute; left: 12px; right: 12px; bottom: 98px; display: flex; align-items: center; gap: 10px; padding: 6px 12px; border-radius: 10px;
  background: rgba(255,255,255,.94); box-shadow: 0 2px 10px rgba(0,0,0,.18); font-size: 13px; user-select: none; }
#timebar[hidden] { display: none; }
.time-toggle { white-space: nowrap; font-weight: 600; }
#timebar button { padding: 3px 0; width: 30px; background: #f1f1ef; color: #222; border: 1px solid #d5d5d0; border-radius: 5px; font-size: 13px; }
#timeYear { min-width: 3.4em; font-size: 16px; text-align: right; font-variant-numeric: tabular-nums; }
.time-track { flex: 1; min-width: 120px; position: relative; }
#timeYearRange { width: 100%; margin: 0; height: 20px; accent-color: #9b7fc9; cursor: pointer; }
.time-scale { position: relative; height: 12px; font-size: 10px; color: #888; font-variant-numeric: tabular-nums; }
.time-scale span { position: absolute; transform: translateX(-50%); }
.time-scale span.lod2 { color: #b3261e; }
.time-info { color: #555; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 38%; font-variant-numeric: tabular-nums; }
#timebar.off .time-track, #timebar.off #timePlay, #timebar.off #timeYear { opacity: .35; }
@media (max-width: 1100px) { .time-info { display: none; } }
#panel .tag.hist { background: #7a5fae; }
.sw.water { background: #2f4a55; }
.nav-hint { font-size: 12px; color: #777; white-space: nowrap; cursor: help; }
@media (max-width: 860px) { .nav-hint { display: none; } }
.fx { display: flex; gap: 12px; font-size: 13px; white-space: nowrap; }
.fx label { display: flex; align-items: center; gap: 4px; cursor: pointer; }
@media (max-width: 1100px) { .fx { display: none; } }
