/* ── THEME VARIABLES ──────────────────────────────────────────── */
:root {
  --bg:          #ffffff;
  --bg2:         #f7f6f3;
  --bg3:         #f0ede8;
  --text:        #1a1a18;
  --text2:       #6b6a65;
  --text3:       #9a9890;
  --border:      rgba(0,0,0,0.09);
  --border2:     rgba(0,0,0,0.16);
  --green:       #1D9E75;
  --green-bg:    #E1F5EE;
  --green-text:  #0F6E56;
  --blue:        #1a56db;
  --sidebar-w:   210px;
  --map-h:       300px;
  --radius:      8px;
}

[data-theme="dark"] {
  --bg:          #071425;
  --bg2:         #0c1e35;
  --bg3:         #0a1628;
  --text:        #e2eaf4;
  --text2:       #7a99bb;
  --text3:       #3d5a7a;
  --border:      rgba(255,255,255,0.07);
  --border2:     rgba(255,255,255,0.13);
  --green:       #1D9E75;
  --green-bg:    #061f14;
  --green-text:  #34c993;
  --blue:        #3b82f6;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:          #071425;
    --bg2:         #0c1e35;
    --bg3:         #0a1628;
    --text:        #e2eaf4;
    --text2:       #7a99bb;
    --text3:       #3d5a7a;
    --border:      rgba(255,255,255,0.07);
    --border2:     rgba(255,255,255,0.13);
    --green:       #1D9E75;
    --green-bg:    #061f14;
    --green-text:  #34c993;
    --blue:        #3b82f6;
  }
}

/* ── RESET ────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', sans-serif;
  background: var(--bg3); color: var(--text);
  height: 100vh; overflow: hidden;
  transition: background 0.3s, color 0.3s;
}

/* ── LAYOUT ───────────────────────────────────────────────────── */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; height: 100vh; }
.main { display: grid; grid-template-rows: var(--map-h) 1fr; height: 100vh; overflow: hidden; background: var(--bg); }

/* ── SIDEBAR ──────────────────────────────────────────────────── */
.sidebar { background: var(--bg); border-right: 0.5px solid var(--border2); display: flex; flex-direction: column; overflow: hidden; }
.sidebar-top { padding: 16px 14px 12px; border-bottom: 0.5px solid var(--border); }

.wordmark { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); line-height: 1; margin-bottom: 10px; }
.wordmark em { font-style: normal; color: var(--green); }

.sidebar-top-row { display: flex; align-items: center; justify-content: space-between; }
.theme-toggle {
  background: none; border: 0.5px solid var(--border2); border-radius: 6px;
  color: var(--text3); cursor: pointer; padding: 4px 6px;
  display: flex; align-items: center; transition: color 0.15s, background 0.15s;
}
.theme-toggle:hover { color: var(--text); background: var(--bg2); }

.status-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text2); margin-top: 8px; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text3); transition: background 0.3s; flex-shrink: 0; }
.dot.fc-connected { background: #f59e0b; }
.dot.ready        { background: var(--green); animation: blink 2s infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.4} }

.sidenav { padding: 8px 7px; border-bottom: 0.5px solid var(--border); }
.nav-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 9px; font-size: 12.5px; font-weight: 400; color: var(--text2); background: none; border: none; border-radius: 6px; cursor: pointer; text-align: left; transition: background 0.12s, color 0.12s; margin-bottom: 2px; }
.nav-item:hover { background: var(--bg2); color: var(--text); }
.nav-item.active { background: var(--bg2); color: var(--text); font-weight: 500; }
.nav-item svg { flex-shrink: 0; opacity: 0.65; }
.nav-item.active svg { opacity: 1; }

.sidebar-stats { padding: 12px 14px; flex: 1; border-bottom: 0.5px solid var(--border); overflow-y: auto; }
.ss-row { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; }
.ss-label { font-size: 11px; color: var(--text3); }
.ss-val { font-size: 12px; font-weight: 500; color: var(--text); }

