/* AutoTerra Cloud — design system. Light by default, dark via OS preference or the theme toggle. */
:root {
    --bg: #f4f6f8;
    --surface: #ffffff;
    --surface-2: #f8fafb;
    --text: #17202a;
    --muted: #5b6876;
    --faint: #8a96a3;
    --line: #e3e8ee;
    --line-strong: #cfd7e0;
    --brand: #14755f;
    --brand-strong: #0f5e4c;
    --brand-soft: #e2f3ee;
    --brand-ink: #ffffff;
    --good: #16794f; --good-bg: #e3f5ec;
    --busy: #1f5fae; --busy-bg: #e5effc;
    --warn: #8f5b06; --warn-bg: #fdf1d9;
    --bad: #a3302f; --bad-bg: #fce8e7;
    --neutral: #4b5765; --neutral-bg: #eef1f5;
    --stage-keypoints: #3b82c4;
    --stage-dense: #14755f;
    --stage-mesh: #8a5cc2;
    --stage-ortho: #c98a1a;
    --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
    --radius: 12px;
    --sidebar: 236px;
    color-scheme: light;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0f1418; --surface: #161d22; --surface-2: #1b232a; --text: #e5eaee; --muted: #9aa7b3; --faint: #6f7d89;
        --line: #26313a; --line-strong: #33414c; --brand: #3fb393; --brand-strong: #5cc8a8; --brand-soft: #173a31; --brand-ink: #062019;
        --good: #78d6ac; --good-bg: #163527; --busy: #8fb9f0; --busy-bg: #172b45; --warn: #f0c46e; --warn-bg: #3a2c10;
        --bad: #f2a3a1; --bad-bg: #432020; --neutral: #b4c0cb; --neutral-bg: #232d35;
        --stage-keypoints: #5f9fdc; --stage-dense: #3fb393; --stage-mesh: #a984dc; --stage-ortho: #e0a83c;
        --shadow: none; color-scheme: dark;
    }
}
:root[data-theme="dark"] {
    --bg: #0f1418; --surface: #161d22; --surface-2: #1b232a; --text: #e5eaee; --muted: #9aa7b3; --faint: #6f7d89;
    --line: #26313a; --line-strong: #33414c; --brand: #3fb393; --brand-strong: #5cc8a8; --brand-soft: #173a31; --brand-ink: #062019;
    --good: #78d6ac; --good-bg: #163527; --busy: #8fb9f0; --busy-bg: #172b45; --warn: #f0c46e; --warn-bg: #3a2c10;
    --bad: #f2a3a1; --bad-bg: #432020; --neutral: #b4c0cb; --neutral-bg: #232d35;
    --stage-keypoints: #5f9fdc; --stage-dense: #3fb393; --stage-mesh: #a984dc; --stage-ortho: #e0a83c;
    --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
    background: var(--bg); color: var(--text);
    font: 14.5px/1.55 "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; font-weight: 650; letter-spacing: -.01em; margin: 0 0 4px; }
h2 { font-size: 15.5px; font-weight: 650; margin: 0; }
h3 { font-size: 14px; font-weight: 650; margin: 0; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.icon { flex: none; vertical-align: middle; }
[hidden] { display: none !important; }
:root:not([data-theme="dark"]) .when-dark { display: none; }
:root[data-theme="dark"] .when-light { display: none; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) .when-dark { display: inline; }
    :root:not([data-theme]) .when-light { display: none; }
}

/* ---------- App shell ---------- */
body.app { display: flex; min-height: 100vh; }
.sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar); background: var(--surface); border-right: 1px solid var(--line);
    display: flex; flex-direction: column; padding: 16px 12px; z-index: 30; transition: transform .2s ease;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 15.5px; padding: 4px 8px 18px; }
.brand:hover { text-decoration: none; }
.brand b { color: var(--brand); font-weight: 700; }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--brand); color: var(--brand-ink); }
.sidenav { display: grid; gap: 2px; }
.sidenav a {
    display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 9px; color: var(--muted); font-weight: 550;
}
.sidenav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.sidenav a.active { background: var(--brand-soft); color: var(--brand); }
.side-foot { margin-top: auto; padding: 12px 10px 4px; border-top: 1px solid var(--line); display: grid; gap: 4px; }
.side-tier { font-weight: 600; font-size: 13px; }
.side-link { font-size: 12.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }

