body { overflow: hidden; }

.topbar {
  height: 52px; display: flex; align-items: center; gap: 12px; padding: 0 14px;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font-weight: 800; letter-spacing: .14em; }
.brand img { width: 26px; height: 26px; }
#missionSelect { width: auto; max-width: 320px; font-weight: 600; }
.stats { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.stats b { color: var(--text); font-variant-numeric: tabular-nums; }
.stats .alert b { color: #fca5a5; }
.clock { color: var(--muted); }

.layout { display: flex; height: calc(100% - 52px); }

/* ---------- sidebar ---------- */
.sidebar { width: 340px; flex: none; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.side-search { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.side-scroll { overflow: auto; flex: 1; display: flex; flex-direction: column; }
details { border-bottom: 1px solid var(--line); padding: 10px 12px 12px; }
summary { cursor: pointer; font-weight: 650; font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); list-style: none; display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
summary::-webkit-details-marker { display: none; }
summary::before { content: "▸"; margin-right: 6px; transition: transform .15s; }
details[open] > summary::before { transform: rotate(90deg); }
summary > :first-child { margin-left: auto; }
.sub { font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; margin: 10px 0 6px; }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; font-size: 13px; }
.checks label.check:has(select) { grid-column: 1 / -1; }
select.inline { width: auto; padding: 2px 6px; font-size: 12px; margin-left: 4px; }
.seg.full { display: flex; }
.seg.full button { flex: 1; }
.filter-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: 13px; }
.filter-row > span { width: 70px; color: var(--muted); flex: none; }
.filter-row select { flex: 1; padding: 4px 8px; }

.lists { display: flex; flex-direction: column; flex: 1; min-height: 260px; }
.tabs { display: flex; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); z-index: 1; }
.tabs button { flex: 1; border: 0; border-radius: 0; background: transparent; padding: 10px 4px; font-size: 12px; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.tabs button span { color: var(--faint); font-variant-numeric: tabular-nums; }
.list { padding: 4px 0; }
.item { display: flex; gap: 10px; padding: 8px 12px; cursor: pointer; align-items: flex-start; border-left: 3px solid transparent; }
.item:hover { background: var(--panel-2); }
.item.sel { background: var(--panel-2); border-left-color: var(--accent); }
.item .ic { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex: none; font-size: 14px; border: 2px solid rgba(255, 255, 255, .85); }
.item .tx { min-width: 0; flex: 1; }
.item .t1 { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .t2 { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item.dim { opacity: .55; }
.item .side { font-size: 11px; color: var(--faint); white-space: nowrap; text-align: right; }
.journal .item .ic { border: 0; background: var(--panel-3); width: 24px; height: 24px; font-size: 12px; }

/* ---------- map ---------- */
.mapwrap { position: relative; flex: 1; min-width: 0; }
#map { position: absolute; inset: 0; }
.map-tools { position: absolute; top: 12px; left: 12px; display: flex; gap: 8px; z-index: 2; }
.map-tools button { box-shadow: var(--shadow); }
.map-hint { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 3; background: var(--accent); color: var(--accent-ink); font-weight: 650; padding: 8px 14px; border-radius: 999px; box-shadow: var(--shadow); display: flex; gap: 10px; align-items: center; }
.map-hint button { background: rgba(0, 0, 0, .15); border: 0; color: inherit; padding: 2px 10px; }
.mapwrap.picking #map { cursor: crosshair; }
.mapwrap.picking .maplibregl-canvas { cursor: crosshair; }
.ctx-menu { position: absolute; z-index: 5; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 4px; min-width: 200px; }
.ctx-menu button { display: flex; width: 100%; justify-content: flex-start; border: 0; background: transparent; padding: 7px 10px; }
.ctx-menu button:hover { background: var(--panel-3); }
.ctx-menu .coord { padding: 6px 10px; font-size: 11px; color: var(--muted); font-family: var(--mono); }

/* ---------- detail panel ---------- */
.detail { width: 380px; flex: none; background: var(--panel); border-left: 1px solid var(--line); overflow: auto; display: flex; flex-direction: column; }
.d-head { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); z-index: 1; }
.d-head .ic { width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 19px; border: 2px solid #fff; flex: none; }
.d-head .kicker { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.d-head h2 { font-size: 17px; line-height: 1.25; word-break: break-word; }
.d-body { padding: 14px 16px 20px; display: flex; flex-direction: column; gap: 14px; }
.d-body .pills { display: flex; gap: 6px; flex-wrap: wrap; }
.d-body .desc { white-space: pre-wrap; word-break: break-word; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 5px 10px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.d-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.d-section h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; }
.type-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.type-grid button { flex-direction: column; gap: 2px; padding: 8px 4px; font-size: 11px; white-space: normal; text-align: center; line-height: 1.2; }
.type-grid button .e { font-size: 20px; }
.type-grid button.on { border-color: var(--c); background: color-mix(in srgb, var(--c) 22%, var(--panel-3)); }
.form { display: flex; flex-direction: column; gap: 12px; }
.upload-progress { height: 4px; background: var(--panel-3); border-radius: 2px; overflow: hidden; }
.upload-progress div { height: 100%; background: var(--accent); width: 0; transition: width .2s; }

@media (max-width: 1100px) {
  .sidebar { width: 290px; }
  .detail { width: 330px; }
  .stats { display: none; }
}
@media (max-width: 760px) {
  .sidebar { display: none; }
  .detail { position: absolute; right: 0; top: 52px; bottom: 0; width: 100%; z-index: 10; }
}