.arm-badge-wrap { padding: 10px 14px; }
.arm-badge { display: inline-block; font-size: 11px; font-weight: 500; padding: 4px 10px; border-radius: 20px; background: var(--bg2); color: var(--text3); border: 0.5px solid var(--border); }
.arm-badge.armed { background: #1f0a08; color: #f87171; border-color: rgba(248,113,113,0.3); }

.settings-btn { display: flex; align-items: center; gap: 8px; width: calc(100% - 14px); margin: 0 7px 10px; padding: 8px 9px; font-size: 12px; font-weight: 500; color: var(--text2); background: none; border: 0.5px solid var(--border); border-radius: 6px; cursor: pointer; text-align: left; transition: background 0.12s, color 0.12s; }
.settings-btn:hover { background: var(--bg2); color: var(--text); }
.settings-btn.active { background: var(--bg2); color: var(--text); border-color: var(--green); }

/* ── MAP ──────────────────────────────────────────────────────── */
.map-section { position: relative; border-bottom: 0.5px solid var(--border2); overflow: hidden; }
#gmap { width: 100%; height: 100%; }
.map-pill { position: absolute; top: 12px; font-size: 11px; font-weight: 500; padding: 5px 12px; border-radius: 20px; pointer-events: none; z-index: 10; }
.map-pill.left { left: 14px; background: var(--bg); color: var(--text); border: 0.5px solid var(--border); }
.map-pill.right { right: 14px; background: var(--green-bg); color: var(--green-text); }

/* ── CAMERA OVERLAY ───────────────────────────────────────────── */
.cam-overlay { position: absolute; bottom: 14px; right: 14px; width: 200px; background: var(--bg); border: 0.5px solid var(--border2); border-radius: var(--radius); overflow: hidden; z-index: 20; transition: width 0.25s; }
.cam-overlay.expanded { width: 340px; }
.cam-overlay-header { display: flex; align-items: center; justify-content: space-between; padding: 6px 10px; border-bottom: 0.5px solid var(--border); }
.cam-label { display: flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 500; color: var(--text2); }
.cam-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text3); }
.cam-dot.live { background: #ef4444; animation: blink 1.2s infinite; }
.cam-expand-btn { background: none; border: none; cursor: pointer; color: var(--text3); padding: 2px; display: flex; align-items: center; }
.cam-expand-btn:hover { color: var(--text); }
.cam-feed-wrap { aspect-ratio: 16/9; background: var(--bg3); position: relative; }
.cam-feed-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam-placeholder { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--text3); font-size: 11px; }

