:root {
  --bg: #f4f5f3;
  --surface: #ffffff;
  --surface-soft: #f7f8f6;
  --text: #1b211d;
  --muted: #68716b;
  --border: #dfe3df;
  --border-strong: #cbd1cc;
  --primary: #1f5b45;
  --primary-hover: #194a38;
  --primary-soft: #e4eee9;
  --danger: #b42318;
  --focus: #2d7b5e;
  --shadow: 0 8px 24px rgba(26, 34, 29, .12);
  font-family: Inter, "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body { min-width: 280px; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(45,123,94,.25); outline-offset: 1px; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.app-shell { height: 100%; display: grid; grid-template-rows: 58px 1fr; }

.topbar { z-index: 1002; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; background: rgba(255,255,255,.97); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; min-width: 0; gap: 10px; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; flex: none; border-radius: 7px; color: white; background: var(--primary); }
.brand-mark svg { width: 19px; height: 19px; }
.brand div { display: grid; gap: 1px; }
.brand strong { font-size: 15px; font-weight: 650; letter-spacing: 0; }
.brand span { font-size: 11px; color: var(--muted); }
.brand > div > span { display: flex; align-items: center; gap: 5px; }
.cloud-state-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--border-strong); }
.brand.is-cloud-synced .cloud-state-dot { background: #2f8f68; }
.brand.is-cloud-readonly .cloud-state-dot { background: #c89412; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.route-count { margin-right: 6px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.route-count b { color: var(--text); font-size: 15px; }
.language-switch { height: 30px; display: grid; grid-template-columns: 30px 36px; align-items: center; padding: 2px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface-soft); }
.language-switch button { height: 24px; padding: 0; border: 0; border-radius: 4px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 700; }
.language-switch button.is-active { background: var(--primary); color: white; }

.button, .icon-button, .text-button { border: 0; background: none; color: inherit; }
.button { height: 34px; padding: 0 12px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-size: 13px; font-weight: 600; white-space: nowrap; transition: background .15s, border-color .15s, color .15s; }
.button svg { width: 15px; height: 15px; }
.button.primary { background: var(--primary); color: white; }
.button.primary:hover { background: var(--primary-hover); }
.button.secondary { background: var(--surface); border: 1px solid var(--border-strong); }
.button.secondary:hover, .button.ghost:hover { background: var(--surface-soft); }
.button.ghost { color: var(--muted); }
.button.compact { height: 30px; padding: 0 9px; }
.icon-button { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 6px; color: var(--muted); }
.icon-button:hover { background: var(--surface-soft); color: var(--text); }
.icon-button svg { width: 16px; height: 16px; }
.text-button { padding: 3px 0; font-size: 12px; color: var(--primary); font-weight: 600; }

.workspace { min-height: 0; display: grid; grid-template-columns: 350px minmax(0, 1fr); }
.sidebar { z-index: 900; min-height: 0; overflow-y: auto; background: var(--surface); border-right: 1px solid var(--border); }
.tabs { position: sticky; top: 0; z-index: 3; display: grid; grid-template-columns: repeat(3, 1fr); padding: 8px 14px 0; background: var(--surface); border-bottom: 1px solid var(--border); }
.tab { min-height: 40px; display: flex; align-items: center; justify-content: center; gap: 7px; color: var(--muted); background: none; border: 0; border-bottom: 2px solid transparent; font-size: 13px; font-weight: 600; }
.tab svg { width: 15px; height: 15px; }
.tab.is-active { color: var(--primary); border-bottom-color: var(--primary); }
.panel { display: none; padding: 18px 16px 24px; }
.panel.is-active { display: block; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.compact-heading { margin-bottom: 12px; }
.eyebrow { display: block; margin-bottom: 4px; color: var(--muted); font-size: 11px; font-weight: 650; text-transform: uppercase; }
h2 { margin: 0; font-size: 16px; font-weight: 650; }
.hub-summary { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; color: var(--muted); font-size: 12px; }
.hub-summary > span { display: flex; align-items: center; gap: 5px; }
.hub-summary svg { width: 13px; height: 13px; }
.divider { height: 1px; margin: 18px -16px; background: var(--border); }

.editor-form { margin-top: 14px; padding: 14px; background: var(--surface-soft); border: 1px solid var(--border); border-radius: 7px; }
.field-grid { display: grid; gap: 10px; }
.field-grid.two { grid-template-columns: 1fr 1fr; }
.classification-grid { margin-top: 10px; }
.classification-grid label:last-child { grid-column: 1 / -1; }
label { display: grid; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 600; }
input, select, textarea { width: 100%; border: 1px solid var(--border-strong); border-radius: 5px; background: var(--surface); color: var(--text); font-size: 13px; }
input, select { height: 34px; padding: 0 9px; }
textarea { padding: 10px; resize: vertical; line-height: 1.6; }
select { padding-right: 28px; }
.form-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 12px; }
.map-pick-row { min-height: 28px; margin-top: 6px; display: flex; align-items: center; gap: 8px; }
#pickHint { color: var(--primary); font-size: 11px; }
.search-row { position: relative; margin-bottom: 8px; }
.search-row svg { position: absolute; left: 10px; top: 9px; width: 15px; height: 15px; color: var(--muted); pointer-events: none; }
.search-row input { padding-left: 33px; background: var(--surface-soft); border-color: transparent; }

.airport-overview-heading { margin-bottom: 4px; }
.airport-overview { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--border); }
.airport-overview > div { min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 8px; border-bottom: 1px solid var(--border); }
.airport-overview > div:nth-child(odd) { border-right: 1px solid var(--border); }
.airport-overview span { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; }
.airport-overview strong { color: var(--text); font-size: 15px; font-variant-numeric: tabular-nums; }
.overview-dot { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: var(--swatch, #64748b); }
.overview-dot.all { border: 2px solid var(--muted); background: transparent; }
.class-style-editor { margin-top: 10px; border-top: 1px solid var(--border); }
.class-style-row { padding: 10px 0; border-bottom: 1px solid var(--border); }
.class-style-heading { min-height: 24px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.class-style-heading > span { display: flex; align-items: center; gap: 7px; font-size: 12px; }
.class-style-heading small { color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.class-style-controls { display: grid; grid-template-columns: 64px minmax(116px, 1fr) minmax(108px, .9fr); gap: 7px; margin-top: 7px; }
.class-style-controls label { min-width: 0; display: grid; grid-template-columns: auto auto; align-items: center; justify-content: space-between; gap: 4px; color: var(--muted); font-size: 10px; }
.class-style-controls label:nth-child(2) { grid-template-columns: auto 42px; }
.class-style-controls label:nth-child(2) input { grid-column: 1 / -1; width: 100%; }
.class-style-controls output { color: var(--text); font-size: 10px; text-align: right; font-variant-numeric: tabular-nums; }
.class-style-controls input[type="color"] { justify-self: end; }
.class-style-controls select { width: 100%; min-width: 0; height: 30px; padding: 0 22px 0 7px; grid-column: 1 / -1; font-size: 10px; }

.route-list { display: grid; gap: 2px; }
.route-row { min-height: 51px; display: grid; grid-template-columns: 18px 8px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 7px 5px; border-bottom: 1px solid #eef0ee; }
.route-row:hover { background: var(--surface-soft); }
.route-row.is-selected { background: var(--primary-soft); }
.route-select { width: 15px; height: 15px; padding: 0; accent-color: var(--primary); }
.route-dot { width: 7px; height: 7px; border-radius: 50%; }
.route-main { min-width: 0; cursor: pointer; }
.route-main strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 600; }
.route-main span { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.route-actions { display: flex; opacity: 0; transition: opacity .15s; }
.route-row:hover .route-actions, .route-row:focus-within .route-actions { opacity: 1; }
.route-actions button { width: 28px; height: 28px; display: grid; place-items: center; border: 0; background: none; border-radius: 5px; color: var(--muted); }
.route-actions button:hover { background: var(--surface); color: var(--text); }
.route-actions button[data-action="delete"]:hover { color: var(--danger); }
.route-actions svg { width: 14px; height: 14px; }
.empty-state { padding: 34px 8px; text-align: center; color: var(--muted); font-size: 13px; }
.batch-route-bar { min-height: 38px; display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin: -2px 0 6px; padding-bottom: 7px; border-bottom: 1px solid var(--border); color: var(--muted); font-size: 11px; }
.batch-route-bar > span { margin-right: auto; }
.batch-route-bar b { color: var(--text); }
.batch-route-bar .text-button:disabled { opacity: .42; cursor: not-allowed; }
.danger-button { color: var(--danger); background: transparent; border: 1px solid color-mix(in srgb, var(--danger) 28%, var(--border)); }
.danger-button:disabled { opacity: .42; cursor: not-allowed; }

.segment-editor { margin-top: 12px; }
.segment-select-grid { margin-bottom: 8px; }
.segment-add-button { width: 100%; }
.segment-path-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 7px; margin-top: 10px; }
.segment-list { display: grid; gap: 2px; margin-top: 10px; }
.segment-row { min-height: 40px; display: grid; grid-template-columns: minmax(0, 1fr) 16px minmax(0, 1fr) 66px 28px; align-items: center; gap: 6px; border-bottom: 1px solid var(--border); font-size: 11px; }
.segment-row > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.segment-row > svg { width: 14px; height: 14px; color: var(--muted); }
.segment-row button { width: 28px; height: 28px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 5px; background: transparent; color: var(--muted); }
.segment-row button:hover { background: var(--surface-soft); color: var(--danger); }
.segment-row button svg { width: 14px; height: 14px; }
.segment-traffic-input { width: 66px; height: 28px; padding: 0 6px; font-size: 11px; text-align: right; font-variant-numeric: tabular-nums; }
.segment-empty { padding: 12px 0; color: var(--muted); font-size: 11px; text-align: center; }

.switch-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.traffic-scale-switch { grid-column: 1 / -1; }
.switch-row { height: 38px; grid-template-columns: 1fr auto; align-items: center; padding: 0 9px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-soft); color: var(--text); font-size: 12px; }
.switch-row input { position: absolute; width: 1px; height: 1px; padding: 0; opacity: 0; pointer-events: none; }
.switch-row i { width: 30px; height: 18px; position: relative; border-radius: 18px; background: #bac1bc; transition: background .15s; }
.switch-row i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: white; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.18); }
.switch-row input:checked + i { background: var(--primary); }
.switch-row input:checked + i::after { transform: translateX(12px); }
.traffic-filter-field { margin-top: 12px; padding: 10px; gap: 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-soft); }
.traffic-filter-field > span:first-child { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; color: var(--text); font-size: 12px; }
.traffic-filter-field b { font: inherit; }
.traffic-filter-field small { color: var(--muted); font-size: 10px; font-weight: 500; }
.traffic-filter-input { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.traffic-filter-input input { text-align: right; font-variant-numeric: tabular-nums; }
.traffic-filter-input em { color: var(--muted); font-size: 11px; font-style: normal; font-weight: 500; white-space: nowrap; }
.traffic-filter-field output { color: var(--muted); font-size: 11px; font-weight: 500; font-variant-numeric: tabular-nums; }
.range-field { margin-top: 14px; gap: 8px; }
.range-field > span { display: flex; align-items: center; justify-content: space-between; color: var(--text); font-size: 12px; }
.range-field output { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
input[type="range"] { height: 20px; padding: 0; accent-color: var(--primary); border: 0; background: transparent; cursor: pointer; }
.color-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 11px; }
.color-grid label { height: 39px; display: flex; align-items: center; justify-content: space-between; padding: 0 8px 0 10px; border: 1px solid var(--border); border-radius: 6px; color: var(--text); background: var(--surface-soft); }
.color-grid label > span { display: flex; align-items: center; gap: 7px; font-size: 11px; }
.swatch { width: 8px; height: 8px; border-radius: 50%; background: var(--swatch); }
input[type="color"] { width: 28px; height: 24px; padding: 2px; border-radius: 4px; cursor: pointer; }

.map-stage { min-width: 0; min-height: 0; position: relative; overflow: hidden; background: #f7faf8; }
#map { width: 100%; height: 100%; background: #ffffff; }
.leaflet-container { font-family: inherit; }
.route-curve { shape-rendering: geometricPrecision; }
.leaflet-control-zoom { border: 1px solid rgba(34,43,37,.18) !important; border-radius: 6px !important; overflow: hidden; box-shadow: 0 2px 8px rgba(30,40,33,.12) !important; }
.leaflet-control-zoom a { color: var(--text) !important; border: 0 !important; }
.leaflet-control-attribution { background: rgba(255,255,255,.72) !important; font-size: 9px !important; }
.route-label { padding: 0 1px; border: 0; box-shadow: none; background: transparent; color: #17211b; font-weight: 650; font-size: var(--route-label-size, 10px); white-space: nowrap; }
.route-label.hub-label { font-size: calc(var(--route-label-size, 10px) * 1.2); }
.route-label span { display: inline-block; padding: 1px 3px; border: 0; border-radius: 2px; background: rgba(255,255,255,.78); box-shadow: 0 1px 2px rgba(20,30,23,.11); transform: translate(var(--label-x, 0px), var(--label-y, 0px)); }
.route-label::before { display: none; }
.route-label.is-decluttered { opacity: 0 !important; pointer-events: none; }
.map-stage.is-label-editing .route-label { pointer-events: auto; }
.map-stage.is-label-editing .route-label span { cursor: move; touch-action: none; outline: 1px dashed color-mix(in srgb, var(--primary) 45%, transparent); outline-offset: 2px; }
.hub-label { font-size: 14px; font-weight: 700; }
.hub-label span { padding: 2px 5px; background: rgba(255,255,255,.88); box-shadow: 0 1px 3px rgba(20,30,23,.14); }
.map-title { position: absolute; z-index: 500; top: 18px; left: 18px; max-width: min(520px, calc(100% - 90px)); display: grid; gap: 3px; padding: 10px 38px 10px 12px; background: rgba(255,255,255,.9); border-left: 3px solid var(--primary); box-shadow: 0 2px 10px rgba(20,30,23,.12); backdrop-filter: blur(6px); pointer-events: auto; }
.map-title strong, .map-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-title strong { font-size: 14px; font-weight: 700; }
.map-title span { color: var(--muted); font-size: 10px; }
.map-title-edit-button { position: absolute; top: 7px; right: 7px; width: 25px; height: 25px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 4px; color: var(--muted); background: rgba(255,255,255,.74); opacity: .45; cursor: pointer; transition: opacity .15s, color .15s, background .15s; }
.map-title:hover .map-title-edit-button, .map-title-edit-button:focus-visible { color: var(--primary); background: var(--surface); opacity: 1; }
.map-title-edit-button svg { width: 13px; height: 13px; }
.map-title-fields { display: grid; gap: 12px; margin-top: 18px; }
.map-title-actions { grid-template-columns: 1fr auto auto; }
.legend { position: absolute; z-index: 500; left: 18px; bottom: 21px; display: flex; align-items: center; gap: 12px; padding: 8px 10px; background: rgba(255,255,255,.9); border-radius: 5px; box-shadow: 0 2px 10px rgba(20,30,23,.12); backdrop-filter: blur(6px); font-size: 10px; pointer-events: none; }
.legend span { display: flex; align-items: center; gap: 5px; }
.legend b { font-weight: 500; }
.legend-line { width: 19px; height: 3px; position: relative; background: var(--swatch); }
.legend-line::after { content: ""; position: absolute; top: 50%; left: 8px; width: 6px; height: 6px; transform: translate(-50%, -50%); border: 1px solid #17202a; border-radius: 50%; background: var(--swatch); box-shadow: 0 0 0 2px white; }
.region-legend { position: absolute; z-index: 500; right: 18px; bottom: 21px; display: grid; grid-template-columns: repeat(2, auto); gap: 5px 12px; padding: 8px 10px; border-radius: 5px; background: rgba(255,255,255,.9); box-shadow: 0 2px 10px rgba(20,30,23,.12); font-size: 10px; pointer-events: none; }
.region-legend span { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.region-legend i { width: 10px; height: 10px; border: 1px solid rgba(44,60,76,.38); background: var(--region-color); }
.background-map-label { width: 0 !important; height: 0 !important; border: 0 !important; background: transparent !important; pointer-events: none !important; }
.background-map-label span { display: block; width: max-content; max-width: 130px; transform: translate(-50%, -50%); color: #687581; font-size: var(--map-label-size); font-weight: 500; line-height: 1.15; letter-spacing: 0; text-align: center; white-space: normal; text-shadow: -1px -1px 0 rgba(255,255,255,.95), 1px -1px 0 rgba(255,255,255,.95), -1px 1px 0 rgba(255,255,255,.95), 1px 1px 0 rgba(255,255,255,.95); }
.background-map-label.province-map-label span { color: #7c878e; }
.background-map-label.ocean-map-label span { color: #6f8fa3; }
.background-map-label.is-label-hidden { display: none !important; }
.classification-mode-field { margin-top: 12px; }
.clean-background-button { width: 100%; margin-top: 8px; }
.reset-labels-button { width: 100%; margin-top: 8px; }
.background-heading { margin-bottom: 10px; }
.background-heading .eyebrow { margin-bottom: 3px; }
.background-switch-grid .switch-row:last-child { grid-column: 1 / -1; }
.color-grid b { font: inherit; }
.domestic { --swatch: #e5483f; }
.international { --swatch: #2563eb; }
.custom { --swatch: #d97706; }
.point { --swatch: #17202a; }
.hub { --swatch: #e5483f; }
.pick-banner { position: absolute; z-index: 800; left: 50%; top: 16px; transform: translateX(-50%); min-height: 38px; display: flex; align-items: center; gap: 9px; padding: 0 8px 0 12px; border-radius: 6px; background: #1e2b24; color: white; box-shadow: var(--shadow); font-size: 12px; }
.pick-banner svg { width: 15px; height: 15px; }
.pick-banner button { height: 26px; padding: 0 8px; border: 0; border-radius: 4px; color: white; background: rgba(255,255,255,.14); }
.mobile-panel-button { display: none; }
.map-stage.is-picking, .map-stage.is-picking .leaflet-grab { cursor: crosshair; }

dialog { width: min(560px, calc(100% - 28px)); padding: 0; border: 0; border-radius: 8px; color: var(--text); background: transparent; box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(18,24,20,.42); backdrop-filter: blur(2px); }
.dialog-card { padding: 20px; background: var(--surface); }
.compact-dialog { max-width: 440px; margin: auto; }
.dialog-header { display: flex; align-items: center; justify-content: space-between; }
#cloudProjectDialog { width: min(500px, calc(100vw - 28px)); max-height: min(760px, calc(100vh - 28px)); overflow: auto; }
.cloud-project-dialog { width: 100%; min-width: 0; box-sizing: border-box; margin: 0; }
.cloud-project-status { display: grid; grid-template-columns: 34px 1fr; align-items: center; gap: 10px; margin: 16px 0; padding: 11px 12px; border-left: 3px solid var(--primary); background: var(--surface-soft); }
.cloud-project-status > svg { width: 20px; height: 20px; color: var(--primary); }
.cloud-project-status strong, .cloud-project-status small { display: block; }
.cloud-project-status strong { color: var(--text); font-size: 12px; }
.cloud-project-status small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.cloud-project-meta { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 6px 10px; margin-top: 12px; color: var(--muted); font-size: 11px; }
.cloud-project-meta code, .cloud-project-meta time { overflow: hidden; color: var(--text); font: 500 11px/1.4 ui-monospace, "Cascadia Code", monospace; text-overflow: ellipsis; white-space: nowrap; }
.cloud-project-feedback { min-height: 18px; margin: 10px 0 0; color: var(--muted); font-size: 11px; }
.cloud-project-feedback.is-error { color: #b42318; }
.account-mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-bottom: 14px; padding: 4px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-soft); }
.account-mode-switch button { min-height: 34px; border: 0; border-radius: 4px; color: var(--muted); background: transparent; font: inherit; font-weight: 650; cursor: pointer; }
.account-mode-switch button.is-active { color: var(--primary); background: var(--surface); box-shadow: 0 1px 4px rgba(20,30,23,.1); }
.account-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.account-help { display: block; margin: 8px 0 12px; color: var(--muted); font-size: 10px; }
.account-submit { width: 100%; }
.account-summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; padding: 9px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-soft); }
.account-summary > span { min-width: 0; display: grid; grid-template-columns: 22px 1fr; align-items: center; }
.account-summary > span svg { grid-row: 1 / 3; width: 17px; height: 17px; color: var(--primary); }
.account-summary b { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.account-summary small { color: var(--muted); font-size: 9px; }
.cloud-project-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.cloud-project-actions .button { min-width: 0; }
.cloud-library-heading { display: flex; align-items: baseline; justify-content: space-between; margin: 18px 0 7px; padding-top: 14px; border-top: 1px solid var(--border); }
.cloud-library-heading strong { font-size: 12px; }
.cloud-library-heading small { color: var(--muted); font-size: 9px; }
.cloud-project-empty { margin: 0; padding: 18px 10px; color: var(--muted); background: var(--surface-soft); text-align: center; font-size: 11px; }
.cloud-project-list { display: grid; gap: 5px; max-height: 230px; overflow: auto; }
.cloud-project-item { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) 18px; gap: 2px 8px; padding: 9px 10px; border: 1px solid var(--border); border-radius: 5px; color: var(--text); background: var(--surface); text-align: left; cursor: pointer; }
.cloud-project-item:hover, .cloud-project-item.is-active { border-color: color-mix(in srgb, var(--primary) 46%, var(--border)); background: var(--primary-soft); }
.cloud-project-item strong, .cloud-project-item small { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cloud-project-item strong { font-size: 11px; }
.cloud-project-item small { color: var(--muted); font-size: 9px; }
.cloud-project-item svg { grid-column: 2; grid-row: 1 / 3; align-self: center; width: 14px; height: 14px; color: var(--primary); }
.dialog-tabs { display: flex; gap: 18px; margin-top: 18px; border-bottom: 1px solid var(--border); }
.dialog-tabs button { height: 36px; padding: 0 1px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); font-size: 12px; font-weight: 650; }
.dialog-tabs button.is-active { color: var(--primary); border-bottom-color: var(--primary); }
.import-mode { display: none; margin-top: 14px; }
.import-mode.is-active { display: block; }
.file-drop { min-height: 188px; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 8px; border: 1px dashed var(--border-strong); border-radius: 7px; background: var(--surface-soft); cursor: pointer; }
.file-drop svg { width: 28px; height: 28px; color: var(--primary); }
.file-drop strong { color: var(--text); font-size: 13px; }
.file-drop span { font-size: 11px; }
.import-options { min-height: 38px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-top: 10px; }
.check-row { display: flex; align-items: center; gap: 7px; color: var(--text); }
.check-row input { width: 15px; height: 15px; accent-color: var(--primary); }
#importFeedback { color: var(--danger); font-size: 11px; text-align: right; }
.import-preview { min-height: 34px; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; padding: 0 10px; border-left: 3px solid var(--primary); background: var(--surface-soft); color: var(--muted); font-size: 11px; }
.import-preview a { flex: none; color: var(--primary); font-weight: 650; text-decoration: none; }
.import-preview a:hover { text-decoration: underline; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.export-choice-list { display: grid; gap: 5px; margin-top: 18px; }
.export-choice { width: 100%; min-height: 58px; display: grid; grid-template-columns: 28px 1fr 18px; align-items: center; gap: 10px; padding: 8px 10px; border: 0; border-radius: 6px; background: transparent; color: var(--text); text-align: left; }
.export-choice:hover { background: var(--surface-soft); }
.export-choice > svg:first-child { color: var(--primary); }
.export-choice > svg { width: 18px; height: 18px; }
.export-choice span { display: grid; gap: 3px; }
.export-choice strong { font-size: 13px; }
.export-choice small { color: var(--muted); font-size: 11px; }
.export-choice.danger > svg:first-child, .export-choice.danger strong { color: var(--danger); }
.resolution-list { display: grid; gap: 7px; margin-top: 18px; }
.resolution-option { min-height: 58px; display: grid; grid-template-columns: 18px 1fr 22px; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); cursor: pointer; }
.resolution-option:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.resolution-option input { width: 15px; height: 15px; padding: 0; accent-color: var(--primary); }
.resolution-option span { display: grid; gap: 3px; }
.resolution-option strong { font-size: 13px; }
.resolution-option small { color: var(--muted); font-size: 11px; }
.resolution-option > svg { width: 18px; height: 18px; color: var(--primary); }
.export-size-row { min-height: 40px; display: flex; align-items: center; justify-content: space-between; margin-top: 10px; padding: 0 10px; border-radius: 6px; background: var(--surface-soft); color: var(--muted); font-size: 11px; }
.export-size-row output { color: var(--text); font-size: 12px; font-weight: 650; font-variant-numeric: tabular-nums; }
.adobe-export-note { display: flex; align-items: flex-start; gap: 9px; margin-top: 10px; padding: 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--muted); }
.adobe-export-note > svg { flex: 0 0 auto; width: 17px; height: 17px; margin-top: 1px; color: var(--primary); }
.adobe-export-note span, .adobe-export-note strong, .adobe-export-note small { display: block; }
.adobe-export-note strong { color: var(--text); font-size: 11px; }
.adobe-export-note small { margin-top: 3px; font-size: 10px; line-height: 1.45; }
.dialog-actions.export-format-actions { display: grid; grid-template-columns: 1fr 1fr; }
.export-format-actions .button { width: 100%; }
.toast { position: fixed; z-index: 3000; left: 50%; bottom: 22px; transform: translate(-50%, 14px); padding: 9px 13px; border-radius: 6px; background: #1e2b24; color: white; font-size: 12px; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.spinner { width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.45); border-top-color: white; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

@media (max-width: 760px) {
  html, body { overflow: auto; }
  .app-shell { min-height: 100%; height: auto; grid-template-rows: 54px auto; }
  .topbar { padding: 0 10px; }
  .brand-mark { width: 32px; height: 32px; }
  .brand span, .route-count { display: none; }
  .topbar-actions { gap: 5px; }
  .language-switch { grid-template-columns: 27px 32px; }
  .topbar-actions .button { width: 34px; padding: 0; }
  .topbar-actions .button span { display: none; }
  .workspace { display: flex; flex-direction: column; }
  .map-stage { order: 1; height: 56vh; min-height: 390px; }
  .sidebar { order: 2; display: none; min-height: 440px; border-right: 0; border-top: 1px solid var(--border); }
  .sidebar.is-mobile-open { display: block; }
  .mobile-panel-button { position: absolute; z-index: 600; right: 12px; bottom: 18px; height: 38px; display: flex; align-items: center; gap: 7px; padding: 0 12px; border: 0; border-radius: 6px; background: var(--primary); color: white; box-shadow: var(--shadow); font-size: 12px; font-weight: 650; }
  .mobile-panel-button svg { width: 15px; height: 15px; }
  .legend { left: 10px; bottom: 15px; }
  .region-legend { right: 10px; bottom: 64px; grid-template-columns: auto; max-height: 118px; overflow: hidden; }
  .map-title { top: 10px; left: 10px; }
  .map-title-edit-button { opacity: .78; }
  .pick-banner { top: 10px; max-width: calc(100% - 20px); width: max-content; }
}

@media (max-width: 400px) {
  .brand strong { font-size: 14px; }
  .map-title { max-width: calc(100% - 80px); }
  .map-title strong, .map-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .legend { gap: 7px; }
  .panel { padding-left: 13px; padding-right: 13px; }
  .divider { margin-left: -13px; margin-right: -13px; }
  .account-fields, .cloud-project-actions { grid-template-columns: 1fr; }
}

/* Workbench layout: map stage on the left, object inspector on the right. */
:root {
  --bg: #eef2f5;
  --surface-soft: #f7f9fb;
  --text: #152235;
  --muted: #697a8e;
  --border: #dce4eb;
  --border-strong: #bcc9d5;
  --primary: #15788a;
  --primary-hover: #0c5b69;
  --primary-soft: #e7f4f5;
  --focus: #15788a;
  --shadow: 0 8px 28px rgba(27,43,58,.09);
}

body { background: var(--bg); }

.app-shell {
  height: 100vh;
  display: grid;
  grid-template-columns: minmax(680px, 1fr) clamp(390px, 28vw, 430px);
  grid-template-rows: 64px minmax(0, 1fr);
  column-gap: 14px;
  row-gap: 0;
  padding: 14px;
}

.topbar {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-bottom-color: var(--border);
  border-radius: 8px 8px 0 0;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.brand-mark { background: var(--primary-soft); color: var(--primary); }
.brand strong { color: var(--text); }
.brand > div > span { color: var(--muted); }
.topbar-actions { min-width: 0; gap: 6px; }
.selection-hint {
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}
.toolbar-divider { width: 1px; height: 24px; margin: 0 2px; background: var(--border); }
.quiet-command { padding-inline: 9px; }
.quiet-command:disabled { opacity: .45; cursor: not-allowed; }
.button.secondary.is-active { color: var(--primary); border-color: color-mix(in srgb, var(--primary) 38%, var(--border)); background: color-mix(in srgb, var(--primary) 8%, white); }
.button[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-hover); }

.region-mode-field { margin-top: 14px; }
.region-summary { margin-top: 12px; padding: 9px 10px; border-left: 3px solid var(--primary); background: var(--surface-soft); color: var(--muted); font-size: 11px; }
.region-color-field { min-height: 39px; display: flex; grid-template-columns: 1fr auto; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; padding: 0 8px 0 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-soft); }
.region-color-field > span { display: flex; align-items: center; gap: 7px; color: var(--text); font-size: 11px; }
.region-color-field b { font: inherit; }
.region-stroke { --swatch: #64748b; }
.region-selected { --swatch: #7dd3fc; }
.region-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.region-actions .button { flex: 1 1 auto; }

.workspace { display: contents; }

.map-stage {
  grid-column: 1;
  grid-row: 2;
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--border-strong);
  border-top: 0;
  border-radius: 0 0 8px 8px;
  box-shadow: var(--shadow);
}

.sidebar {
  grid-column: 2;
  grid-row: 1 / 3;
  z-index: 900;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: 64px 50px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.inspector-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
}
.inspector-heading > div { min-width: 0; display: grid; gap: 2px; }
.inspector-heading .eyebrow { margin: 0; color: var(--primary-hover); }
.inspector-heading strong { overflow: hidden; text-overflow: ellipsis; font-size: 14px; white-space: nowrap; }
.live-status { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.live-status i { width: 7px; height: 7px; border-radius: 50%; background: #22a06b; box-shadow: 0 0 0 3px rgba(34,160,107,.12); }

.sidebar .tabs {
  position: static;
  height: 50px;
  padding: 6px 12px 0;
  border-bottom: 1px solid var(--border);
}
.sidebar .tab { border: 1px solid transparent; border-bottom: 0; border-radius: 6px 6px 0 0; }
.sidebar .tab.is-active { border-color: var(--border); background: var(--primary-soft); color: var(--primary-hover); box-shadow: inset 0 -3px 0 var(--primary); }
.sidebar .panel { min-height: 0; overflow-y: auto; padding: 18px 16px 26px; }
.sidebar .panel::-webkit-scrollbar { width: 8px; }
.sidebar .panel::-webkit-scrollbar-thumb { border: 2px solid var(--surface); border-radius: 8px; background: var(--border-strong); }

.editor-form { border-radius: 6px; }
.route-row { border-color: var(--border); }
.route-row:hover { background: var(--primary-soft); }
.map-title, .legend { border-radius: 4px; backdrop-filter: none; }

/* Optimized workflow */
.import-kind-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: 14px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-soft); }
.import-kind-switch button { min-height: 38px; display: flex; align-items: center; justify-content: center; gap: 7px; border: 0; border-radius: 4px; color: var(--muted); background: transparent; font: inherit; font-weight: 650; cursor: pointer; }
.import-kind-switch button.is-active { color: var(--primary); background: var(--surface); box-shadow: 0 1px 4px rgba(20,30,23,.1); }
.import-kind-switch svg { width: 16px; height: 16px; }
.route-import-area > label:first-child { display: grid; gap: 7px; }
.route-file-drop { margin-top: 10px; }

.route-chain-section { margin: 12px 0 4px; padding-top: 12px; border-top: 1px solid var(--border); }
.subsection-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.subsection-heading span { display: flex; align-items: baseline; gap: 8px; }
.subsection-heading b { font-size: 12px; }
.subsection-heading small { color: var(--muted); font-size: 10px; }
.route-chain-list { display: grid; gap: 5px; max-height: 180px; overflow: auto; }
.route-chain-row { display: grid; grid-template-columns: 54px minmax(0,1fr) 28px; gap: 7px; align-items: center; min-height: 42px; padding: 5px 6px; border: 1px solid var(--border); border-radius: 5px; background: var(--surface); }
.route-chain-badge { padding: 3px 5px; border-radius: 3px; text-align: center; color: #fff; background: #6688ad; font-size: 10px; font-weight: 700; }
.route-chain-badge.stopover { background: #103f70; }
.route-chain-badge.tagon { background: #c89412; }
.route-chain-badge.connecting { background: #66737f; }
.route-chain-badge.multistop { background: #446b82; }
.route-chain-main { min-width: 0; }
.route-chain-main b, .route-chain-main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.route-chain-main b { font-size: 11px; letter-spacing: 0; }
.route-chain-main small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.route-chain-row button { width: 26px; height: 26px; display: grid; place-items: center; padding: 0; border: 0; color: var(--muted); background: transparent; cursor: pointer; }
.route-chain-row button:hover { color: var(--danger); }

.airport-symbol { width: var(--marker-size, 28px); height: var(--marker-size, 28px); display: grid; place-items: center; border: 2px solid #fff; border-radius: 50%; color: #fff; background: var(--marker-color, #103f70); box-shadow: 0 0 0 1px rgba(13,49,78,.48), 0 2px 6px rgba(13,49,78,.28); font-family: "Segoe UI Symbol", "Microsoft YaHei", sans-serif; }
.airport-symbol b { display: block; font-size: calc(var(--marker-size, 28px) * .57); line-height: 1; font-weight: 800; transform: translateY(-.5px); }
.airport-symbol.arrow b { font-size: calc(var(--marker-size, 28px) * .61); }
.airport-symbol.star b { font-size: calc(var(--marker-size, 28px) * .54); }
.airport-symbol.triangle { border-radius: 6px; }
.airport-symbol.triangle b { font-size: calc(var(--marker-size, 28px) * .5); transform: translateY(0); }
.airport-symbol.dot { width: 12px; height: 12px; border-width: 2px; }
.leaflet-div-icon.airport-symbol-icon { border: 0; background: transparent; }
.leaflet-tooltip.route-label.has-symbol { margin-top: -3px; }
.route-marker-glyph { display: inline-block; margin-right: 4px; color: var(--primary); font-family: "Segoe UI Symbol", "Microsoft YaHei", sans-serif; font-size: 12px; line-height: 1; }

.swatch.trunk { --swatch: #103f70; }
.legend-line.trunk { --swatch: #103f70; }
.map-stage.focus-map, .map-stage.focus-map .leaflet-container { background: #dce8f0; }
.map-stage.focus-map .map-title { border-left-color: #103f70; }

@media (max-width: 760px) {
  .route-chain-list { max-height: 150px; }
  .import-kind-switch button { font-size: 12px; }
}

@media (max-width: 1450px) {
  .app-shell { grid-template-columns: minmax(620px, 1fr) 400px; }
  .selection-hint, .quiet-command span, .data-command span { display: none; }
  .quiet-command, .data-command { width: 34px; padding: 0; }
}

@media (max-width: 1100px) {
  html, body { overflow: auto; }
  .app-shell {
    height: auto;
    min-height: 100vh;
    grid-template-columns: 1fr;
    grid-template-rows: 60px minmax(520px, 64vh) auto;
    padding: 10px;
  }
  .topbar { grid-column: 1; grid-row: 1; }
  .map-stage { grid-column: 1; grid-row: 2; }
  .sidebar { grid-column: 1; grid-row: 3; min-height: 620px; margin-top: 12px; }
  .mobile-panel-button { display: none; }
}

@media (max-width: 680px) {
  .app-shell { display: flex; flex-direction: column; min-height: 100vh; padding: 0; }
  .topbar { min-height: 58px; border-radius: 0; box-shadow: none; }
  .brand > div > span, .route-count, .fit-command, .selection-hint, .toolbar-divider { display: none; }
  .topbar-actions .button { width: 34px; padding: 0; }
  .topbar-actions .button span { display: none; }
  .map-stage { height: 58vh; min-height: 390px; border-radius: 0; }
  .sidebar { display: grid; min-height: 680px; margin: 10px; border-radius: 8px; }
}