.main { flex: 1; margin-left: var(--sidebar); min-width: 0; display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; height: 60px; padding: 0 28px;
    background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.topbar-title { font-weight: 600; color: var(--muted); margin-right: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.balance-pill {
    display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--surface);
    border: 1px solid var(--line); color: var(--text); font-weight: 650; box-shadow: var(--shadow);
}
.balance-pill:hover { text-decoration: none; border-color: var(--line-strong); }
.balance-pill .icon { color: var(--brand); }
.balance-pill small { color: var(--muted); font-weight: 500; }
.icon-btn {
    display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; border: 1px solid transparent;
    background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--surface); border-color: var(--line); color: var(--text); }
.only-mobile { display: none; }

.usermenu { position: relative; }
.usermenu summary { list-style: none; cursor: pointer; }
.usermenu summary::-webkit-details-marker { display: none; }
.avatar {
    display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: var(--brand-ink);
    font-weight: 700; font-size: 13px; letter-spacing: .02em;
}
.usermenu-panel {
    position: absolute; right: 0; top: 44px; width: 250px; background: var(--surface); border: 1px solid var(--line);
    border-radius: 12px; box-shadow: 0 12px 32px rgba(16, 24, 40, .14); padding: 6px; display: grid;
}
.usermenu-head { display: grid; padding: 10px 10px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.usermenu-panel a, .usermenu-panel button {
    display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px; border-radius: 8px; color: var(--text);
    font: inherit; background: none; border: 0; cursor: pointer; text-align: left;
}
.usermenu-panel a:hover, .usermenu-panel button:hover { background: var(--surface-2); text-decoration: none; }
.usermenu-panel form { margin: 0; }

.content { padding: 28px; max-width: 1240px; width: 100%; }
.scrim { display: none; }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head p { margin: 2px 0 0; color: var(--muted); }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 6px; display: flex; gap: 6px; align-items: center; }

/* ---------- Cards and grids ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; min-width: 0; }
.card + .card { margin-top: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head .muted { font-size: 13px; }
.stack-lg > * + * { margin-top: 18px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px; }
.grid-2 > .card + .card { margin-top: 0; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { padding: 16px 18px; }
.kpi-label { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 550; }
.kpi-value { font-size: 28px; font-weight: 700; letter-spacing: -.02em; margin-top: 6px; line-height: 1.15; }
.kpi-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.kpi .icon { color: var(--brand); }
.chart-box { position: relative; height: 250px; }

/* ---------- Buttons and forms ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line-strong); background: var(--surface);
    color: var(--text); padding: 8px 14px; border-radius: 9px; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn:hover { text-decoration: none; border-color: var(--faint); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; padding: 11px 14px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.row-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row-actions form { margin: 0; }
label { font-weight: 600; font-size: 13.5px; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.input, input[type=email], input[type=text], input[type=search], input:not([type]) {
    font: inherit; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface);
    color: var(--text); width: 100%; outline: none;
}
input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
input.code { font-size: 26px; letter-spacing: 10px; text-align: center; font-weight: 600; padding: 12px; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: 10px; background: var(--busy-bg); color: var(--busy); margin-bottom: 16px; font-size: 13.5px; }
.notice.bad { background: var(--bad-bg); color: var(--bad); }
.notice.good { background: var(--good-bg); color: var(--good); }
.notice.warn { background: var(--warn-bg); color: var(--warn); }

/* ---------- Tables, lists, badges ---------- */
.table-wrap { overflow-x: auto; margin: 0 -20px -20px; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 10px 20px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 12px 20px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.num, .table th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pos { color: var(--good); font-weight: 600; }
.neg { color: var(--text); }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 650; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.good { background: var(--good-bg); color: var(--good); }
.badge.busy { background: var(--busy-bg); color: var(--busy); }
.badge.busy::before { animation: pulse 1.4s infinite; }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.neutral { background: var(--neutral-bg); color: var(--neutral); }
@keyframes pulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .badge.busy::before { animation: none; } }

