:root {
  --bg: #ffffff;
  --panel: #f7f7f6;
  --line: #dcdcd8;
  --ink: #1c1c1a;
  --muted: #6b6b66;
  --accent: #1f5fa8;
  --bus: #c2410c;
  --subway: #1d4ed8;
  --entrance: #b91c1c;
  --path: #ea8a2b;
  --warn: #92400e;
  --warn-bg: #fef6e7;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

#app { display: flex; height: calc(100vh - 42px); }
#mapwrap { position: relative; flex: 1; min-width: 0; }
#map { position: absolute; inset: 0; }

#panel {
  width: 430px;
  flex: none;
  border-left: 1px solid var(--line);
  background: var(--panel);
  overflow-y: auto;
  padding: 18px 20px 40px;
}

h1 { font-size: 16px; margin: 0 0 12px; letter-spacing: .01em; }
h2.sec { font-size: 13px; margin: 18px 0 6px; padding-bottom: 4px;
         border-bottom: 1px solid var(--line); }
.step > h2.sec:first-child { margin-top: 0; }
.lot-facts { font-size: 12px; color: var(--muted); margin: 4px 0 8px; }
.lot-facts b { color: var(--ink); }
.confirm { display: flex; gap: 7px; align-items: flex-start; font-weight: 600;
           font-size: 13px; margin: 10px 0 0; }
.confirm input { width: auto; margin: 3px 0 0; flex: none; }
.mini { font-size: 12px; padding: 4px 9px; }

#steps {
  display: flex;
  gap: 6px;
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  font-size: 12px;
  counter-reset: s;
}
#steps li {
  flex: 1;
  text-align: center;
  padding: 5px 2px;
  border-radius: 4px;
  color: var(--muted);
  background: #ececea;
  white-space: nowrap;
}
#steps li.active { background: var(--accent); color: #fff; }
#steps li.done { background: #d7e5f5; color: var(--accent); }

label { display: block; margin: 14px 0 4px; font-size: 13px; font-weight: 600; }
input, select, button, textarea {
  font: inherit;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: inherit;
}
input, select { width: 100%; margin-top: 4px; }
.row { display: flex; gap: 8px; align-items: flex-end; margin-top: 4px; }
.row input { margin-top: 0; }
button { cursor: pointer; white-space: nowrap; }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.step > button, .step > .row { margin-top: 16px; }

