/* ===== 项目跟进系统 — 样式表 ===== */

:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e3e8f0;
  --border-strong: #cfd7e5;
  --text: #16202e;
  --text-2: #5a6a80;
  --text-3: #8a97a8;
  --muted: #8a97a8;
  --primary: #2f6fed;
  --primary-hover: #2560d8;
  --primary-soft: #e8f0fe;
  --danger: #d9453f;
  --danger-soft: #fdeceb;
  --success: #17a06a;
  --warn: #d98324;
  --shadow-sm: 0 1px 2px rgba(16, 30, 54, .06);
  --shadow: 0 4px 16px rgba(16, 30, 54, .08);
  --shadow-lg: 0 18px 48px rgba(16, 30, 54, .18);
  --radius: 10px;
  --radius-sm: 7px;
  --sidebar-w: 208px;
  --topbar-h: 58px;
}

html[data-theme="dark"] {
  --bg: #0f172a;
  --surface: #161f33;
  --surface-2: #1b2540;
  --border: #27324a;
  --border-strong: #384663;
  --text: #e9eef8;
  --text-2: #a3b0c6;
  --text-3: #7b8aa3;
  --muted: #7b8aa3;
  --primary: #5b8ef5;
  --primary-hover: #6f9cf7;
  --primary-soft: #1e2b4a;
  --danger: #f0665f;
  --danger-soft: #3a1f22;
  --success: #35c48c;
  --warn: #e5a04a;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 4px 18px rgba(0, 0, 0, .35);
  --shadow-lg: 0 20px 56px rgba(0, 0, 0, .55);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }

a { color: var(--primary); text-decoration: none; }

/* ---------- 通用控件 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 15px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: background .14s, border-color .14s, transform .06s, box-shadow .14s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); border-color: var(--primary); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 1px 3px rgba(47, 111, 237, .3);
}
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger { color: var(--danger); border-color: var(--border-strong); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border); }
.btn-sm { padding: 5px 11px; font-size: 12.5px; }
.btn-block { width: 100%; padding: 10px; font-size: 14.5px; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: background .14s, color .14s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.field { display: block; margin-bottom: 14px; }
.field > span {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 6px;
}
.field .hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
.field.required > span::after { content: " *"; color: var(--danger); }

input[type="text"], input[type="password"], input[type="number"],
input[type="date"], input[type="search"], select, textarea {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
  transition: border-color .14s, box-shadow .14s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
textarea { resize: vertical; min-height: 84px; line-height: 1.65; }
select { cursor: pointer; }

.row { display: flex; gap: 12px; }
.row > * { flex: 1; min-width: 0; }

/* ---------- 提示条 ---------- */
.alert {
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 14px;
  border: 1px solid transparent;
}
.alert-error { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.alert-warn { background: #fff6e6; color: #a35b00; border-color: #f0c98a; }
.alert-info { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); }
html[data-theme="dark"] .alert-warn { background: #3a2c14; color: #e5a04a; border-color: #6b5527; }

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(1000px 520px at 12% -8%, rgba(47, 111, 237, .16), transparent 62%),
    radial-gradient(860px 460px at 106% 108%, rgba(23, 160, 106, .13), transparent 60%),
    var(--bg);
}
.login-card {
  width: 100%;
  max-width: 396px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 30px 26px;
  box-shadow: var(--shadow-lg);
}
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }
.login-brand h1 { font-size: 19px; }
.login-brand p { margin: 2px 0 0; font-size: 12.5px; }
.brand-mark {
  width: 46px; height: 46px;
  flex: none;
  border-radius: 13px;
  background: linear-gradient(135deg, #4a86f7, #2f6fed);
  color: #fff;
  font-size: 21px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 5px 16px rgba(47, 111, 237, .36);
}
.brand-mark.small { width: 27px; height: 27px; border-radius: 8px; font-size: 13.5px; box-shadow: none; }
.login-hint { font-size: 12px; text-align: center; margin: 16px 0 0; }

/* ---------- 主框架 ---------- */
.app { height: 100%; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-h);
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 30;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 10px; }
.app-title { font-weight: 600; font-size: 15px; }

