/* ParkSketch 2 – visual design
   Calm grouped surfaces in the spirit of iOS / iPadOS: a soft grey canvas, white rounded cards, translucent
   bars, one accent blue and the familiar system colours (blue #007aff, green #34c759, red #ff3b30,
   orange #ff9500, indigo #5856d6, teal #30b0c7, pink #ff2d55). */
:root {
  --bg: #f2f2f7; --bg2: #e9e9ef; --card: #ffffff; --ink: #1c1c1e; --ink2: #3a3a3c; --muted: #8a8a8e; --muted2: #aeaeb2;
  --line: rgba(60,60,67,.12); --line2: rgba(60,60,67,.2); --fill: rgba(118,118,128,.12); --fill2: rgba(118,118,128,.08);
  --blue: #007aff; --blue-d: #0062cc; --blue-t: rgba(0,122,255,.1);
  --green: #34c759; --green-d: #248a3d; --red: #ff3b30; --red-d: #d70015; --orange: #ff9500; --yellow: #ffcc00;
  --indigo: #5856d6; --teal: #30b0c7; --pink: #ff2d55; --purple: #af52de;
  --ok: var(--green-d); --bad: var(--red-d);
  --r-s: 9px; --r: 12px; --r-l: 16px; --r-xl: 22px;
  --sh-1: 0 1px 2px rgba(0,0,0,.04), 0 0 0 .5px rgba(0,0,0,.035);
  --sh-2: 0 6px 20px rgba(0,0,0,.08), 0 1px 3px rgba(0,0,0,.05);
  --sh-3: 0 24px 60px rgba(0,0,0,.18), 0 6px 16px rgba(0,0,0,.08);
  --glass: saturate(180%) blur(22px);
  --side: 344px; --res: 316px; --top: 58px; --gap: 10px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font: 13px/1.45 var(--font); letter-spacing: -0.008em; color: var(--ink); background: var(--bg); overflow: hidden; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
button, input, select, textarea { font: inherit; letter-spacing: inherit; color: inherit; }
.hidden { display: none !important; }
.ic { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
::selection { background: rgba(0,122,255,.22); }
.muted { color: var(--muted); }

/* ---------- controls ---------- */
button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap;
  border: 0; background: var(--fill); color: var(--ink); border-radius: var(--r-s); padding: 6px 12px; min-height: 31px;
  cursor: pointer; font-weight: 500; transition: background .15s, color .15s, box-shadow .15s, transform .1s;
}
button:hover { background: rgba(118,118,128,.18); }
button:active { transform: scale(.97); }
button:disabled { opacity: .45; cursor: default; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; box-shadow: 0 0 0 3.5px rgba(0,122,255,.35); }
button.primary { background: var(--blue); color: #fff; box-shadow: 0 1px 2px rgba(0,98,204,.25); }
button.primary:hover { background: var(--blue-d); }
button.danger { color: var(--red-d); }
button.danger:hover { background: rgba(255,59,48,.1); }
button.small { padding: 3px 11px; min-height: 27px; font-size: 12px; border-radius: 999px; }
button.tool.active { background: var(--orange); color: #fff; box-shadow: 0 2px 8px rgba(255,149,0,.35); }

input[type=number], input:not([type]), input[type=text], input[type=password], select, textarea {
  width: 100%; border: 0; border-radius: var(--r-s); padding: 7px 10px; min-height: 33px;
  background: var(--fill2); box-shadow: inset 0 0 0 1px var(--line); color: var(--ink); transition: box-shadow .15s, background .15s;
}
textarea { resize: vertical; line-height: 1.45; }
input[type=number]:hover, input:not([type]):hover, select:hover, textarea:hover { background: rgba(118,118,128,.12); }
input[type=number]:focus, input:not([type]):focus, input[type=text]:focus, input[type=password]:focus, select:focus, textarea:focus { background: #fff; box-shadow: inset 0 0 0 1px var(--blue), 0 0 0 3.5px rgba(0,122,255,.22); outline: none; }
select { appearance: none; -webkit-appearance: none; padding-right: 28px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='14' viewBox='0 0 10 14'%3E%3Cpath d='M2 5l3-3 3 3M2 9l3 3 3-3' fill='none' stroke='%238a8a8e' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }
input[type=checkbox], input[type=radio] { accent-color: var(--blue); }

input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 24px; background: transparent; margin: 4px 0 0; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(var(--blue), var(--blue)) 0 / var(--pct, 50%) 100% no-repeat, rgba(118,118,128,.2); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -9px; border-radius: 50%; background: #fff; box-shadow: 0 0.5px 4px rgba(0,0,0,.12), 0 3px 8px rgba(0,0,0,.15), 0 0 0 .5px rgba(0,0,0,.04); }
input[type=range]::-moz-range-track { height: 4px; border-radius: 2px; background: rgba(118,118,128,.2); }
input[type=range]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--blue); }
input[type=range]::-moz-range-thumb { width: 22px; height: 22px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0,0,0,.15), 0 0 0 .5px rgba(0,0,0,.06); }

/* iOS switch */
label.switch input, .li.switch input { -webkit-appearance: none; appearance: none; width: 42px; height: 25px; min-height: 0; padding: 0; border-radius: 999px; background: rgba(120,120,128,.18); box-shadow: none; position: relative; cursor: pointer; transition: background .22s; flex: none; margin: 0; }
label.switch input::after, .li.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 21px; height: 21px; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0,0,0,.15), 0 1px 1px rgba(0,0,0,.08); transition: transform .22s cubic-bezier(.3,.7,.4,1.2); }
label.switch input:checked, .li.switch input:checked { background: var(--green); }
label.switch input:checked::after, .li.switch input:checked::after { transform: translateX(17px); }

