:root {
  --bg: #0f1419; --panel: #161d24; --panel2: #1c252e; --line: #2a3540; --text: #d8e0e7; --muted: #8796a3;
  --accent: #e8642c; --ok: #4cc38a; --warn: #f0b429; --bad: #e5484d;
  font: 13px/1.4 "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow: hidden; }
#app { display: grid; grid-template-columns: 270px 1fr 320px; height: 100vh; }
.panel { background: var(--panel); overflow-y: auto; border-right: 1px solid var(--line); }
#right { border-right: 0; border-left: 1px solid var(--line); }
section { padding: 10px 14px; border-bottom: 1px solid var(--line); }
h3 { margin: 0 0 8px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600;
     display: flex; align-items: center; gap: 8px; }
.brand { padding: 14px; border-bottom: 1px solid var(--line); }
.logo { font-weight: 800; font-size: 22px; letter-spacing: .04em; }
.logo span { color: var(--accent); margin-left: 3px; }
.sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.conn { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); margin-top: 6px; }
.conn i { width: 8px; height: 8px; border-radius: 50%; background: var(--bad); }
.conn.on i { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
label { display: block; cursor: pointer; }
.row { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; align-items: center; margin: 8px 0; color: var(--muted); }
.row input[type=range], .row select { grid-column: 1 / -1; width: 100%; }
.row b { color: var(--text); font-weight: 600; }
.checks label { padding: 3px 0; }
.inline { margin-top: 6px; color: var(--muted); }
select, input, button { font: inherit; color: var(--text); background: var(--panel2); border: 1px solid var(--line);
  border-radius: 6px; padding: 5px 8px; }
input[type=checkbox] { accent-color: var(--accent); }
input[type=range] { accent-color: var(--accent); padding: 0; border: 0; background: none; }
button { cursor: pointer; }
button:hover { border-color: #3d4b58; background: #22303b; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.primary:hover { filter: brightness(1.1); }
.wide { width: 100%; }
.row2 { display: flex; gap: 6px; margin-top: 8px; }
.row2 > select, .row2 > input { flex: 1; min-width: 0; }
.seg { display: flex; gap: 0; margin-bottom: 8px; }
.seg button { flex: 1; border-radius: 0; padding: 4px; }
.seg button:first-child { border-radius: 6px 0 0 6px; }
.seg button:last-child { border-radius: 0 6px 6px 0; }
.seg button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
#clipPos { width: 100%; }
.hidden { display: none !important; }
.list { display: flex; flex-direction: column; gap: 2px; }
.list .item { display: grid; grid-template-columns: auto 1fr auto; gap: 6px; align-items: center; padding: 4px 6px;
  border-radius: 6px; cursor: pointer; }
.list .item:hover { background: var(--panel2); }
.list .item.sel { background: #2b2018; outline: 1px solid var(--accent); }
.list .item small { color: var(--muted); }
.list .item .meta { grid-column: 2 / -1; color: var(--muted); font-size: 11px; }
.list .item.excluded .name, .list .item.excluded small { color: var(--muted); text-decoration: line-through; }
.list .item .offtag { color: var(--muted); font-weight: 600; }
.list .item.fresh .name::after { content: " ● новый замер"; color: var(--ok); font-size: 11px; }
.list.small .item { grid-template-columns: 1fr auto; font-size: 11px; word-break: break-all; }
.count { color: var(--muted); font-weight: 400; text-transform: none; letter-spacing: 0; }
.hint { color: var(--muted); font-size: 11px; margin-top: 6px; }
.badge { font-size: 10px; padding: 1px 6px; border-radius: 10px; background: var(--panel2); color: var(--muted);
  text-transform: none; letter-spacing: 0; font-weight: 500; }
.badge.on { background: #173b2b; color: var(--ok); }
.badge.err { background: #3d1b1d; color: var(--bad); }
.live { display: flex; gap: 12px; align-items: center; }
.live .big { display: flex; flex-direction: column; }
.live .big b { font-size: 34px; line-height: 1; font-variant-numeric: tabular-nums; }
.live .big small, .live .rock small { color: var(--muted); font-size: 11px; }
.live .rock { display: grid; grid-template-columns: 14px 1fr; gap: 2px 6px; align-items: center; }
.live .rock i { width: 14px; height: 14px; border-radius: 3px; background: #555; }
.live .rock span { font-weight: 600; }
.live .rock small { grid-column: 2; }
.kv { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-top: 8px; }
.kv div { background: var(--panel2); border-radius: 6px; padding: 4px 6px; }
.kv div small { display: block; color: var(--muted); font-size: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
th, td { padding: 3px 4px; text-align: right; border-bottom: 1px solid var(--line); }
th:first-child, td:first-child { text-align: left; }
th { color: var(--muted); font-weight: 500; font-size: 11px; }
tr.total td { font-weight: 700; color: #fff; border-bottom: 0; }
#view { position: relative; overflow: hidden; }
#three { position: absolute; inset: 0; }
#toolbar { position: absolute; top: 10px; right: 10px; display: flex; gap: 4px; }
#toolbar button { background: rgba(22, 29, 36, .85); }
#compass { position: absolute; top: 10px; left: 10px; width: 46px; height: 46px; border-radius: 50%;
  background: rgba(22, 29, 36, .85); border: 1px solid var(--line); }
#compass .needle { position: absolute; left: 50%; top: 50%; width: 4px; height: 36px; margin: -18px 0 0 -2px;
  background: linear-gradient(var(--bad) 50%, #8796a3 50%); border-radius: 2px; transform-origin: 50% 50%; }
#compass span { position: absolute; top: -16px; width: 100%; text-align: center; font-size: 10px; color: var(--muted); }
#legend { position: absolute; left: 10px; bottom: 10px; background: rgba(22, 29, 36, .9); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; font-size: 11px; min-width: 180px; }
#legend .bar { height: 10px; border-radius: 3px; margin: 4px 0 2px; }
#legend .ticks { display: flex; justify-content: space-between; color: var(--muted); }
#legend .sw { display: flex; align-items: center; gap: 6px; margin: 2px 0; }
#legend .sw i { width: 14px; height: 10px; border-radius: 2px; display: inline-block; }
#tooltip { position: absolute; pointer-events: none; background: rgba(15, 20, 25, .95); border: 1px solid var(--line);
  padding: 6px 8px; border-radius: 6px; font-size: 12px; white-space: nowrap; transform: translate(12px, 12px); }
#busy { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); background: rgba(22, 29, 36, .95);
  border: 1px solid var(--line); border-radius: 16px; padding: 5px 12px; display: flex; gap: 8px; align-items: center; }
#busy i { width: 12px; height: 12px; border: 2px solid var(--accent); border-top-color: transparent; border-radius: 50%;
  animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.label3d { font-size: 11px; color: #fff; background: rgba(15, 20, 25, .75); padding: 1px 5px; border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, .15); white-space: nowrap; pointer-events: none; }
.label3d.bit { border-color: var(--accent); }
.label3d.live { background: var(--accent); border-color: #fff; font-weight: 700; }
#logCanvas { width: 100%; height: 520px; background: var(--panel2); border-radius: 6px; display: block; }
@media (max-width: 1100px) { #app { grid-template-columns: 230px 1fr 280px; } }

/* пустоты (каверны) */
.checks label.sub { padding-left: 20px; font-size: 11px; color: var(--muted); }
.voidtag { color: #35d0ff; font-weight: 600; }
.list .item.void .name { color: #35d0ff; }
.list .item.void .meta i.conf { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; background: #f0b429; }
.list .item.void .meta i.conf.hi { background: #4cc38a; }
tr.void td { color: #35d0ff; }
.label3d.void { border-color: #35d0ff; color: #35d0ff; }
.label3d.working { border-color: #d5dbe2; color: #d5dbe2; }
.label3d.zmark { background: transparent; border-color: transparent; color: #aab7c3; transform: translate(0, -50%); }
.label3d.strat { border-color: #8796a3; }
.label3d.live.void { background: #35d0ff; color: #0f1419; }
#liveBox.alarm { box-shadow: inset 3px 0 0 #35d0ff; background: rgba(53, 208, 255, .08); }
#liveBox.alarm #liveRock { color: #35d0ff; }