.user-chip {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 9px 5px 6px;
  border-radius: 20px;
  cursor: pointer;
  transition: background .14s;
  user-select: none;
}
.user-chip:hover { background: var(--surface-2); }
.avatar {
  width: 27px; height: 27px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4a86f7, #2f6fed);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.user-name { font-size: 13.5px; font-weight: 500; }
.chev { color: var(--muted); }

.menu {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  min-width: 152px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 5px;
  display: none;
  z-index: 60;
}
.user-chip.open .menu { display: block; }
.menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 11px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.menu button:hover { background: var(--surface-2); }
.menu button.danger { color: var(--danger); }
.menu button.danger:hover { background: var(--danger-soft); }

.layout { flex: 1; display: flex; min-height: 0; }

.sidebar {
  width: var(--sidebar-w);
  flex: none;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
#nav { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background .14s, color .14s;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); }
.nav-badge {
  margin-left: auto;
  min-width: 19px;
  height: 19px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 19px;
  text-align: center;
  flex: none;
}
.nav-item.active .nav-badge { background: var(--danger); }

/* ---------- 提醒筛选标签 ---------- */
.tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px;
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .14s, border-color .14s, color .14s;
}
.tab:hover { border-color: var(--primary); color: var(--text); }
.tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.tab .n {
  font-size: 11.5px;
  font-weight: 700;
  padding: 0 6px;
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--text-2);
  min-width: 18px;
  text-align: center;
}
.tab.active .n { background: rgba(255,255,255,.24); color: #fff; }
.tab.danger:not(.active) { border-color: var(--danger); color: var(--danger); }
.tab.danger:not(.active) .n { background: var(--danger-soft); color: var(--danger); }

.due {
  display: inline-flex;
  flex-direction: column;
  line-height: 1.35;
}
.due .d1 { font-weight: 600; font-size: 13px; }
.due .d2 { font-size: 11.5px; }
.due-overdue .d1, .due-overdue .d2 { color: var(--danger); }
.due-today .d1, .due-today .d2 { color: var(--warn); }
.due-soon .d1 { color: var(--text-2); }
.due-soon .d2 { color: var(--muted); }
.due-later .d1 { color: var(--text-2); }
.due-later .d2 { color: var(--muted); }

.rem-alert {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13.5px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.rem-alert.warn { border-color: var(--warn); background: #fff6e6; color: #a35b00; }
html[data-theme="dark"] .rem-alert.warn { background: #3a2c14; border-color: #6b5527; color: #e5a04a; }
.rem-alert strong { font-weight: 700; }
.rem-alert .grow { flex: 1; min-width: 140px; }

.sidebar-foot { font-size: 12px; padding: 10px 12px 4px; }

.main { flex: 1; min-width: 0; overflow: auto; padding: 20px 22px 40px; }

.scrim {
  position: fixed;
  inset: 0;
  background: rgba(10, 18, 34, .45);
  z-index: 40;
}

.only-mobile { display: none; }

/* ---------- 页头 ---------- */
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.page-head h2 { font-size: 19px; }
.page-head .sub { font-size: 13px; color: var(--muted); margin-top: 3px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 18px; }
.card-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.card-head h3 { font-size: 14.5px; }

/* ---------- 工具条 ---------- */
.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.toolbar .search { flex: 1; min-width: 190px; position: relative; }
.toolbar .search input { padding-left: 33px; }
.toolbar .search svg {
  position: absolute;
  left: 11px; top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.toolbar select { width: auto; min-width: 116px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  text-align: left;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  text-transform: none;
}
tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr.clickable { cursor: pointer; transition: background .12s; }
tbody tr.clickable:hover { background: var(--surface-2); }
.td-name { font-weight: 600; }
.td-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.td-actions { text-align: right; white-space: nowrap; }
.empty {
  padding: 52px 20px;
  text-align: center;
  color: var(--muted);
}
.empty svg { opacity: .4; margin-bottom: 10px; }
.empty p { margin: 0 0 14px; font-size: 13.5px; }

/* ---------- 状态徽标 ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge::before {
  content: "";
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
}
.badge-gray   { background: #eef1f6; color: #5a6a80; }
.badge-blue   { background: #e6efff; color: #2560d8; }
.badge-red    { background: #fdeceb; color: #c9382f; }
.badge-green  { background: #e5f7ef; color: #0d8a58; }
.badge-amber  { background: #fff4e2; color: #a96411; }
.badge-purple { background: #f0eaff; color: #6b46d6; }
html[data-theme="dark"] .badge-gray  { background: #23304a; color: #9fb0c8; }
html[data-theme="dark"] .badge-blue  { background: #1b2c4d; color: #7ea9fb; }
html[data-theme="dark"] .badge-red   { background: #3a2022; color: #f0817a; }
html[data-theme="dark"] .badge-green { background: #14332a; color: #4fd39d; }
html[data-theme="dark"] .badge-amber { background: #3a2c14; color: #e5a04a; }
html[data-theme="dark"] .badge-purple{ background: #2a2145; color: #a98af0; }

.chip {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--text-2);
  margin: 0 4px 4px 0;
}

/* 自动生成的项目编号 */
.code-chip {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 11.5px;
  color: var(--text-2);
  white-space: nowrap;
}

/* ---------- 统计卡片 ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 17px;
  box-shadow: var(--shadow-sm);
}
.stat .k { font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.stat .v { font-size: 27px; font-weight: 700; margin-top: 6px; letter-spacing: -.02em; }
.stat .d { font-size: 12px; color: var(--muted); margin-top: 2px; }

.bar-list { display: flex; flex-direction: column; gap: 13px; }
.bar-row { display: flex; align-items: center; gap: 12px; }
.bar-row .label { width: 84px; flex: none; font-size: 13px; }
.bar-track {
  flex: 1;
  height: 9px;
  border-radius: 6px;
  background: var(--surface-2);
  overflow: hidden;
  border: 1px solid var(--border);
}
.bar-fill { height: 100%; border-radius: 6px; transition: width .5s cubic-bezier(.2,.8,.3,1); }
.bar-row .num { width: 46px; text-align: right; font-size: 13px; font-weight: 600; flex: none; }

/* ---------- 抽屉 ---------- */
.drawer-scrim {
  position: fixed;
  inset: 0;
  background: rgba(10, 18, 34, .42);
  z-index: 70;
  opacity: 0;
  animation: fadeIn .16s ease forwards;
}
.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(560px, 100vw);
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  z-index: 71;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  animation: slideIn .22s cubic-bezier(.22,.85,.3,1) forwards;
}
@keyframes slideIn { to { transform: translateX(0); } }
@keyframes fadeIn { to { opacity: 1; } }
.drawer-head {
  flex: none;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.drawer-head h3 { font-size: 16px; }
.drawer-body { flex: 1; overflow: auto; padding: 18px 20px 26px; }

.kv { display: grid; grid-template-columns: 82px 1fr; gap: 9px 14px; font-size: 13.5px; }
.kv dt { color: var(--text-2); font-size: 12.5px; }
.kv dd { margin: 0; word-break: break-word; }

.section-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  margin: 22px 0 12px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ---------- 时间线 ---------- */
.timeline { position: relative; padding-left: 22px; }
.timeline::before {
  content: "";
  position: absolute;
  left: 5px; top: 7px; bottom: 7px;
  width: 2px;
  background: var(--border);
}
.tl-item { position: relative; padding-bottom: 20px; }
.tl-item:last-child { padding-bottom: 2px; }
.tl-item::before {
  content: "";
  position: absolute;
  left: -21px; top: 5px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--surface);
  border: 2.5px solid var(--primary);
}
.tl-meta {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 5px;
}
.tl-user { font-weight: 600; color: var(--text-2); }
.tl-content {
  font-size: 13.5px;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.tl-tags { margin-top: 7px; display: flex; flex-wrap: wrap; gap: 5px; font-size: 11.5px; }
.tl-actions { margin-top: 6px; display: flex; gap: 6px; }

/* ---------- 模态框 ---------- */
.modal-scrim {
  position: fixed;
  inset: 0;
  background: rgba(10, 18, 34, .5);
  z-index: 90;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 18px;
  overflow: auto;
  animation: fadeIn .16s ease forwards;
  opacity: 0;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 100%;
  max-width: 540px;
  box-shadow: var(--shadow-lg);
  animation: popIn .2s cubic-bezier(.22,.85,.3,1) forwards;
  transform: scale(.96);
  margin: auto;
}
.modal.wide { max-width: 720px; }
@keyframes popIn { to { transform: scale(1); } }
.modal-head {
  padding: 17px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.modal-head h3 { font-size: 16px; }
.modal-body { padding: 20px; }
.modal-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  background: var(--surface-2);
  border-radius: 0 0 14px 14px;
}

/* ---------- 地图 ---------- */
.map-shell {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.map-canvas { width: 100%; height: 520px; }
.map-canvas.picker { height: 300px; }
.map-placeholder {
  height: 100%;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
  text-align: center;
  padding: 28px;
}
.map-placeholder strong { color: var(--text-2); font-size: 13.5px; }
.map-placeholder p { margin: 0; font-size: 12.5px; max-width: 340px; }

.coord-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-2);
  padding: 9px 12px;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.coord-line code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 7px;
}

/* ---------- Leaflet 主题适配 ---------- */
/* 注意：leaflet.css 在 <head> 中先于本文件加载，故此处覆盖可生效 */
.pt-marker { background: none; border: none; }

.leaflet-container {
  background: var(--surface-2);
  font-family: inherit;
  font-size: 12.5px;
}
.leaflet-popup-content-wrapper {
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}
.leaflet-popup-tip { background: var(--surface); }
.leaflet-popup-content { margin: 11px 14px; line-height: 1.6; }
.leaflet-container a.leaflet-popup-close-button { color: var(--text-3); }
.pt-pop-sub { color: var(--text-2); font-size: 11.5px; }

.leaflet-bar a,
.leaflet-bar a:hover {
  background: var(--surface);
  color: var(--text);
  border-bottom-color: var(--border);
}
.leaflet-bar a:hover { background: var(--surface-2); }
.leaflet-bar { border-color: var(--border-strong); }

.leaflet-control-attribution {
  background: rgba(255, 255, 255, .85) !important;
  color: var(--text-2);
  font-size: 10.5px;
  padding: 1px 6px;
}
.leaflet-control-attribution a { color: var(--primary); }
html[data-theme="dark"] .leaflet-control-attribution {
  background: rgba(15, 23, 42, .85) !important;
}

/* ---------- Toast ---------- */
.toast-root {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 9px;
  align-items: center;
  pointer-events: none;
}
.toast {
  padding: 10px 17px;
  border-radius: 9px;
  background: #1d283c;
  color: #fff;
  font-size: 13.5px;
  box-shadow: var(--shadow-lg);
  animation: toastIn .22s cubic-bezier(.22,.85,.3,1);
  max-width: 88vw;
}
.toast.ok { background: #12805a; }
.toast.err { background: #b8382f; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } }

/* ---------- 加载 ---------- */
.spinner {
  width: 15px; height: 15px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading { padding: 46px; text-align: center; color: var(--muted); font-size: 13.5px; }

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
  .only-mobile { display: inline-flex; }
  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0; bottom: 0;
    z-index: 45;
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: var(--shadow-lg);
    width: 232px;
  }
  .sidebar.open { transform: translateX(0); }
  .main { padding: 16px 14px 40px; }
  .app-title { display: none; }
  .user-name { display: none; }
  .map-canvas { height: 400px; }
  .kv { grid-template-columns: 1fr; gap: 3px 0; }
  .kv dt { margin-top: 8px; }
  .drawer { width: 100vw; }
  .stat-grid { grid-template-columns: repeat(auto-fit, minmax(136px, 1fr)); gap: 10px; }
  .stat .v { font-size: 23px; }
}
