:root {
  --green: #144534;
  --green-2: #1f6b4f;
  --panel: rgba(255,255,255,.92);
  --line: rgba(20,69,52,.16);
  --ink: #17251f;
  --muted: #65736b;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Arial, sans-serif; color: var(--ink); background: #101715; overflow: hidden; }
button, input, select { font: inherit; }
.viewer-shell { height: 100vh; display: grid; grid-template-columns: 300px 1fr 260px; }
.stage-wrap { position: relative; min-width: 0; }
#stage { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
#stage:active { cursor: grabbing; }
.panel {
  z-index: 4;
  background: var(--panel);
  backdrop-filter: blur(16px);
  border-right: 1px solid var(--line);
  padding: 18px;
  overflow: auto;
}
.right-panel { border-right: 0; border-left: 1px solid var(--line); }
.brand { font-size: 28px; font-weight: 900; color: var(--green); margin-bottom: 24px; }
.brand span { display: block; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; }
.control-group { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 16px; }
h1, h2 { margin: 0 0 12px; color: var(--green); }
h2 { font-size: 15px; }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.segmented.two { grid-template-columns: repeat(2, 1fr); }
button, select, input[type="text"], input[type="password"], input[type="number"], input[type="file"], input:not([type]) {
  min-height: 38px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); padding: 0 10px;
}
button { cursor: pointer; font-weight: 800; }
button.active, button:hover { background: var(--green); color: #fff; }
select { width: 100%; margin: 4px 0 8px; }
textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; resize: vertical; }
.hint { font-size: 12px; color: var(--muted); line-height: 1.4; margin-bottom: 0; }
.range-label { display: grid; gap: 6px; margin: 12px 0; color: var(--muted); font-size: 13px; font-weight: 800; }
input[type="range"] { width: 100%; accent-color: var(--green-2); }
.check { display: flex; align-items: center; gap: 8px; margin: 10px 0; color: var(--muted); font-size: 13px; font-weight: 800; }
.hud {
  position: absolute; left: 18px; bottom: 18px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.4); pointer-events: none;
}
.hud span { background: rgba(0,0,0,.36); border: 1px solid rgba(255,255,255,.18); border-radius: 999px; padding: 7px 10px; font-size: 12px; font-weight: 800; }
.loading {
  position: absolute; inset: auto 50% 50% auto; transform: translate(50%, 50%);
  padding: 14px 18px; border-radius: 10px; background: rgba(255,255,255,.94); font-weight: 900; color: var(--green);
}
.login { position: fixed; inset: 0; display: grid; place-items: center; z-index: 10; background: linear-gradient(135deg, rgba(20,69,52,.92), rgba(71,125,235,.72)); }
.login.hidden { display: none; }
.login-panel { width: min(440px, calc(100vw - 32px)); display: grid; gap: 14px; background: #fff; border-radius: 12px; padding: 26px; box-shadow: 0 30px 80px rgba(0,0,0,.28); }
.login-panel h1 { font-size: 28px; }
.login-panel label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 800; }
.login-panel button { background: var(--green); color: #fff; min-height: 44px; }
.form-note { margin: -8px 0 0; font-size: 12px; color: var(--muted); }
.form-error { margin: -8px 0 0; color: #9b1c31; font-size: 12px; font-weight: 800; }
.field-label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--muted); font-weight: 800; }
.avatar-grid { display: grid; grid-template-columns: repeat(4, minmax(58px, 1fr)); gap: 8px; }
.avatar-choice { min-height: 74px; display: grid; place-items: center; gap: 4px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); font-size: 11px; font-weight: 900; }
.avatar-choice.active { outline: 3px solid rgba(31,107,79,.25); border-color: var(--green-2); }
.avatar-preview { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; overflow: hidden; background: var(--green-2); color: #fff; }
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; }
.eyebrow { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; font-weight: 900; color: var(--green-2); }
.visitor-list { display: grid; gap: 8px; }
.visitor { display: grid; grid-template-columns: 28px 1fr; gap: 8px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.visitor { cursor: pointer; }
.visitor:hover, .visitor:focus { outline: 2px solid rgba(31,107,79,.25); border-color: rgba(31,107,79,.45); }
.avatar-dot { width: 28px; height: 28px; border-radius: 50%; background: var(--green-2); }
.visitor strong { display: block; font-size: 13px; }
.visitor span { color: var(--muted); font-size: 12px; }
.status-list { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; font-size: 13px; }
.status-list dt { color: var(--muted); font-weight: 900; }
.status-list dd { margin: 0; font-weight: 800; }
.status-list.compact { margin: 10px 0; }
.object-title { font-weight: 900; color: var(--green); margin-bottom: 8px; }
.empty-state { color: var(--muted); font-size: 13px; line-height: 1.4; }
.tool-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0; }
.admin-project-form { display: grid; gap: 8px; }
.admin-project-form label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; font-weight: 800; }
.admin-project-form button { min-height: 38px; background: var(--green); color: #fff; }
.layers-panel { display: grid; gap: 6px; margin-top: 8px; }
.layer-row { display: grid; grid-template-columns: 20px 1fr auto; gap: 8px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; }
.layer-row small { color: var(--muted); font-weight: 900; }
.map-panel { min-height: 196px; position: relative; display: grid; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: #edf3ee; color: var(--green); overflow: hidden; }
.map-panel.is-hidden { min-height: 0; }
.map-panel.is-hidden .map-canvas, .map-panel.is-hidden .map-meta { display: none; }
.map-toolbar, .map-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; position: relative; z-index: 1; }
.map-toolbar button, .map-meta button { min-height: 30px; padding: 0 8px; font-size: 12px; }
.map-meta span { color: var(--muted); font-size: 11px; font-weight: 800; }
.map-canvas { height: 134px; border: 1px solid rgba(20,69,52,.14); border-radius: 8px; background: linear-gradient(135deg, #dbe9df, #d8e2f2); overflow: hidden; }
.map-svg { width: 100%; height: 100%; display: block; }
.map-grid { stroke: rgba(20,69,52,.12); stroke-width: .7; fill: none; }
.map-footprint { fill: rgba(31,107,79,.2); stroke: rgba(20,69,52,.72); stroke-width: 1.4; }
.map-north path { fill: var(--green); }
.map-north text { font: 900 8px Arial, sans-serif; text-anchor: middle; fill: var(--green); }
.map-marker circle { stroke: #fff; stroke-width: 1.4; }
.map-marker-user circle { fill: #477deb; }
.map-marker-remote circle { fill: #bf3b77; }
.map-marker-selected circle { fill: #ffd166; stroke: #144534; }
.map-calibration { display: grid; gap: 6px; padding: 8px; border: 1px solid rgba(20,69,52,.12); border-radius: 8px; background: rgba(255,255,255,.58); }
.map-calibration .range-label { margin: 0; }
.admin-only { display: none; }
.role-admin .admin-only { display: grid; }
.mobile-controls { position: absolute; inset: auto 18px 72px 18px; display: none; pointer-events: none; z-index: 3; }
.stick { width: 112px; height: 112px; border-radius: 50%; background: rgba(255,255,255,.24); border: 1px solid rgba(255,255,255,.5); pointer-events: auto; touch-action: none; position: relative; }
.stick span { position: absolute; left: 36px; top: 36px; width: 40px; height: 40px; border-radius: 50%; background: rgba(20,69,52,.86); }
.mobile-controls button { position: absolute; right: 0; width: 68px; min-height: 46px; pointer-events: auto; background: rgba(255,255,255,.9); }
#mobile-up { bottom: 56px; }
#mobile-down { bottom: 0; }
.advanced-hidden .advanced-only { display: none; }
@media (max-width: 980px) {
  .viewer-shell { grid-template-columns: 1fr; }
  .panel { position: absolute; max-height: 45vh; width: min(320px, calc(100vw - 24px)); margin: 12px; border: 1px solid var(--line); border-radius: 12px; }
  .right-panel { right: 0; }
  .mobile-controls { display: block; }
  .hud { bottom: 196px; }
}