.facts { display: grid; gap: 0; margin: 0; }
.facts div { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.facts div:last-child { border-bottom: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; text-align: right; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line);
    background: var(--surface); color: var(--muted); font: inherit; font-size: 13px; font-weight: 550; cursor: pointer;
}
.chip.active { background: var(--text); border-color: var(--text); color: var(--bg); }
.meta { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--muted); font-size: 13px; }
.meta span { display: inline-flex; align-items: center; gap: 6px; }
.toolbar { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 14px; }
.search { position: relative; flex: 1; max-width: 340px; }
.search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.search input { padding-left: 36px; }
.empty { text-align: center; padding: 28px 12px; color: var(--muted); }
.empty .icon { color: var(--faint); margin-bottom: 6px; }

/* ---------- Project rows with mini pipeline ---------- */
.project-list { display: grid; }
.project-row {
    display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 18px; align-items: center; padding: 14px 20px;
    border-top: 1px solid var(--line); color: var(--text);
}
.project-row:first-child { border-top: 0; }
.project-row:hover { background: var(--surface-2); text-decoration: none; }
.project-list.flush { margin: 0 -20px -20px; }
.project-name { font-weight: 650; }
.project-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.mini-pipe { display: flex; gap: 5px; align-items: center; }
.mini-pipe i { display: block; width: 22px; height: 6px; border-radius: 3px; background: var(--neutral-bg); }
.mini-pipe i.good { background: var(--good); }
.mini-pipe i.busy { background: var(--busy); animation: pulse 1.4s infinite; }
.mini-pipe i.warn { background: var(--warn); }
.mini-pipe i.bad { background: var(--bad); }
.mini-pipe i.inapp { background: var(--line-strong); }
.row-right { text-align: right; min-width: 132px; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 6px; background: var(--neutral-bg); color: var(--neutral); font-size: 11.5px; font-weight: 600; }
.tag-row { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 6px; }
.row-right .credits { font-weight: 650; font-variant-numeric: tabular-nums; }

/* ---------- Pipeline (project detail) ---------- */
.pipeline { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0; margin: 4px 0 2px; }
.pipe-step { position: relative; text-align: center; padding: 0 6px; }
.pipe-step::before {
    content: ""; position: absolute; top: 21px; left: calc(-50% + 24px); right: calc(50% + 24px); height: 2px; background: var(--line);
}
.pipe-step:first-child::before { display: none; }
.pipe-step.good::before { background: var(--good); }
.pipe-dot {
    position: relative; display: grid; place-items: center; width: 44px; height: 44px; margin: 0 auto 8px; border-radius: 50%;
    background: var(--neutral-bg); color: var(--neutral); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line);
}
.pipe-step.good .pipe-dot { background: var(--good-bg); color: var(--good); box-shadow: 0 0 0 1px var(--good); }
.pipe-step.busy .pipe-dot { background: var(--busy-bg); color: var(--busy); box-shadow: 0 0 0 2px var(--busy); }
.pipe-step.warn .pipe-dot { background: var(--warn-bg); color: var(--warn); box-shadow: 0 0 0 2px var(--warn); }
.pipe-step.bad .pipe-dot { background: var(--bad-bg); color: var(--bad); box-shadow: 0 0 0 1px var(--bad); }
.pipe-where { position: absolute; right: -4px; bottom: -4px; display: grid; place-items: center; width: 19px; height: 19px; border-radius: 50%; background: var(--surface); color: var(--muted); box-shadow: 0 0 0 1px var(--line); }
.pipe-label { font-weight: 650; font-size: 13px; }
.pipe-state { font-size: 12px; color: var(--muted); }

.stage-card { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 14px; padding: 18px 20px; border-top: 1px solid var(--line); }
.stage-card:first-of-type { border-top: 0; }
.stage-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--surface-2); color: var(--muted); }
.stage-icon.keypoints { color: var(--stage-keypoints); } .stage-icon.dense { color: var(--stage-dense); }
.stage-icon.mesh { color: var(--stage-mesh); } .stage-icon.ortho { color: var(--stage-ortho); }
.stage-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.stage-title { display: flex; align-items: center; gap: 10px; }
.stage-nums { display: flex; gap: 22px; margin-top: 10px; flex-wrap: wrap; }
.stage-nums div { display: grid; }
.stage-nums dt { font-size: 12px; color: var(--muted); }
.stage-nums dd { margin: 0; font-weight: 650; font-variant-numeric: tabular-nums; }
.progress { height: 8px; border-radius: 4px; background: var(--neutral-bg); overflow: hidden; margin-top: 12px; }
.progress span { display: block; height: 100%; background: var(--busy); border-radius: 4px; transition: width .6s; }
.files { display: grid; gap: 8px; margin-top: 12px; }
.file {
    display: flex; align-items: center; gap: 12px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2);
}
.file-name { font-weight: 600; }
.file .grow { flex: 1; min-width: 0; }
.where-tag { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); }

