/* Streetscape Jogja — palette & type follow geotwinverse.ai
   (Plus Jakarta Sans, slate surfaces, orange call-to-action, blue→green gradient) */
:root {
  --bg: #020617;
  --surface: #0B1222;
  --card: #0F172A;
  --card-2: #131D33;
  --line: #1E293B;
  --line-2: #334155;
  --text: #E2E8F0;
  --text-2: #CBD5E1;
  --muted: #94A3B8;
  --dim: #64748B;
  --orange: #F15B22;
  --orange-2: #FF7A45;
  --orange-soft: rgba(241, 91, 34, .12);
  --blue: #3B82F6;
  --blue-600: #2563EB;
  --blue-soft: rgba(59, 130, 246, .14);
  --green: #00A86B;
  --green-soft: rgba(0, 168, 107, .14);
  --navy: #0C426A;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 10px 30px -12px rgba(0, 0, 0, .6), 0 0 0 1px rgba(255, 255, 255, .04);
  --top: 64px;
  --font: "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  display: flex; flex-direction: column;
}
img { display: block; max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
.hidden, [hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ topbar */
.topbar {
  position: sticky; top: 0; z-index: 1000;
  height: var(--top);
  display: flex; align-items: center; gap: 28px;
  padding: 0 24px;
  background: rgba(11, 18, 34, .82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 30px; height: 30px; color: var(--blue); }
.brand-name b { font-weight: 800; }
.nav { display: flex; gap: 4px; margin-left: 8px; }
.nav a {
  color: var(--text-2); font-weight: 500; font-size: 14px;
  padding: 8px 14px; border-radius: var(--radius-sm);
  transition: background .15s, color .15s;
}
.nav a:hover { color: #fff; background: rgba(255, 255, 255, .05); text-decoration: none; }
.nav a.active { color: #fff; background: rgba(255, 255, 255, .08); }
.nav a.nav-cta { color: var(--orange); font-weight: 700; }
.nav a.nav-cta.active { background: var(--orange-soft); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.select-wrap {
  display: flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 10px 0 12px;
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--card); color: var(--muted);
}
.select-wrap svg { width: 15px; height: 15px; }
.select-wrap select { background: transparent; border: 0; color: var(--text); font-weight: 600; font-size: 14px; outline: none; cursor: pointer; }
.select-wrap select option { background: var(--card); }
.lang { display: flex; border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 3px; background: var(--card); }
.lang button { border: 0; background: transparent; font-size: 12px; font-weight: 700; padding: 4px 9px; border-radius: 6px; color: var(--muted); cursor: pointer; }
.lang button.on { background: var(--line-2); color: #fff; }
.burger { display: none; }

/* ------------------------------------------------------------ layout */
main { flex: 1; position: relative; }
.view { display: none; }
.view.active { display: block; }
.view-map.active { display: block; position: absolute; inset: 0; overflow: hidden; }
html, body { overflow-x: hidden; }
.page { max-width: 1240px; margin: 0 auto; padding: 40px 24px 64px; }
.page > .card, .page > .card-grid { margin-top: 20px; }
.page-head { max-width: 760px; margin-bottom: 28px; }
.eyebrow { display: inline-block; color: var(--orange); font-size: 13px; font-weight: 600; letter-spacing: .01em; }
.eyebrow.light { color: #FFD3C2; }
h1 { font-size: clamp(28px, 3.4vw, 42px); line-height: 1.12; font-weight: 800; letter-spacing: -.025em; margin: 8px 0 12px; color: #fff; }
h3 { font-size: 16px; font-weight: 700; margin: 0; letter-spacing: -.01em; color: #fff; }
.lead { color: var(--text-2); font-size: 17px; margin: 0; max-width: 680px; }
.hint { color: var(--dim); font-size: 13px; margin: 0; }
.foot {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 14px 24px; border-top: 1px solid var(--line);
  color: var(--dim); font-size: 12px; background: var(--surface);
}
body.on-map .foot { display: none; }

/* ------------------------------------------------------------ cards */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px;
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.card-grid { display: grid; gap: 20px; }
.card-grid.two { grid-template-columns: 1.15fr 1fr; align-items: start; }
.card-grid.four { grid-template-columns: repeat(4, 1fr); }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px; position: relative; overflow: hidden;
}
.stat::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent, var(--blue)); }
.stat-label { color: var(--muted); font-size: 13px; font-weight: 500; }
.stat-value { font-size: 34px; font-weight: 800; letter-spacing: -.03em; color: #fff; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat-sub { color: var(--dim); font-size: 12.5px; margin-top: 2px; }

/* ------------------------------------------------------------ map view */
.map { position: absolute; inset: 0; background: #0b0f1a; z-index: 0; }
.leaflet-container { font-family: var(--font); background: #0b0f1a; }
.leaflet-control-attribution { background: rgba(2, 6, 23, .7) !important; color: var(--dim) !important; font-size: 10.5px; }
.leaflet-control-attribution a { color: var(--muted) !important; }
.leaflet-bar a { background: var(--card) !important; color: var(--text) !important; border-color: var(--line) !important; }
.leaflet-bar { border: 1px solid var(--line-2) !important; box-shadow: var(--shadow) !important; }
.leaflet-control-zoom { margin-top: 84px !important; margin-right: 16px !important; }

.panel {
  position: absolute; z-index: 500;
  background: rgba(15, 23, 42, .94); backdrop-filter: blur(10px);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.layers { top: 16px; left: 16px; width: 290px; max-height: calc(100% - 32px); overflow: auto; padding: 16px 16px 12px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.field { display: flex; flex-direction: column; gap: 8px; margin: 6px 0; }
.field-label { color: var(--text-2); font-size: 13px; font-weight: 600; }
.field-label em { color: var(--dim); font-style: normal; font-weight: 400; }
.sub-field { margin: 2px 0 10px 46px; display: flex; flex-direction: column; gap: 8px; }
.divider { height: 1px; background: var(--line); margin: 12px 0; }

.chip-list { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--line-2); background: transparent; color: var(--text-2);
  font-size: 12.5px; font-weight: 500; padding: 5px 10px; border-radius: 999px; cursor: pointer;
  transition: all .15s;
}
.chip:hover { border-color: var(--muted); color: #fff; }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); font-weight: 600; }
.chip .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }

.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; padding: 5px 9px; border-radius: 6px; cursor: pointer; }
.seg button.on { background: var(--line-2); color: #fff; }

.toggle { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; padding: 6px 0; font-size: 14px; font-weight: 500; color: var(--text); }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle .sw { flex: none; width: 34px; height: 20px; border-radius: 999px; background: var(--line-2); position: relative; transition: background .2s; margin-top: 1px; }
.toggle .sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .2s; }
.toggle input:checked + .sw { background: var(--blue); }
.toggle input:checked + .sw::after { transform: translateX(14px); }
.toggle input:focus-visible + .sw { outline: 2px solid var(--blue); outline-offset: 2px; }
.help { display: block; color: var(--dim); font-size: 12.5px; font-weight: 400; margin-top: 2px; }

.legend-ramp { margin-top: 4px; }
.legend-ramp .bar { height: 8px; border-radius: 4px; }
.legend-ramp .ticks { display: flex; justify-content: space-between; color: var(--muted); font-size: 11.5px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.legend-cat { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--text-2); }
.legend-cat.vertical { flex-direction: column; gap: 8px; font-size: 13px; }
.legend-cat i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

.kpi-strip {
  position: absolute; z-index: 500; top: 16px; left: 322px; right: 16px;
  display: flex; gap: 10px; pointer-events: none; flex-wrap: wrap;
}
.kpi {
  pointer-events: auto;
  background: rgba(15, 23, 42, .94); backdrop-filter: blur(10px);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 9px 14px; box-shadow: var(--shadow); min-width: 118px;
}
.kpi span { display: block; color: var(--muted); font-size: 11.5px; font-weight: 500; }
.kpi b { font-size: 19px; font-weight: 800; letter-spacing: -.02em; color: #fff; font-variant-numeric: tabular-nums; }
.basemap-switch { position: absolute; z-index: 500; right: 16px; bottom: 26px; box-shadow: var(--shadow); background: rgba(2, 6, 23, .9); }

.drawer {
  position: absolute; z-index: 600; top: 0; right: 0; bottom: 0; width: 440px; max-width: 100%;
  background: var(--card); border-left: 1px solid var(--line);
  box-shadow: -20px 0 40px -20px rgba(0, 0, 0, .7);
  transform: translateX(100%); transition: transform .28s cubic-bezier(.2, .8, .2, 1);
  overflow-y: auto;
}
.drawer.open { transform: none; }
.drawer-close { position: absolute; top: 14px; right: 14px; z-index: 2; }
.icon-btn {
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line-2);
  background: rgba(2, 6, 23, .6); color: var(--text); font-size: 20px; line-height: 1; cursor: pointer;
}
.icon-btn:hover { background: var(--line-2); }
.only-mobile { display: none; }

/* ------------------------------------------------------------ detail (drawer + modal + result) */
.detail { padding: 22px 22px 28px; }
.detail-top { padding-right: 40px; }
.detail h2 { font-size: 22px; font-weight: 800; letter-spacing: -.02em; margin: 6px 0 4px; color: #fff; }
.meta { color: var(--muted); font-size: 13px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--blue-soft); color: #93C5FD; }
.badge.orange { background: var(--orange-soft); color: #FFB08F; }
.badge.green { background: var(--green-soft); color: #6EE7B7; }
.badge.gray { background: rgba(148, 163, 184, .12); color: var(--muted); }

.viewer { margin-top: 16px; border-radius: var(--radius); overflow: hidden; background: #000; border: 1px solid var(--line); }
.viewer-img { position: relative; aspect-ratio: 4 / 3; background: #05070d; }
.viewer-img img { width: 100%; height: 100%; object-fit: cover; }
.viewer-img img.pano { object-fit: contain; }
.viewer-tabs { display: flex; gap: 2px; padding: 4px; background: var(--bg); border-top: 1px solid var(--line); }
.viewer-tabs button { flex: 1; border: 0; background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 600; padding: 7px 4px; border-radius: 6px; cursor: pointer; }
.viewer-tabs button.on { background: var(--line-2); color: #fff; }

.section { margin-top: 24px; }
.section-title { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; margin: 0 0 10px; }
.comp { display: flex; height: 14px; border-radius: 7px; overflow: hidden; gap: 2px; background: var(--card); }
.comp > div { height: 100%; min-width: 2px; }
.comp-legend { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px 12px; margin-top: 10px; font-size: 12.5px; color: var(--text-2); }
.comp-legend b { color: #fff; font-weight: 700; font-variant-numeric: tabular-nums; margin-left: auto; }
.comp-legend div { display: flex; align-items: center; gap: 6px; }
.comp-legend i { width: 9px; height: 9px; border-radius: 3px; flex: none; }

.count-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.count { background: var(--card-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; }
.count b { display: block; font-size: 22px; font-weight: 800; color: #fff; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.count span { color: var(--muted); font-size: 12px; }

.attrs { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.attr { background: var(--card-2); padding: 10px 12px; }
.attr span { display: block; color: var(--muted); font-size: 11.5px; font-weight: 500; }
.attr b { font-size: 14px; font-weight: 600; color: #fff; }
.attr.wide { grid-column: span 2; }
.quote { margin: 14px 0 0; padding: 12px 14px; border-left: 3px solid var(--orange); background: var(--card-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--text-2); font-size: 14px; }
.side-switch { display: flex; gap: 6px; margin-bottom: 10px; }

/* ------------------------------------------------------------ charts */
.chart { width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.axis text { fill: var(--dim); font-size: 11px; font-variant-numeric: tabular-nums; }
.axis line, .axis path { stroke: var(--line); }
.gridline { stroke: var(--line); stroke-dasharray: 2 4; }
.hist-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px 26px; }
.hist h4 { margin: 0 0 2px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.hist .avg { color: var(--dim); font-size: 12px; }
.hist .avg b { color: #fff; font-weight: 700; }
.scatter-ctrl { display: flex; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.scatter-ctrl label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 12px; font-weight: 500; }
select, input[type="text"] {
  background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  padding: 8px 10px; font-size: 13.5px; color: var(--text); outline: none;
}
select:focus, input[type="text"]:focus { border-color: var(--blue); }

.hbars { display: flex; flex-direction: column; gap: 9px; }
.hbar { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; font-size: 13px; cursor: default; }
.hbar .lbl { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar .val { color: #fff; font-weight: 700; font-variant-numeric: tabular-nums; }
.hbar .track { grid-column: span 2; height: 8px; border-radius: 4px; background: var(--card-2); }
.hbar .fill { height: 100%; border-radius: 4px; transition: width .5s cubic-bezier(.2, .8, .2, 1); }
.hbar:hover .lbl { color: #fff; }

.life-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.life { background: var(--card-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px; }
.life .pct { font-size: 28px; font-weight: 800; color: #fff; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.life .lbl { color: var(--text-2); font-size: 13.5px; font-weight: 500; }
.life .meter { height: 6px; border-radius: 3px; background: var(--line); margin-top: 12px; overflow: hidden; }
.life .meter div { height: 100%; background: var(--green); border-radius: 3px; }

.thumb-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
.thumb { position: relative; border-radius: var(--radius-sm); overflow: hidden; cursor: pointer; border: 1px solid var(--line); background: var(--bg); }
.thumb img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; transition: transform .35s; }
.thumb:hover img { transform: scale(1.05); }
.thumb .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 10px 8px; background: linear-gradient(transparent, rgba(2, 6, 23, .92)); font-size: 12px; color: var(--text-2); }
.thumb .cap b { color: #fff; font-size: 15px; font-weight: 800; display: block; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.g-item { background: var(--card-2); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; cursor: pointer; transition: border-color .15s, transform .15s; text-align: left; padding: 0; }
.g-item:hover { border-color: var(--line-2); transform: translateY(-2px); }
.g-item img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.g-body { padding: 10px 12px 12px; }
.g-body .t { font-weight: 700; color: #fff; font-size: 14px; display: flex; align-items: center; gap: 7px; }
.g-body .t i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.g-body .s { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; padding: 0 12px 10px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--line); color: var(--text-2); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: rgba(255, 255, 255, .02); }
.tbl .r { text-align: right; font-variant-numeric: tabular-nums; }
.tbl td.strong { color: #fff; font-weight: 600; }

/* ------------------------------------------------------------ spatial */
.moran-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.moran { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; cursor: pointer; transition: border-color .15s; }
.moran:hover, .moran.on { border-color: var(--line-2); }
.moran.on { box-shadow: inset 0 0 0 1px var(--orange); }
.moran .name { color: var(--text-2); font-size: 13.5px; font-weight: 600; }
.moran .I { font-size: 30px; font-weight: 800; color: #fff; letter-spacing: -.03em; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.moran .p { color: var(--dim); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.moran .badge { margin-top: 10px; }
.lisa-wrap { display: grid; grid-template-columns: 1fr 260px; gap: 20px; }
.mini-map { height: 440px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: #0b0f1a; }
.lisa-side { display: flex; flex-direction: column; gap: 22px; }

/* ------------------------------------------------------------ analyze */
.hero {
  margin: -16px 0 28px; padding: 56px 40px 88px;
  background: linear-gradient(180deg, var(--navy) 0%, #0E4A6A 45%, #0A7A63 100%);
  border-radius: var(--radius);
  position: relative; overflow: hidden;
}
.hero::before {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px) 0 0 / 48px 48px,
    linear-gradient(0deg, rgba(255,255,255,.04) 1px, transparent 1px) 0 0 / 48px 48px;
  mask-image: linear-gradient(180deg, #000, transparent 85%);
}
.hero-inner { position: relative; max-width: 1240px; margin: 0 auto; }
.hero h1 { font-size: clamp(30px, 4vw, 48px); max-width: 760px; }
.hero .lead { color: #D6E6F2; }
.analyze-grid { display: grid; grid-template-columns: 420px 1fr; gap: 20px; align-items: start; margin-top: -56px; position: relative; }
.upload-card { display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow); }
.drop {
  display: block; border: 1.5px dashed var(--line-2); border-radius: var(--radius); background: var(--bg);
  cursor: pointer; overflow: hidden; transition: border-color .15s, background .15s; min-height: 200px;
}
.drop:hover, .drop.drag { border-color: var(--orange); background: rgba(241, 91, 34, .04); }
.drop-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 36px 20px; text-align: center; color: var(--muted); font-size: 13px; }
.drop-empty svg { width: 44px; height: 44px; color: var(--dim); margin-bottom: 6px; }
.drop-empty strong { color: var(--text); font-size: 15px; }
.drop img { width: 100%; max-height: 300px; object-fit: contain; background: #000; }
.pick-map { height: 170px; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.pick-row { display: flex; justify-content: space-between; align-items: center; }
.link-btn { border: 0; background: none; color: var(--blue); font-size: 13px; cursor: pointer; padding: 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 46px; border-radius: var(--radius-sm); border: 0; font-weight: 700; font-size: 15px; cursor: pointer; transition: background .15s, transform .1s; }
.btn.primary { background: var(--orange); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--orange-2); }
.btn.primary:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn .spin { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.result-card { min-height: 460px; padding: 0; overflow: hidden; box-shadow: var(--shadow); }
.result-card .detail { padding: 24px; }
.empty-state { padding: 48px 32px; display: flex; flex-direction: column; gap: 28px; justify-content: center; min-height: 460px; }
.steps { display: flex; flex-direction: column; gap: 14px; }
.steps div { display: flex; align-items: center; gap: 14px; color: var(--text-2); font-weight: 500; }
.steps b { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--card-2); border: 1px solid var(--line-2); color: var(--muted); font-size: 13px; }
.steps div.run b { border-color: var(--orange); color: var(--orange); }
.steps div.done b { background: var(--green); border-color: var(--green); color: #fff; }
.result-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 24px; }
.result-grid .viewer { margin-top: 0; }

/* ------------------------------------------------------------ tooltip / modal */
.tooltip {
  position: fixed; z-index: 3000; pointer-events: none; opacity: 0;
  background: #0B1222; border: 1px solid var(--line-2); border-radius: 8px;
  padding: 8px 10px; font-size: 12.5px; color: var(--text-2); box-shadow: var(--shadow);
  transition: opacity .12s; max-width: 260px;
}
.tooltip b { color: #fff; }
.tooltip.show { opacity: 1; }
.leaflet-tooltip.tt { background: #0B1222; border: 1px solid var(--line-2); color: var(--text-2); border-radius: 8px; box-shadow: var(--shadow); font: 500 12.5px/1.4 var(--font); padding: 6px 9px; }
.leaflet-tooltip.tt b { color: #fff; }
.leaflet-tooltip.tt::before { display: none; }
.modal { position: fixed; inset: 0; z-index: 2500; background: rgba(2, 6, 23, .72); backdrop-filter: blur(4px); display: none; align-items: center; justify-content: center; padding: 24px; }
.modal.open { display: flex; }
.modal-card { position: relative; width: min(920px, 100%); max-height: calc(100vh - 48px); overflow: auto; background: var(--card); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--shadow); }
.modal-close { position: absolute; right: 14px; top: 14px; z-index: 2; }
.modal .result-grid { padding: 0; }

.skeleton { background: linear-gradient(90deg, var(--card-2), var(--line), var(--card-2)); background-size: 200% 100%; animation: sk 1.4s infinite; border-radius: 8px; }
@keyframes sk { to { background-position: -200% 0; } }
.err { color: #FCA5A5; font-size: 13px; }

/* ------------------------------------------------------------ capture along a line */
.capture-btn {
  position: absolute; z-index: 500; left: 16px; bottom: 26px;
  display: inline-flex; align-items: center; gap: 9px; height: 42px; padding: 0 18px 0 14px;
  border: 0; border-radius: 999px; background: var(--orange); color: #fff;
  font-weight: 700; font-size: 14px; cursor: pointer; box-shadow: var(--shadow);
  transition: background .15s, transform .1s;
}
.capture-btn:hover { background: var(--orange-2); }
.capture-btn:active { transform: translateY(1px); }
.capture-btn svg { width: 18px; height: 18px; }
body.capturing .capture-btn { display: none; }
.job-pill {
  position: absolute; z-index: 500; left: 196px; bottom: 26px; height: 42px;
  display: inline-flex; align-items: center; gap: 10px; padding: 8px 14px 8px 10px;
  border: 1px solid var(--line-2); border-radius: 999px; background: rgba(15, 23, 42, .94);
  color: var(--text); font-size: 13px; font-weight: 600; cursor: pointer; box-shadow: var(--shadow);
}
.job-pill .ring { width: 22px; height: 22px; border-radius: 50%; flex: none;
  background: conic-gradient(var(--orange) calc(var(--p, 0) * 1%), var(--line-2) 0); position: relative; }
.job-pill .ring::after { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: var(--card); }
.job-pill b { color: var(--orange); font-variant-numeric: tabular-nums; }
.job-pill.done .ring { background: var(--green); }
.job-pill.error .ring { background: #EF4444; }
.map.drawing, .map.drawing .leaflet-interactive { cursor: crosshair !important; }
.map.drawing .leaflet-overlay-pane .leaflet-interactive, .map.drawing .leaflet-marker-pane { pointer-events: none; }

.drawer.capture { z-index: 650; visibility: hidden; transition: transform .28s cubic-bezier(.2, .8, .2, 1), visibility 0s .28s; }
.drawer.capture.open { visibility: visible; transition: transform .28s cubic-bezier(.2, .8, .2, 1); }
.drawer.capture .detail { display: flex; flex-direction: column; gap: 4px; }
.drawer.capture .detail-top .hint { margin-top: 6px; font-size: 13.5px; color: var(--muted); }
#capDraw, #capPreview, #capJob { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
#capDraw[hidden], #capPreview[hidden], #capJob[hidden] { display: none; }
.cap-line { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.cap-line > div { background: var(--card-2); padding: 10px 12px; }
.cap-line span { display: block; color: var(--muted); font-size: 11.5px; font-weight: 500; }
.cap-line b { font-size: 20px; font-weight: 800; color: #fff; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.cap-line .cap-line-btns { grid-column: span 2; display: flex; gap: 18px; padding: 8px 12px; }
.link-btn:disabled { color: var(--dim); cursor: default; }
.btn.wide { width: 100%; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line-2); }
.btn.ghost:hover { background: rgba(255, 255, 255, .05); }
.btn-row { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; }
input[type="text"] { width: 100%; }

.cap-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.cap-stats > div { background: var(--card-2); padding: 12px 14px; }
.cap-stats span { display: block; color: var(--muted); font-size: 11.5px; font-weight: 500; }
.cap-stats b { font-size: 24px; font-weight: 800; color: #fff; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.cap-stats small { color: var(--dim); font-size: 12px; margin-left: 4px; }
.cap-stats .wide { grid-column: span 2; }
.cap-stats .wide b { font-size: 15px; font-weight: 700; }
.src-bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; gap: 2px; margin-top: 8px; }
.src-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--text-2); margin-top: 8px; }
.src-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.src-legend em { font-style: normal; color: var(--dim); }
.cap-strip { display: grid; grid-auto-flow: column; grid-auto-columns: 132px; gap: 8px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.cap-strip .thumb img { aspect-ratio: 16 / 10; }
.cap-strip .thumb .cap { padding: 18px 8px 6px; font-size: 11px; }
.cap-strip .thumb .cap b { font-size: 12px; font-weight: 700; }
.cap-strip .thumb .src-dot { position: absolute; top: 6px; left: 6px; width: 9px; height: 9px; border-radius: 50%; border: 2px solid rgba(2, 6, 23, .8); }
.note { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--blue-soft); color: #BFDBFE; font-size: 13px; }
.note.warn { background: var(--orange-soft); color: #FFD3C2; }

.job-steps { display: flex; flex-direction: column; gap: 4px; }
.job-step { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 12px; padding: 8px 0; color: var(--dim); font-size: 14px; font-weight: 500; }
.job-step b { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--card-2); border: 1px solid var(--line-2); font-size: 12px; color: var(--muted); }
.job-step .n { font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--muted); }
.job-step.run { color: #fff; }
.job-step.run b { border-color: var(--orange); color: var(--orange); }
.job-step.done { color: var(--text-2); }
.job-step.done b { background: var(--green); border-color: var(--green); color: #fff; }
.job-step .bar { grid-column: 2 / 4; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; margin-top: 2px; }
.job-step .bar div { height: 100%; background: var(--orange); border-radius: 3px; transition: width .4s; }
.job-msg { color: var(--muted); font-size: 12.5px; grid-column: 2 / 4; margin-top: -2px; }
.done-hero { padding: 18px; border-radius: var(--radius-sm); background: linear-gradient(135deg, var(--navy), #0A7A63); }
.done-hero h3 { font-size: 18px; }
.done-hero p { margin: 6px 0 0; color: #D6E6F2; font-size: 13.5px; }

.cap-mode { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
.cap-mode button { padding: 8px 9px; font-size: 13px; }
.fill-status { margin-top: 10px; padding: 12px; border-radius: var(--radius-sm); background: var(--card-2); border: 1px solid var(--line); font-size: 12.5px; color: var(--text-2); }
.fill-status b { color: #fff; }
.fill-status .t { display: flex; align-items: center; gap: 8px; font-weight: 700; color: #fff; font-size: 13px; }
.fill-status .t i { width: 8px; height: 8px; border-radius: 50%; background: var(--orange); animation: pulse 1.6s infinite; }
.fill-status .bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; margin: 8px 0 6px; }
.fill-status .bar div { height: 100%; background: var(--orange); border-radius: 3px; transition: width .5s; }
@keyframes pulse { 50% { opacity: .35; } }
.reading { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--card-2); border: 1px solid var(--line); color: var(--text-2); font-size: 13.5px; }
.reading .spin { width: 16px; height: 16px; border: 2px solid var(--line-2); border-top-color: var(--orange); border-radius: 50%; animation: spin .8s linear infinite; flex: none; }

/* ------------------------------------------------------------ public mode */
body.visitor .capture-btn, body.visitor .job-pill { display: none !important; }
.admin-link { position: fixed; z-index: 700; left: 12px; bottom: 4px; font-size: 11px; color: var(--dim);
  background: rgba(2, 6, 23, .7); padding: 2px 8px; border-radius: 6px; }
.admin-link:empty { display: none; }
.admin-link:hover { color: var(--text-2); text-decoration: none; }
body:not(.on-map) .admin-link { left: auto; right: 12px; bottom: 12px; }
input[type="password"] { background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 14px; color: var(--text); outline: none; }
input[type="password"]:focus { border-color: var(--blue); }

/* ------------------------------------------------------------ responsive */
@media (max-width: 1080px) {
  .card-grid.four, .moran-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .thumb-row { grid-template-columns: repeat(3, 1fr); }
  .analyze-grid { grid-template-columns: 1fr; }
  .card-grid.two { grid-template-columns: 1fr; }
  .kpi-strip { display: none; }
}
@media (max-width: 760px) {
  .topbar { gap: 12px; padding: 0 16px; }
  .nav { display: none; position: absolute; top: var(--top); left: 0; right: 0; flex-direction: column; background: var(--surface); border-bottom: 1px solid var(--line); padding: 8px 16px 14px; }
  .nav.open { display: flex; }
  .burger { display: flex; flex-direction: column; gap: 5px; border: 1px solid var(--line-2); background: var(--card); border-radius: 8px; padding: 10px 9px; cursor: pointer; }
  .burger span { width: 16px; height: 2px; background: var(--text); border-radius: 2px; }
  .brand-name { display: none; }
  .topbar-right { gap: 8px; min-width: 0; }
  .select-wrap { min-width: 0; padding: 0 8px; }
  .select-wrap svg { display: none; }
  .select-wrap select { max-width: 132px; text-overflow: ellipsis; }
  .page { padding: 28px 16px 48px; }
  .hero { margin: -8px 0 24px; padding: 36px 20px 72px; }
  .stat-grid, .card-grid.four, .moran-grid, .life-grid, .hist-grid { grid-template-columns: 1fr 1fr; }
  .result-grid, .lisa-wrap { grid-template-columns: 1fr; }
  .layers { display: none; left: 12px; right: 12px; width: auto; top: 12px; }
  .layers.open { display: block; }
  .only-mobile { display: inline-flex; }
  .fab { position: absolute; z-index: 500; left: 12px; bottom: 24px; border: 1px solid var(--line-2); background: var(--card); color: var(--text); font-weight: 600; font-size: 13px; padding: 10px 14px; border-radius: 999px; box-shadow: var(--shadow); }
  .drawer { width: 100%; }
  .stat-value { font-size: 26px; }
  .capture-btn { left: auto; right: 12px; bottom: 74px; height: 40px; }
  /* capture panel becomes a bottom sheet so the map above stays drawable */
  .drawer.capture { top: auto; height: 50%; border-left: 0; border-top: 1px solid var(--line-2);
    border-radius: 16px 16px 0 0; transform: translateY(100%); }
  .drawer.capture.open { transform: none; }
  .drawer.capture .detail { padding: 16px 16px 24px; }
  .drawer.capture h2 { font-size: 19px; }
  .job-pill { left: 12px; bottom: 72px; height: auto; }
}
