:root {
  --bg: #f6f8fc;
  --bg-2: #eef2f9;
  --card: #ffffff;
  --card-2: #fbfcfe;
  --elev: #ffffff;
  --border: rgba(15, 23, 42, 0.10);
  --hair: rgba(15, 23, 42, 0.06);
  --text: #0f1b33;
  --muted: #5a6b87;
  --dim: #93a0b8;
  --accent: #2f6bff;
  --accent-2: #7c52ff;
  --grad: linear-gradient(135deg, #2f6bff 0%, #7c52ff 100%);

  --c-altitude: #2f6bff;
  --c-freefall: #ec2d62;
  --c-canopy: #08b97a;
  --c-heart: #f0508a;
  --c-speed: #e8870f;
  --c-track: #7c52ff;

  --radius: 18px;
  --radius-sm: 13px;
  --shadow: 0 10px 30px -16px rgba(15, 23, 42, 0.22);
  --shadow-sm: 0 2px 8px -3px rgba(15, 23, 42, 0.14);
  --maxw: 1160px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  letter-spacing: -0.005em;
}
a { color: inherit; text-decoration: none; }
::selection { background: rgba(47,107,255,0.22); }
.dim { color: var(--dim); }

/* background depth (subtle on light) */
.bg-grid, .bg-glow { position: fixed; inset: 0; z-index: -1; pointer-events: none; }
.bg-grid {
  background-image: linear-gradient(rgba(15,23,42,0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15,23,42,0.022) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: radial-gradient(120% 90% at 50% -10%, #000 30%, transparent 78%);
}
.bg-glow {
  background:
    radial-gradient(50% 40% at 12% -5%, rgba(47, 107, 255, 0.07), transparent 70%),
    radial-gradient(45% 38% at 92% 4%, rgba(124, 82, 255, 0.06), transparent 70%);
}

/* icons */
.ic { display: inline-flex; align-items: center; justify-content: center; }
.ic svg { display: block; }
.rot90 { transform: rotate(90deg); }

/* ---------------- topbar ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 0.65rem;
  padding: 0.7rem 1.4rem;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 0.55rem; font-weight: 800; font-size: 1.15rem; letter-spacing: -0.03em; }
.brand-logo { color: var(--accent); display: flex; }
.brand-accent { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.topbar nav { display: flex; gap: 0.15rem; margin-left: 1rem; }
.topbar nav a {
  display: flex; align-items: center; gap: 0.45rem;
  color: var(--muted); font-weight: 600; font-size: 0.9rem;
  padding: 0.5rem 0.85rem; border-radius: 11px; transition: all 0.16s ease;
}
.topbar nav a svg { width: 17px; height: 17px; opacity: 0.85; }
.topbar nav a:hover { color: var(--text); background: var(--hair); }
.topbar nav a.active { color: var(--accent); background: rgba(47,107,255,0.10); box-shadow: inset 0 0 0 1px rgba(47,107,255,0.28); }
.topbar nav a.active svg { opacity: 1; color: var(--accent); }

.sync-badge {
  margin-left: auto; display: flex; align-items: center; gap: 0.45rem;
  font-size: 0.76rem; font-weight: 700; color: var(--c-canopy);
  background: rgba(16, 214, 138, 0.08); border: 1px solid rgba(16, 214, 138, 0.28);
  padding: 0.32rem 0.7rem; border-radius: 999px;
}
.lang-select { width: auto; padding: 0.32rem 1.7rem 0.32rem 0.6rem; border-radius: 999px; font-size: 0.8rem; font-weight: 600;
  background-color: #f1f4fa; border: 1px solid var(--border); color: var(--text); cursor: pointer; }
#unit-select { min-width: 56px; }
.sync-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--c-canopy); box-shadow: 0 0 0 0 rgba(16,214,138,0.6); animation: pulse 1.9s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(16,214,138,0.5); } 70% { box-shadow: 0 0 0 6px rgba(16,214,138,0); } 100% { box-shadow: 0 0 0 0 rgba(16,214,138,0); } }

main { max-width: var(--maxw); margin: 0 auto; padding: 1.8rem 1.4rem 3rem; animation: fadeUp 0.35s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------------- page head ---------------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.page-title { font-size: 1.85rem; font-weight: 800; letter-spacing: -0.03em; margin: 0; }
.page-sub { color: var(--muted); margin: 0.25rem 0 0; font-size: 0.94rem; }

/* ---------------- buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  font-family: inherit; font-weight: 650; font-size: 0.92rem; cursor: pointer;
  padding: 0.62rem 1.1rem; border-radius: 12px; border: 1px solid transparent;
  transition: transform 0.12s ease, box-shadow 0.18s ease, background 0.15s ease;
}
.btn svg { width: 16px; height: 16px; }
.btn.sm { padding: 0.46rem 0.85rem; font-size: 0.85rem; border-radius: 10px; }
.btn.primary { background: var(--grad); color: #fff; box-shadow: 0 10px 22px -12px rgba(47,107,255,0.55); }
.btn.primary:hover { transform: translateY(-2px); box-shadow: 0 16px 28px -12px rgba(47,107,255,0.65); }
.btn.ghost { background: #f1f4fa; color: var(--text); border-color: var(--border); }
.btn.ghost:hover { background: #e7ecf5; }
.btn.danger { background: linear-gradient(135deg, #f43f6e, #c01f4a); color: #fff; }
.btn.ghost-danger { background: transparent; color: #ff7a9c; border-color: rgba(244,63,110,0.35); }
.btn.ghost-danger:hover { background: rgba(244,63,110,0.1); }
.btn.icon-btn { padding: 0.5rem; width: 38px; height: 38px; border-radius: 10px; }
.btn.icon-btn svg { width: 16px; height: 16px; }

.back { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--muted); font-weight: 600; font-size: 0.88rem; margin-bottom: 0.9rem; transition: color 0.15s; }
.back:hover { color: var(--text); }
.back svg { width: 16px; height: 16px; }

/* ---------------- generic panel ---------------- */
.panel {
  background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.25rem; margin-bottom: 1.2rem; box-shadow: var(--shadow);
}
.panel-head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 1rem; }
.panel-head h3 { margin: 0; font-size: 1.02rem; font-weight: 700; letter-spacing: -0.01em; }
.panel-ico { display: flex; width: 30px; height: 30px; border-radius: 9px; align-items: center; justify-content: center;
  color: var(--c, var(--accent)); background: color-mix(in srgb, var(--c, var(--accent)) 14%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c, var(--accent)) 25%, transparent); }

/* data-color → --c */
[data-color="altitude"] { --c: var(--c-altitude); }
[data-color="freefall"] { --c: var(--c-freefall); }
[data-color="canopy"] { --c: var(--c-canopy); }
[data-color="heart"] { --c: var(--c-heart); }
[data-color="speed"] { --c: var(--c-speed); }
[data-color="track"] { --c: var(--c-track); }

/* ---------------- tags / badges ---------------- */
.tag.est { font-size: 0.6rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em;
  color: #a85f06; background: rgba(232,135,15,0.14); border: 1px solid rgba(232,135,15,0.32);
  padding: 1px 6px; border-radius: 5px; cursor: help; }
.status-badge { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.74rem; font-weight: 650;
  padding: 0.3rem 0.65rem; border-radius: 999px; border: 1px solid var(--border); background: #f1f4fa; color: var(--muted); }
.status-badge svg { width: 13px; height: 13px; }
.status-badge.warn { color: #b3690a; background: rgba(232,135,15,0.12); border-color: rgba(232,135,15,0.3); }
.status-badge.track { color: #6a3fe0; background: rgba(124,82,255,0.12); border-color: rgba(124,82,255,0.3); }
.status-badge.neutral { color: var(--muted); }

/* ---------------- hero ---------------- */
.hero {
  position: relative; overflow: hidden; border-radius: 22px; border: 1px solid var(--border);
  background: linear-gradient(180deg, #ffffff, #fafbff); padding: 1.7rem 1.7rem 1.5rem; margin-bottom: 1.2rem;
  box-shadow: var(--shadow);
}
.hero-glow { position: absolute; inset: 0; background:
  radial-gradient(60% 120% at 100% 0, rgba(47,107,255,0.10), transparent 60%),
  radial-gradient(50% 120% at 0% 100%, rgba(124,82,255,0.08), transparent 60%); pointer-events: none; }
.hero-path { position: absolute; right: 0; bottom: 0; left: 0; height: 70%; opacity: 0.8; pointer-events: none; }
.hero-path svg { width: 100%; height: 100%; }
.hero-content { position: relative; z-index: 1; }
.hero-eyebrow { text-transform: uppercase; letter-spacing: 0.16em; font-size: 0.7rem; font-weight: 700; color: var(--accent); margin-bottom: 0.3rem; }
.hero-title { font-size: 2.4rem; font-weight: 850; letter-spacing: -0.04em; margin: 0 0 0.7rem; }
.hero-num { font-family: "JetBrains Mono", monospace; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 1.1rem; margin-bottom: 1rem; }
.meta-item { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--muted); font-size: 0.9rem; font-weight: 550; }
.meta-item svg { width: 15px; height: 15px; color: var(--dim); }
.hero-badges { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* ---------------- metric cards ---------------- */
.metric-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 0.85rem; margin-bottom: 1.2rem; }
.metric-card {
  position: relative; overflow: hidden;
  background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1rem 1.05rem;
  transition: transform 0.15s ease, border-color 0.2s ease;
}
.metric-card::after { content: ""; position: absolute; top: 0; right: 0; width: 60%; height: 60%;
  background: radial-gradient(100% 100% at 100% 0, color-mix(in srgb, var(--c) 14%, transparent), transparent 70%); pointer-events: none; }
.metric-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--c) 35%, var(--border)); }
.metric-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 0.7rem; }
.metric-ico { display: flex; width: 34px; height: 34px; border-radius: 10px; align-items: center; justify-content: center;
  color: var(--c); background: color-mix(in srgb, var(--c) 15%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 25%, transparent); }