.hint { color: var(--muted); font-size: 12px; margin: 6px 0; }
.error { color: #b91c1c; font-size: 13px; }
.hidden { display: none !important; }

.results { list-style: none; padding: 0; margin: 8px 0 0; }
.results li {
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  margin-bottom: 6px;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.results li:hover { border-color: var(--accent); }
.results li .meta { color: var(--muted); font-size: 11px; }
.results li button { padding: 2px 7px; font-size: 12px; }

.floating {
  position: absolute;
  z-index: 500;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,.12);
}
#download { top: 12px; right: 12px; padding: 8px 14px; font-weight: 600; }
.note-map {
  top: 12px; left: 52px; padding: 7px 11px; font-size: 12px;
  background: var(--warn-bg); border-color: #f0d9ae; color: var(--warn);
}
.basemap-ctl {
  right: 12px; bottom: 16px; padding: 6px 9px; font-size: 12px; color: var(--muted);
}
.basemap-ctl select { margin-left: 6px; font-size: 12px; padding: 2px 4px; }
.legend { bottom: 16px; left: 12px; padding: 9px 11px; font-size: 12px; line-height: 1.9; }
.legend .sw {
  display: inline-block; width: 14px; height: 10px; margin-right: 7px;
  vertical-align: middle; border-radius: 2px;
}
.sw.entrance { background: var(--entrance); }
.sw.boundary { background: transparent; border: 2px dashed var(--entrance); height: 8px; }
.sw.bus { background: var(--bus); }
.sw.subway { background: var(--subway); }
.sw.path { background: var(--path); }
.sw.excluded { background: #bbb; }

.filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.filters button {
  font-size: 12px; padding: 3px 9px; border-radius: 999px; background: #fff;
}
.filters button.on { background: var(--accent); color: #fff; border-color: var(--accent); }

table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { padding: 5px 4px; border-bottom: 1px solid var(--line); text-align: right; }
th:nth-child(-n+3), td:nth-child(-n+3) { text-align: left; }
th { font-weight: 600; color: var(--muted); font-size: 11px; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #eef3f9; }
tbody tr.sel { background: #dfeaf7; }
tbody tr.out td:not(:first-child) { opacity: .4; text-decoration: line-through; }
td .mode { font-size: 10px; color: var(--muted); display: block; }
tfoot td { font-weight: 700; border-top: 2px solid var(--ink); border-bottom: none; }

.card {
  background: #fff; border: 1px solid var(--line); border-radius: 6px;
  padding: 14px; margin-bottom: 12px;
}
.card h2 { font-size: 13px; margin: 0 0 10px; }
.big { font-size: 26px; font-weight: 700; line-height: 1.2; }
.kv { display: flex; justify-content: space-between; padding: 3px 0; }
.kv span:last-child { font-variant-numeric: tabular-nums; }

.notice {
  background: var(--warn-bg); border: 1px solid #f0d9ae; color: var(--warn);
  border-radius: 5px; padding: 9px 11px; font-size: 12px; margin-top: 10px;
}
.notice ul { margin: 6px 0 0; padding-left: 18px; }

#advanced {
  margin-top: 26px; border-top: 1px solid var(--line); padding-top: 12px;
}
#advanced summary { cursor: pointer; font-size: 13px; font-weight: 600; }
.badge {
  background: var(--accent); color: #fff; border-radius: 999px;
  padding: 1px 7px; font-size: 11px; margin-left: 6px;
}
.cfg { margin: 12px 0; }
.cfg-head { display: flex; align-items: center; gap: 6px; }
.cfg-path { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.tip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px; border-radius: 50%; border: 1px solid var(--muted);
  color: var(--muted); font-size: 10px; cursor: help; flex: none;
}
.cfg-tag { font-size: 10px; padding: 1px 6px; border-radius: 3px; background: #ececea; color: var(--muted); }
.cfg-tag.LEED { background: #dcefe0; color: #14532d; }
.cfg-tag.office { background: #e5e7f5; color: #312e81; }
.cfg-tag.unverified { background: #fdecc8; color: var(--warn); }
.cfg.changed .cfg-path { color: var(--accent); font-weight: 700; }

#provenance { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 10px; }
#provenance code { font-size: 11px; }

.spinner {
  width: 22px; height: 22px; margin: 14px auto 6px;
  border: 3px solid #ddd; border-top-color: var(--accent);
  border-radius: 50%; animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.marker-num {
  background: var(--bus); color: #fff; border-radius: 50%;
  width: 20px; height: 20px; line-height: 20px; text-align: center;
  font-size: 11px; font-weight: 700; box-shadow: 0 0 0 2px #fff;
}
.marker-num.subway { background: var(--subway); }
.marker-num.out { background: #bbb; }
.marker-entrance {
  width: 0; height: 0; border-left: 8px solid transparent;
  border-right: 8px solid transparent; border-bottom: 14px solid var(--entrance);
  filter: drop-shadow(0 0 1.5px #fff);
}

/* 第二步的鼠标模式切换：同一张地图上"加入口"和"改红线"必须是两种模式 */
.segmented { display: flex; gap: 0; margin-bottom: 8px; }
.segmented button {
  flex: 1; border-radius: 0; font-size: 13px; padding: 7px 10px;
}
.segmented button:first-child { border-radius: 6px 0 0 6px; }
.segmented button:last-child { border-radius: 0 6px 6px 0; margin-left: -1px; }
.segmented button.on { background: var(--accent); color: #fff; border-color: var(--accent); }
/* 顶点手柄要好抓 */
.leaflet-interactive.vertex-handle { cursor: move; }

/* 步骤条：走到过的步骤可以点回去 */
#steps li.reachable { cursor: pointer; }
#steps li.reachable:hover { background: #cddcee; color: var(--accent); }
#steps li:not(.reachable):not(.active) { cursor: default; }
/* 四个模式，按钮要窄一点才排得下 */
.segmented button { padding: 7px 4px; font-size: 12px; }

/* 第一步：输入即搜的候选列表 */
#addr-search { position: relative; }
.dropdown {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 900;
  margin-top: 2px; max-height: 260px; overflow-y: auto;
  background: #fff; border-radius: 4px; box-shadow: 0 4px 14px rgba(0,0,0,.14);
}
.dropdown li { margin: 0; border-radius: 0; border-bottom: none; }
.dropdown li:hover { background: #eef3f9; }
.picked {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  background: #fff; border: 1px solid var(--line); border-radius: 4px;
  padding: 9px 11px; margin-top: 4px;
}
.picked .meta { display: block; color: var(--muted); font-size: 11px; }

/* 确认页的键值表 */
.kvtable { width: 100%; font-size: 13px; }
.kvtable th {
  text-align: left; font-weight: 600; color: var(--muted); width: 42%;
  vertical-align: top; padding: 6px 8px 6px 0;
}
.kvtable td { text-align: left; padding: 6px 0; }
.warn-text { color: var(--warn); font-weight: 600; }

/* 地图上的编号圆点就是开关 */
.marker-num { cursor: pointer; transition: transform .12s; }
.marker-num:hover { transform: scale(1.25); }
.marker-num.sel { box-shadow: 0 0 0 3px var(--accent); }

/* 地图上的工具条：编辑红线和入口都是"在图上做的事"，控件跟着手走 */
.map-tools { top: 12px; left: 52px; padding: 7px 8px; max-width: 420px; }
.map-tools .segmented { margin-bottom: 0; }
.map-tools .tool-hint { display: none; }
/* 角标贴在工具条正下方，同一个角：控件和它的说明待在一起 */
.map-badge {
  top: 58px; left: 52px; max-width: 360px;
  padding: 7px 11px; font-size: 12px; color: var(--muted); line-height: 1.5;
  background: rgba(255,255,255,.96);
}

/* 入口坐标可编辑 —— 门口在哪一米上会直接决定卡线的地铁站算不算 */
.entrance-row { align-items: center; gap: 6px; }
.entrance-row .ent-no { flex: none; font-size: 12px; white-space: nowrap; }
.entrance-row input.coord {
  width: 92px; margin: 0; padding: 4px 6px; font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.entrance-row input.coord.bad { border-color: var(--entrance); background: #fff5f5; }

/* 卡在 LEED 限值上的线路 */
.flag {
  display: inline-block; margin-left: 5px; padding: 0 5px; border-radius: 3px;
  font-size: 10px; font-weight: 700; cursor: help; vertical-align: middle;
}
.flag.round { background: var(--warn-bg); color: var(--warn); border: 1px solid #f0d9ae; }
.flag.near { background: #ececea; color: var(--muted); border: 1px solid var(--line); }
.flag.sparse { background: #e5e7f5; color: #312e81; border: 1px solid #c7cbe8; }
tbody tr.hover-map { background: #dfeaf7; }


/* ---------------------------------------------------- 登录 / 首页 / 顶栏 */
/* 这三块是"项目"这一层，和向导那一层视觉上要分开：顶栏细、首页宽松，
   进到向导里才是那张占满屏幕的地图。 */

#topbar {
  display: flex; align-items: center; gap: 12px;
  height: 42px; padding: 0 14px;
  border-bottom: 1px solid var(--line); background: var(--panel);
  font-size: 13px;
}
#topbar .grow { flex: 1; }
#topbar .crumb { font-weight: 600; }
#topbar .meta { color: var(--muted); font-size: 12px; }
#topbar .meta.error { color: #b91c1c; }
.linky {
  background: none; border: none; padding: 0; cursor: pointer;
  color: var(--accent); font: inherit; font-weight: 600;
}
.linky:hover { text-decoration: underline; }
.pill {
  background: var(--warn-bg); color: var(--warn);
  border: 1px solid #f0d9ae; border-radius: 999px;
  padding: 1px 9px; font-size: 12px;
}

.gate {
  position: fixed; inset: 0; display: grid; place-items: center;
  background: var(--panel); padding: 20px; z-index: 50;
}
.gate-card {
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  padding: 30px 32px; max-width: 420px; text-align: center;
}
.gate-card h1 { font-size: 21px; margin: 0 0 8px; }
.gate-card p { color: var(--muted); margin: 0 0 18px; }
.gate-card .primary { width: 100%; }
.gate-card .hint { margin: 16px 0 0; font-size: 12px; }

.home { max-width: 880px; margin: 0 auto; padding: 30px 20px 60px; }
.home-head {
  display: flex; gap: 20px; align-items: flex-start;
  justify-content: space-between; flex-wrap: wrap; margin-bottom: 22px;
}
.home-head h1 { font-size: 22px; margin: 0 0 4px; }
.home-head .hint { margin: 0; max-width: 46ch; }

/* 一行一个项目：名字和地址在左，状态和操作在右。
   卡片整体可点 —— 打开是最常做的事，不该只有一个小链接能点。 */
.project {
  display: flex; gap: 16px; align-items: center; justify-content: space-between;
  border: 1px solid var(--line); border-radius: 6px;
  padding: 13px 15px; margin-bottom: 9px; cursor: pointer; background: var(--bg);
}
.project:hover { border-color: var(--accent); }
.project-main { min-width: 0; }
.project h3 { font-size: 15px; margin: 0 0 2px; }
.project .hint { margin: 0; font-size: 12px; }
.project .nums {
  display: inline-block; margin-top: 5px; font-size: 12px;
  font-variant-numeric: tabular-nums; color: var(--ink);
}
.project-side { text-align: right; flex: none; }
.project-side .hint { font-size: 11px; }
.project-actions { display: flex; gap: 6px; margin-top: 6px; }
.mini.danger { color: #b91c1c; border-color: #e7c3c3; }
.mini.danger:hover { background: #fdeeee; }

.empty {
  border: 1px dashed var(--line); border-radius: 6px;
  padding: 26px; text-align: center;
}
.empty p { margin: 0 0 6px; }
.empty .hint { max-width: 48ch; margin: 0 auto; }