/* coloured symbol tiles (like the icons in iOS Settings) */
.sym { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; flex: none; color: #fff; box-shadow: inset 0 -1px 0 rgba(0,0,0,.08); }
.sym svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.sym.big { width: 58px; height: 58px; border-radius: 15px; margin: 0 auto; box-shadow: 0 8px 20px rgba(0,0,0,.12); }
.sym.big svg { width: 32px; height: 32px; stroke-width: 1.6; }
.c-blue { background: linear-gradient(180deg, #3d9bff, #007aff); }
.c-green { background: linear-gradient(180deg, #4cd471, #28b14c); }
.c-orange { background: linear-gradient(180deg, #ffad33, #ff9000); }
.c-indigo { background: linear-gradient(180deg, #7472e8, #5450d1); }
.c-teal { background: linear-gradient(180deg, #47c3d8, #24a5bd); }
.c-pink { background: linear-gradient(180deg, #ff5577, #f2264c); }

/* ---------- top bar ---------- */
#topbar {
  position: relative; z-index: 1000; height: var(--top); display: flex; align-items: center; gap: 10px; padding: 0 14px 0 16px;
  background: rgba(248,248,250,.82); -webkit-backdrop-filter: var(--glass); backdrop-filter: var(--glass);
  border-bottom: .5px solid var(--line2);
}
#topbar .brand { display: flex; align-items: center; gap: 9px; white-space: nowrap; }
#topbar .logo { width: 30px; height: 30px; display: block; filter: drop-shadow(0 2px 4px rgba(0,90,200,.25)); }
#topbar .logo svg { width: 100%; height: 100%; display: block; }
#topbar .brand-name { font-weight: 650; font-size: 15px; letter-spacing: -0.02em; }
.ver-chip { min-height: 20px; padding: 1px 8px; font-size: 11px; font-weight: 600; color: var(--muted); background: var(--fill2); border-radius: 999px; font-variant-numeric: tabular-nums; }
.ver-chip:hover { color: var(--blue); background: var(--blue-t); }
#topbar .proj { display: flex; flex-direction: column; justify-content: center; min-width: 120px; max-width: 240px; flex: 0 1 240px; margin-left: 6px; padding-left: 14px; border-left: .5px solid var(--line2); }
#topbar .proj-name { background: transparent; box-shadow: none; padding: 1px 6px; min-height: 24px; font-weight: 600; font-size: 14px; letter-spacing: -0.015em; border-radius: 6px; }
#topbar .proj-name:hover { background: var(--fill2); }
#topbar .proj-name:focus { background: #fff; }
#topbar .save-state { font-size: 11px; color: var(--muted); padding: 0 6px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#topbar .save-state::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--green); margin-right: 5px; vertical-align: 1px; }
#topbar .save-state.bad { color: var(--red-d); }
#topbar .save-state.bad::before { background: var(--red); }
#topbar .country { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); white-space: nowrap; }
#topbar .country > span { display: none; }
#topbar .country select { width: auto; max-width: 210px; min-height: 31px; padding-top: 5px; padding-bottom: 5px; font-weight: 500; border-radius: 999px; padding-left: 13px; }
.spacer { flex: 1; }
.tb-group { display: flex; gap: 4px; align-items: center; }
.seg-group { gap: 1px; background: var(--fill2); padding: 2px; border-radius: 999px; }
.seg-group .tb { background: transparent; border-radius: 999px; }
.seg-group .tb:hover { background: #fff; box-shadow: var(--sh-1); }
button.tb { background: transparent; color: var(--ink2); padding: 6px 10px; border-radius: 999px; position: relative; }
button.tb:hover { background: var(--fill); color: var(--ink); }
button.tb.icon-only { padding: 6px 8px; width: 34px; }
button.tb .dot { position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: transparent; }
button.tb .dot.on { background: var(--green); box-shadow: 0 0 0 1.5px #f8f8fa; }

/* workspace switch: Design · Model · Plans */
.ws-switch { display: flex; gap: 2px; padding: 3px; border-radius: 999px; background: rgba(118,118,128,.12); }
.ws-switch button { min-height: 30px; padding: 4px 16px 4px 13px; border-radius: 999px; background: transparent; color: var(--ink2); font-weight: 600; font-size: 13px; gap: 7px; }
.ws-switch button .ic { width: 16px; height: 16px; }
.ws-switch button:hover { background: rgba(255,255,255,.55); }
.ws-switch button.on { background: #fff; color: var(--ink); box-shadow: 0 3px 8px rgba(0,0,0,.1), 0 1px 1px rgba(0,0,0,.05); }
.ws-switch button.on .ic { color: var(--blue); }

/* ---------- update banner ---------- */
#updateBar {
  position: fixed; z-index: 2600; top: calc(var(--top) + 12px); left: 50%; transform: translate(-50%, -16px); opacity: 0;
  display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 16px; border-radius: 999px;
  background: rgba(255,255,255,.88); -webkit-backdrop-filter: var(--glass); backdrop-filter: var(--glass);
  box-shadow: var(--sh-3), inset 0 0 0 .5px rgba(0,0,0,.08); font-size: 13px; white-space: nowrap;
  transition: transform .35s cubic-bezier(.2,.9,.3,1.2), opacity .25s;
}
#updateBar.show { transform: translate(-50%, 0); opacity: 1; }
#updateBar .spark { color: var(--blue); width: 18px; height: 18px; }
button.pill { border-radius: 999px; padding: 5px 15px; min-height: 30px; font-size: 12.5px; font-weight: 600; background: var(--fill); color: var(--blue); }
button.pill:hover { background: rgba(118,118,128,.2); }
button.pill.primary { background: var(--blue); color: #fff; }
button.pill.primary:hover { background: var(--blue-d); }
button.pill.ghost { background: transparent; color: var(--muted); }
button.pill.ghost:hover { background: var(--fill); color: var(--ink); }

/* ---------- Design workspace ---------- */
#layout { display: grid; grid-template-columns: var(--side) 1fr var(--res); height: calc(100% - var(--top)); }
body:not(.ws-design) #layout { visibility: hidden; }
#side, #results { overflow-y: auto; background: var(--bg); scrollbar-width: thin; scrollbar-color: rgba(0,0,0,.16) transparent; }
#side { padding: 12px 6px 22px 12px; }
#results { padding: 14px 12px 24px 6px; }
#side::-webkit-scrollbar, #results::-webkit-scrollbar { width: 8px; }
#side::-webkit-scrollbar-thumb, #results::-webkit-scrollbar-thumb { background: rgba(0,0,0,.14); border-radius: 8px; border: 2px solid var(--bg); }

/* sidebar sections as grouped cards */
.panel { background: var(--card); border-radius: var(--r-l); box-shadow: var(--sh-1); margin-bottom: 10px; overflow: hidden; }
.panel > h3 { margin: 0; padding: 11px 12px 11px 12px; font-size: 14px; font-weight: 600; letter-spacing: -0.015em; cursor: pointer; user-select: none; display: flex; align-items: center; gap: 11px; }
.panel > h3:hover { background: rgba(0,0,0,.015); }
.panel > h3 .ttl { flex: 1; }
.panel > h3 .chev { width: 14px; height: 14px; fill: none; stroke: var(--muted2); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transition: transform .25s cubic-bezier(.3,.7,.4,1); }
.panel.open > h3 .chev { transform: rotate(90deg); }
.panel .body { display: none; padding: 0 14px 14px; border-top: .5px solid var(--line); }
.panel.open .body { display: block; animation: reveal .25s ease-out; }
@keyframes reveal { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.body label { display: block; margin: 11px 0 0; color: var(--muted); font-size: 12px; font-weight: 500; }
.body label > input, .body label > select { margin-top: 5px; color: var(--ink); font-weight: 400; }
.body label.check { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 13px; }
.body label.check input { width: auto; margin: 0; }
.row { display: flex; gap: 6px; align-items: center; }
.btns { display: flex; flex-wrap: wrap; gap: 6px; margin: 11px 0 4px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; align-items: end; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 8px; align-items: end; }
.sub { background: var(--bg); border-radius: var(--r); padding: 4px 11px 11px; margin-top: 11px; }
.sub .hint { margin-top: 8px; }
.hint { color: var(--muted); font-size: 11.5px; line-height: 1.5; margin: 8px 0; }
.hint b { color: var(--ink2); font-weight: 600; }
.stats { background: var(--blue-t); color: #004a99; border-radius: var(--r-s); padding: 9px 11px; margin-top: 11px; font-size: 12px; line-height: 1.5; }
.stats:empty { display: none; }
.val { float: right; color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.subhead { margin: 18px 0 2px; font-size: 13px; font-weight: 600; letter-spacing: -0.01em; }
.side-foot { color: var(--muted); font-size: 11px; text-align: center; padding: 6px 16px; line-height: 1.5; }
.side-foot b { font-weight: 600; color: var(--ink2); }

form.search { position: relative; margin-top: 12px; }
form.search .sicon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--muted); pointer-events: none; }
form.search input { padding-left: 31px; border-radius: 999px; }
form.search button { flex: none; border-radius: 999px; }
.results-list { list-style: none; margin: 6px 0 0; padding: 0; max-height: 180px; overflow: auto; border-radius: var(--r-s); }
.results-list:not(:empty) { background: var(--bg); padding: 4px; }
.results-list li { padding: 7px 9px; border-radius: 7px; cursor: pointer; font-size: 12px; }
.results-list li:hover { background: var(--blue); color: #fff; }
.results-list li.muted { color: var(--muted); cursor: default; background: none; }

.seg { display: flex; gap: 2px; background: rgba(118,118,128,.12); padding: 2px; border-radius: 10px; margin-top: 12px; }
.seg label { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; margin: 0; padding: 6px 8px; border-radius: 8px; font-size: 12.5px; font-weight: 500; color: var(--ink); cursor: pointer; transition: background .2s, box-shadow .2s; }
.seg label input { position: absolute; opacity: 0; pointer-events: none; width: 0; height: 0; }
.seg label:has(input:checked) { background: #fff; box-shadow: 0 3px 8px rgba(0,0,0,.12), 0 3px 1px rgba(0,0,0,.04); font-weight: 600; }
.seg label:has(input:focus-visible) { box-shadow: 0 0 0 3px rgba(0,122,255,.35); }

.progress { height: 4px; background: var(--fill); border-radius: 2px; overflow: hidden; margin: 8px 0; }
.progress > div { height: 100%; width: 0; background: var(--blue); border-radius: 2px; transition: width .15s; }
table.obs { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 11.5px; }
table.obs th { text-align: left; color: var(--muted); font-weight: 500; padding: 0 2px 4px; }
table.obs td { padding: 2px; }
table.obs input { padding: 3px 5px; min-height: 26px; }
table.obs button.x { padding: 1px 6px; min-height: 24px; color: var(--red-d); }
table.obs td.acts { white-space: nowrap; }
table.obs td.acts button { padding: 1px 6px; min-height: 24px; margin-left: 2px; color: var(--ink); }
table.obs td.acts button.del { color: var(--red-d); }
table.obs tr.sub td { font-size: 11px; color: var(--muted); padding-bottom: 6px; }
.oktxt { color: var(--ok); font-weight: 600; } .badtxt { color: var(--bad); font-weight: 600; }

/* map: an inset, rounded window onto the site */
#mapWrap { position: relative; overflow: hidden; margin: var(--gap) 0; border-radius: var(--r-xl); box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 0 0 .5px rgba(0,0,0,.08); isolation: isolate; }
#map { position: absolute; inset: 0; background: #e5e7eb; }
#mapWrap.grid-bg #map { background-color: #fafafa; background-image: linear-gradient(#ececf1 1px, transparent 1px), linear-gradient(90deg, #ececf1 1px, transparent 1px); background-size: 24px 24px; }
#map.crosshair, #map.crosshair .leaflet-interactive { cursor: crosshair; }
.floating { position: absolute; z-index: 800; background: rgba(255,255,255,.8); -webkit-backdrop-filter: var(--glass); backdrop-filter: var(--glass); border-radius: var(--r-l); box-shadow: var(--sh-2), inset 0 0 0 .5px rgba(0,0,0,.06); padding: 8px 12px; }
#levelBar { top: 14px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; align-items: center; max-width: 70%; flex-wrap: wrap; padding: 5px 8px 5px 14px; border-radius: 999px; }
#levelBar .lbl { font-size: 12px; font-weight: 600; color: var(--muted); }
#levelBar #levelBtns { display: flex; gap: 2px; flex-wrap: wrap; background: rgba(118,118,128,.12); padding: 2px; border-radius: 999px; }
#levelBar button { padding: 3px 11px; min-height: 26px; border-radius: 999px; background: transparent; font-weight: 600; font-size: 12px; }
#levelBar button.on { background: #fff; color: var(--blue); box-shadow: 0 2px 6px rgba(0,0,0,.12); }
#levelBar .muted { color: var(--muted); font-size: 12px; padding-right: 4px; font-variant-numeric: tabular-nums; }
#hintBar { bottom: 38px; left: 50%; transform: translateX(-50%); max-width: min(80%, 620px); background: rgba(28,28,30,.84); color: #fff; font-size: 12.5px; line-height: 1.45; padding: 10px 16px; border-radius: var(--r-l); box-shadow: var(--sh-3); }
#legend { right: 12px; top: 12px; display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; padding: 11px 13px; }
#legend .sw { display: inline-block; width: 15px; height: 10px; border: 1.5px solid #0b3d91; border-radius: 3px; margin-right: 7px; vertical-align: -1px; }
#legend .sw.std { background: #464a50; border-color: #fff; outline: 1px solid #464a50; }
#legend .sw.acc { background: #1f5fbf; }
#legend .sw.shared { background: repeating-linear-gradient(45deg, #464a50 0 2px, #ffd200 2px 3.5px); border-color: #ffd200; }
#legend .sw.land { background: #5c8a46; border-color: #3c6a2a; }
#legend .sw.manual { background: #3cc85a; border-color: #2a9a44; }
#legend .sw.removed { border: 1.5px dashed var(--red); }
#legend .sw.unused { background: repeating-linear-gradient(45deg, #6e6e76 0 2px, #9a9aa2 2px 3.5px); border-color: #6e6e76; }
#legend .show { border-top: .5px solid var(--line2); margin-top: 6px; padding-top: 7px; display: flex; flex-direction: column; gap: 3px; }
#legend .show b { font-size: 10.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
#legend .show label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
#legend .show input { margin: 0; }
.layout-canvas { position: absolute; left: 0; top: 0; pointer-events: none; }

/* compass (north symbol) and rotate buttons */
#mapTools { left: 12px; top: 96px; padding: 6px; display: flex; flex-direction: column; align-items: center; gap: 6px; border-radius: 22px; }
.compass { width: 46px; height: 46px; padding: 0; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.12); touch-action: none; }
.compass:hover { background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.16); }
.compass svg { width: 46px; height: 46px; display: block; }
.compass #compassRose { transition: transform .12s linear; }
.compass.turned { box-shadow: 0 0 0 2px rgba(255,59,48,.35), 0 2px 8px rgba(0,0,0,.14); }
.rot-btns { display: flex; flex-direction: column; gap: 2px; }
.rot-btns button { width: 34px; height: 30px; min-height: 0; padding: 0; border-radius: 10px; background: transparent; color: var(--ink2); }
.rot-btns button:hover { background: var(--fill); }
.rot-btns .ic { width: 16px; height: 16px; }

#dropHint { position: absolute; inset: 12px; z-index: 900; display: none; place-items: center; border-radius: var(--r-xl); border: 2.5px dashed var(--blue); background: rgba(0,122,255,.08); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); pointer-events: none; }
#dropHint div { background: rgba(255,255,255,.9); padding: 12px 20px; border-radius: 999px; font-weight: 600; color: var(--blue); box-shadow: var(--sh-2); }
body.dropping #dropHint { display: grid; }

.leaflet-container { font-family: var(--font); }
.leaflet-bar { border: 0 !important; border-radius: 14px !important; overflow: hidden; box-shadow: var(--sh-2), inset 0 0 0 .5px rgba(0,0,0,.06) !important; }
.leaflet-bar a, .leaflet-bar a:hover { width: 36px !important; height: 36px !important; line-height: 36px !important; background: rgba(255,255,255,.86); -webkit-backdrop-filter: var(--glass); backdrop-filter: var(--glass); color: var(--ink2) !important; border-bottom: .5px solid var(--line2) !important; font-weight: 400; font-size: 19px !important; }
.leaflet-bar a:hover { background: #fff; }
.leaflet-top.leaflet-left { top: 6px; left: 6px; }
.leaflet-control-scale-line { border-color: var(--ink2) !important; background: rgba(255,255,255,.82) !important; border-radius: 0 0 5px 5px; font-size: 10.5px !important; }
.leaflet-control-attribution { background: rgba(255,255,255,.72) !important; border-top-left-radius: 9px; font-size: 10px !important; }
.leaflet-control-attribution a { color: var(--blue) !important; }

.leaflet-marker-icon.vtx { background: #fff; border: 2px solid var(--orange); border-radius: 4px; margin-left: -6px !important; margin-top: -6px !important; box-shadow: 0 1px 3px rgba(0,0,0,.35); }
.leaflet-marker-icon.mid { background: rgba(255,149,0,.6); border: 1.5px solid #fff; border-radius: 50%; }
.vtx.rect-side { background: #fff; border: 2px solid var(--blue); border-radius: 4px; }
.rect-move { background: var(--blue); border: 2px solid #fff; border-radius: 50%; box-shadow: 0 1px 4px rgba(0,0,0,.45); cursor: move; }
.rect-rot { background: #fff; border: 3px solid var(--blue); border-radius: 50%; box-shadow: 0 1px 4px rgba(0,0,0,.45); cursor: grab; }
.edge-label span { position: absolute; transform: translate(-50%, -150%); white-space: nowrap; background: rgba(28,28,30,.82); color: #fff; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; pointer-events: none; font-variant-numeric: tabular-nums; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.edge-label.measure span { background: #0a84ff; }
.obs-handle, .entry-handle { border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.45); }
.obs-handle.ramp { background: var(--orange); } .obs-handle.core { background: #48484a; } .obs-handle.nogo { background: var(--red); }
.obs-handle.stair { background: #a2845e; } .obs-handle.lift { background: #48484a; }
.entry-handle { background: var(--blue); }
.obs-handle span, .entry-handle span, .veh-handle span { position: absolute; left: 18px; top: -2px; white-space: nowrap; font-size: 10px; font-weight: 700; color: #fff; background: rgba(28,28,30,.78); padding: 1px 7px; border-radius: 999px; letter-spacing: .02em; }
.veh-handle { background: #ffb300; border: 2px solid #fff; border-radius: 4px; box-shadow: 0 1px 4px rgba(0,0,0,.45); }
.veh-handle span { left: 20px; top: -1px; }
.bh { border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.55); border-radius: 3px; }
.bh.len { background: var(--orange); cursor: ew-resize; }
.bh.wid { background: var(--yellow); cursor: ns-resize; }
.bh.conn { background: var(--yellow); border-radius: 50%; }
.bh.lobby { background: #98989d; }
.bh.row { background: #ff6d00; transform: rotate(45deg); }
.bh.aisle { background: var(--blue); }
.bh.edited { outline: 2px solid #30d158; }
.bh.manual { background: var(--green); cursor: move; }
.bh.rot { background: #fff; border: 3px solid var(--green); border-radius: 50%; cursor: grab; }

/* results column */
.opt-head { display: flex; flex-direction: column; }
#results h3 { margin: 4px 4px 8px; font-size: 22px; font-weight: 700; letter-spacing: -0.028em; }
#results > h3 { font-size: 15px; margin: 22px 4px 8px; letter-spacing: -0.015em; }
.opt-btns { margin: 0 0 4px; gap: 5px; }
.opt-btns button { padding: 4px 11px; min-height: 28px; font-size: 12px; border-radius: 999px; background: var(--card); box-shadow: var(--sh-1); }
.opt-btns button:hover { background: #fff; color: var(--blue); }
.opt-btns button.danger:hover { color: var(--red-d); }
#optTabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 14px; }
#optTabs .tab { flex-direction: column; align-items: flex-start; min-width: 96px; padding: 9px 13px; background: var(--card); border-radius: var(--r); box-shadow: var(--sh-1); font-weight: 600; gap: 1px; white-space: nowrap; }
#optTabs .tab .tn { display: inline-flex; align-items: center; gap: 5px; }
#optTabs .tab .pref { width: 12px; height: 12px; fill: var(--orange); stroke: var(--orange); stroke-width: 1.5; stroke-linejoin: round; }
#optTabs .tab small { color: var(--muted); font-weight: 500; font-size: 11px; font-variant-numeric: tabular-nums; }
#optTabs .tab.on { background: var(--blue); color: #fff; box-shadow: 0 6px 16px rgba(0,122,255,.3); }
#optTabs .tab.on .pref { fill: #ffd60a; stroke: #ffd60a; }
#optTabs .tab.on small { color: rgba(255,255,255,.82); }
#summary { background: var(--card); border-radius: var(--r-l); box-shadow: var(--sh-1); padding: 18px 16px 16px; }
#summary:empty { display: none; }
.big { font-size: 13px; color: var(--muted); margin: 0 0 12px; font-weight: 500; }
.big span { display: block; font-size: 56px; line-height: 1; font-weight: 700; letter-spacing: -0.045em; margin-bottom: 5px; font-variant-numeric: tabular-nums; color: var(--ink); }
table.sum, table.cmp { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
table.sum td, table.sum th, table.cmp td, table.cmp th { padding: 7px 4px; border-bottom: .5px solid var(--line2); text-align: left; }
table.sum td:not(:first-child), table.sum th:not(:first-child) { text-align: right; }
table.sum th, table.cmp th { color: var(--muted); font-weight: 500; font-size: 11px; }
table.sum tr.cur td { background: var(--blue-t); }
table.sum tr.cur td:first-child { border-radius: 7px 0 0 7px; } table.sum tr.cur td:last-child { border-radius: 0 7px 7px 0; }
table.sum tr.tot td { font-weight: 700; border-bottom: 0; }
#compare { background: var(--card); border-radius: var(--r-l); box-shadow: var(--sh-1); padding: 6px 12px; overflow-x: auto; }
table.cmp tr:last-child td { border-bottom: 0; }
table.cmp tr.on td { color: var(--blue); font-weight: 600; }
table.cmp td:first-child { white-space: nowrap; }
.chk { margin: 12px 0; padding: 9px 11px; border-radius: var(--r-s); font-weight: 600; font-size: 12.5px; }
.chk.ok { background: rgba(52,199,89,.12); color: var(--green-d); }
.chk.bad { background: rgba(255,59,48,.1); color: var(--red-d); }
dl.facts { display: grid; grid-template-columns: auto 1fr; gap: 0; font-size: 12px; margin: 8px 0 0; }
dl.facts dt, dl.facts dd { padding: 6px 0; border-bottom: .5px solid var(--line2); }
dl.facts dt { color: var(--muted); padding-right: 10px; }
dl.facts dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
dl.facts dt:last-of-type, dl.facts dd:last-of-type { border-bottom: 0; }
ul.warn { background: rgba(255,149,0,.12); border-radius: var(--r-s); padding: 9px 11px 9px 27px; color: #8a4b00; font-size: 12px; margin: 12px 0 0; }
.empty { padding: 2px; color: var(--ink2); }
.empty b { font-size: 14px; }
.empty ol { padding-left: 18px; margin: 8px 0 0; line-height: 1.65; }
.disclaimer { color: var(--muted); font-size: 11px; margin: 16px 4px 0; line-height: 1.5; }

#toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); background: rgba(28,28,30,.88); -webkit-backdrop-filter: var(--glass); backdrop-filter: var(--glass); color: #fff; padding: 11px 20px; border-radius: 999px; z-index: 3000; box-shadow: var(--sh-3); max-width: min(90%, 680px); font-weight: 500; text-align: center; }
#toast.show { animation: toastIn .35s cubic-bezier(.2,.9,.3,1.2); }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 14px) scale(.96); } to { opacity: 1; transform: translate(-50%, 0) scale(1); } }

/* ---------- shared iOS-style lists and cards ---------- */
.group-label { margin: 18px 6px 7px; font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; display: flex; align-items: center; gap: 8px; }
.card { background: #fff; border-radius: var(--r-l); box-shadow: var(--sh-1); }
.card.pad { padding: 12px 14px; }
.card.list { padding: 0 0 0 14px; overflow: hidden; }
.li { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 6px 14px 6px 0; margin: 0; border-bottom: .5px solid var(--line2); font-size: 13px; color: var(--ink); font-weight: 400; width: 100%; background: transparent; border-radius: 0; text-align: left; justify-content: flex-start; cursor: default; }
.li:last-child { border-bottom: 0; }
.li > span:first-child { flex: 1; }
.li.switch { cursor: pointer; }
.li.num input { width: 76px; text-align: right; min-height: 30px; padding: 4px 8px; font-variant-numeric: tabular-nums; }
.li.num em, .li.act em { font-style: normal; color: var(--muted); font-size: 12px; width: 18px; }
.li.sel select, .li.sel input { width: 58%; min-height: 30px; padding-top: 4px; padding-bottom: 4px; }
.li.sel .two { display: flex; gap: 6px; width: 58%; }
.li.sel .two input { width: 50%; }
button.li { cursor: pointer; transition: background .15s; }
button.li:hover { background: rgba(0,0,0,.025); }
button.li:active { transform: none; background: rgba(0,0,0,.05); }
button.li.act span { color: var(--blue); font-weight: 500; }
button.li.act em { width: auto; }
.li.opt .radio { width: 20px; height: 20px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--muted2); flex: none; transition: box-shadow .2s; }
.li.opt.on .radio { box-shadow: inset 0 0 0 6px var(--blue); }
.li.opt .grow { flex: 1; display: flex; flex-direction: column; }
.li.opt small { color: var(--muted); font-size: 11.5px; }
.badge { font-size: 10.5px; font-weight: 700; color: #b36b00; background: rgba(255,149,0,.14); padding: 2px 8px; border-radius: 999px; }
.chip { font-size: 10.5px; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--muted); background: var(--fill2); padding: 2px 8px; border-radius: 999px; }
.chip.on { color: var(--green-d); background: rgba(52,199,89,.14); }
.mini { font-size: 11.5px; color: var(--muted); line-height: 1.5; margin: 8px 0; }

/* ---------- Model workspace ---------- */
#modelView { position: fixed; top: var(--top); left: 0; right: 0; bottom: 0; z-index: 900; display: grid; grid-template-columns: 330px 1fr 300px; background: var(--bg); }
.m-side, .m-info { overflow-y: auto; padding: 6px 8px 24px 14px; scrollbar-width: thin; }
.m-info { padding: 6px 14px 24px 8px; }
.m-title h2 { margin: 14px 6px 4px; font-size: 26px; letter-spacing: -0.03em; }
.m-title p { margin: 0 6px; color: var(--muted); font-size: 12.5px; line-height: 1.5; }
#mBrief { min-height: 84px; background: var(--bg); box-shadow: none; border-radius: 10px; }
#mBrief:focus { background: #fff; }
.big-btn { width: 100%; margin-top: 18px; min-height: 48px; border-radius: 14px; font-size: 15px; font-weight: 600; background: var(--blue); color: #fff; box-shadow: 0 8px 20px rgba(0,122,255,.28); gap: 9px; }
.big-btn:hover { background: var(--blue-d); }
.big-btn .ic { width: 15px; height: 15px; fill: currentColor; stroke: none; }
.big-btn.busy { background: #fff; color: var(--red-d); box-shadow: var(--sh-2); }
.big-btn.busy .ic { display: none; }
.mini.foot { margin: 8px 6px; }
.m-stage { position: relative; margin: var(--gap) 0; border-radius: var(--r-xl); overflow: hidden; background: radial-gradient(120% 90% at 50% 10%, #fbfcfe 0%, #eef1f6 55%, #e2e6ee 100%); box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 0 0 .5px rgba(0,0,0,.08); }
#viewer { position: absolute; inset: 0; }
.viewer-canvas { display: block; touch-action: none; cursor: grab; }
.viewer-canvas:active { cursor: grabbing; }
.viewer-fail { display: grid; place-items: center; height: 100%; color: var(--muted); }
.m-empty { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.m-empty-card { max-width: 360px; text-align: center; padding: 26px 28px; background: rgba(255,255,255,.75); -webkit-backdrop-filter: var(--glass); backdrop-filter: var(--glass); border-radius: var(--r-xl); box-shadow: var(--sh-2); }
.m-empty-card h3 { margin: 14px 0 6px; font-size: 18px; letter-spacing: -0.02em; }
.m-empty-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.m-toolbar { left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; align-items: center; gap: 2px; padding: 5px; border-radius: 999px; }
.m-toolbar button { width: 38px; height: 34px; min-height: 0; padding: 0; border-radius: 999px; background: transparent; color: var(--ink2); }
.m-toolbar button:hover { background: var(--fill); }
.m-toolbar button.on { background: var(--blue); color: #fff; }
.m-toolbar .sep { width: .5px; height: 20px; background: var(--line2); margin: 0 4px; }
.m-levels { top: 14px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 2px; padding: 4px 5px 4px 13px; border-radius: 999px; }
.m-levels .lbl { font-size: 12px; font-weight: 600; color: var(--muted); margin-right: 6px; }
.m-levels button { padding: 3px 11px; min-height: 26px; border-radius: 999px; background: transparent; font-weight: 600; font-size: 12px; }
.m-levels button.on { background: #fff; color: var(--blue); box-shadow: 0 2px 6px rgba(0,0,0,.12); }
.m-progress { top: 14px; right: 14px; width: 300px; padding: 11px 14px 6px; }
.m-levels:not(.hidden) ~ .m-progress { top: 62px; }
.m-prog-top { display: flex; align-items: center; gap: 9px; font-size: 12.5px; }
.m-prog-top b { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-prog-top .muted { font-variant-numeric: tabular-nums; font-size: 11.5px; }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(0,122,255,.2); border-top-color: var(--blue); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.m-kpi { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 8px; }
.m-kpi div { background: var(--bg); border-radius: 10px; padding: 8px 9px; }
.m-kpi b { display: block; font-size: 20px; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.m-kpi small { color: var(--muted); font-size: 11px; }
dl.m-counts { display: grid; grid-template-columns: 1fr auto; margin: 4px 0 0; font-size: 12px; }
dl.m-counts dt, dl.m-counts dd { padding: 5px 0; border-bottom: .5px solid var(--line); margin: 0; }
dl.m-counts dt small { display: block; color: var(--muted); font-size: 10.5px; font-family: var(--mono); }
dl.m-counts dd { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; max-width: 170px; overflow-wrap: anywhere; }
dl.m-counts dd.mono { font-family: var(--mono); font-size: 10.5px; font-weight: 500; }
dl.m-counts dt.ps { grid-column: 1 / -1; font-weight: 700; color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; padding-top: 12px; border-bottom: 0; }
dl.m-counts dd.ps { display: none; }
dl.m-counts dt:last-of-type, dl.m-counts dd:last-of-type { border-bottom: 0; }
.p-head { display: flex; gap: 10px; align-items: center; }
.p-head i { width: 26px; height: 26px; border-radius: 7px; flex: none; box-shadow: inset 0 0 0 .5px rgba(0,0,0,.15); }
.p-head b { display: block; font-size: 13.5px; }
.p-head small { color: var(--muted); font-family: var(--mono); font-size: 10.5px; }
#mNotes ul { margin: 0; padding-left: 18px; font-size: 12px; line-height: 1.55; color: var(--ink2); }
ol.log { list-style: none; margin: 0; padding: 6px 12px; max-height: 300px; overflow: auto; font-size: 11.5px; }
ol.log:empty::before { content: "Nothing yet."; color: var(--muted); display: block; padding: 6px 0; }
ol.log li { display: flex; gap: 8px; padding: 5px 0; border-bottom: .5px solid var(--line); }
ol.log li:last-child { border-bottom: 0; }
ol.log time { color: var(--muted2); font-variant-numeric: tabular-nums; flex: none; }
ol.log li.ok span { color: var(--green-d); } ol.log li.bad span { color: var(--red-d); } ol.log li.warn span { color: #a35a00; }

/* ---------- Plans workspace ---------- */
#sheetsView { position: fixed; top: var(--top); left: 0; right: 0; bottom: 0; z-index: 900; background: var(--bg2); display: flex; flex-direction: column; }
.sheets-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 10px 18px; background: rgba(248,248,250,.85); -webkit-backdrop-filter: var(--glass); backdrop-filter: var(--glass); border-bottom: .5px solid var(--line2); }
.sheets-bar strong { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; }
.sheets-bar label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.sheets-bar select { width: auto; min-height: 29px; padding-top: 4px; padding-bottom: 4px; border-radius: 999px; padding-left: 12px; }
.sheets-bar .check { color: var(--ink); }
.sheets-bar .check input { width: auto; margin: 0; }
.sheets-bar .hint { margin: 0; }
.sheets-bar button.primary { border-radius: 999px; padding: 6px 16px; }
#sheetOpts { display: flex; gap: 12px; flex-wrap: wrap; }
#sheets { flex: 1; overflow: auto; padding: 30px; display: flex; flex-direction: column; align-items: center; gap: 30px; }
.sheet { flex: none; width: min(100%, 1300px); background: #fff; box-shadow: 0 18px 50px rgba(0,0,0,.14), 0 2px 6px rgba(0,0,0,.06); line-height: 0; border-radius: 6px; overflow: hidden; }
.sheet svg { width: 100%; height: auto; display: block; }
.sheet-empty { background: #fff; padding: 30px; border-radius: var(--r-l); line-height: 1.4; box-shadow: var(--sh-2); }

#side .row select { flex: 1; }

/* ---------- dialogs ---------- */
dialog#aboutDlg, dialog#connDlg { width: min(470px, calc(100vw - 32px)); max-height: calc(100vh - 48px); border: 0; border-radius: 24px; padding: 26px 20px 18px; background: rgba(242,242,247,.94); -webkit-backdrop-filter: var(--glass); backdrop-filter: var(--glass); box-shadow: var(--sh-3), inset 0 0 0 .5px rgba(255,255,255,.6); color: var(--ink); }
dialog#connDlg { width: min(520px, calc(100vw - 32px)); }
dialog[open] { animation: dlgIn .32s cubic-bezier(.2,.9,.3,1.12); }
dialog::backdrop { background: rgba(0,0,0,.22); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
@keyframes dlgIn { from { opacity: 0; transform: scale(.95) translateY(6px); } to { opacity: 1; transform: none; } }
.dlg-x { position: absolute; top: 14px; right: 14px; width: 30px; height: 30px; min-height: 0; padding: 0; border-radius: 50%; color: var(--muted); background: var(--fill); }
.dlg-x .ic { width: 13px; height: 13px; stroke-width: 2.6; }
.about-head { text-align: center; margin-bottom: 14px; }
.about-head .logo.big { display: inline-block; width: 68px; height: 68px; filter: drop-shadow(0 8px 16px rgba(0,80,200,.28)); }
.about-head .logo.big svg { width: 100%; height: 100%; }
.about-head h2 { margin: 12px 0 2px; font-size: 22px; letter-spacing: -0.025em; }
.about-head .muted { color: var(--muted); margin: 0 10px; font-size: 12.5px; }
.about-ver { margin: 8px 0 0; font-size: 12.5px; color: var(--ink2); }
.about-ver b { font-variant-numeric: tabular-nums; }
#aboutDlg .card { padding: 4px 14px; margin-bottom: 10px; }
.card-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; }
.card-row + .card-row { border-top: .5px solid var(--line2); }
.card-row > div:first-child { flex: 1; min-width: 0; }
.card-row p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.card-row p.hl { color: var(--blue); font-weight: 500; }
.card-row .stack { display: flex; flex-direction: column; gap: 4px; }
#aboutDlg .whatsnew { padding: 13px 14px; }
.whatsnew ul { margin: 6px 0 0; padding-left: 18px; font-size: 12px; color: var(--ink2); line-height: 1.55; }
.fine { color: var(--muted); font-size: 11px; text-align: center; margin: 8px 0 0; }
.conn-test { display: flex; align-items: center; gap: 10px; margin: 10px 4px 0; }
.conn-test .mini { margin: 0; }
#cWhere { margin: 8px 6px 0; }
details.adsk { margin-top: 14px; }
details.adsk summary { cursor: pointer; padding: 2px 0; list-style: none; }
details.adsk summary::-webkit-details-marker { display: none; }
details.adsk summary::before { content: "›"; display: inline-block; margin-right: 8px; color: var(--muted); transition: transform .2s; font-weight: 700; }
details.adsk[open] summary::before { transform: rotate(90deg); }
details.adsk .li { padding-right: 0; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* ---------- section help behind an "i" ---------- */
.info-btn { width: 24px; height: 24px; min-height: 0; padding: 0; border-radius: 50%; background: transparent; color: var(--muted2); flex: none; }
.info-btn .ic { width: 18px; height: 18px; stroke-width: 1.7; }
.info-btn:hover, .info-btn[aria-expanded="true"] { background: var(--blue-t); color: var(--blue); }
.help-pop {
  position: fixed; z-index: 2500; width: 320px; max-height: min(70vh, 520px); overflow: auto; padding: 13px 15px 4px;
  background: rgba(255,255,255,.92); -webkit-backdrop-filter: var(--glass); backdrop-filter: var(--glass);
  border-radius: var(--r-l); box-shadow: var(--sh-3), inset 0 0 0 .5px rgba(0,0,0,.08);
  opacity: 0; visibility: hidden; transform: translateX(-4px) scale(.98); transform-origin: left top;
  transition: opacity .16s, transform .16s, visibility 0s linear .16s;
}
.help-pop.left { transform-origin: right top; transform: translateX(4px) scale(.98); }
.help-pop.on { opacity: 1; visibility: visible; transform: none; transition: opacity .16s, transform .16s; }
.help-pop::before { content: ""; position: absolute; left: -6px; top: calc(var(--arrow-y, 20px) - 6px); width: 12px; height: 12px; background: rgba(255,255,255,.96); transform: rotate(45deg); box-shadow: -1px 1px 1px rgba(0,0,0,.05); }
.help-pop.left::before { left: auto; right: -6px; box-shadow: 1px -1px 1px rgba(0,0,0,.05); }
.help-title { font-weight: 600; font-size: 13px; margin-bottom: 4px; letter-spacing: -0.01em; }
.help-pop .hint { color: var(--ink2); font-size: 12px; line-height: 1.5; margin: 0 0 10px; }
.help-pop .hint:empty { display: none; }

.body label.check.switch { gap: 10px; margin-top: 12px; min-height: 28px; justify-content: space-between; flex-direction: row-reverse; }
.body label.check.switch input { width: 42px; height: 25px; min-width: 42px; margin: 0; flex: none; }
label.lobby-tog { display: inline-flex; align-items: center; gap: 6px; margin: 2px 0 4px; color: var(--ink2); font-size: 11.5px; cursor: pointer; }
label.lobby-tog input { width: auto; margin: 0; }
#aboutTitle:focus { outline: none; }

/* ---------- smaller windows ---------- */
@media (max-width: 1500px) {
  #topbar .proj { flex-basis: 200px; }
  #topbar .country select { max-width: 180px; }
}
@media (max-width: 1320px) {
  .ws-switch button span { display: none; }
  .ws-switch button { padding: 4px 12px; }
  #btnInstall span { display: none; }
}
@media (max-width: 1100px) {
  :root { --side: 300px; --res: 264px; }
  #topbar .brand-name, #topbar .save-state { display: none; }
  #modelView { grid-template-columns: 290px 1fr; }
  .m-info { display: none; }
}
@media (max-width: 800px) {
  body { overflow: auto; }
  #layout { grid-template-columns: 1fr; height: auto; }
  #mapWrap { height: 60vh; order: -1; margin: 8px; }
  #topbar { height: auto; flex-wrap: wrap; padding: 8px; position: sticky; top: 0; }
  #updateBar { white-space: normal; border-radius: var(--r-l); width: calc(100% - 24px); }
  #modelView { grid-template-columns: 1fr; overflow: auto; }
}

@media print {
  html, body { height: auto; overflow: visible; background: #fff; }
  #topbar, #layout, #toast, .sheets-bar, #updateBar, #aboutDlg, #connDlg, #modelView, .help-pop { display: none !important; }
  #sheetsView { position: static; display: block !important; background: #fff; }
  #sheets { display: block; padding: 0; overflow: visible; }
  .sheet { box-shadow: none; margin: 0; border-radius: 0; page-break-after: always; break-after: page; overflow: hidden; }
  .sheet:last-child { page-break-after: auto; break-after: auto; }
  .sheet svg { width: 100%; height: 100%; }
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
}

/* map rotation (js/maprotate.js): the map element turns around its centre; labels turn back to stay upright */
#map { transform-origin: 50% 50%; }
.edge-label span { transform: translate(-50%, -150%) rotate(var(--inv-rot, 0deg)); }
.obs-handle span, .entry-handle span, .veh-handle span { transform: rotate(var(--inv-rot, 0deg)); transform-origin: -10px 50%; }
.zoom-btns { display: flex; flex-direction: column; gap: 2px; padding-bottom: 6px; border-bottom: .5px solid var(--line2); }
.zoom-btns button { width: 34px; height: 32px; min-height: 0; padding: 0; border-radius: 10px; background: transparent; color: var(--ink2); }
.zoom-btns button:hover { background: var(--fill); }
#mapTools { top: 12px; }
#mapFoot { position: absolute; z-index: 800; left: 10px; right: 10px; bottom: 8px; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; pointer-events: none; }
#mapFoot .scale { display: flex; align-items: center; gap: 7px; padding: 4px 9px; border-radius: 999px; background: rgba(255,255,255,.82); -webkit-backdrop-filter: var(--glass); backdrop-filter: var(--glass); box-shadow: var(--sh-1); font-size: 10.5px; font-weight: 600; color: var(--ink2); font-variant-numeric: tabular-nums; }
#mapFoot .scale i { display: block; height: 5px; border: 1.5px solid var(--ink2); border-top: 0; }
#mapFoot .attr { max-width: 70%; padding: 2px 8px; border-radius: 7px; background: rgba(255,255,255,.72); font-size: 10px; color: var(--ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: auto; }

/* model out of date (only rebuilt when asked) */
.m-stale { left: 50%; top: 14px; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; padding: 6px 6px 6px 16px; border-radius: 999px; font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.m-levels:not(.hidden) ~ .m-stale { top: 62px; }
.big-btn:disabled { background: var(--fill); color: var(--muted); box-shadow: none; opacity: 1; }
/* handles: a larger invisible grip around each one, so a near miss doesn't grab the map */
.leaflet-marker-draggable { touch-action: none; }
.leaflet-marker-draggable::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; }
.obs-handle.leaflet-marker-draggable::after { inset: -2px; }

/* row-end choice (circulation ↻ or bays P) and ramp direction buttons */
.rowend { display: grid !important; place-items: center; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.45); font: 700 11px/1 var(--font); color: #fff; cursor: pointer; }
.rowend.circ { background: var(--blue); }
.rowend.bays { background: #48484a; }
.rdirs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 4px 0 6px; font-size: 11px; color: var(--muted); }
.rdirs > span { margin-right: 2px; }
.rdirs button.rdir { min-height: 24px; padding: 2px 8px; border-radius: 999px; font-size: 11px; background: var(--fill); color: var(--ink2); }
.rdirs button.rdir b { color: var(--blue); font-weight: 700; }
.rdirs button.rdir.rev b { color: var(--orange); }

/* legend: a small glass button when minimised, the full card when open */
#legend { padding: 6px 8px 10px; gap: 4px; }
#legend .legend-head { display: flex; align-items: center; gap: 7px; min-height: 28px; padding: 3px 8px; border-radius: 999px; background: transparent; font-size: 12px; font-weight: 600; color: var(--ink2); width: 100%; justify-content: flex-start; }
#legend .legend-head:hover { background: var(--fill); }
#legend .legend-head .ic { width: 15px; height: 15px; }
#legend .legend-head .chev { margin-left: auto; transform: rotate(90deg); transition: transform .2s; color: var(--muted); }
#legend .legend-body { display: flex; flex-direction: column; gap: 4px; padding: 2px 4px 0; }
#legend.min { padding: 4px; border-radius: 999px; }
#legend.min .legend-body { display: none; }
#legend.min .legend-head .chev { transform: rotate(0deg); }
#legend.min .legend-head { width: auto; padding: 4px 12px 4px 10px; }

/* ---- quieter map chrome ---- */
/* zoom, compass and rotate: a slim, light column that only firms up when the pointer is on it */
#mapTools { left: 10px; top: 10px; padding: 3px; gap: 3px; border-radius: 16px; background: rgba(255,255,255,.62); box-shadow: 0 1px 4px rgba(0,0,0,.08), inset 0 0 0 .5px rgba(0,0,0,.05); opacity: .82; transition: opacity .2s, background .2s; }
#mapTools:hover, #mapTools:focus-within { opacity: 1; background: rgba(255,255,255,.86); }
.zoom-btns { gap: 1px; padding-bottom: 3px; }
.zoom-btns button, .rot-btns button { width: 26px; height: 24px; border-radius: 8px; color: var(--ink2); }
.zoom-btns .ic, .rot-btns .ic { width: 13px; height: 13px; stroke-width: 2; }
.rot-btns { gap: 1px; }
.compass { width: 30px; height: 30px; box-shadow: 0 0 0 .5px rgba(0,0,0,.08); }
.compass svg { width: 30px; height: 30px; }
.compass.turned { box-shadow: 0 0 0 1.5px rgba(255,59,48,.35); }

/* small round toggle used to put panels away */
.mini-tog { width: 22px; height: 22px; min-height: 0; padding: 0; border-radius: 50%; background: transparent; color: var(--muted); flex: none; }
.mini-tog:hover { background: var(--fill); color: var(--ink); }
.mini-tog .ic { width: 12px; height: 12px; stroke-width: 2.4; }

/* level picker: full, or just the current level */
#levelBar { top: 10px; padding: 3px 4px 3px 12px; gap: 6px; }
#levelBar button { min-height: 24px; padding: 2px 10px; }
#levelBar #btnLevelMin { min-height: 0; padding: 0; transform: rotate(180deg); }
#levelBar.min { padding: 3px 4px; gap: 2px; }
#levelBar.min .lbl, #levelBar.min #levelCount { display: none; }
#levelBar.min #levelBtns { background: transparent; padding: 0; }
#levelBar.min #levelBtns button:not(.on) { display: none; }
#levelBar.min #btnLevelMin { transform: none; }

/* tool help: a capsule with a close button, or a small ⓘ when put away */
#hintBar { display: flex; align-items: flex-start; gap: 10px; padding: 9px 8px 9px 16px; }
#hintBar.hidden { display: none !important; }
#hintBar .mini-tog { color: rgba(255,255,255,.7); margin-top: -1px; }
#hintBar .mini-tog:hover { background: rgba(255,255,255,.14); color: #fff; }
.hint-pill { bottom: 38px; left: 50%; transform: translateX(-50%); width: 32px; height: 32px; min-height: 0; padding: 0; border-radius: 50%; display: grid; place-items: center; color: var(--blue); }
.hint-pill.hidden { display: none !important; }
.hint-pill .ic { width: 17px; height: 17px; }
.hint-pill { left: auto; right: 12px; bottom: 34px; transform: none; }