.metric-value { font-family: "JetBrains Mono", monospace; font-size: 1.7rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.metric-unit { font-family: "Inter"; font-size: 0.8rem; color: var(--muted); font-weight: 600; margin-left: 0.25rem; }
.metric-na { font-size: 0.92rem; color: var(--dim); font-weight: 600; font-style: italic; padding: 0.32rem 0; }
.metric-label { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; color: var(--muted); font-size: 0.78rem; font-weight: 600; margin-top: 0.35rem; }
.metric-trend { display: inline-flex; align-items: center; gap: 0.2rem; font-size: 0.75rem; font-weight: 700; padding: 0.15rem 0.45rem; border-radius: 6px; }
.metric-trend svg { width: 13px; height: 13px; }
.metric-trend.up { color: var(--c-canopy); background: rgba(16,214,138,0.12); }
.metric-trend.down { color: var(--c-freefall); background: rgba(244,63,110,0.12); }

/* ---------------- phase timeline ---------------- */
.timeline-track { display: flex; gap: 5px; height: 68px; }
.tl-seg { position: relative; display: flex; flex-direction: column; justify-content: center; gap: 1px;
  padding: 0 0.7rem; border-radius: 10px; overflow: hidden; min-width: 0;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 26%, transparent), color-mix(in srgb, var(--c) 12%, transparent));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 35%, transparent); }
