:root {
  --blue: #1e90ff;
  --blue-soft: #e8f2ff;
  --green: #1faa59;
  --bg: #f3f6fb;
  --panel: #eef3f9;
  --text: #1a1a1a;
  --gray: #8a94a6;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg); color: var(--text);
}
.app {
  max-width: 480px; margin: 0 auto; background: #fff; min-height: 100vh;
  display: flex; flex-direction: column; box-shadow: 0 0 20px rgba(0,0,0,.06);
}

/* 状态栏 */
.status-bar { background: #fff; padding: 12px 16px; border-bottom: 1px solid #eef0f4; }
.status-bar .row { display: flex; align-items: center; justify-content: space-between; margin: 4px 0; }
.title { font-size: 18px; font-weight: 700; color: #111; }
.update-time { font-size: 12px; color: var(--blue); }
.device-state { font-size: 13px; color: var(--blue); }
.pills { display: flex; gap: 6px; }
.pill {
  font-size: 11px; padding: 3px 9px; border-radius: 999px; background: var(--blue-soft);
  color: var(--blue); white-space: nowrap;
}
.pill-mqtt { background: #e6f7ee; color: var(--green); display: flex; align-items: center; gap: 4px; }
.pill-mqtt .dot { width: 6px; height: 6px; border-radius: 50%; background: #2ecc71; display: inline-block; }
.pill.off { background: #f0f0f0; color: #999; }
.mode { font-size: 13px; color: #555; }
.switch { font-size: 13px; color: var(--blue); text-decoration: none; }

/* 地图 */
.map-wrap { position: relative; flex: 1; min-height: 360px; }
#map { position: absolute; inset: 0; }
.map-fab { position: absolute; right: 14px; bottom: 14px; display: flex; flex-direction: column; gap: 10px; z-index: 500; }
.fab {
  width: 44px; height: 44px; border-radius: 50%; border: none; background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.18); color: var(--blue); font-size: 20px; cursor: pointer;
}
.fab:active { transform: scale(.94); }

/* 车辆 marker */
.car-marker { width: 26px; height: 34px; }
.car-marker svg { width: 100%; height: 100%; filter: drop-shadow(0 2px 3px rgba(0,0,0,.3)); }

/* 功能栏 */
.func-bar { display: flex; background: #fff; border-top: 1px solid #eef0f4; }
.func {
  flex: 1; border: none; background: #fff; padding: 10px 0; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--blue);
}
.func .ic { font-size: 20px; }
.func span:last-child { font-size: 12px; }
.func:active { background: var(--blue-soft); }

/* 防盗面板 */
.panel { background: var(--panel); margin: 8px; border-radius: 14px; padding: 12px; }
.panel-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.panel-head .bar { width: 4px; height: 16px; background: var(--blue); border-radius: 2px; }
.panel-title { font-weight: 700; font-size: 15px; }
.panel-head .sync { margin-left: auto; font-size: 12px; color: var(--gray); }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ctrl {
  background: #fff; border: 1px solid #e3e8ef; border-radius: 12px; padding: 14px 0;
  display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer;
  color: #333; font-size: 13px;
}
.ctrl .ic { font-size: 22px; }
.ctrl:active { background: var(--blue-soft); border-color: var(--blue); }
.ctrl.active { background: var(--blue); color: #fff; border-color: var(--blue); }

/* Toast */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 90px;
  background: rgba(0,0,0,.8); color: #fff; padding: 8px 16px; border-radius: 8px;
  font-size: 13px; opacity: 0; transition: opacity .25s; pointer-events: none; z-index: 999;
}
.toast.show { opacity: 1; }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: flex-end; z-index: 1000; }
.modal[hidden] { display: none; }
.modal-card { background: #fff; width: 100%; max-width: 480px; margin: 0 auto; border-radius: 16px 16px 0 0; padding: 16px; max-height: 70vh; overflow: auto; }
.modal-head { display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 16px; margin-bottom: 12px; }
.modal-head .close { border: none; background: none; font-size: 24px; line-height: 1; cursor: pointer; color: #888; }
.log-list { list-style: none; margin: 0; padding: 0; }
.log-list li { padding: 10px; border-bottom: 1px solid #f0f0f0; font-size: 13px; }
.log-list .t { color: var(--gray); font-size: 11px; }
.log-list .badge { display: inline-block; padding: 1px 6px; border-radius: 4px; background: #ffe9e9; color: #d33; font-size: 11px; margin-right: 6px; }
.set-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid #f0f0f0; }
.set-row label { font-size: 14px; }
.set-row input, .set-row select { padding: 6px 8px; border: 1px solid #d9dee6; border-radius: 8px; width: 140px; }
.save { width: 100%; margin-top: 14px; padding: 12px; border: none; border-radius: 10px; background: var(--blue); color: #fff; font-size: 15px; cursor: pointer; }