/* ---------- Project tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: -6px 0 18px; }
.tabs a {
    display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px; color: var(--muted); font-weight: 600;
    border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--brand); border-bottom-color: var(--brand); }

/* ---------- Flight map ---------- */
.map-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.map-card { padding: 0; overflow: hidden; }
.flightmap { height: 620px; width: 100%; background: #1d2a26; }
.map-side .card + .card { margin-top: 18px; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.stat-grid div { display: grid; }
.stat-grid div.wide { grid-column: 1 / -1; }
.stat-grid span { font-size: 12px; color: var(--muted); }
.stat-grid strong { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.legend { display: grid; gap: 4px; }
.legend-row { display: flex; align-items: center; gap: 10px; padding: 6px 4px; border-radius: 8px; cursor: pointer; font-weight: 550; }
.legend-row:hover { background: var(--surface-2); }
.legend-row .grow { flex: 1; }
.legend-row input { accent-color: var(--brand); width: 16px; height: 16px; }
.swatch { display: inline-block; width: 22px; height: 4px; border-radius: 2px; }
.swatch.f0 { background: #2dd4bf; } .swatch.f1 { background: #f59e0b; } .swatch.f2 { background: #a78bfa; }
.swatch.f3 { background: #f472b6; } .swatch.f4 { background: #60a5fa; }
.swatch.ortho { width: 22px; height: 14px; border-radius: 3px; background: linear-gradient(135deg, #7c8a5a, #b9a77c 45%, #8f9b6e); }
.opacity-row { display: flex; align-items: center; gap: 10px; padding: 4px 4px 0 36px; }
.opacity-row input { flex: 1; accent-color: var(--brand); }
.swatch.dsm { width: 22px; height: 14px; border-radius: 3px; }
.swatch.hillshade { width: 22px; height: 14px; border-radius: 3px; background: linear-gradient(135deg, #f4f4f4, #9a9a9a 55%, #4a4a4a); }
.height-legend { padding: 6px 4px 4px 36px; }
.height-legend .bar { height: 10px; border-radius: 5px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.height-legend .ticks { display: flex; justify-content: space-between; margin: 4px 0 6px; font-variant-numeric: tabular-nums; }
.pin span {
    display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: #fff; font: 700 11px/1 system-ui, sans-serif;
    border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4);
}
.gcp-pin { display: flex !important; align-items: center; gap: 4px; white-space: nowrap; }
.gcp-pin b { color: #fff; font: 700 11.5px/1 system-ui, sans-serif; text-shadow: 0 0 3px #000, 0 0 3px #000; }
.tri { display: inline-block; width: 0; height: 0; border-left: 9px solid transparent; border-right: 9px solid transparent; border-bottom: 16px solid #3b82f6; filter: drop-shadow(0 0 1.5px #fff) drop-shadow(0 1px 2px rgba(0,0,0,.5)); }
.tri.check { border-bottom-color: #f97316; }
.gcp-key { display: inline-block; width: 0; height: 0; border-left: 7px solid transparent; border-right: 7px solid transparent; border-bottom: 12px solid #3b82f6; }
.image-table { max-height: 420px; overflow-y: auto; }
.image-table thead th { position: sticky; top: 0; z-index: 1; }
tr.clickable { cursor: pointer; }
.leaflet-container { font: inherit; }
.leaflet-popup-content { font-size: 13px; line-height: 1.5; }
@media (max-width: 1100px) {
    .map-layout { grid-template-columns: minmax(0, 1fr); }
    .flightmap { height: 460px; }
}

/* ---------- Credits ---------- */
.balance-hero { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.balance-hero .big { font-size: 40px; font-weight: 750; letter-spacing: -.02em; line-height: 1; }
.packs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.pack { position: relative; border: 1px solid var(--line); border-radius: 12px; padding: 18px; display: grid; gap: 4px; background: var(--surface); }
.pack.featured { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.pack-tag { position: absolute; top: -10px; right: 14px; background: var(--brand); color: var(--brand-ink); font-size: 11.5px; font-weight: 700; padding: 2px 9px; border-radius: 999px; }
.pack-credits { font-weight: 650; color: var(--muted); }
.pack-price { font-size: 26px; font-weight: 750; letter-spacing: -.01em; }
.pack .btn { margin-top: 10px; }

/* ---------- Sign-in ---------- */
.auth-body { background: var(--bg); }
.auth-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 100vh; }
.auth-hero {
    background: linear-gradient(160deg, #0f5e4c, #14755f 55%, #1c8c71); color: #e9f6f2; padding: 40px 48px; display: flex; flex-direction: column;
}
.brand.light { color: #fff; }
.brand.light b { color: #a7e8d4; }
.brand.light .brand-mark { background: rgba(255,255,255,.16); color: #fff; }
.hero-copy { margin: auto 0; max-width: 460px; }
.hero-copy h2 { font-size: 30px; line-height: 1.2; font-weight: 700; letter-spacing: -.01em; margin-bottom: 22px; }
.hero-points { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; font-size: 15px; }
.hero-points li { display: flex; gap: 12px; align-items: center; }
.hero-points .icon { color: #a7e8d4; }
.hero-foot { color: #b9ddd2; font-size: 13px; margin: 0; }
.auth-panel { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 24px; margin-bottom: 6px; }
.auth-card .lead { color: var(--muted); margin: 0 0 22px; }
.auth-card form { margin-bottom: 16px; }

/* ---------- Receipt / narrow pages ---------- */
.narrow { max-width: 640px; }
.stack { display: grid; gap: 8px; margin-top: 16px; }
.stack label { margin-top: 6px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin: 16px 0; }
.receipt h1 { margin-bottom: 14px; }
@media print {
    .sidebar, .topbar, .noprint { display: none !important; }
    .main { margin: 0; }
    body { background: #fff; }
    .card { border: 0; box-shadow: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
    .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
    .sidebar { transform: translateX(-100%); box-shadow: 0 0 40px rgba(0,0,0,.2); }
    body.nav-open .sidebar { transform: none; }
    body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 25; }
    .main { margin-left: 0; }
    .only-mobile { display: inline-grid; }
    .topbar { padding: 0 16px; }
    .content { padding: 20px 16px; }
    .balance-pill small { display: none; }
    .pipeline { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 18px; }
    .pipe-step:nth-child(4)::before { display: none; }
    .packs { grid-template-columns: minmax(0, 1fr); }
    .project-row { grid-template-columns: minmax(0, 1fr) auto; }
    .project-row .mini-pipe { display: none; }
    .auth-split { grid-template-columns: minmax(0, 1fr); }
    .auth-hero { display: none; }
}
@media (max-width: 520px) {
    .kpis { grid-template-columns: minmax(0, 1fr); }
    .table th, .table td { padding: 10px 14px; }
}

/* Height tools on the project map */
.map-tools a { display: flex !important; align-items: center; gap: 6px; width: auto !important; padding: 0 10px; color: var(--text); font: 600 12px/30px system-ui, sans-serif; }
.map-tools a { height: 30px !important; line-height: 30px !important; }
.map-tools a.active { background: var(--brand); color: #fff; }
.map-tools svg { flex: none; }
.leaflet-container.measuring { cursor: crosshair; }
.map-hint { position: absolute; z-index: 800; left: 50%; bottom: 28px; transform: translateX(-50%); max-width: 90%; padding: 6px 12px; border-radius: 999px; background: rgba(15, 23, 20, .82); color: #fff; font-size: 12.5px; pointer-events: none; }
.leaflet-tooltip.spot-label { background: rgba(15, 23, 20, .82); color: #fff; border: 0; border-radius: 6px; padding: 2px 7px; font: 600 12px/1.4 system-ui, sans-serif; box-shadow: none; }
.leaflet-tooltip.spot-label::before { display: none; }
.profile-card { margin-top: 18px; }
.profile-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px 16px; margin: 4px 0 12px; }
.profile-stats div { display: grid; }
.profile-stats span { font-size: 12px; color: var(--muted); }
.profile-stats strong { font-variant-numeric: tabular-nums; }
.profile-chart { position: relative; height: 240px; margin-bottom: 8px; }
/* While measuring, clicks go to the map, not to GCP pins or flight markers. */
.leaflet-container.measuring .leaflet-marker-icon.leaflet-interactive { pointer-events: none; }
.measure-list { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 2px; }
.measure-list li { display: flex; align-items: flex-start; gap: 10px; padding: 8px 4px; border-radius: 8px; }
.measure-list li:hover { background: var(--surface-2); }
.measure-list .grow { flex: 1; min-width: 0; cursor: pointer; }
.measure-list .n { flex: none; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #f59e0b; color: #fff; font: 700 11px/1 system-ui, sans-serif; }
.measure-list .kind { color: var(--muted); }
.measure-list strong { font-variant-numeric: tabular-nums; }
.icon-btn { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* Share links */
.share-form { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(240px, 1.4fr) 140px auto; gap: 14px 20px; align-items: start; }
.share-form fieldset { border: 0; padding: 0; margin: 0 0 14px; display: grid; gap: 6px; }
.share-form legend { font-size: 13px; font-weight: 600; margin-bottom: 4px; padding: 0; }
.share-form .check { display: flex; gap: 8px; align-items: center; font-size: 13.5px; }
.share-form .check input { accent-color: var(--brand); width: 16px; height: 16px; }
.share-form .check:has(input:disabled) { color: var(--faint); }
.share-form > div:last-child { align-self: end; margin-bottom: 14px; }
.share-new { display: grid; gap: 10px; }
.copy-row { display: flex; gap: 8px; flex-wrap: wrap; }
.copy-row input { flex: 1; min-width: 220px; font: 13px ui-monospace, monospace; padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--text); }
tr.faded td { color: var(--faint); }
@media (max-width: 900px) { .share-form { grid-template-columns: 1fr; } }

/* Shared (public) map page */
body.share { background: var(--bg); }
.share-top { display: flex; align-items: center; gap: 14px; padding: 12px 22px; border-bottom: 1px solid var(--line); background: var(--surface); }
.share-top .brand { display: flex; align-items: center; gap: 10px; font-weight: 650; color: var(--text); text-decoration: none; }
.share-top .grow { flex: 1; }
.share-main { max-width: 1400px; margin: 0 auto; padding: 22px; }
.share-head h1 { margin: 0 0 6px; }
.share-head .meta { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--muted); font-size: 13.5px; margin-bottom: 18px; }
.share-foot { color: var(--faint); font-size: 12.5px; margin-top: 22px; text-align: center; }

/* GCP marking: the desktop marking panel's dark workspace (same colours as AutoTerra) */
.gcp-workspace { display: grid; grid-template-columns: 220px minmax(0, 1fr) 320px; gap: 0; border-radius: var(--radius); overflow: hidden;
    background: rgb(22, 24, 28); color: #d3d3d3; height: calc(100vh - 290px); min-height: 520px; box-shadow: var(--shadow); }
.gcp-dock, .gcp-selection { background: rgb(26, 28, 33); overflow: auto; }
.gcp-dock { border-right: 1px solid rgb(40, 43, 52); }
.dock-title { padding: 10px 12px; font-weight: 600; font-size: 13px; color: #e8e8e8; border-bottom: 1px solid rgb(40, 43, 52); }
.gcp-grid { width: 100%; border-collapse: collapse; font-size: 13px; }
.gcp-grid th { text-align: left; font-weight: 600; color: #9aa0a6; padding: 6px 12px; border-bottom: 1px solid rgb(40, 43, 52); }
.gcp-grid th.num, .gcp-grid td.num { text-align: right; width: 64px; }
.gcp-grid td { padding: 7px 12px; border-bottom: 1px solid rgb(34, 37, 44); cursor: pointer; }
.gcp-grid tr:hover td { background: rgb(40, 43, 52); }
.gcp-grid tr.selected td { background: rgb(0, 84, 150); color: #fff; }
.gcp-grid tr.check .nm { font-style: italic; }
.gcp-grid .cov { font-size: 14px; }
.gcp-tiles-panel { display: flex; flex-direction: column; min-width: 0; }
.gcp-toolbar { display: flex; align-items: center; gap: 18px; padding: 8px 12px; background: rgb(40, 43, 52); font-size: 12.5px; }
.gcp-toolbar .tb-title { font-weight: 600; color: #fff; margin-right: auto; }
.gcp-toolbar label { display: flex; align-items: center; gap: 8px; color: #c8c8c8; }
.gcp-toolbar input[type=range] { width: 120px; accent-color: rgb(0, 122, 204); }
.gcp-tiles { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 5px; display: flex; flex-wrap: wrap; align-content: flex-start; gap: 5px; outline: none; }
.gcp-tile { background: rgb(28, 30, 34); border: 2px solid transparent; }
.gcp-tile:hover { border-color: dodgerblue; }
.gcp-tile.focused { border-color: rgb(0, 122, 204); }
.gcp-tile .tile-head { height: 26px; display: flex; align-items: center; gap: 6px; padding: 0 8px; background: rgb(40, 43, 52); font: 11px "Segoe UI", system-ui, sans-serif; color: #e0e0e0; white-space: nowrap; overflow: hidden; }
.gcp-tile:hover .tile-head { background: rgb(0, 84, 150); }
.gcp-tile .st { font-weight: 700; width: 12px; text-align: center; }
.gcp-tile canvas { display: block; cursor: crosshair; }
.gcp-selection { border-left: 1px solid rgb(40, 43, 52); display: flex; flex-direction: column; }
.sel-head { padding: 10px 14px; font-weight: 600; color: #fff; border-bottom: 1px solid rgb(40, 43, 52); }
.sel-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.sel-table th { text-align: left; font-weight: 500; color: #9aa0a6; padding: 7px 8px 7px 14px; width: 52%; white-space: pre; vertical-align: top; }
.sel-table td { padding: 7px 14px 7px 0; color: #e8e8e8; font-variant-numeric: tabular-nums; white-space: pre-wrap; }
.sel-status { margin: 10px 14px; padding: 9px 10px; border-radius: 6px; background: rgb(22, 24, 28); font-size: 12.5px; white-space: pre-wrap; color: #d3d3d3; }
.sel-buttons { display: flex; gap: 8px; justify-content: flex-end; padding: 0 14px; }
.dk-btn { border: 0; border-radius: 4px; padding: 7px 12px; font: 600 12.5px system-ui, sans-serif; color: #fff; background: rgb(58, 62, 74); cursor: pointer; }
.dk-btn#btn-auto { background: rgb(48, 52, 62); }
.dk-btn:hover:not(:disabled) { background: rgb(0, 122, 204); }
.dk-btn:disabled { opacity: .45; cursor: default; }
.sel-help { margin: auto 14px 14px; padding-top: 14px; font-size: 12px; line-height: 1.5; color: #8a9096; }
.continue-bar { margin-top: 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.continue-bar form { display: flex; align-items: center; gap: 14px; }
@media (max-width: 1100px) {
    .gcp-workspace { grid-template-columns: 1fr; height: auto; }
    .gcp-tiles { min-height: 420px; }
}
.dk-btn.apply { background: rgb(0, 122, 204); }
.dk-btn.apply:hover:not(:disabled) { background: rgb(0, 102, 184); }
.sel-buttons { flex-wrap: wrap; }
.gcp-grid tr.dirty .nm::after { content: " *"; color: #ffd700; }
/* Saved measurements */
.measure-group { margin-bottom: 8px; }
.measure-group .group-title { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 2px 4px 2px; }
.measure-list .n.saved { background: #e11d48; font-size: 12px; }
.row-actions-mini { display: flex; gap: 2px; }
.save-row { display: flex; gap: 6px; margin-top: 6px; }
.save-row input { flex: 1; min-width: 0; padding: 5px 8px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); color: var(--text); font: inherit; }
.leaflet-tooltip.saved-label { background: rgba(225, 29, 72, .92); }
/* Volumes */
.vol-base { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.vol-base select, .vol-base input { padding: 4px 6px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); color: var(--text); font: inherit; font-size: 12.5px; }
.vol-base input { width: 120px; }
.leaflet-tooltip.volume-label { background: rgba(124, 58, 237, .92); }
/* Pro Aero top-up discount */
.pack-price s.was { font-size: 15px; font-weight: 500; color: var(--faint); margin-left: 6px; }
.pro-off { display: inline-block; margin: 2px 0 4px; padding: 1px 8px; border-radius: 999px; background: var(--good-bg); color: var(--good); font-size: 12px; font-weight: 600; }