.tl-seg::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--c); }
.tl-ico { display: flex; color: var(--c); }
.tl-ico svg { width: 14px; height: 14px; }
.tl-label { font-size: 0.78rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-dur { font-family: "JetBrains Mono", monospace; font-size: 0.74rem; color: var(--muted); }
.tl-seg.missing { flex-grow: 0.18; background: none; box-shadow: inset 0 0 0 1px var(--hair); border: 1px dashed var(--border); }
.tl-seg.missing::before { display: none; }
.tl-seg.missing .tl-label, .tl-seg.missing .tl-dur { color: var(--dim); font-weight: 600; }
.tl-seg[data-phase="climb"] { --c: var(--c-altitude); }
.tl-seg[data-phase="exit"] { --c: var(--c-speed); }
.tl-seg[data-phase="freefall"] { --c: var(--c-freefall); }
.tl-seg[data-phase="canopy"] { --c: var(--c-canopy); }
.tl-seg[data-phase="landed"] { --c: var(--c-landed, #8a93a8); }

/* ---------------- charts ---------------- */
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
.chart-grid > .panel { margin-bottom: 0; }
.chart-card .chart-body { min-height: 250px; }
.chart-wrap { position: relative; height: 250px; }

/* ---------------- auth / login ---------------- */
body.logged-out .topbar nav,
body.logged-out .sync-badge,
body.logged-out #user-slot,
body.logged-out .site-footer { display: none; }
body.logged-out main { max-width: none; padding: 0; }

.auth-screen { min-height: calc(100vh - 56px); display: flex; align-items: center; justify-content: center; position: relative; padding: 2rem 1rem; }
.auth-bg { position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(60% 50% at 50% 0%, rgba(47,107,255,0.12), transparent 70%),
              radial-gradient(50% 40% at 80% 100%, rgba(124,82,255,0.10), transparent 70%); }
.auth-card { position: relative; z-index: 1; width: 100%; max-width: 380px; background: var(--card);
  border: 1px solid var(--border); border-radius: 22px; padding: 2rem 1.8rem; box-shadow: var(--shadow); }
.auth-brand { display: flex; align-items: center; gap: 0.6rem; justify-content: center; margin-bottom: 1.2rem; }
.auth-logo { color: var(--accent); display: flex; }
.auth-word { font-size: 1.4rem; font-weight: 800; letter-spacing: -0.03em; }
.auth-word .grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-title { font-size: 1.5rem; font-weight: 800; text-align: center; margin: 0 0 0.3rem; }
.auth-sub { text-align: center; color: var(--muted); font-size: 0.9rem; margin: 0 0 1.4rem; }
.g-btn-wrap { display: flex; justify-content: center; margin-bottom: 1rem; min-height: 44px; }
.auth-divider { display: flex; align-items: center; gap: 0.7rem; color: var(--dim); font-size: 0.78rem; margin: 0.4rem 0 1.1rem; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.auth-form { display: flex; flex-direction: column; gap: 0.85rem; }
.auth-submit { width: 100%; margin-top: 0.3rem; padding: 0.7rem; }
.auth-switch { text-align: center; margin-top: 1.1rem; font-size: 0.88rem; color: var(--muted); }
.auth-switch a { color: var(--accent); font-weight: 650; }

/* ---------------- user menu ---------------- */
.user-slot { position: relative; margin-left: 0.4rem; }
.avatar-btn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--border); background: var(--grad);
  color: #fff; font-weight: 800; font-size: 0.95rem; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.user-menu { position: absolute; right: 0; top: 46px; width: 230px; background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow); padding: 0.5rem; z-index: 40; }
.user-menu.hidden { display: none; }
.um-head { padding: 0.5rem 0.6rem 0.6rem; border-bottom: 1px solid var(--hair); margin-bottom: 0.4rem; }
.um-name { font-weight: 700; font-size: 0.92rem; }
.um-email { font-size: 0.78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.um-item { display: flex; align-items: center; gap: 0.6rem; width: 100%; text-align: left; background: none; border: none;
  color: var(--text); font: inherit; font-size: 0.9rem; font-weight: 550; padding: 0.55rem 0.6rem; border-radius: 9px; cursor: pointer; }
.um-item:hover { background: var(--hair); }
.um-item svg { color: var(--muted); }
.mono-input { font-family: "JetBrains Mono", monospace; font-size: 0.8rem; }

/* ---------------- jump card delete ---------------- */
.jump-card { position: relative; }
.jc-del { position: absolute; top: 0.6rem; right: 0.6rem; z-index: 2; width: 30px; height: 30px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--card); color: var(--muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.15s, color 0.15s, background 0.15s; }
.jump-card:hover .jc-del { opacity: 1; }
.jc-del:hover { color: #fff; background: var(--c-freefall); border-color: var(--c-freefall); }
@media (hover: none) { .jc-del { opacity: 0.6; } }

/* ---------------- records + currency ---------------- */
.records { display: flex; flex-direction: column; }
.record-row { display: flex; align-items: center; gap: 0.8rem; padding: 0.7rem 0.2rem; border-bottom: 1px solid var(--hair); cursor: pointer; transition: background 0.14s; border-radius: 8px; }
.record-row:last-child { border-bottom: none; }
.record-row:hover { background: var(--hair); }
.record-ico { display: flex; width: 32px; height: 32px; border-radius: 9px; align-items: center; justify-content: center; color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 22%, transparent); flex-shrink: 0; }
.record-main { flex: 1; min-width: 0; }
.record-label { font-weight: 650; font-size: 0.92rem; }
.record-sub { font-size: 0.76rem; color: var(--dim); }
.record-value { font-family: "JetBrains Mono", monospace; font-weight: 700; font-size: 1.05rem; }

.currency-bar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.7rem; margin-bottom: 1.4rem; }
.currency-chip { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.7rem 0.85rem; box-shadow: var(--shadow-sm); }
.cc-value { font-family: "JetBrains Mono", monospace; font-weight: 700; font-size: 1.15rem; }
.cc-label { font-size: 0.72rem; color: var(--muted); margin-top: 0.15rem; }
h2 { font-size: 1.15rem; font-weight: 750; letter-spacing: -0.02em; margin: 1.6rem 0 0.9rem; }

/* ---------------- map ---------------- */
.map-wrap { height: 440px; border-radius: 16px; overflow: hidden; border: 1px solid var(--border); }
.leaflet-container { background: #dde6f3; font-family: inherit; }
.map-pin { transform: translate(-50%, -100%); text-align: center; pointer-events: none; }
.map-pin i { display: block; width: 14px; height: 14px; border-radius: 50%; margin: 0 auto; border: 2px solid #fff; box-shadow: 0 1px 5px rgba(0,0,0,0.5); }
.map-pin b { display: inline-block; margin-top: 2px; background: rgba(15,23,42,0.82); color: #fff; font-size: 0.6rem; font-weight: 800; letter-spacing: 0.05em; padding: 1px 6px; border-radius: 5px; }
.map-legend { background: rgba(255,255,255,0.92); border: 1px solid var(--border); border-radius: 10px; padding: 0.4rem 0.6rem; display: flex; flex-direction: column; gap: 0.2rem; box-shadow: var(--shadow-sm); }
.map-legend span { display: flex; align-items: center; gap: 0.4rem; font-size: 0.72rem; font-weight: 600; color: var(--text); }
.map-legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.leaflet-bar a, .leaflet-control-layers { border-radius: 10px !important; border-color: var(--border) !important; color: var(--text); }
.leaflet-control-layers { box-shadow: var(--shadow-sm) !important; }

/* ---------------- 3D track ---------------- */
.track-chips { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-bottom: 0.9rem; }
.three-container { border-radius: 16px; overflow: hidden; border: 1px solid var(--border); }
#three-canvas { width: 100%; height: 480px; display: block; background: radial-gradient(120% 100% at 50% 0, #eef3fb, #dde6f3); }
.three-controls { display: flex; align-items: center; gap: 0.85rem; margin-top: 0.9rem; }
.scrubber { flex: 1; height: 5px; accent-color: var(--accent); cursor: pointer; }

.phase-chip { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.78rem; font-weight: 650; color: var(--muted);
  background: #f1f4fa; border: 1px solid var(--border); padding: 0.28rem 0.7rem; border-radius: 999px; }
.phase-chip .dot { width: 9px; height: 9px; border-radius: 50%; }
.phase-chip .dot[data-phase="climb"] { background: var(--c-altitude); }
.phase-chip .dot[data-phase="exit"] { background: var(--c-speed); }
.phase-chip .dot[data-phase="freefall"] { background: var(--c-freefall); }
.phase-chip .dot[data-phase="canopy"] { background: var(--c-canopy); }
.phase-chip .dot[data-phase="landed"] { background: #8a93a8; }
.chip-dur { font-family: "JetBrains Mono", monospace; color: var(--dim); }

/* ---------------- edit form ---------------- */
.edit-card { padding: 0; overflow: hidden; }
.edit-head { width: 100%; display: flex; align-items: center; gap: 0.6rem; background: none; border: none; cursor: pointer;
  color: var(--text); padding: 1.1rem 1.25rem; font: inherit; }
.edit-head h3 { margin: 0; font-size: 1.02rem; font-weight: 700; }
.edit-chevron { margin-left: auto; color: var(--muted); transition: transform 0.2s ease; display: flex; }
.edit-card.collapsed .edit-chevron { transform: rotate(-90deg); }
.edit-body { padding: 0 1.25rem 1.25rem; display: grid; gap: 1.3rem; }
.edit-card.collapsed .edit-body { display: none; }
.edit-section-title { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--dim); font-weight: 700; margin-bottom: 0.7rem; }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.9rem; }
.form-grid.two { grid-template-columns: 1fr 1fr; }
.field { display: flex; flex-direction: column; gap: 0.4rem; }
.field-label { font-size: 0.78rem; color: var(--muted); font-weight: 600; }
.field-hint { font-size: 0.8rem; color: var(--dim); margin: 0.5rem 0 0; }
.edit-actions { display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap; }
.del-wrap { display: flex; align-items: center; gap: 0.6rem; margin-left: auto; }
.del-confirm-text { font-size: 0.85rem; color: #c41d4c; font-weight: 600; }

input, select, textarea {
  background: #fbfcfe; border: 1px solid var(--border-strong, var(--border)); color: var(--text);
  border-radius: 11px; padding: 0.62rem 0.75rem; font-size: 0.94rem; font-family: inherit; transition: border-color 0.15s, box-shadow 0.15s; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47,107,255,0.16); }
textarea { resize: vertical; min-height: 84px; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238b97b3' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.7rem center; padding-right: 2rem; }

/* ---------------- logbook cards ---------------- */
.logbook-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 1rem; }
.jump-card {
  position: relative; overflow: hidden; cursor: pointer;
  background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.2rem 1.1rem 1.35rem;
  transition: transform 0.16s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.jc-rail { position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--grad); }
.jump-card:hover { transform: translateY(-4px); border-color: rgba(47,107,255,0.4); box-shadow: var(--shadow); }
.jc-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 0.85rem; }
.jc-num { font-family: "JetBrains Mono", monospace; font-size: 1.7rem; font-weight: 700; letter-spacing: -0.03em; }
.jc-num .hash { color: var(--dim); font-size: 1rem; }
.jc-src { text-align: right; }
.jc-date { color: var(--muted); font-size: 0.78rem; margin-top: 0.35rem; }
.jc-dz { display: flex; align-items: center; gap: 0.4rem; font-weight: 600; margin-bottom: 0.9rem; font-size: 0.92rem; }
.jc-dz svg { width: 15px; height: 15px; color: var(--c-track); flex-shrink: 0; }
.jc-type { margin-left: auto; font-size: 0.72rem; font-weight: 700; color: var(--muted); background: #eef2f9;
  border: 1px solid var(--border); padding: 0.15rem 0.55rem; border-radius: 999px; }
.jc-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
.jc-stat { display: flex; align-items: center; gap: 0.45rem; background: #f7f9fc; border: 1px solid var(--hair); border-radius: 11px; padding: 0.5rem 0.55rem; }
.jc-stat-ico { display: flex; color: var(--c); }
.jc-stat-ico svg { width: 15px; height: 15px; }
.jc-stat-l { font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--dim); font-weight: 600; }
.jc-stat-v { font-size: 0.92rem; font-weight: 700; font-family: "JetBrains Mono", monospace; }

/* ---------------- upload ---------------- */
.upload-panel { max-width: 720px; }
.dropzone { border: 2px dashed var(--border); border-radius: 18px; padding: 3rem 1.5rem; text-align: center;
  background: #fafbfe; cursor: pointer; transition: all 0.18s ease; margin: 1rem 0 0.5rem; }
.dropzone:hover { border-color: rgba(47,107,255,0.5); background: rgba(47,107,255,0.05); }
.dropzone.drag { border-color: var(--accent); background: rgba(47,107,255,0.08); transform: scale(1.005); }
.dz-ico { display: flex; justify-content: center; color: var(--accent); margin-bottom: 0.7rem; }
.dz-title { font-weight: 700; font-size: 1rem; }
.dz-hint { color: var(--dim); font-size: 0.85rem; margin-top: 0.3rem; }
.note { display: flex; align-items: center; gap: 0.5rem; border-radius: 12px; padding: 0.7rem 0.9rem; font-size: 0.88rem; font-weight: 550; margin-top: 0.9rem; }
.note svg { width: 16px; height: 16px; flex-shrink: 0; }
.note.info { background: rgba(47,107,255,0.08); border: 1px solid rgba(47,107,255,0.28); color: #1f4fd0; }
.note.err { background: rgba(236,45,98,0.08); border: 1px solid rgba(236,45,98,0.3); color: #c41d4c; }

/* ---------------- empty state ---------------- */
.empty-state { text-align: center; padding: 4rem 1.5rem; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--card); }
.empty-state.compact { padding: 2.4rem 1rem; border: none; background: none; }
.empty-ico { display: inline-flex; padding: 1rem; border-radius: 16px; color: var(--accent);
  background: rgba(47,107,255,0.10); box-shadow: inset 0 0 0 1px rgba(47,107,255,0.25); margin-bottom: 1rem; }
.empty-state.compact .empty-ico { padding: 0.7rem; margin-bottom: 0.7rem; }
.empty-title { font-size: 1.2rem; font-weight: 700; margin-bottom: 0.4rem; }
.empty-state.compact .empty-title { font-size: 1rem; }
.empty-text { color: var(--muted); max-width: 440px; margin: 0 auto 1.2rem; font-size: 0.92rem; }

/* ---------------- toast ---------------- */
.toast { position: fixed; bottom: 1.25rem; right: 1.25rem; background: var(--elev); border: 1px solid var(--border);
  padding: 0.85rem 1.15rem; border-radius: 14px; max-width: 380px; z-index: 60; box-shadow: var(--shadow);
  font-weight: 600; font-size: 0.9rem; animation: slideIn 0.25s ease both; }
@keyframes slideIn { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
.toast.err { border-color: rgba(244,63,110,0.5); }
.toast.ok { border-left: 3px solid var(--c-canopy); }

/* ---------------- footer ---------------- */
.site-footer { max-width: var(--maxw); margin: 0 auto; padding: 1.6rem 1.4rem; display: flex; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.84rem; }
.foot-brand { font-weight: 800; letter-spacing: -0.02em; }
.foot-link { color: var(--muted); font-weight: 600; }
.foot-link:hover { color: var(--accent); }
.auth-legal { margin-top: 1rem; font-size: 0.72rem; color: var(--dim); text-align: center; line-height: 1.5; }
.auth-legal a { color: var(--muted); text-decoration: underline; }
.privacy-p { color: var(--muted); font-size: 0.92rem; line-height: 1.6; margin: 0 0 0.9rem; white-space: pre-wrap; }

/* ---------------- responsive ---------------- */
@media (max-width: 820px) {
  .chart-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .map-wrap { height: 380px; }
  #three-canvas { height: 380px; }
}

@media (max-width: 560px) {
  html { -webkit-text-size-adjust: 100%; }
  body { overflow-x: hidden; }
  main { padding: 1.1rem 0.9rem 2.5rem; }

  /* topbar: brand + Live on row 1, tabs full-width on row 2 */
  .topbar { flex-wrap: wrap; padding: 0.55rem 0.9rem; padding-top: max(0.55rem, env(safe-area-inset-top)); gap: 0.5rem; }
  .topbar nav { margin-left: 0; order: 3; width: 100%; justify-content: space-between; gap: 0.3rem; }
  .topbar nav a { flex: 1; justify-content: center; padding: 0.5rem 0.3rem; }
  .topbar nav a span { display: none; }
  .sync-badge { margin-left: auto; }

  .page-head { margin-bottom: 1.1rem; gap: 0.6rem; }
  .page-title { font-size: 1.5rem; }

  .hero { padding: 1.2rem 1.15rem 1.1rem; border-radius: 18px; }
  .hero-title { font-size: 1.7rem; }
  .hero-meta { gap: 0.5rem 1rem; margin-bottom: 0.8rem; }
  .meta-item { font-size: 0.84rem; }

  .metric-grid { grid-template-columns: 1fr 1fr; gap: 0.7rem; }
  .metric-card { padding: 0.85rem 0.9rem; }
  .metric-value { font-size: 1.4rem; }
  .metric-card .metric-ico { width: 30px; height: 30px; }

  .panel { padding: 1rem; border-radius: 16px; }
  .form-grid, .form-grid.two { grid-template-columns: 1fr; }
  .del-wrap { margin-left: 0; width: 100%; flex-wrap: wrap; }

  .map-wrap { height: 300px; }
  #three-canvas { height: 320px; }
  .chart-wrap { height: 220px; }

  /* phase timeline stays readable when squeezed */
  .timeline-track { height: 56px; gap: 3px; }
  .tl-seg { padding: 0 0.4rem; }
  .tl-label { font-size: 0.66rem; }
  .tl-dur { font-size: 0.62rem; }
  .tl-ico { display: none; }

  .logbook-grid { grid-template-columns: 1fr; }
  .currency-bar { grid-template-columns: 1fr 1fr; }
  .site-footer { flex-direction: column; gap: 0.25rem; padding: 1.2rem 0.9rem max(1.2rem, env(safe-area-inset-bottom)); }
}

@media (max-width: 360px) {
  .metric-grid { grid-template-columns: 1fr; }
}
