:root {
  --bg: #F4EDE4;
  --surface: #FBF8F3;
  --surface-alt: #F1E9DE;
  --white: #FFFFFF;
  --navy: #264653;
  --navy-hover: #2E5564;
  --navy-line: #3D6676;
  --navy-muted: #A9C4C9;
  --teal: #2A9D8F;
  --teal-text: #1C7268;
  --teal-tint: #EAF4F1;
  --coral: #E76F51;
  --coral-ink: #14262E;
  --coral-tint: #FBEAE4;
  --coral-line: #F2C1B2;
  --sand: #E9C46A;
  --warn-text: #A63A1F;
  --line: #E6DCCF;
  --line-strong: #DDD3C6;
  --muted: #576A71;
  --switch-off: #D8CEC1;
  --danger: #C43E3E;
  --font-body: "Segoe UI", Roboto, system-ui, -apple-system, sans-serif;
  --font-display: Bahnschrift, "Roboto Condensed", "Segoe UI", Roboto, system-ui, sans-serif;
  --font-mono: "Cascadia Mono", "Roboto Mono", ui-monospace, Consolas, monospace;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--navy);
  background: var(--bg);
  overscroll-behavior: none;
  overflow-x: hidden;
}

button, input, select, textarea { font-family: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
/* Icon size default; :where() keeps it at zero specificity so any class
   rule wins, and Leaflet's own vector-layer <svg> is left alone. */
:where(svg:not(.leaflet-zoom-animated)) { width: 20px; height: 20px; flex-shrink: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.caption { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.12em; color: var(--teal-text); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 16px; border-radius: 12px; border: none;
  font-size: 14.5px; font-weight: 600; white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; }
.btn svg { width: 18px; height: 18px; }
.btn-coral { background: var(--coral); color: var(--coral-ink); font-family: var(--font-display); font-weight: 700; font-size: 15px; }
.btn-navy { background: var(--navy); color: var(--bg); }
.btn-outline { background: transparent; color: var(--navy); border: 1.5px solid var(--navy); width: 100%; }
.btn-ghost { background: transparent; color: var(--navy); border: 1px solid var(--line-strong); }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn-danger-solid { background: var(--danger); color: #fff; width: 100%; }

/* ============================================================ */
/* Screens: login / dashboard / editor - only one shown at a time */
/* ============================================================ */
.screen {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1;
  background: var(--bg);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.screen.active { display: block; }

.brand-line { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 16px; min-width: 0; }
.brand-line .wordmark { height: 40px; width: auto; display: block; }
.brand-line span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Login ---- */
.login-screen.active { display: flex; flex-direction: column; }
.login-hero {
  color: var(--bg);
  /* Navy with a faint survey grid and a teal glow behind the demo. */
  background:
    radial-gradient(ellipse 70% 55% at 60% 62%, rgba(42, 157, 143, 0.28), transparent 70%),
    linear-gradient(rgba(169, 196, 201, 0.07) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(90deg, rgba(169, 196, 201, 0.07) 1px, transparent 1px) 0 0 / 32px 32px,
    var(--navy);
  padding: calc(24px + var(--safe-top)) 16px 40px;
  display: flex; flex-direction: column; gap: 18px;
}
.hero-copy { display: flex; flex-direction: column; gap: 8px; }
.login-tagline { font-family: var(--font-display); font-size: 25px; line-height: 1.2; margin: 0; letter-spacing: -0.01em; }
.hero-sub { margin: 0; color: var(--navy-muted); font-size: 14.5px; line-height: 1.5; max-width: 560px; }

.hero-demo { margin: 0; display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 820px; }
.demo-frame {
  border-radius: 14px; overflow: hidden; background: #14262E;
  border: 1px solid rgba(169, 196, 201, 0.22);
  box-shadow: 0 24px 60px rgba(8, 18, 23, 0.45), 0 0 0 6px rgba(255, 255, 255, 0.03);
  animation: demo-in 0.7s ease-out both;
}
.demo-bar { display: flex; align-items: center; gap: 6px; height: 26px; padding: 0 12px; background: #1B323C; }
.demo-bar i { width: 8px; height: 8px; border-radius: 50%; background: #3D6676; }
.demo-bar i:first-child { background: var(--coral); }
.demo-bar span { margin-left: 8px; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.06em; color: var(--navy-muted); }
.demo-frame video { display: block; width: 100%; aspect-ratio: 2 / 1; object-fit: cover; background: #14262E; }

/* Step chips follow the loop: --p is the active step's progress (landing.js). */
.demo-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.demo-steps button {
  position: relative; overflow: hidden; width: 100%; display: flex; align-items: center; gap: 8px;
  padding: 9px 10px; border-radius: 10px; border: 1px solid rgba(169, 196, 201, 0.18);
  background: rgba(20, 38, 46, 0.45); color: var(--navy-muted); font-size: 12.5px; text-align: left;
  transition: color 0.25s, border-color 0.25s, background 0.25s;
}
.demo-steps b {
  flex-shrink: 0; width: 20px; height: 20px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: rgba(169, 196, 201, 0.16); font-family: var(--font-display); font-size: 11px; transition: background 0.25s, color 0.25s;
}
.demo-steps button::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 2px; width: 100%;
  background: var(--teal); transform-origin: left; transform: scaleX(var(--p, 0));
}
.demo-steps li.on button { color: var(--bg); border-color: rgba(42, 157, 143, 0.7); background: rgba(42, 157, 143, 0.16); }
.demo-steps li.on b, .demo-steps li.done b { background: var(--teal); color: var(--coral-ink); }

.hero-tutorials { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12.5px; color: var(--navy-muted); }
.hero-tutorials button {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px; border-radius: 999px;
  border: 1px solid rgba(244, 237, 228, 0.28); background: transparent; color: var(--bg); font-size: 12.5px; font-weight: 600;
}
.hero-tutorials button::before { content: "▶"; font-size: 9px; color: var(--coral); }
.hero-tutorials button:hover { border-color: var(--coral); }

@keyframes demo-in { from { opacity: 0; transform: translateY(14px) scale(0.985); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .demo-frame { animation: none; } .demo-steps button::after { display: none; } }

.tutor-overlay {
  position: fixed; inset: 0; z-index: 50; background: rgba(8, 18, 23, 0.82);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.tutor-overlay[hidden] { display: none; }
.tutor-box { position: relative; width: min(1100px, 100%); }
.tutor-box video { display: block; width: 100%; max-height: calc(100vh - 96px); border-radius: 12px; background: #000; }
.tutor-close {
  position: absolute; top: -44px; right: 0; width: 36px; height: 36px; border-radius: 50%;
  border: none; background: var(--bg); color: var(--navy); font-size: 16px; font-weight: 700;
}

.login-features { list-style: none; margin: 22px 0 0; padding: 18px 0 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; color: var(--muted); font-size: 13px; }
.login-features li { display: flex; align-items: center; gap: 10px; }
.login-features li::before {
  content: "✓"; flex-shrink: 0; width: 20px; height: 20px; border-radius: 50%;
  background: var(--teal-tint); color: var(--teal-text); font-weight: 700; font-size: 11px;
  display: inline-flex; align-items: center; justify-content: center;
}
.login-downloads { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.login-downloads[hidden] { display: none; }
.dl-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.dl-btn {
  display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 8px 12px; border-radius: 12px;
  background: var(--navy); color: var(--bg); text-decoration: none; transition: background 0.2s;
}
.dl-btn:hover { background: var(--navy-hover); }
.dl-btn:active { transform: scale(0.98); }
.dl-btn svg { width: 22px; height: 22px; color: var(--teal); }
.dl-btn span { display: flex; flex-direction: column; line-height: 1.2; }
.dl-btn b { font-family: var(--font-display); font-size: 14.5px; }
.dl-btn small { font-size: 11.5px; color: var(--navy-muted); }
.dl-web {
  display: flex; align-items: flex-start; gap: 10px; margin-top: 10px; padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--line-strong); background: var(--white);
}
.dl-web svg { width: 24px; height: 24px; color: var(--teal-text); margin-top: 1px; }
.dl-web span { display: flex; flex-direction: column; gap: 2px; line-height: 1.4; }
.dl-web b { font-family: var(--font-display); font-size: 14px; }
.dl-web small { font-size: 12px; color: var(--muted); }
.dl-web i { font-style: normal; font-weight: 600; color: var(--navy); }
/* On the visitor's own platform (landing.js) the web option comes first and stands out. */
.dl-web.mine { order: -1; margin: 10px 0 0; border-color: var(--teal); background: var(--teal-tint); }
.login-downloads.apple { display: flex; flex-direction: column; }
.login-downloads.apple .caption { order: -2; }
.login-card {
  position: relative;
  margin: -20px 16px calc(24px + var(--safe-bottom));
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px;
  padding: 28px 24px; box-shadow: 0 10px 30px rgba(20, 38, 46, 0.12);
}
.login-title { font-family: var(--font-display); font-size: 24px; margin: 6px 0 6px; }
.login-lead { color: var(--muted); margin: 0 0 22px; line-height: 1.45; }
.btn-google {
  width: 100%; height: 52px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--white);
  display: flex; align-items: center; justify-content: center; gap: 12px;
  font-size: 15px; font-weight: 600; color: var(--navy);
}
.btn-google:active { transform: scale(0.98); }
.btn-google:disabled { opacity: 0.6; }
.login-status { font-size: 12.5px; color: var(--muted); margin-top: 14px; min-height: 16px; text-align: center; }

@media (min-width: 640px) {
  .demo-steps { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 900px) {
  .login-screen.active { flex-direction: row; }
  .login-hero { flex: 1 1 auto; min-width: 0; justify-content: center; padding: 40px 48px; gap: 22px; }
  .login-tagline { font-size: 34px; max-width: 640px; }
  .hero-sub { font-size: 15.5px; }
  .login-card { flex: 0 0 400px; margin: auto 40px; }
}

/* ---- Dashboard ---- */
.dash-header {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: calc(12px + var(--safe-top)) 16px 12px;
  background: var(--navy); color: var(--bg);
}
.dash-header-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.header-email { font-size: 12px; color: var(--navy-muted); display: none; }
.plan-chip { font-family: var(--font-mono); font-size: 11px; font-weight: 600; letter-spacing: 0.06em; padding: 5px 9px; border-radius: 6px; }
.plan-chip.pro { background: var(--coral); color: var(--coral-ink); }
.plan-chip.trial { background: var(--bg); color: var(--navy); }
.nav-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; min-width: 40px; justify-content: center;
  padding: 0 10px; border-radius: 10px; border: 1px solid var(--navy-line); background: transparent; color: var(--bg);
  font-size: 13px; font-weight: 600;
}
.nav-btn span { display: none; }
.admin-btn { text-decoration: none; }
.nav-count {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; align-items: center; justify-content: center;
  background: var(--coral); color: var(--coral-ink); font-size: 11px; font-weight: 700;
}
@media (min-width: 640px) {
  .header-email { display: inline; }
  .nav-btn span { display: inline; }
}

/* Drone Nation App tabs (MAPPER | TUTORIAL), right under the navy header */
.app-tabs {
  position: sticky; top: calc(64px + var(--safe-top)); z-index: 4;
  display: flex; gap: 6px; padding: 0 16px 10px; background: var(--navy);
}
.app-tab {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 44px;
  border: none; border-radius: 12px; background: transparent; color: var(--navy-muted);
  font-family: var(--font-mono); font-size: 13px; font-weight: 600; letter-spacing: 0.06em;
  border-bottom: 3px solid transparent;
}
.app-tab[aria-selected="true"] { background: var(--navy-hover); color: var(--bg); }
.app-tab.mapper[aria-selected="true"] { border-bottom-color: var(--teal); }
.app-tab.tutorial[aria-selected="true"] { border-bottom-color: var(--sand); }
.app-tab-mark { width: 24px; height: 24px; flex: none; opacity: 0.6; }
.app-tab[aria-selected="true"] .app-tab-mark { opacity: 1; }
@media (max-width: 420px) {
  .app-tabs { gap: 4px; padding: 0 10px 10px; }
  .app-tab { gap: 6px; font-size: 12px; letter-spacing: 0.03em; padding: 0 4px; }
  .app-tab-mark { width: 20px; height: 20px; }
}
@media (min-width: 640px) { .app-tab { flex: 0 0 auto; padding: 0 18px; } }

/* Mission sync status under "Misi saya" */
.sync-status { font-size: 12px; color: var(--teal-text); margin-top: 4px; min-height: 16px; }
.sync-status.offline { color: var(--warn-text); }

/* TUTORIAL tab / tutorial.html */
.tut-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 14px; }
.tut-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 16px;
  display: grid; grid-template-columns: 52px minmax(0, 1fr); grid-template-rows: 1fr auto; gap: 12px 14px;
}
.tut-icon {
  grid-row: 1 / 3; width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-weight: 700; font-size: 13px;
}
.tut-icon.pdf { background: var(--coral-tint); color: var(--warn-text); border: 1px solid var(--coral-line); }
.tut-icon.video { background: var(--navy); color: var(--sand); font-size: 20px; }
.tut-body { min-width: 0; }
.tut-title { font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }
.tut-desc { margin: 4px 0 0; font-size: 13px; color: var(--muted); line-height: 1.45; overflow-wrap: anywhere; }
.tut-open { justify-self: start; min-height: 40px; }
.tut-note { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }
.tut-player-card { max-width: 960px; padding: 16px; }
.tut-player-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tut-player-head .modal-title { font-size: 17px; min-width: 0; overflow-wrap: anywhere; }
.tut-media video, .tut-media iframe { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 12px; background: #000; }

/* Update notice (updater.js) */
.update-modal .modal-card { gap: 10px; }
.upd-lead { margin: 0; line-height: 1.45; }
.upd-notes { margin: 0; padding-left: 20px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.upd-notes[hidden] { display: none; }
.upd-help { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.update-modal .btn[hidden] { display: none; }
.update-bar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(16px + var(--safe-bottom)); z-index: 3000;
  display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 16px; max-width: calc(100% - 32px);
  background: var(--navy); color: var(--bg); border-radius: 14px; box-shadow: 0 10px 30px rgba(20, 38, 46, 0.25);
}
.update-bar .btn { min-height: 38px; }


.dash-body { padding: 24px 16px calc(40px + var(--safe-bottom)); max-width: 1240px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
.dash-body[hidden] { display: none; }
.greeting-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.dash-greeting { font-family: var(--font-display); font-size: 28px; margin: 4px 0 0; overflow-wrap: anywhere; }
.btn-new { min-height: 50px; padding: 0 20px; border-radius: 14px; }

.license-banner {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--coral-tint); border: 1px solid var(--coral-line); border-radius: 18px; padding: 16px;
}
.license-tile {
  width: 46px; height: 46px; border-radius: 14px; background: var(--coral); color: var(--coral-ink);
  display: flex; align-items: center; justify-content: center; font-family: var(--font-mono); font-size: 12px; font-weight: 600; flex-shrink: 0;
}
.license-banner-text { flex: 1 1 220px; min-width: 0; }
.license-banner-title { font-weight: 600; font-size: 15px; }
.license-banner-msg { font-size: 13px; color: var(--muted); margin-top: 3px; line-height: 1.4; }
.pk3d-banner { background: var(--teal-tint); border-color: var(--line); }
.pk3d-logo { width: 46px; height: 46px; padding: 3px; border-radius: 14px; background: #fff; flex-shrink: 0; }
.pk3d-banner .btn { text-decoration: none; }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px; min-width: 0; }
.stat-label { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-value { font-family: var(--font-display); font-weight: 600; font-size: 24px; margin-top: 4px; white-space: nowrap; }
.stat-value small { font-family: var(--font-body); font-size: 13px; font-weight: 400; color: var(--muted); margin-left: 4px; }

.missions-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.missions-head h2 { font-family: var(--font-display); font-size: 20px; margin: 0; }
.mission-count { font-family: var(--font-body); font-size: 13px; font-weight: 400; color: var(--muted); margin-left: 6px; }

.search-field {
  display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 6px 0 12px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px; flex: 1 1 260px; max-width: 100%;
}
.search-field:focus-within { border-color: var(--teal); }
.search-field svg { width: 18px; height: 18px; color: var(--muted); }
.search-field input { flex: 1; min-width: 0; border: none; outline: none; background: transparent; font-size: 14.5px; }
.missions-head .search-field { max-width: 320px; }
.step .search-field { flex: none; }
.search-go { border: none; background: var(--navy); color: var(--bg); font-size: 13px; font-weight: 600; padding: 8px 12px; border-radius: 9px; }

.mission-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.mission-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden;
  display: flex; flex-direction: column; text-align: left; padding: 0; color: var(--navy); width: 100%;
}
.mission-card:active { transform: scale(0.99); }
.mission-thumb { display: block; width: 100%; height: 130px; background: #D9D3C3; }
.mission-card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; }
.mission-card-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.mission-card-name { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mission-card-date { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.type-chip { flex-shrink: 0; font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: #D4ECE7; color: #1C5F57; }
.type-chip.wpml { background: var(--navy); color: var(--bg); }
.mission-meta { font-family: var(--font-mono); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mission-open { margin-top: 4px; text-align: center; padding: 9px; border-radius: 10px; border: 1px solid var(--navy); font-weight: 600; font-size: 13.5px; }
.empty-state { grid-column: 1 / -1; background: var(--surface); border: 1px dashed var(--line-strong); border-radius: 18px; padding: 28px 20px; text-align: center; }
.empty-state b { display: block; font-size: 16px; margin-bottom: 6px; }
.empty-state span { color: var(--muted); }

/* ============================================================ */
/* Editor                                                       */
/* ============================================================ */
#map { position: absolute; inset: 0; z-index: 0; background: #D9D3C3; }

.map-btn {
  width: 46px; height: 46px; min-width: 46px; border: none; border-radius: 14px;
  background: var(--surface); color: var(--navy); box-shadow: 0 3px 10px rgba(20, 38, 46, 0.18);
  display: flex; align-items: center; justify-content: center;
}
.map-btn-navy { background: var(--navy); color: var(--bg); }

.topbar {
  position: fixed; top: calc(12px + var(--safe-top)); left: 12px; right: 12px; z-index: 500;
  display: flex; align-items: center; gap: 10px;
}
.mission-chip {
  flex: 1; min-width: 0; height: 46px; border-radius: 14px; background: var(--surface);
  box-shadow: 0 3px 10px rgba(20, 38, 46, 0.18); padding: 0 14px;
  display: flex; flex-direction: column; justify-content: center;
}
.mission-chip-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mission-chip-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.fab-stack.hidden { display: none; }
.fab-stack {
  position: fixed; right: 12px; z-index: 500; display: flex; flex-direction: column; gap: 8px;
  bottom: var(--fab-bottom, 260px); transition: bottom 0.25s ease;
}

.draw-hint, .toast {
  position: fixed; top: calc(70px + var(--safe-top)); left: 50%; transform: translateX(-50%); z-index: 900;
  background: var(--navy); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: 13px;
  box-shadow: 0 6px 18px rgba(20, 38, 46, 0.3); display: none; max-width: 86vw; text-align: center;
}
.offline-banner {
  position: fixed; top: calc(70px + var(--safe-top)); left: 12px; right: 12px; z-index: 500; display: none;
  background: var(--coral-tint); color: var(--warn-text); border: 1px solid var(--coral-line);
  padding: 9px 14px; border-radius: 12px; font-size: 12.5px;
}

/* ---- Step sheet ---- */
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 600;
  background: var(--surface); border-radius: 24px 24px 0 0; box-shadow: 0 -8px 30px rgba(20, 38, 46, 0.2);
  max-height: 64vh; display: flex; flex-direction: column;
}
.sheet-handle { border: none; background: transparent; padding: 10px 0 4px; display: flex; justify-content: center; flex-shrink: 0; }
.handle-bar { width: 40px; height: 4px; border-radius: 4px; background: var(--line-strong); }

.hud {
  margin: 6px 14px 0; background: var(--navy); color: var(--bg); border-radius: 16px; padding: 10px 4px;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); flex-shrink: 0;
}
.hud-cell { padding: 0 10px; min-width: 0; }
.hud-cell + .hud-cell { border-left: 1px solid var(--navy-line); }
.hud-wide { display: none; }
.hud-label { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.1em; color: var(--navy-muted); white-space: nowrap; }
.hud-value { font-family: var(--font-display); font-weight: 600; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-value small { font-family: var(--font-body); font-weight: 400; font-size: 11px; color: var(--navy-muted); margin-left: 2px; }
.hud-cell.warn .hud-value { color: #F4A68F; }

.step-head { padding: 14px 16px 6px; flex-shrink: 0; }
.step-progress { display: flex; align-items: center; gap: 6px; }
.step-progress button { width: 22px; height: 6px; border-radius: 6px; border: none; padding: 0; background: var(--line); position: relative; }
.step-progress button::after { content: ""; position: absolute; inset: -10px -3px; }
.step-progress button.done { background: var(--teal); }
.step-progress button.active { width: 40px; background: var(--coral); }
.step-count { margin-left: auto; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em; color: var(--teal-text); }
.step-title { font-family: var(--font-display); font-size: 21px; margin: 6px 0 0; }

.sheet-body { overflow-y: auto; padding: 8px 16px 12px; flex: 1 1 auto; min-height: 0; }
.sheet.collapsed .sheet-body { display: none; }
.step { display: none; flex-direction: column; gap: 12px; }
.step.active { display: flex; }

.sheet-foot { flex-shrink: 0; border-top: 1px solid var(--line); padding: 8px 16px calc(14px + var(--safe-bottom)); }
.status-text { font-size: 12px; color: var(--muted); min-height: 16px; margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.foot-buttons { display: flex; gap: 10px; }
.foot-buttons .btn-coral { flex: 1; }

/* ---- Step content ---- */
.action-card {
  display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; text-align: left;
  border: 1px solid var(--line); background: var(--white); color: var(--navy); width: 100%;
}
.action-card.active { border: 1.5px solid var(--teal); background: var(--teal-tint); }
.action-icon { width: 42px; height: 42px; border-radius: 11px; background: var(--surface-alt); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.action-card.active .action-icon { background: var(--navy); color: var(--bg); }
.action-title { display: block; font-weight: 600; font-size: 14.5px; }
.action-sub { display: block; font-size: 12.5px; color: var(--muted); }

.info-card { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; background: var(--surface-alt); border-radius: 14px; padding: 12px 14px; }
.info-label { font-size: 12px; color: var(--muted); }
.info-value { font-family: var(--font-display); font-weight: 600; font-size: 20px; }
.row-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

.field-caption { font-weight: 600; font-size: 14px; margin-top: 4px; }
.drone-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.drone-card {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; min-height: 56px; border-radius: 12px; text-align: left;
  border: 1px solid var(--line); background: var(--white); color: var(--navy); font-weight: 600; font-size: 13.5px;
}
.drone-card svg { width: 24px; height: 24px; }
.drone-card.active { border: 1.5px solid var(--teal); background: var(--teal-tint); }
.drone-card.active svg { color: var(--teal-text); }
.note { margin: 4px 0 0; padding: 12px 14px; border-radius: 14px; background: var(--surface-alt); font-size: 13px; line-height: 1.45; }

.segmented { display: flex; gap: 4px; padding: 4px; background: var(--surface-alt); border-radius: 12px; min-width: 0; }
.segment {
  flex: 1; min-width: 0; border: none; background: transparent; border-radius: 9px; padding: 9px 6px;
  font-size: 14px; font-weight: 600; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 1px;
}
.segment span { font-size: 11px; font-weight: 400; color: var(--muted); }
.segment.active { background: var(--white); color: var(--navy); box-shadow: 0 1px 3px rgba(38, 70, 83, 0.15); }

.presets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.preset {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 12px; border-radius: 12px; text-align: left;
  border: 1px solid var(--line); background: var(--white); color: var(--navy); min-width: 0;
}
.preset b { font-size: 14px; }
.preset span { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.preset.active { background: var(--navy); border-color: var(--navy); color: var(--bg); }
.preset.active span { color: var(--navy-muted); }

.slider-card { background: var(--white); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 14px; }
/* Step 3 hides whatever the chosen survey type does not use (3D templates). */
.slider-card[hidden], .segmented[hidden], .presets[hidden], .row-2[hidden], .slider-row[hidden], .switch-row[hidden], .field-caption[hidden] { display: none; }
.switch-row[hidden] + .switch-row { border-top: none; }
.card-label { font-weight: 600; font-size: 13.5px; margin-bottom: -8px; }
.card-note { margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--muted); }
.card-note.strong { color: var(--navy); font-weight: 600; }
.slider-row { min-width: 0; }
.slider-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-weight: 600; }
.slider-head label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.readout { font-family: var(--font-mono); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.warn-text { font-size: 12.5px; color: var(--warn-text); margin-top: 4px; }
input[type=range] { width: 100%; margin: 10px 0 0; accent-color: var(--coral); height: 24px; }

.switch-card { background: var(--white); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.switch-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; cursor: pointer; }
.switch-row + .switch-row { border-top: 1px solid #EFE7DC; }
.switch-text { flex: 1; min-width: 0; }
.switch-title { display: block; font-weight: 600; }
.switch-sub { display: block; font-size: 12.5px; color: var(--muted); }
.pro-tag { font-family: var(--font-mono); font-size: 10px; padding: 2px 6px; border-radius: 5px; background: var(--coral); color: var(--coral-ink); margin-left: 4px; vertical-align: 1px; }
.switch { position: relative; width: 48px; height: 28px; flex: 0 0 48px; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.slider { position: absolute; inset: 0; border-radius: 14px; background: var(--switch-off); transition: 0.2s; pointer-events: none; }
.slider::before { content: ""; position: absolute; width: 22px; height: 22px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: 0.2s; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); }
.switch input:checked + .slider { background: var(--teal); }
.switch input:checked + .slider::before { transform: translateX(20px); }
.switch input:focus-visible + .slider { outline: 2px solid var(--teal); outline-offset: 2px; }

.advanced { border: 1px solid var(--line-strong); border-radius: 14px; padding: 0 14px; background: transparent; }
.advanced summary { list-style: none; display: flex; align-items: center; justify-content: space-between; min-height: 46px; font-weight: 600; cursor: pointer; }
.advanced summary::-webkit-details-marker { display: none; }
.advanced summary svg { transition: transform 0.2s; }
.advanced[open] summary svg { transform: rotate(180deg); }
.advanced .row-2 { padding-bottom: 14px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); min-width: 0; }
.field input, .field select, .field textarea {
  height: 44px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--white);
  padding: 0 12px; font-size: 15px; color: var(--navy); width: 100%;
}
.field textarea { height: auto; padding: 10px 12px; resize: vertical; }

.checklist { display: flex; flex-direction: column; gap: 8px; }
.check-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--white); border: 1px solid var(--line); }
.check-row.warn { background: var(--coral-tint); border-color: var(--coral-line); }
.takeoff-icon {
  width: 30px; height: 30px; border-radius: 50%; background: var(--navy); color: var(--bg);
  border: 3px solid var(--surface); box-shadow: 0 3px 10px rgba(20, 38, 46, 0.4);
  display: flex; align-items: center; justify-content: center; font: 700 14px var(--font-display);
}
.resume-icon {
  width: 28px; height: 28px; border-radius: 50%; background: var(--coral); color: #fff; padding-left: 2px;
  border: 3px solid var(--surface); box-shadow: 0 3px 10px rgba(20, 38, 46, 0.4); box-sizing: border-box;
  display: flex; align-items: center; justify-content: center; font: 700 11px var(--font-display);
}
.resume-caption { margin-top: 14px; }
.note.ok { background: var(--teal-tint); }
.resume-option { font-weight: 600; color: var(--navy); }
.resume-hint { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.check-icon { flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%; background: var(--teal); color: var(--coral-ink); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.check-row.warn .check-icon { background: var(--coral); }
.check-title { display: block; font-weight: 600; }
.check-detail { display: block; font-size: 12.5px; color: var(--muted); }

/* ---- Leaflet ---- */
.leaflet-control-attribution { font-size: 9px !important; }
.leaflet-bar { border: 1px solid var(--line) !important; border-radius: 12px !important; overflow: hidden; }
.leaflet-bar a { color: var(--navy) !important; background: var(--surface) !important; }

/* ---- Tablet / desktop browser: the sheet becomes a right-hand inspector ---- */
@media (min-width: 900px) {
  .sheet { left: auto; top: 0; width: 420px; max-height: none; border-radius: 0; box-shadow: -1px 0 0 var(--line); }
  .sheet-handle { display: none; }
  .sheet.collapsed .sheet-body { display: block; }
  .hud { margin: calc(14px + var(--safe-top)) 16px 0; grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 10px; }
  .hud-wide { display: block; }
  .hud-cell:nth-child(4) { border-left: none; }
  .topbar { right: 432px; }
  .fab-stack { right: 432px; bottom: calc(20px + var(--safe-bottom)) !important; }
}

/* ============================================================ */
/* Modals (profile / save-mission name)                          */
/* ============================================================ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 2000; background: rgba(20, 38, 46, 0.5);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-card {
  width: 100%; max-width: 400px; max-height: 86vh; overflow-y: auto;
  background: var(--surface); border-radius: 20px; padding: 22px 20px; display: flex; flex-direction: column; gap: 12px;
}
.modal-title { font-family: var(--font-display); font-size: 20px; margin: 0; }
.modal-email { font-size: 12.5px; color: var(--muted); margin-top: -6px; }
.modal-actions { display: flex; gap: 10px; margin-top: 6px; }
.modal-actions .btn { flex: 1; }
.app-version { margin-top: 10px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.app-version[hidden] { display: none; }
.app-version-title { font-size: 12px; font-weight: 700; letter-spacing: 0.03em; }
.app-version-text { font-size: 12px; color: var(--muted); margin-top: 2px; }
.app-version .btn { min-height: 40px; }
.danger-zone { margin-top: 10px; padding-top: 14px; border-top: 1px solid var(--line); }
.danger-zone-title { font-size: 12px; font-weight: 700; color: var(--danger); letter-spacing: 0.03em; margin-bottom: 4px; }
.danger-zone-desc { font-size: 12px; color: var(--muted); margin-bottom: 10px; line-height: 1.4; }

/* PRO invitation after the trial (dashboard.js maybeShowProNudge) */
.nudge-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; line-height: 1.45; }
.nudge-price { margin: 0; font-size: 13.5px; color: var(--muted); }