/* ── CONTENT AREA ─────────────────────────────────────────────── */
.content { overflow-y: auto; padding: 18px 24px; }
.panel { display: none; }
.panel.active { display: block; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.field-label { font-size: 10px; letter-spacing: 0.07em; color: var(--text3); margin-bottom: 8px; text-transform: uppercase; }

/* ── ADDRESS INPUTS ───────────────────────────────────────────── */
.route-block { display: flex; align-items: stretch; gap: 10px; margin-bottom: 10px; }
.route-dots { display: flex; flex-direction: column; align-items: center; padding-top: 28px; }
.rdot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.rdot-o { border: 2px solid var(--text); }
.rdot-d { background: var(--text); }
.rline { flex: 1; width: 1px; background: var(--border2); margin: 4px 0; }
.route-fields { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.addr-field { background: var(--bg2); border: 0.5px solid var(--border); border-radius: var(--radius); padding: 8px 12px; transition: border-color 0.15s; position: relative; }
.addr-field:focus-within { border-color: var(--green); }
.rfield-label { display: block; font-size: 10px; color: var(--text3); margin-bottom: 3px; }
.addr-input { width: 100%; background: none; border: none; outline: none; font-size: 13px; font-weight: 500; color: var(--text); font-family: inherit; }
.addr-input::placeholder { color: var(--text3); font-weight: 400; }

/* Quick picks */
.quick-picks { display: none; position: absolute; top: 100%; left: 0; right: 0; background: var(--bg); border: 0.5px solid var(--border2); border-radius: var(--radius); z-index: 100; margin-top: 2px; overflow: hidden; box-shadow: 0 4px 12px rgba(0,0,0,0.12); }
.quick-pick { display: flex; flex-direction: column; padding: 9px 12px; cursor: pointer; border-bottom: 0.5px solid var(--border); transition: background 0.1s; }
.quick-pick:last-child { border-bottom: none; }
.quick-pick:hover { background: var(--bg2); }
.qp-name { font-size: 12px; font-weight: 500; color: var(--text); }
.qp-addr { font-size: 11px; color: var(--text3); margin-top: 1px; }

/* ── BUTTONS ──────────────────────────────────────────────────── */
.btn-primary { width: 100%; padding: 11px 16px; background: var(--text); color: var(--bg); font-size: 13px; font-weight: 500; border: none; border-radius: var(--radius); cursor: pointer; transition: opacity 0.15s; }
.btn-primary:hover { opacity: 0.82; }
.btn-primary:disabled { opacity: 0.3; cursor: not-allowed; }
.btn-outline { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 14px; background: none; color: var(--text); font-size: 12.5px; font-weight: 500; border: 0.5px solid var(--border2); border-radius: var(--radius); cursor: pointer; transition: background 0.12s; margin-bottom: 10px; }
.btn-outline:hover { background: var(--bg2); }
.btn-outline.full { width: 100%; }
.btn-secondary { flex: 1; padding: 9px 12px; background: none; color: var(--text); font-size: 12.5px; font-weight: 400; border: 0.5px solid var(--border2); border-radius: var(--radius); cursor: pointer; transition: background 0.12s; }
.btn-secondary:hover { background: var(--bg2); }
.btn-secondary.full { width: 100%; }
.btn-warn { flex: 1; padding: 9px 12px; background: none; color: #ef4444; font-size: 12.5px; font-weight: 500; border: 0.5px solid rgba(239,68,68,0.3); border-radius: var(--radius); cursor: pointer; transition: background 0.12s; }
.btn-warn:hover { background: rgba(239,68,68,0.08); }
.btn-row { display: flex; gap: 8px; }
.btn-green { flex: 1; padding: 9px 12px; background: var(--green); color: #fff; font-size: 12.5px; font-weight: 500; border: none; border-radius: var(--radius); cursor: pointer; transition: opacity 0.15s; }
.btn-green:hover { opacity: 0.85; }
.btn-green:disabled { opacity: 0.3; cursor: not-allowed; }

/* ── PROGRESS ─────────────────────────────────────────────────── */
.progress-block { margin-bottom: 12px; }
.pb-header { display: flex; justify-content: space-between; margin-bottom: 6px; }
.pb-header span { font-size: 12px; font-weight: 500; color: var(--text); }
#pb-pct { font-weight: 400; color: var(--text2); }
.pb-track { height: 2px; background: var(--border2); border-radius: 2px; overflow: hidden; }
.pb-bar { height: 100%; background: var(--green); border-radius: 2px; width: 0; transition: width 0.3s; }

/* ── STATS ────────────────────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat-card { background: var(--bg2); border-radius: var(--radius); padding: 10px 12px; border: 0.5px solid var(--border); }
.stat-card.accent { border-color: var(--green); background: var(--green-bg); }
.stat-card.accent .sclabel { color: var(--green-text); }
.stat-card.accent .scval  { color: var(--green-text); }
.sclabel { display: block; font-size: 10px; color: var(--text3); margin-bottom: 4px; }
.scval { font-size: 19px; font-weight: 500; color: var(--text); line-height: 1; }
.scval small { font-size: 11px; font-weight: 400; color: var(--text2); margin-left: 2px; }

/* ── DELIVERED ────────────────────────────────────────────────── */
.delivered-card { text-align: center; padding: 16px 0 4px; }
.check-circle { width: 44px; height: 44px; border-radius: 50%; background: var(--green-bg); color: var(--green-text); display: flex; align-items: center; justify-content: center; margin: 0 auto 10px; }
.delivered-title { font-size: 15px; font-weight: 500; margin-bottom: 4px; }
.delivered-sub { font-size: 12px; color: var(--text2); margin-bottom: 14px; }

/* ── ESTIMATE ─────────────────────────────────────────────────── */
.estimate-card { background: var(--bg2); border: 0.5px solid var(--border); border-radius: var(--radius); overflow: hidden; min-height: 140px; }
.estimate-placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 28px 16px; color: var(--text3); font-size: 12px; text-align: center; line-height: 1.6; }
.estimate-data { padding: 12px; }
.breakdown { border-top: 0.5px solid var(--border); padding-top: 10px; margin-top: 10px; }
.bd-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 12px; }
.bd-row span:first-child { color: var(--text2); }
.bd-row span:last-child { font-weight: 500; color: var(--text); }
.inflight-stats { margin-top: 12px; }

/* ── DELIVERY TICKET FORM ─────────────────────────────────────── */
.ticket-form {
  background: var(--bg2); border: 0.5px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px;
}
.ticket-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.tf-field { display: flex; flex-direction: column; gap: 4px; }
.tf-field.full { grid-column: span 2; }
.tf-label { font-size: 10px; color: var(--text3); letter-spacing: 0.05em; text-transform: uppercase; }
.tf-input {
  background: var(--bg); border: 0.5px solid var(--border2);
  border-radius: 6px; padding: 8px 10px;
  font-size: 13px; color: var(--text); font-family: inherit;
  outline: none; transition: border-color 0.15s;
  width: 100%;
}
.tf-input:focus { border-color: var(--green); }
.tf-input::placeholder { color: var(--text3); }
select.tf-input { cursor: pointer; }

.qty-row { display: flex; align-items: center; gap: 10px; }
.qty-btn { width: 28px; height: 28px; border-radius: 6px; background: var(--bg); border: 0.5px solid var(--border2); color: var(--text); font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: background 0.12s; }
.qty-btn:hover { background: var(--bg3); }
.qty-display { font-size: 18px; font-weight: 600; color: var(--text); min-width: 36px; text-align: center; }
.qty-max { font-size: 11px; color: var(--text3); }

/* ── DELIVERY QUEUE ───────────────────────────────────────────── */
.queue-list { display: flex; flex-direction: column; gap: 8px; }
.queue-item {
  background: var(--bg2); border: 0.5px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px;
  display: grid; grid-template-columns: 1fr auto;
  align-items: start; gap: 10px;
}
.queue-item.in-progress { border-color: var(--green); background: var(--green-bg); }
.queue-item.delivered   { opacity: 0.6; }
.qi-ticket { font-size: 10px; font-weight: 600; color: var(--text3); letter-spacing: 0.08em; margin-bottom: 3px; }
.qi-recipient { font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 2px; }
.qi-meta { font-size: 11px; color: var(--text2); }
.qi-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.status-badge { font-size: 10px; font-weight: 600; padding: 3px 8px; border-radius: 20px; letter-spacing: 0.04em; white-space: nowrap; }
.status-badge.pending     { background: var(--bg3); color: var(--text3); border: 0.5px solid var(--border); }
.status-badge.in_progress { background: var(--green-bg); color: var(--green-text); border: 0.5px solid rgba(29,158,117,0.3); }
.status-badge.delivered   { background: rgba(59,130,246,0.1); color: var(--blue); border: 0.5px solid rgba(59,130,246,0.2); }
.status-badge.failed      { background: rgba(239,68,68,0.1); color: #ef4444; border: 0.5px solid rgba(239,68,68,0.2); }
.qi-date { font-size: 10px; color: var(--text3); }
.qi-start-btn { font-size: 11px; font-weight: 500; padding: 5px 10px; background: var(--green); color: #fff; border: none; border-radius: 20px; cursor: pointer; transition: opacity 0.15s; white-space: nowrap; }
.qi-start-btn:hover { opacity: 0.85; }
.qi-start-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.queue-empty { text-align: center; padding: 28px; font-size: 12px; color: var(--text3); }
.queue-loading { text-align: center; padding: 20px; font-size: 12px; color: var(--text3); }

/* ── CAMERA (telemetry panel) ─────────────────────────────────── */
.cam-wrap-large { position: relative; background: var(--bg3); border-radius: var(--radius); overflow: hidden; border: 0.5px solid var(--border); aspect-ratio: 16/9; margin-bottom: 10px; }
.cam-wrap-large img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam-offline { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; font-size: 12px; color: var(--text3); text-align: center; line-height: 1.6; }
.cam-offline code { font-family: 'SF Mono', monospace; font-size: 11px; background: var(--bg2); padding: 2px 6px; border-radius: 4px; color: var(--text2); }
.cam-controls { display: flex; align-items: center; gap: 8px; }

/* ── CONTROLS PANEL ───────────────────────────────────────────── */
.mode-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 6px; }
.mode-btn { padding: 8px 4px; font-size: 12px; background: var(--bg2); border: 0.5px solid var(--border); border-radius: var(--radius); cursor: pointer; color: var(--text); transition: background 0.12s; }
.mode-btn:hover { background: var(--bg3); }
.mode-btn.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.motor-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 6px; }
.motor-btn { padding: 9px; font-size: 13px; font-weight: 500; background: var(--bg2); border: 0.5px solid var(--border); border-radius: var(--radius); cursor: pointer; color: var(--text); transition: background 0.12s; }
.motor-btn:hover { background: var(--bg3); }
.slider-row { display: flex; align-items: center; gap: 10px; }
.slider-row input { flex: 1; }
.note { font-size: 10px; color: var(--text3); font-weight: 400; }
.log-box { background: var(--bg2); border: 0.5px solid var(--border); border-radius: var(--radius); padding: 10px 13px; font-family: 'SF Mono', 'Fira Code', monospace; font-size: 11px; color: var(--text2); height: 130px; overflow-y: auto; line-height: 1.7; }
.log-ok   { color: var(--green-text); }
.log-err  { color: #ef4444; }
.log-warn { color: #f59e0b; }

/* ── PREFLIGHT PANEL ──────────────────────────────────────────── */
.pf-header { background: var(--bg2); border: 0.5px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 0; }
.pf-title-row { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; gap: 12px; }
.pf-title { font-size: 15px; font-weight: 500; margin-bottom: 3px; }
.pf-sub { font-size: 12px; color: var(--text2); }
.pf-checks { display: flex; flex-wrap: wrap; gap: 6px; }
.pf-check { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 500; padding: 4px 10px; border-radius: 20px; border: 0.5px solid transparent; }
.pf-check.ok   { background: var(--green-bg); color: var(--green-text); }
.pf-check.fail { background: rgba(239,68,68,0.1); color: #ef4444; }

.device-list { display: flex; flex-direction: column; gap: 8px; }
.device-loading { font-size: 12px; color: var(--text3); padding: 12px 0; }
.device-card { background: var(--bg); border: 0.5px solid var(--border); border-radius: var(--radius); padding: 11px 13px; display: flex; align-items: center; gap: 12px; }
.device-card.connected    { border-left: 2px solid var(--green); }
.device-card.disconnected { border-left: 2px solid #ef4444; opacity: 0.8; }
.device-card.warning      { border-left: 2px solid #f59e0b; }
.device-card.unknown      { border-left: 2px solid var(--border2); }
.device-icon { width: 32px; height: 32px; border-radius: 7px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 15px; }
.device-icon.connected    { background: var(--green-bg); color: var(--green-text); }
.device-icon.disconnected { background: rgba(239,68,68,0.1); color: #ef4444; }
.device-icon.unknown      { background: var(--bg2); color: var(--text3); }
.device-info { flex: 1; min-width: 0; }
.device-name   { font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 2px; }
.device-detail { font-size: 11px; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.device-notes  { font-size: 11px; color: var(--text2); margin-top: 2px; }
.device-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.status-dot.connected    { background: var(--green); }
.status-dot.disconnected { background: #ef4444; }
.status-dot.unknown      { background: var(--text3); }
.test-btn { font-size: 11px; font-weight: 500; padding: 4px 9px; background: none; border: 0.5px solid var(--border2); border-radius: 20px; cursor: pointer; color: var(--text2); transition: background 0.12s; white-space: nowrap; }
.test-btn:hover { background: var(--bg2); color: var(--text); }
.test-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.test-result { font-size: 11px; padding: 4px 10px; border-radius: 4px; margin-top: 5px; display: none; }
.test-result.ok   { background: var(--green-bg); color: var(--green-text); }
.test-result.fail { background: rgba(239,68,68,0.1); color: #ef4444; }

.vitals-card { background: var(--bg2); border: 0.5px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.battery-bar-wrap { margin-bottom: 12px; }
.battery-label-row { display: flex; justify-content: space-between; font-size: 12px; font-weight: 500; color: var(--text); margin-bottom: 5px; }
.battery-track { height: 6px; background: var(--bg3); border-radius: 4px; overflow: hidden; }
.battery-fill { height: 100%; border-radius: 4px; background: var(--green); transition: width 0.5s, background 0.3s; }
.battery-fill.low { background: #ef4444; }
.battery-fill.med { background: #f59e0b; }
.vitals-grid { border-top: 0.5px solid var(--border); padding-top: 10px; }
.vital-row { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 0.5px solid var(--border); }
.vital-row:last-child { border-bottom: none; }
.vital-label { font-size: 12px; color: var(--text2); }
.vital-val { font-size: 12px; font-weight: 500; color: var(--text); }
.arm-block { background: var(--bg2); border: 0.5px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.arm-warning { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #92400e; margin-bottom: 10px; background: rgba(245,158,11,0.12); padding: 8px 10px; border-radius: 6px; }

/* ── MOBILE ───────────────────────────────────────────────────── */
@media (max-width: 760px) {
  body { overflow: auto; }
  .app { grid-template-columns: 1fr; height: auto; }
  .sidebar { border-right: none; border-bottom: 0.5px solid var(--border2); flex-direction: row; flex-wrap: wrap; }
  .sidebar-top { flex: 1; border-bottom: none; }
  .sidenav { display: flex; padding: 8px; border-bottom: none; border-left: 0.5px solid var(--border); }
  .nav-item { margin-bottom: 0; margin-right: 2px; }
  .sidebar-stats, .arm-badge-wrap { display: none; }
  .main { height: auto; grid-template-rows: 220px auto; }
  .content { padding: 14px; }
  .cols { grid-template-columns: 1fr; gap: 16px; }
  .cam-overlay { width: 150px; }
}
