* { box-sizing: border-box; margin: 0; }
:root {
  --bg: #0e1118; --panel: #171c26; --panel2: #1d2432; --border: #2a3345;
  --text: #e8ecf4; --muted: #8b96ab; --accent: #ffb347;
}
body { background: var(--bg); color: var(--text);
  font: 14px/1.45 -apple-system, "Segoe UI", Roboto, sans-serif;
  height: 100vh; display: flex; flex-direction: column; overflow: hidden; }

.topbar { display: flex; align-items: center; gap: 20px; padding: 10px 18px;
  border-bottom: 1px solid var(--border); background: linear-gradient(180deg,#141a24,#10141c); }
.brand { display: flex; align-items: center; gap: 11px; }
.logo { height: 38px; width: auto; display: block; }
.brand-name { font-size: 15px; font-weight: 700; letter-spacing: .3px; }
.brand-sub { font-size: 11px; color: var(--muted); letter-spacing: .4px; }
.head-mid { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.muted { color: var(--muted); font-size: 12px; }
.sel { background: var(--panel); color: var(--text); border: 1px solid var(--border);
  border-radius: 7px; padding: 5px 10px; font-size: 13px; max-width: 320px; }

.tabs { display: flex; gap: 6px; }
.tab { padding: 7px 16px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--panel); color: var(--muted); cursor: pointer; font-size: 13px; font-weight: 500; }
.tab.active { background: var(--accent); border-color: var(--accent); color: #201400; font-weight: 700; }

main { flex: 1; position: relative; min-height: 0; }
.view { position: absolute; inset: 0; }
.view.hidden { display: none; }
.hidden { display: none; }

/* 3D */
#viewport { position: absolute; inset: 0; }
#viewport canvas { display: block; }
.panel3d { position: absolute; top: 14px; left: 14px; display: flex; align-items: center; gap: 14px;
  background: rgba(14,17,24,.82); border: 1px solid var(--border); border-radius: 10px; padding: 8px 14px; }
.ctl { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.ctl input[type=range] { width: 96px; accent-color: var(--accent); }
.mini-btn { padding: 5px 12px; border-radius: 7px; font-size: 12px; background: var(--panel);
  color: var(--text); border: 1px solid var(--border); cursor: pointer; }
.mini-btn:hover, .mini-btn.active { background: var(--accent); color: #201400; border-color: var(--accent); }

.legend3d { position: absolute; left: 14px; bottom: 40px; width: 240px; display: flex; align-items: center;
  gap: 8px; font-size: 11px; background: rgba(14,17,24,.8); padding: 6px 11px; border-radius: 7px; }
.legend-bar { flex: 1; height: 9px; border-radius: 5px;
  background: linear-gradient(90deg,#d9f2ff,#8fd0f0,#4a9bd8,#1f5fa8,#0a2a5e); }
.hint { position: absolute; right: 14px; bottom: 14px; font-size: 11px; color: var(--muted);
  background: rgba(14,17,24,.72); padding: 5px 10px; border-radius: 6px; }
.hover3d { position: absolute; left: 14px; top: 70px; z-index: 5; background: rgba(14,17,24,.88);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; pointer-events: none;
  font-size: 12px; line-height: 1.5; display: flex; flex-direction: column; gap: 1px;
  font-variant-numeric: tabular-nums; }
.hover3d.hidden { display: none; }
.hover3d .hv-ll { font: 12px/1.5 ui-monospace, Menlo, monospace; color: var(--accent); }
.hover3d .hv-d b { color: #7fd4ff; }
.loading { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  color: var(--muted); background: rgba(14,17,24,.85); padding: 12px 20px; border-radius: 8px;
  border: 1px solid var(--border); }

/* side scan */
.ss-toolbar { position: absolute; top: 0; left: 0; right: 0; height: 46px; display: flex;
  align-items: center; gap: 18px; padding: 0 16px; border-bottom: 1px solid var(--border);
  background: var(--panel); z-index: 3; }
.ss-scroller { position: absolute; top: 46px; left: 0; right: 0; bottom: 0; overflow-x: auto;
  overflow-y: hidden; background: #000; }
.ss-host { height: 100%; display: flex; align-items: stretch; width: max-content; }
.ss-host img { height: 100%; display: block; pointer-events: none; user-select: none; image-rendering: auto; }
.ss-tip { position: absolute; background: rgba(14,17,24,.93); border: 1px solid var(--border);
  border-radius: 7px; padding: 7px 10px; font-size: 12px; pointer-events: none; z-index: 5;
  white-space: nowrap; line-height: 1.5; }
.ss-tip b { color: var(--accent); }

.foot { display: flex; justify-content: space-between; align-items: center; padding: 6px 16px;
  border-top: 1px solid var(--border); font-size: 11px; }

@media (max-width: 820px) {
  .topbar { flex-wrap: wrap; gap: 10px; }
  .head-mid { order: 3; width: 100%; }
}

/* co-branding (client company logo) */
.client-brand { display: flex; align-items: center; gap: 10px; padding-left: 14px; border-left: 1px solid var(--border); }
.client-brand.hidden { display: none; }
.client-txt { text-align: right; }
.client-name { font-size: 13px; font-weight: 600; }
.logo2 { height: 34px; width: auto; display: block; }

/* admin / settings page */
.admin-wrap { position: absolute; inset: 0; overflow-y: auto; padding: 22px; max-width: 900px; margin: 0 auto; }
.admin-card { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; margin-bottom: 16px; }
.admin-card h2 { font-size: 15px; margin-bottom: 6px; }
.admin-card code { background: var(--panel2); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; margin-top: 10px; }
.grid2 label, .row label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.grid2 label.chk { flex-direction: row; align-items: center; gap: 8px; }
.admin-wrap input[type=text], .admin-wrap input:not([type]), .admin-wrap input[type=password] {
  background: var(--panel2); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 7px 9px; font-size: 13px; }
.row { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.list { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.list-row { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: 6px; font-size: 13px; color: var(--text); }
.list-row:hover { background: var(--panel2); }
.lr-name { flex: 1; }
.merged-def { border: 1px solid var(--border); border-radius: 8px; padding: 12px; margin-bottom: 12px; }
.merged-def .m-name { flex: 1; }
.admin-actions { display: flex; align-items: center; gap: 14px; margin: 8px 0 40px; }
.mini-btn.danger, .btn.danger { border-color: #7c322f; color: #f0a09c; }

.btn { padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 600;
  border: 1px solid var(--border); background: var(--panel2); color: var(--text); cursor: pointer; }
.btn.go { background: #1c4d2e; border-color: #2a7045; color: #8ef0ac; }
