:root {
  --red: #c8102e;
  --red-dark: #a80d27;
  --red-soft: #fff2f4;
  --ink: #151719;
  --ink-soft: #4c5258;
  --muted: #7b8288;
  --line: #dde1e4;
  --line-strong: #cdd2d6;
  --panel: #ffffff;
  --canvas: #f4f5f6;
  --canvas-2: #eef0f1;
  --success: #277a46;
  --success-soft: #edf8f1;
  --warning: #9a6400;
  --warning-soft: #fff8e8;
  --danger: #a2232f;
  --shadow: 0 16px 40px rgba(19, 25, 31, 0.08);
  --shadow-soft: 0 5px 18px rgba(19, 25, 31, 0.08);
  --radius: 10px;
  --font: Inter, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: var(--font);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.hidden { display: none !important; }
.route-page { min-height: 100vh; }

/* Header */
.app-header {
  height: 64px;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  background: #fff;
  border-top: 3px solid var(--red);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 50;
}
.brand { display: flex; align-items: center; min-width: 0; }
.brand-logo-wrap {
  width: 165px;
  height: 61px;
  display: flex;
  align-items: center;
  padding: 8px 18px;
  border-right: 1px solid var(--line);
  background: #fff;
  flex: 0 0 auto;
}
.brand-logo-wrap.compact-logo { width: 148px; }
.brand-logo { width: 100%; max-height: 44px; object-fit: contain; object-position: left center; }
.brand-copy { padding: 0 18px; min-width: 0; }
.brand-title { font-size: 16px; font-weight: 750; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-subtitle { margin-top: 3px; color: var(--muted); font-size: 11px; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-actions { display: flex; align-items: center; gap: 8px; padding: 0 16px; }
.header-nav-button,
.icon-button,
.header-back-link {
  border: 1px solid var(--line);
  background: #fff;
  color: #34383c;
  text-decoration: none;
  border-radius: 7px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 13px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
  transition: border-color .16s ease, background .16s ease, color .16s ease, transform .16s ease;
}
.header-nav-button:hover, .icon-button:hover, .header-back-link:hover { border-color: #aeb4b9; background: #f8f9f9; }
.header-nav-button:active, .icon-button:active, .header-back-link:active { transform: translateY(1px); }
.header-nav-button svg { width: 18px; height: 18px; }
.header-nav-button.subtle { border-color: transparent; }
.header-nav-button.sync-button { color: var(--red); border-color: #e5c6cc; }
.header-nav-button.sync-button:hover { background: var(--red-soft); }
.header-nav-button.is-loading { pointer-events: none; opacity: .72; }
.header-nav-button.is-loading svg { animation: rotate 1s linear infinite; }
.icon-button { width: 38px; padding: 0; }
.icon-button svg { width: 18px; height: 18px; }
.header-back-link { width: 38px; min-width: 38px; margin-left: 14px; padding: 0; border-color: transparent; }
.header-back-link svg { width: 20px; height: 20px; }
.sync-indicator {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  padding: 0 4px;
}
.sync-indicator-dot { width: 8px; height: 8px; border-radius: 50%; background: #a8adb1; box-shadow: 0 0 0 3px rgba(168, 173, 177, .12); }
.sync-indicator.is-success .sync-indicator-dot { background: var(--success); box-shadow: 0 0 0 3px rgba(39, 122, 70, .12); }
.sync-indicator.is-warning .sync-indicator-dot { background: #d78b00; box-shadow: 0 0 0 3px rgba(215, 139, 0, .12); }
.sync-indicator.is-error .sync-indicator-dot { background: var(--danger); box-shadow: 0 0 0 3px rgba(162, 35, 47, .12); }
@keyframes rotate { to { transform: rotate(360deg); } }

/* Home */
.home-main { width: min(1240px, calc(100% - 56px)); margin: 0 auto; padding: 70px 0 48px; }
.home-hero { max-width: 770px; }
.eyebrow { color: var(--red); font-size: 11px; font-weight: 800; letter-spacing: .12em; margin-bottom: 11px; }
.home-hero h1, .data-hero h1 { margin: 0; font-size: clamp(30px, 4vw, 48px); line-height: 1.08; letter-spacing: -.035em; }
.home-hero p, .data-hero p { color: var(--ink-soft); font-size: 16px; line-height: 1.65; margin: 18px 0 0; }
.project-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-top: 44px; }
.project-card {
  position: relative;
  min-height: 330px;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px;
  box-shadow: 0 8px 24px rgba(17, 24, 31, .045);
  overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.project-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--red); opacity: .95; }
.project-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: #cbd0d4; }
.project-card-icon { width: 58px; height: 58px; border-radius: 14px; display: grid; place-items: center; color: var(--red); background: var(--red-soft); margin-bottom: 24px; }
.project-card-icon svg { width: 31px; height: 31px; stroke-width: 1.55; }
.project-card h2 { margin: 0; font-size: 23px; letter-spacing: -.02em; }
.project-card-subtitle { color: var(--red); font-size: 12px; font-weight: 750; margin-top: 8px; }
.project-card-description { color: var(--ink-soft); line-height: 1.58; margin: 16px 0 22px; flex: 1; }
.project-card-state { display: flex; gap: 9px; align-items: center; color: var(--muted); font-size: 11px; min-height: 28px; padding-top: 14px; border-top: 1px solid #edf0f1; }
.project-card-state-dot { width: 8px; height: 8px; border-radius: 50%; background: #a9afb4; flex: 0 0 auto; }
.project-card-state.is-ready .project-card-state-dot { background: var(--success); }
.project-card-actions { display: grid; grid-template-columns: 1fr auto; gap: 9px; margin-top: 18px; }
.project-open-button, .project-settings-button {
  border: 0;
  border-radius: 7px;
  min-height: 43px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
  font-size: 12px;
  text-decoration: none;
  cursor: pointer;
}
.project-open-button { color: #fff; background: var(--red); padding: 0 18px; }
.project-open-button:hover { background: var(--red-dark); }
.project-settings-button { width: 43px; color: #4a4f54; background: #f2f4f5; border: 1px solid var(--line); }
.project-settings-button:hover { background: #e9edef; }
.project-settings-button svg { width: 18px; height: 18px; }
.home-info-panel { margin-top: 28px; display: flex; gap: 17px; align-items: flex-start; padding: 21px 24px; background: #fff; border: 1px solid var(--line); border-radius: 11px; }
.home-info-icon { width: 42px; height: 42px; border-radius: 9px; display: grid; place-items: center; color: var(--red); background: var(--red-soft); flex: 0 0 auto; }
.home-info-icon svg { width: 23px; height: 23px; }
.home-info-panel strong { display: block; margin-bottom: 5px; }
.home-info-panel span { color: var(--ink-soft); line-height: 1.55; }
.app-footer { display: flex; justify-content: space-between; gap: 20px; width: min(1240px, calc(100% - 56px)); margin: 0 auto; padding: 20px 0 28px; color: var(--muted); font-size: 11px; border-top: 1px solid var(--line); }

/* Map app */
.map-app-main { height: calc(100vh - 64px); min-height: 580px; display: grid; grid-template-columns: 286px minmax(420px, 1fr) 350px; overflow: hidden; }
.sidebar { background: #fff; border-right: 1px solid var(--line); overflow-y: auto; overscroll-behavior: contain; }
.sidebar-data-note { padding: 16px 17px 14px; border-bottom: 1px solid var(--line); background: #fbfcfc; }
.sidebar-data-note-label { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; margin-bottom: 8px; }
.sidebar-data-note-row { display: flex; align-items: flex-start; gap: 10px; }
.sidebar-data-note-copy { min-width: 0; flex: 1; }
.sidebar-data-note-copy strong, .sidebar-data-note-copy span { display: block; }
.sidebar-data-note-copy strong { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-data-note-copy span { color: var(--muted); font-size: 10px; line-height: 1.4; margin-top: 3px; }
.sidebar-data-note-copy .sidebar-sync-state { color: var(--success); }
.sidebar-data-note-link { color: var(--red); font-size: 10px; text-decoration: none; font-weight: 750; padding-top: 1px; }
.sidebar-section { padding: 15px 17px; border-bottom: 1px solid #edf0f1; }
.sidebar-section.compact { padding-top: 13px; padding-bottom: 13px; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.stat-item { min-width: 0; }
.stat-item strong { display: block; font-size: 18px; letter-spacing: -.02em; }
.stat-item span { color: var(--muted); font-size: 8px; letter-spacing: .08em; text-transform: uppercase; display: block; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-field { position: relative; }
.search-field svg { width: 16px; height: 16px; position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: #8a9095; }
.search-field input { width: 100%; height: 39px; border: 1px solid var(--line); border-radius: 6px; padding: 0 11px 0 36px; outline: none; background: #f8f9f9; color: var(--ink); font-size: 12px; }
.search-field input:focus { border-color: #b9bdc1; background: #fff; box-shadow: 0 0 0 3px rgba(200, 16, 46, .07); }
.search-control-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 9px; margin-top: 8px; }
.reset-button { border: 0; background: none; color: var(--red); padding: 0; font-size: 9px; font-weight: 700; cursor: pointer; }
.reset-button:disabled { color: #b8bdc1; cursor: default; }
.dynamic-filter { padding: 15px 17px; border-bottom: 1px solid #edf0f1; }
.filter-label { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.filter-label span { font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #6c7277; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.filter-chip {
  min-height: 27px;
  border: 1px solid var(--line);
  background: #fff;
  color: #464b50;
  border-radius: 999px;
  padding: 4px 9px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  font-size: 10px;
  line-height: 1.2;
}
.filter-chip:hover { border-color: #abb1b6; }
.filter-chip.is-active { border-color: var(--red); background: var(--red-soft); color: var(--red); }
.filter-chip-count { color: #969ca1; font-size: 9px; }
.filter-chip.is-active .filter-chip-count { color: var(--red); }
.filter-more-button { margin-top: 9px; border: 0; background: none; padding: 0; color: var(--red); font-size: 10px; font-weight: 700; cursor: pointer; }
.search-filter-empty { margin: 15px 17px; padding: 13px; border: 1px dashed var(--line-strong); border-radius: 7px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.search-filter-empty a { color: var(--red); }
.range-values { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 7px; margin-bottom: 9px; }
.range-value-box { min-width: 0; border: 1px solid var(--line); border-radius: 5px; background: #fafbfb; padding: 6px 8px; }
.range-value-label { display: block; color: var(--muted); font-size: 7px; text-transform: uppercase; letter-spacing: .08em; }
.range-value-box output { display: block; font-size: 11px; font-weight: 700; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.range-separator { color: var(--muted); }
.dual-range { position: relative; height: 26px; margin: 0 3px; }
.dual-range-track, .dual-range-selection { position: absolute; top: 11px; height: 4px; border-radius: 99px; }
.dual-range-track { left: 0; right: 0; background: #dfe3e6; }
.dual-range-selection { left: 0; right: 0; background: var(--red); }
.range-input { position: absolute; inset: 0; width: 100%; height: 26px; margin: 0; background: transparent; pointer-events: none; appearance: none; -webkit-appearance: none; }
.range-input::-webkit-slider-runnable-track { height: 4px; background: transparent; }
.range-input::-webkit-slider-thumb { width: 16px; height: 16px; margin-top: -6px; border: 2px solid #fff; border-radius: 50%; background: var(--red); box-shadow: 0 1px 5px rgba(0,0,0,.22); pointer-events: auto; appearance: none; -webkit-appearance: none; cursor: grab; }
.range-input::-moz-range-track { height: 4px; background: transparent; }
.range-input::-moz-range-thumb { width: 13px; height: 13px; border: 2px solid #fff; border-radius: 50%; background: var(--red); box-shadow: 0 1px 5px rgba(0,0,0,.22); pointer-events: auto; cursor: grab; }
.range-min { z-index: 3; }
.range-max { z-index: 4; }
.range-scale { display: flex; justify-content: space-between; color: #a0a5a9; font-size: 8px; }
.range-empty { color: var(--muted); font-size: 10px; }

.map-container { min-width: 0; min-height: 0; background: #edf1ef; position: relative; }
.online-map-shell, .online-map { width: 100%; height: 100%; }
.online-map-shell { position: relative; overflow: hidden; }
.online-map { background: #edf1ef; }

.map-view-control {
  position: absolute;
  right: 14px;
  top: 14px;
  z-index: 10;
  width: 188px;
  padding: 5px;
  border: 1px solid #cbd0d4;
  border-radius: 8px;
  background: rgba(255,255,255,.96);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(5px);
}
.map-view-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.map-view-button {
  min-height: 32px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #51575c;
  font: inherit;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}
.map-view-button:hover { background: #f0f2f3; color: var(--ink); }
.map-view-button.is-active { background: #1f2326; color: #fff; }
.map-view-button:disabled { opacity: .55; cursor: wait; }
.map-layer-option {
  position: relative;
  min-height: 31px;
  margin-top: 4px;
  padding: 0 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid #e3e6e8;
  color: #41474c;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}
.map-layer-option input { position: absolute; opacity: 0; pointer-events: none; }
.map-layer-check {
  width: 15px;
  height: 15px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid #b7bdc2;
  border-radius: 4px;
  background: #fff;
}
.map-highway-option input:checked + .map-layer-check { border-color: var(--red); background: var(--red); }
.map-layer-option input:checked + .map-layer-check::after {
  content: "";
  width: 7px;
  height: 4px;
  margin-top: -2px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg);
}
.map-layer-option input:focus-visible + .map-layer-check { outline: 2px solid rgba(31,35,38,.25); outline-offset: 2px; }
.map-layer-option.is-unavailable { opacity: .52; cursor: not-allowed; }
.map-transit-option input:checked + .map-layer-check { border-color: #1261a0; background: #1261a0; }
.online-map-fit-button { position: absolute; right: 14px; top: 140px; width: 37px; height: 37px; display: grid; place-items: center; border: 1px solid #cbd0d4; border-radius: 7px; background: #fff; color: #3b4146; box-shadow: var(--shadow-soft); cursor: pointer; z-index: 8; }
.online-map-fit-button svg { width: 18px; height: 18px; }
.online-map-badge { position: absolute; left: 13px; bottom: 12px; z-index: 8; display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border-radius: 6px; background: rgba(255,255,255,.94); box-shadow: var(--shadow-soft); color: #51575c; font-size: 9px; }
.online-map-badge-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
.online-map-badge.is-loading .online-map-badge-dot { background: #d78b00; }
.online-map-badge.is-error .online-map-badge-dot { background: var(--danger); }
.online-map-status { position: absolute; inset: 0; z-index: 7; display: flex; align-items: center; justify-content: center; flex-direction: column; text-align: center; gap: 11px; padding: 32px; background: rgba(242, 245, 244, .91); }
.online-map-status.is-ready { display: none; }
.online-map-status-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; background: #fff; color: var(--red); box-shadow: var(--shadow-soft); }
.online-map-status-icon svg { width: 25px; height: 25px; }
.online-map-status-copy strong, .online-map-status-copy span { display: block; }
.online-map-status-copy strong { font-size: 14px; }
.online-map-status-copy span { color: var(--muted); font-size: 11px; margin-top: 5px; }
.online-map-retry { border: 0; border-radius: 6px; background: var(--red); color: #fff; min-height: 35px; padding: 0 14px; font-weight: 700; cursor: pointer; }
.map-message { position: absolute; left: 50%; top: 78px; transform: translate(-50%, -10px); opacity: 0; pointer-events: none; z-index: 20; background: #202326; color: #fff; border-radius: 6px; padding: 10px 14px; box-shadow: var(--shadow); font-size: 11px; transition: opacity .2s ease, transform .2s ease; }
.map-message.is-visible { opacity: 1; transform: translate(-50%, 0); }

.iul-marker { width: 32px; height: 40px; position: relative; cursor: pointer; filter: drop-shadow(0 4px 4px rgba(0,0,0,.18)); }
.iul-marker-pin { position: absolute; left: 4px; top: 2px; width: 25px; height: 25px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--marker-color, #16191b); border: 2px solid #fff; }
.iul-marker-core { position: absolute; left: 10px; top: 8px; width: 13px; height: 13px; border-radius: 50%; background: #fff; display: grid; place-items: center; color: var(--marker-color, #16191b); font-size: 8px; font-weight: 900; }
.iul-marker-star { position: absolute; right: -4px; top: -5px; width: 16px; height: 16px; display: grid; place-items: center; border-radius: 50%; background: var(--red); color: #fff; border: 1px solid #fff; font-size: 10px; line-height: 1; }
.iul-marker.is-selected { transform: scale(1.18); z-index: 10; }
.iul-marker.is-selected .iul-marker-pin { box-shadow: 0 0 0 3px rgba(200,16,46,.28); }

.listpanel { min-width: 0; background: #fff; border-left: 1px solid var(--line); display: flex; flex-direction: column; overflow: hidden; }
.listpanel-header { min-height: 64px; padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.listpanel-title { font-weight: 800; font-size: 13px; }
.listpanel-subtitle { color: var(--muted); font-size: 9px; margin-top: 3px; }
.listpanel-count { color: var(--muted); font-size: 10px; white-space: nowrap; }
.listpanel-count span { color: var(--ink); font-weight: 800; }
.list-view, .detail-view { flex: 1; min-height: 0; overflow-y: auto; }
.list { list-style: none; margin: 0; padding: 0; }
.list-item { position: relative; border-bottom: 1px solid #edf0f1; display: grid; grid-template-columns: 25px 1fr; gap: 8px; padding: 15px 15px 14px 13px; cursor: pointer; transition: background .14s ease; }
.list-item:hover { background: #fafbfb; }
.list-item.is-selected { background: var(--red-soft); }
.list-item-check { display: flex; justify-content: center; padding-top: 2px; }
.object-checkbox { width: 15px; height: 15px; accent-color: var(--red); cursor: pointer; }
.list-item-main { min-width: 0; }
.list-item-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.list-item-title { font-size: 12px; font-weight: 800; line-height: 1.35; }
.list-item-star { color: var(--red); font-size: 15px; line-height: 1; }
.list-item-fields { margin-top: 8px; display: grid; gap: 5px; }
.list-field { display: grid; grid-template-columns: minmax(72px, .8fr) minmax(0, 1.4fr); gap: 8px; font-size: 9px; line-height: 1.35; }
.list-field-label { color: #a0a5a9; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-field-value { color: #555b60; text-align: right; overflow-wrap: anywhere; }
.empty-list { padding: 40px 22px; text-align: center; color: var(--muted); }
.empty-list strong, .empty-list span { display: block; }
.empty-list strong { color: var(--ink); margin-bottom: 6px; }
.detail-header { padding: 16px; border-bottom: 1px solid var(--line); }
.detail-back { border: 0; background: none; padding: 0; color: var(--red); font-size: 10px; font-weight: 750; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.detail-title { margin: 13px 0 0; font-size: 19px; line-height: 1.25; }
.detail-body { padding: 16px; }
.detail-field { padding: 10px 0; border-bottom: 1px solid #edf0f1; }
.detail-field:last-child { border-bottom: 0; }
.detail-field-label { color: var(--muted); font-size: 8px; text-transform: uppercase; letter-spacing: .08em; font-weight: 750; }
.detail-field-value { margin-top: 4px; color: #353a3e; font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; }
.selection-panel { border-top: 1px solid var(--line); padding: 12px 14px 14px; background: #fbfcfc; }
.selection-panel-summary { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.selection-panel-summary div { display: flex; gap: 5px; align-items: baseline; }
.selection-panel-summary strong { font-size: 14px; }
.selection-panel-summary span { color: var(--muted); font-size: 9px; }
.selection-clear { border: 0; background: none; color: var(--red); font-size: 9px; font-weight: 700; cursor: pointer; }
.primary-button, .secondary-button, .small-button {
  border-radius: 6px;
  min-height: 39px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 750;
  transition: background .15s ease, border-color .15s ease, opacity .15s ease;
}
.primary-button { color: #fff; background: var(--red); border: 1px solid var(--red); }
.primary-button:hover { background: var(--red-dark); border-color: var(--red-dark); }
.primary-button:disabled { opacity: .42; cursor: default; }
.secondary-button { color: #34393d; background: #fff; border: 1px solid var(--line-strong); }
.secondary-button:hover { border-color: #aab0b5; background: #fafbfb; }
.small-button { min-height: 31px; padding: 0 10px; font-size: 9px; color: #4d5358; background: #fff; border: 1px solid var(--line); }
.selection-send { width: 100%; }

/* Data & display */
.data-main { width: min(1240px, calc(100% - 56px)); margin: 0 auto; padding: 42px 0 118px; }
.data-hero { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 44px; align-items: end; }
.data-hero h1 { font-size: clamp(28px, 3.3vw, 42px); }
.data-hero p { font-size: 14px; max-width: 840px; }
.data-project-picker { padding: 17px 18px; background: #fff; border: 1px solid var(--line); border-radius: 9px; }
.data-project-picker label { display: block; color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 7px; }
.data-project-picker select { width: 100%; height: 39px; border: 1px solid var(--line); border-radius: 6px; background: #fff; padding: 0 10px; font-weight: 700; color: var(--ink); }
.server-panel { display: grid; grid-template-columns: 1fr minmax(340px, 1.3fr) auto; gap: 18px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 15px 17px; margin-top: 28px; }
.server-state strong, .server-state span { display: block; }
.server-state strong { font-size: 11px; }
.server-state span { color: var(--success); font-size: 9px; margin-top: 4px; }
.server-state.is-error span { color: var(--danger); }
.server-paths { display: grid; gap: 5px; color: var(--muted); font-size: 9px; padding: 9px 12px; border: 1px solid #e5e8ea; border-radius: 6px; background: #fafbfb; overflow: hidden; }
.server-paths span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.server-paths strong { color: #5a6065; }
.notice-panel { display: flex; gap: 12px; align-items: flex-start; margin: 14px 0 20px; padding: 14px 16px; border: 1px solid #e5c77e; border-radius: 8px; background: var(--warning-soft); color: #72511a; }
.notice-panel svg { width: 19px; height: 19px; flex: 0 0 auto; margin-top: 1px; }
.notice-panel strong, .notice-panel span { display: block; }
.notice-panel strong { font-size: 10px; }
.notice-panel span { font-size: 9px; line-height: 1.5; margin-top: 3px; }
.settings-card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 24px; margin-top: 16px; box-shadow: 0 4px 15px rgba(18, 24, 30, .025); }
.step-heading { display: grid; grid-template-columns: 32px 1fr; gap: 13px; align-items: start; margin-bottom: 22px; }
.step-heading.with-actions { grid-template-columns: 32px minmax(0, 1fr) auto; }
.step-number { width: 29px; height: 29px; border-radius: 50%; display: grid; place-items: center; background: #17191b; color: #fff; font-size: 11px; font-weight: 800; }
.step-heading h2 { margin: 1px 0 0; font-size: 18px; letter-spacing: -.015em; }
.step-heading p { margin: 5px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.step-actions { display: flex; flex-wrap: wrap; gap: 7px; justify-content: flex-end; }
.source-actions-row { display: flex; align-items: center; gap: 14px; padding: 0 0 16px 45px; }
.primary-button.is-inline svg { width: 17px; height: 17px; }
.source-meta { color: var(--muted); font-size: 10px; }
.upload-dropzone { margin-left: 45px; min-height: 82px; border: 1px dashed #bfc5ca; border-radius: 8px; background: #fafbfb; display: flex; align-items: center; justify-content: center; gap: 14px; cursor: pointer; text-align: left; transition: border-color .15s ease, background .15s ease; }
.upload-dropzone:hover, .upload-dropzone.is-dragging { border-color: var(--red); background: var(--red-soft); }
.upload-icon { width: 39px; height: 39px; border-radius: 9px; display: grid; place-items: center; color: var(--red); background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.upload-icon svg { width: 21px; height: 21px; }
.upload-dropzone strong, .upload-dropzone small { display: block; }
.upload-dropzone strong { font-size: 11px; }
.upload-dropzone small { color: var(--muted); margin-top: 4px; font-size: 9px; }
.upload-status { margin: 8px 0 0 45px; color: var(--muted); font-size: 9px; }
.upload-status.is-success { color: var(--success); }
.upload-status.is-error { color: var(--danger); }
.source-settings-grid { margin: 19px 0 0 45px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.form-field { display: block; min-width: 0; }
.form-field > span { display: block; font-size: 9px; font-weight: 750; color: #565c61; margin-bottom: 6px; }
.form-field select, .form-field input { width: 100%; height: 39px; border: 1px solid var(--line); border-radius: 6px; background: #fff; padding: 0 10px; color: var(--ink); outline: none; }
.form-field select:focus, .form-field input:focus { border-color: #aeb4b9; box-shadow: 0 0 0 3px rgba(200,16,46,.06); }
.form-field select:disabled, .form-field input:disabled { color: #a2a7ab; background: #f5f6f6; }
.form-field small { display: block; color: #9aa0a5; font-size: 8px; line-height: 1.4; margin-top: 5px; }
.dataset-summary { margin: 17px 0 0 45px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.dataset-summary-item { padding: 12px 13px; border: 1px solid #e7eaec; border-radius: 7px; background: #fafbfb; min-width: 0; }
.dataset-summary-item strong { display: block; font-size: 15px; }
.dataset-summary-item span { display: block; color: var(--muted); font-size: 8px; text-transform: uppercase; letter-spacing: .07em; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mapping-grid { margin-left: 45px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.mapping-item { display: grid; grid-template-columns: minmax(130px, .8fr) minmax(160px, 1.2fr); gap: 12px; align-items: center; padding: 10px 11px; border: 1px solid #e6e9eb; border-radius: 7px; background: #fcfcfc; }
.mapping-item-label strong, .mapping-item-label span { display: block; }
.mapping-item-label strong { font-size: 10px; }
.mapping-item-label span { color: #9aa0a5; font-size: 8px; margin-top: 3px; line-height: 1.35; }
.mapping-item select { width: 100%; height: 36px; border: 1px solid var(--line); border-radius: 6px; background: #fff; padding: 0 9px; font-size: 10px; }
.marker-rule-grid { margin: 16px 0 0 45px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding-top: 16px; border-top: 1px solid #edf0f1; }
.field-table-wrap { margin-left: 45px; border: 1px solid #e3e6e8; border-radius: 8px; overflow: hidden; }
.field-table-header, .field-selection-row { display: grid; grid-template-columns: minmax(260px, 2fr) 90px 90px 180px 110px; align-items: center; }
.field-table-header { min-height: 39px; background: #f3f5f5; color: #777e83; font-size: 8px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.field-table-header span { padding: 0 12px; }
.field-table-header span:not(:first-child) { text-align: center; }
.field-selection-row { min-height: 62px; border-top: 1px solid #edf0f1; background: #fff; }
.field-selection-row:first-child { border-top: 0; }
.field-selection-row:hover { background: #fcfcfc; }
.field-name-cell { padding: 8px 12px; min-width: 0; }
.field-name-cell strong { display: block; font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.field-name-cell input { width: 100%; height: 27px; border: 1px solid transparent; border-radius: 4px; padding: 0 7px; margin-top: 4px; color: #687076; font-size: 9px; background: #f5f6f6; }
.field-name-cell input:focus { background: #fff; border-color: var(--line-strong); outline: none; }
.field-check-cell { display: grid; place-items: center; }
.field-check-cell input { width: 16px; height: 16px; accent-color: var(--red); }
.field-filter-cell { padding: 0 9px; }
.field-filter-cell select { width: 100%; height: 33px; border: 1px solid var(--line); border-radius: 5px; background: #fff; padding: 0 8px; font-size: 9px; }
.split-cell { display: grid; place-items: center; }
.split-cell label { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 8px; }
.split-cell input { accent-color: var(--red); }
.preview-grid { margin-left: 45px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.preview-card { min-height: 195px; border: 1px solid #e3e6e8; border-radius: 8px; background: #fbfcfc; padding: 14px; }
.preview-card-label { color: var(--muted); font-size: 8px; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; margin-bottom: 12px; }
.preview-object { border: 1px solid var(--line); border-radius: 7px; background: #fff; padding: 12px; }
.preview-object-title { font-size: 11px; font-weight: 800; line-height: 1.35; }
.preview-row { display: grid; grid-template-columns: minmax(80px, .9fr) minmax(0, 1.2fr); gap: 8px; font-size: 9px; margin-top: 8px; }
.preview-row span:first-child { color: var(--muted); }
.preview-row span:last-child { text-align: right; overflow-wrap: anywhere; }
.preview-filter { display: flex; justify-content: space-between; gap: 9px; align-items: center; padding: 9px 0; border-bottom: 1px solid #e8ebed; font-size: 9px; }
.preview-filter:last-child { border-bottom: 0; }
.preview-filter-type { color: var(--red); font-weight: 700; }
.preview-empty { color: var(--muted); font-size: 9px; line-height: 1.5; }
.data-savebar { position: fixed; left: 0; right: 0; bottom: 0; min-height: 70px; z-index: 70; background: rgba(255,255,255,.97); border-top: 1px solid var(--line); box-shadow: 0 -8px 24px rgba(18,24,30,.07); display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 11px max(28px, calc((100vw - 1240px) / 2)); }
.data-savebar > div:first-child { min-width: 0; }
.data-savebar strong, .data-savebar span { display: block; }
.data-savebar strong { font-size: 11px; }
.data-savebar span { color: var(--muted); font-size: 9px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.data-savebar-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.toast { position: fixed; left: 50%; bottom: 88px; transform: translate(-50%, 10px); z-index: 100; padding: 11px 15px; background: #1d2022; color: #fff; border-radius: 7px; box-shadow: var(--shadow); font-size: 11px; opacity: 0; pointer-events: none; transition: opacity .18s ease, transform .18s ease; max-width: min(540px, calc(100vw - 40px)); text-align: center; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { background: var(--danger); }
.toast.is-success { background: var(--success); }

/* MapLibre controls */
.maplibregl-ctrl-top-left { top: 10px; left: 10px; }
.maplibregl-ctrl-group { border-radius: 7px !important; box-shadow: var(--shadow-soft) !important; overflow: hidden; }
.maplibregl-popup-content { border-radius: 7px !important; padding: 10px 12px !important; font-family: var(--font) !important; font-size: 11px !important; }

@media (max-width: 1180px) {
  .map-app-main { grid-template-columns: 260px minmax(360px, 1fr) 320px; }
  .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field-table-header, .field-selection-row { grid-template-columns: minmax(230px, 2fr) 78px 78px 160px 96px; }
  .header-actions .sync-indicator { display: none; }
}

@media (max-width: 980px) {
  .app-header { height: auto; min-height: 64px; flex-wrap: wrap; }
  .header-actions { padding: 8px 12px; }
  .map-app-main { height: auto; min-height: calc(100vh - 64px); grid-template-columns: 260px 1fr; grid-template-rows: minmax(560px, 68vh) minmax(360px, auto); overflow: visible; }
  .listpanel { grid-column: 1 / -1; min-height: 420px; border-left: 0; border-top: 1px solid var(--line); }
  .sidebar { grid-row: 1; }
  .map-container { grid-row: 1; }
  .home-main, .data-main { width: min(100% - 34px, 1240px); }
  .data-hero { grid-template-columns: 1fr; gap: 22px; }
  .server-panel { grid-template-columns: 1fr; }
  .mapping-grid { grid-template-columns: 1fr; }
  .preview-grid { grid-template-columns: 1fr; }
  .source-settings-grid { grid-template-columns: 1fr; }
  .field-table-wrap { overflow-x: auto; }
  .field-table-header, .field-selection-row { min-width: 780px; }
  .data-savebar { position: static; flex-direction: column; align-items: stretch; padding: 15px 17px; }
  .data-savebar-actions { flex-wrap: wrap; }
  .data-main { padding-bottom: 42px; }
}

@media (max-width: 720px) {
  .brand-logo-wrap { width: 126px; padding-left: 11px; padding-right: 11px; }
  .brand-logo-wrap.compact-logo { display: none; }
  .brand-copy { padding: 0 11px; }
  .brand-subtitle { display: none; }
  .header-nav-button span { display: none; }
  .header-nav-button { width: 38px; padding: 0; }
  .project-grid { grid-template-columns: 1fr; }
  .home-main { padding-top: 42px; }
  .home-hero h1 { font-size: 34px; }
  .project-card { min-height: 285px; }
  .map-app-main { display: block; height: auto; }
  .sidebar { max-height: none; border-right: 0; }
  .map-container { height: 58vh; min-height: 430px; }
  .map-view-control { right: 10px; top: 10px; width: 170px; }
  .online-map-fit-button { right: 10px; top: 101px; }
  .listpanel { min-height: 470px; }
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .data-main { width: calc(100% - 24px); }
  .settings-card { padding: 18px 13px; }
  .step-heading, .step-heading.with-actions { grid-template-columns: 30px 1fr; }
  .step-actions { grid-column: 2; justify-content: flex-start; }
  .source-actions-row, .upload-dropzone, .upload-status, .source-settings-grid, .dataset-summary, .mapping-grid, .marker-rule-grid, .field-table-wrap, .preview-grid { margin-left: 0; }
  .source-actions-row { align-items: flex-start; flex-direction: column; }
  .dataset-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .marker-rule-grid { grid-template-columns: 1fr; }
  .app-footer { width: calc(100% - 34px); flex-direction: column; }
  .data-savebar-actions { display: grid; grid-template-columns: 1fr; }
}
