:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #090c10;
  --panel: #10151c;
  --panel-2: #151b24;
  --line: #252d38;
  --text: #f4f6f8;
  --muted: #8f9aa8;
  --accent: #4f8cff;
  --accent-2: #6ea1ff;
  --good: #48c78e;
  --warn: #f0b45f;
  --danger: #ef6a73;
}
* { box-sizing: border-box; }
html, body, #app { margin: 0; width: 100%; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); }
button, input, select { font: inherit; }
button { color: inherit; }
.ui-icon { width: 16px; height: 16px; display: inline-block; flex: 0 0 auto; vertical-align: middle; }
.panel-heading { display: flex; align-items: center; gap: 9px; margin: 0 0 5px; }
.panel-heading .panel-title { margin: 0; }
.panel-icon { width: 20px; height: 20px; color: #82aef5; }
.app { height: 100%; display: grid; grid-template-columns: 390px minmax(0, 1fr); }
.sidebar { min-width: 0; height: 100vh; overflow: hidden; border-right: 1px solid var(--line); background: linear-gradient(180deg, #111720 0%, #0c1117 100%); display: flex; flex-direction: column; }
.brand { height: 68px; padding: 0 18px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.brand-left { display: flex; align-items: center; gap: 11px; }
.logo { width: 34px; height: 34px; border: 1px solid #3b4655; border-radius: 10px; display: grid; place-items: center; background: #181f29; font-weight: 800; letter-spacing: -.04em; }
.brand-title { font-weight: 720; font-size: 15px; letter-spacing: -.01em; }
.brand-sub { color: var(--muted); font-size: 11px; margin-top: 2px; }
.status-pill { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 999px; padding: 6px 9px; color: var(--muted); font-size: 11px; background: #0d1218; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 15%, transparent); }
.status-pill.ready .status-dot { background: var(--good); box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 15%, transparent); }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 12px; border-bottom: 1px solid var(--line); }
.tab { border: 1px solid transparent; background: transparent; border-radius: 8px; padding: 8px 5px; cursor: pointer; font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.tab:hover { background: #171e27; color: var(--text); }
.tab.active { background: #1a2330; border-color: #2b394c; color: #fff; }
.tab .ui-icon { width: 15px; height: 15px; opacity: .86; }
.tab.active .ui-icon { color: #82aef5; opacity: 1; }
.panel-scroll { flex: 1; min-height: 0; overflow-x: hidden; overflow-y: scroll; overscroll-behavior: contain; scrollbar-gutter: stable; scrollbar-width: thin; padding: 16px; }
.panel-scroll::-webkit-scrollbar { width: 10px; }
.panel-scroll::-webkit-scrollbar-track { background: #0c1117; }
.panel-scroll::-webkit-scrollbar-thumb { background: #34404f; border-radius: 999px; border: 2px solid #0c1117; }
.panel-scroll::-webkit-scrollbar-thumb:hover { background: #465568; }
.app-credit {
  flex: 0 0 auto;
  border-top: 1px solid var(--line);
  padding: 9px 16px 10px;
  color: #667487;
  font-size: 10px;
  line-height: 1.2;
  text-align: center;
  letter-spacing: .01em;
  user-select: none;
}
.panel-title { margin: 0 0 5px; font-size: 18px; letter-spacing: -.02em; }
.panel-desc { margin: 0 0 18px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.section { border-top: 1px solid var(--line); padding-top: 15px; margin-top: 17px; }
.section:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }
.section-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #718093; margin: 0 0 10px; font-weight: 700; }
.row { display: flex; gap: 9px; align-items: center; margin: 9px 0; }
.row > * { min-width: 0; }
.field { margin: 12px 0; }
.field label { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; font-size: 12px; color: #c8d0da; }
.value { color: var(--muted); font-variant-numeric: tabular-nums; }
input[type="text"], input[type="number"], select { width: 100%; height: 38px; border: 1px solid #2a3441; background: #0c1117; color: var(--text); border-radius: 8px; padding: 0 10px; outline: none; }
input:focus, select:focus { border-color: #507bbd; box-shadow: 0 0 0 3px rgba(79, 140, 255, .12); }
input[type="range"] { width: 100%; accent-color: var(--accent); cursor: pointer; }
.slider-field { margin-bottom: 16px; }
.slider-note { display: flex; align-items: flex-start; gap: 6px; margin-top: 6px; color: #718095; font-size: 10px; line-height: 1.35; }
.slider-note .ui-icon { width: 13px; height: 13px; margin-top: .5px; color: #5f7da6; }
.slider-note span { min-width: 0; }
input[type="color"] { width: 38px; height: 31px; padding: 2px; border: 1px solid #2a3441; border-radius: 7px; background: #0c1117; }
.btn { height: 38px; border-radius: 8px; border: 1px solid #2d3846; background: #171e27; padding: 0 12px; cursor: pointer; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.btn .ui-icon { width: 15px; height: 15px; }
.btn:hover:not(:disabled) { background: #202a36; }
.btn.primary { background: #356fd1; border-color: #4e83de; color: white; }
.btn.primary:hover:not(:disabled) { background: #3d78db; }
.btn.ghost { background: transparent; }
.btn.danger { color: #ff8b93; }
.btn:disabled { opacity: .42; cursor: not-allowed; }
.btn.icon { width: 32px; height: 32px; padding: 0; }
.search-line { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.search-results { margin-top: 8px; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: #0d1218; }
.search-result { width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--text); padding: 10px 11px; cursor: pointer; }
.search-result:last-child { border-bottom: 0; }
.search-result:hover { background: #18202a; }
.search-result b { display: block; font-size: 12px; }
.search-result span { display: block; font-size: 10px; color: var(--muted); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.waypoints { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.waypoint { display: grid; grid-template-columns: 24px minmax(0, 1fr) max-content; align-items: center; gap: 8px; border: 1px solid #26303c; border-radius: 9px; padding: 8px; background: #121821; overflow: hidden; }
.waypoint.dragging { opacity: .5; }
.drag { color: #657184; cursor: grab; user-select: none; text-align: center; display: grid; place-items: center; }
.drag .ui-icon { width: 17px; height: 17px; }
.wp-content { min-width: 0; }
.wp-name { min-width: 0; font-size: 12px; font-weight: 650; line-height: 1.25; white-space: normal; overflow: hidden; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
.wp-name-input { width: 100%; min-width: 0; height: 28px; padding: 4px 7px; font-size: 12px; font-weight: 650; border: 1px solid transparent; border-radius: 6px; background: transparent; color: inherit; }
.wp-name-input:hover, .wp-name-input:focus { border-color: #344253; background: #0d1219; outline: none; }
.wp-coord { font-size: 10px; color: var(--muted); margin-top: 2px; font-variant-numeric: tabular-nums; }
.wp-actions { display: flex; gap: 3px; flex: 0 0 auto; min-width: max-content; }
.empty { border: 1px dashed #2a3440; border-radius: 10px; padding: 22px 12px; text-align: center; color: var(--muted); font-size: 12px; }
.check { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 0; font-size: 12px; color: #c8d0da; }
.check input { accent-color: var(--accent); }
.segmented { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.segmented button { border: 1px solid #2a3441; background: #0c1117; color: var(--muted); border-radius: 8px; padding: 8px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.segmented .ui-icon { width: 14px; height: 14px; }
.segmented button.active { background: #1c2a3e; color: white; border-color: #416aa4; }
.main { min-width: 0; display: grid; grid-template-rows: 64px minmax(0, 1fr) 76px; background: radial-gradient(circle at 50% 20%, #171d25, #080b0f 70%); }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 0 22px; border-bottom: 1px solid #1f2731; background: rgba(10, 13, 18, .88); }
.top-title { font-size: 13px; font-weight: 650; }
.top-meta { display: flex; gap: 16px; color: var(--muted); font-size: 11px; }
.account-menu-btn { background: none; border: none; color: var(--muted); font: inherit; padding: 0; cursor: pointer; text-decoration: underline dotted; }
.account-menu-btn:hover { color: var(--text); }
.account-menu { position: absolute; z-index: 40; background: #121924; border: 1px solid #26313f; border-radius: 10px; padding: 14px; width: 220px; box-shadow: 0 12px 30px rgba(0,0,0,.4); }
.account-menu .field { margin-bottom: 8px; }
.account-menu-username { font-weight: 600; margin-bottom: 8px; }
.preview-stage { min-height: 0; display: grid; place-items: center; padding: 22px; position: relative; }
.preview-frame { position: relative; width: min(100%, calc((100vh - 204px) * 16 / 9)); max-height: 100%; aspect-ratio: 16/9; border-radius: 12px; overflow: hidden; background: #dfe5e8; box-shadow: 0 24px 70px rgba(0,0,0,.48), 0 0 0 1px rgba(255,255,255,.08); }
#mapCanvas { width: 100%; height: 100%; display: block; cursor: grab; }
#mapCanvas.add-mode { cursor: crosshair; }
.map-badge { position: absolute; left: 12px; top: 12px; z-index: 3; background: rgba(8, 12, 17, .74); border: 1px solid rgba(255,255,255,.13); backdrop-filter: blur(8px); border-radius: 8px; padding: 6px 9px; font-size: 10px; color: #d7dde5; pointer-events: none; }
.attribution { position: absolute; right: 7px; bottom: 6px; z-index: 3; background: rgba(255,255,255,.83); color: #3e4650; border-radius: 4px; padding: 3px 5px; font-size: 8px; pointer-events: none; max-width: 62%; text-align: right; }
.map-hint { position: absolute; left: 50%; top: 16px; transform: translateX(-50%); z-index: 4; background: #1a2532; border: 1px solid #3e5878; border-radius: 999px; padding: 7px 12px; font-size: 11px; box-shadow: 0 8px 24px rgba(0,0,0,.3); display: none; }
.map-hint.show { display: block; }
.playbar { border-top: 1px solid #1e2630; background: rgba(10, 13, 18, .93); display: grid; grid-template-columns: auto minmax(180px, 1fr) auto; align-items: center; gap: 16px; padding: 0 22px; }
.play-actions { display: flex; gap: 7px; }
.play-btn { width: 46px; height: 42px; border-radius: 10px; border: 1px solid #467cda; background: #346ed0; color: white; cursor: pointer; font-size: 16px; display: grid; place-items: center; }
.play-btn .ui-icon { width: 20px; height: 20px; }
.play-btn:disabled { opacity: .35; cursor: not-allowed; }
.timeline { min-width: 0; }
.timeline-top { display: flex; justify-content: space-between; margin-bottom: 7px; color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.track { height: 5px; background: #222b36; border-radius: 99px; overflow: hidden; }
.progress { height: 100%; width: 0; background: linear-gradient(90deg, #4f8cff, #79a8ff); border-radius: inherit; }
.play-status { min-width: 110px; text-align: right; font-size: 10px; color: var(--muted); }
.notice { border: 1px solid #3b4552; background: #141b23; border-radius: 9px; padding: 10px 11px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.notice.warn { border-color: #5c4830; background: #1e1811; color: #dcb879; }
.export-box { border: 1px solid #2b3541; border-radius: 11px; background: #101720; padding: 14px; }
.export-spec { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-size: 12px; }
.export-spec span:last-child { color: var(--muted); }
.export-progress { margin-top: 12px; display: none; }
.export-progress.show { display: block; }
.export-progress .track { height: 7px; }
.kbd { border: 1px solid #3a4350; background: #161c24; border-radius: 4px; padding: 1px 5px; font-size: 9px; color: #aab4c0; }
@media (max-width: 900px) {
  .app { grid-template-columns: 330px minmax(0, 1fr); }
  .preview-stage { padding: 10px; }
}
.render-history { display: flex; flex-direction: column; gap: 9px; }
.render-card { border: 1px solid #2a3441; border-radius: 10px; background: #0e141c; padding: 11px; }
.render-card.running { border-color: #315d96; }
.render-card.completed { border-color: #285a48; }
.render-card.failed { border-color: #64343a; }
.render-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.render-route { min-width: 0; font-size: 12px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.render-status { flex: 0 0 auto; font-size: 9px; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; border-radius: 999px; padding: 4px 7px; background: #222b36; color: #aeb8c4; }
.render-status.running { background: #17345a; color: #8ec0ff; }
.render-status.completed { background: #173c30; color: #7fe0b4; }
.render-status.failed { background: #4a2228; color: #ff9aa2; }
.render-meta { margin-top: 4px; color: var(--muted); font-size: 9px; line-height: 1.35; }
.render-progress-line { margin-top: 10px; display: grid; grid-template-columns: minmax(0,1fr) 34px; align-items: center; gap: 8px; color: var(--muted); font-size: 9px; font-variant-numeric: tabular-nums; }
.render-progress-line .track { height: 6px; }
.render-times { display: flex; justify-content: space-between; gap: 8px; margin-top: 7px; color: #7f8b99; font-size: 9px; font-variant-numeric: tabular-nums; }
.render-error { margin-top: 8px; color: #ff9aa2; font-size: 9px; line-height: 1.35; white-space: pre-wrap; overflow-wrap: anywhere; }
.render-note { margin-top: 8px; color: #8f9aa8; font-size: 9px; line-height: 1.35; white-space: pre-wrap; overflow-wrap: anywhere; }
.render-actions { display: flex; gap: 7px; margin-top: 10px; }
.render-actions .btn { flex: 1; height: 34px; text-decoration: none; }
.control-note { display:flex; gap:6px; align-items:flex-start; margin-top:7px; color:#7f8c9d; font-size:10px; line-height:1.35; }
.control-note .ui-icon { width:12px; height:12px; flex:0 0 12px; margin-top:1px; }

/* V11 multi-drone controls */
.drone-fleet { display:flex; flex-direction:column; gap:6px; }
.drone-chip { width:100%; min-width:0; display:grid; grid-template-columns:12px minmax(0,1fr) auto; align-items:center; gap:8px; border:1px solid #293443; border-radius:9px; background:#0d131a; color:#b8c2cf; padding:8px 9px; cursor:pointer; text-align:left; }
.drone-chip:hover { background:#151d27; }
.drone-chip.active { border-color:#4f83d9; background:#17243a; color:#fff; }
.drone-chip span:nth-child(2) { min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.drone-chip small { color:#6f7d90; font-size:9px; }
.drone-dot { width:10px; height:10px; border-radius:50%; box-shadow:0 0 0 1px rgba(255,255,255,.22); }
.two-fields { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.two-fields .field { min-width:0; }
.active-drone-notice { margin-bottom:14px; }
.drone-quick-switch { display:flex; flex-wrap:wrap; gap:6px; margin: -6px 0 16px; }
.drone-quick-switch .chip { border:1px solid #2a3441; background:#0c1117; color:var(--muted); border-radius:999px; padding:6px 14px; font-size:12.5px; cursor:pointer; }
.drone-quick-switch .chip.active { background:#1c2a3e; color:#fff; border-color:#416aa4; }
.drone-timeline { display:flex; flex-direction:column; gap:7px; }
.timeline-lane { width:100%; border:1px solid #283342; border-radius:9px; background:#0d131a; color:#c4ccd6; padding:8px; cursor:pointer; text-align:left; }
.timeline-lane.selected { border-color:#4c7dc6; background:#142034; }
.timeline-lane-head { display:flex; justify-content:space-between; gap:8px; align-items:center; margin-bottom:6px; font-size:10px; }
.timeline-lane-head b { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:10px; }
.timeline-lane-head span { flex:0 0 auto; color:#78879a; font-size:8px; font-variant-numeric:tabular-nums; }
.timeline-lane-track { height:7px; background:#222c37; border-radius:999px; position:relative; overflow:hidden; }
.timeline-lane-bar { position:absolute; top:0; bottom:0; border-radius:999px; min-width:3px; opacity:.92; }

.render-card.cancelled { opacity: .86; }
.render-status.cancelled { color: #b7c0cc; }

@media (max-width: 760px) {
  html, body, #app { height: auto; min-height: 100%; overflow: auto; }
  .app { display: grid; grid-template-columns: 1fr; grid-template-rows: auto auto; height: auto; min-height: 100vh; }
  .sidebar { height: auto; max-height: 58vh; border-right: 0; border-bottom: 1px solid var(--line); }
  .main { min-height: 72vw; grid-template-rows: 54px minmax(260px, 1fr) 72px; }
  .preview-stage { padding: 8px; }
  .topbar { padding: 0 12px; }
  .top-meta { gap: 8px; font-size: 9px; }
  .playbar { padding: 0 10px; gap: 9px; grid-template-columns: auto minmax(100px, 1fr); }
  .play-status { display: none; }
}

.tour-help-link { border: 0; background: transparent; color: #7d9cd6; font-size: inherit; cursor: pointer; padding: 0; text-decoration: underline; text-underline-offset: 2px; }
.tour-help-link:hover { color: var(--accent-2); }
#tourOverlay { position: fixed; inset: 0; z-index: 80; }
.tour-backdrop { position: fixed; inset: 0; background: rgba(4, 6, 9, .74); cursor: pointer; }
.tour-highlight { position: fixed; z-index: 81; border-radius: 10px; border: 2px solid var(--accent-2); box-shadow: 0 0 0 4px rgba(110, 161, 255, .18), 0 0 22px rgba(110, 161, 255, .45); pointer-events: none; transition: left .2s ease, top .2s ease, width .2s ease, height .2s ease; }
.tour-card { position: fixed; z-index: 82; background: var(--panel-2); border: 1px solid #33415a; border-radius: 12px; padding: 16px 17px; box-shadow: 0 20px 50px rgba(0,0,0,.55); }
.tour-step-count { font-size: 10px; letter-spacing: .07em; text-transform: uppercase; color: #7d9cd6; font-weight: 700; margin-bottom: 7px; }
.tour-title { margin: 0 0 7px; font-size: 15px; letter-spacing: -.01em; }
.tour-body { margin: 0 0 16px; font-size: 12px; line-height: 1.5; color: #c8d0da; }
.tour-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tour-nav { display: flex; gap: 8px; }
