/* ============ 汪汪星球 · 管理后台设计系统 v2 ============ */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --ink: #14182A; --ink-2: #5A6072; --muted: #9BA1B1;
  --amber: #F59E0B; --amber-soft: #FFF4E0;
  --line: #ECEDF2; --bg: #F6F7F9; --card: #FFFFFF;
  --danger: #E5484D; --ok: #2F9E44;
  --r-sm: 10px; --r-md: 14px; --r-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(16,24,40,.05), 0 2px 8px rgba(16,24,40,.05);
  --shadow-md: 0 4px 20px rgba(16,24,40,.08);
}
html, body { height: 100%; font-family: -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif; background: var(--bg); color: var(--ink); }
button { font-family: inherit; cursor: pointer; }
svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.panel.active { animation: fadeUp .28s ease; }

/* 登录 */
.login-overlay { position: fixed; inset: 0; z-index: 2000; background: rgba(20,24,42,.55); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; }
.login-box { background: #fff; border-radius: var(--r-lg); padding: 32px 28px; width: 320px; box-shadow: var(--shadow-md); text-align: center; }
.login-title { font-size: 20px; font-weight: 800; }
.login-sub { font-size: 13px; color: var(--muted); margin: 6px 0 20px; }
.login-input { width: 100%; padding: 11px 13px; margin-bottom: 12px; border: 1.5px solid var(--line); border-radius: var(--r-sm); font-size: 14px; outline: none; background: var(--bg); }
.login-input:focus { border-color: var(--amber); background: #fff; }
.login-btn { width: 100%; padding: 12px; font-size: 15px; border-radius: var(--r-sm); }
.login-error { color: var(--danger); font-size: 13px; margin-top: 10px; min-height: 18px; }

/* 框架 */
#shell { height: 100vh; display: flex; }
.side { width: 220px; min-width: 220px; background: var(--card); border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.side-brand { display: flex; align-items: center; gap: 8px; padding: 20px; font-size: 16px; font-weight: 800; }
.side-tag { font-size: 10px; color: var(--muted); background: var(--bg); padding: 3px 8px; border-radius: 999px; font-weight: 600; }
.side-nav { flex: 1; padding: 6px 10px; }
.side-item { display: flex; align-items: center; width: 100%; padding: 11px 14px; margin-bottom: 4px; border: none; background: none; border-radius: var(--r-sm); font-size: 14px; color: var(--ink-2); font-weight: 600; transition: all .18s; }
.side-item:hover { background: var(--bg); color: var(--ink); }
.side-item.active { background: var(--amber-soft); color: #8A5A00; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-top: 1px solid var(--line); }
.side-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--amber-soft); display: flex; align-items: center; justify-content: center; }
.side-user-info { flex: 1; min-width: 0; }
.side-user-info b { display: block; font-size: 13px; }
.side-user-info span { font-size: 11px; color: var(--muted); }
.side-exit { background: none; border: none; color: var(--muted); padding: 6px; border-radius: 8px; }
.side-exit:hover { color: var(--danger); background: #FDECEC; }

.content { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.content-top { display: flex; align-items: center; gap: 14px; padding: 18px 24px 12px; }
.content-top h1 { font-size: 19px; font-weight: 800; }
.content-hint { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); display: inline-block; }
.dot.on { background: var(--ok); }
.dot.off { background: var(--danger); }
.link-btn { color: var(--ink-2); text-decoration: none; font-size: 13px; padding: 7px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); transition: all .18s; }
.link-btn:hover { color: var(--ink); border-color: var(--amber); }
.btn { background: var(--bg); color: var(--ink-2); border: 1px solid var(--line); padding: 8px 16px; border-radius: var(--r-sm); font-size: 13px; transition: all .18s; }
.btn:hover { border-color: var(--amber); color: var(--ink); }
.btn.primary { background: var(--ink); border: none; color: #fff; font-weight: 600; }
.btn.primary:hover { background: #2A2F45; }

.panel { display: none; flex: 1; overflow-y: auto; padding: 0 24px 24px; }
.panel.active { display: block; }
.panel-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 8px; }
.panel-head .btn { flex-shrink: 0; margin-top: 16px; }
.list-title { font-size: 13px; color: var(--muted); font-weight: 700; letter-spacing: 1px; padding: 14px 0 8px; }
.panel-body { display: flex; flex-direction: column; gap: 10px; }

/* 统计 */
.stat-cards { display: flex; gap: 12px; flex-wrap: wrap; flex: 1; }
.stat-card { flex: 1; min-width: 100px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 16px; box-shadow: var(--shadow-sm); }
.stat-card b { font-size: 24px; display: block; color: var(--ink); }
.stat-card span { font-size: 12px; color: var(--muted); }

/* 列表项 */
.list-item { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); padding: 13px 16px; display: flex; justify-content: space-between; align-items: center; box-shadow: var(--shadow-sm); animation: fadeUp .25s ease; }
.list-item .info { font-size: 14px; font-weight: 600; }
.list-item .sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.mini-btn { background: var(--bg); border: 1px solid var(--line); color: var(--ink-2); border-radius: 8px; padding: 6px 13px; font-size: 12px; transition: all .15s; }
.mini-btn:hover { border-color: var(--amber); color: var(--ink); }
.mini-btn.danger:hover { background: #FDECEC; color: var(--danger); border-color: #F5C2C4; }
.mini-btn.warn:hover { background: var(--amber-soft); color: #8A5A00; }

/* 设备管理(沿用地图) */
.layout { display: flex; height: 100%; }
.sidebar { width: 280px; min-width: 280px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); display: flex; flex-direction: column; overflow-y: auto; padding: 12px; }
.sidebar-title { font-size: 12px; font-weight: 700; color: var(--muted); margin: 8px 0 6px; letter-spacing: 1px; }
.track-title { margin-top: 16px; }
.track-controls { display: flex; flex-direction: column; gap: 8px; }
.track-controls select { padding: 9px; border: 1.5px solid var(--line); border-radius: var(--r-sm); font-size: 13px; background: var(--bg); outline: none; }
.device-list { display: flex; flex-direction: column; gap: 8px; }
.device-item { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 11px 13px; cursor: pointer; transition: all .15s; }
.device-item:hover { box-shadow: var(--shadow-sm); }
.device-item.active { border-color: var(--amber); box-shadow: 0 0 0 2px rgba(245,158,11,.15); }
.device-item .name { font-size: 14px; font-weight: 700; display: flex; justify-content: space-between; }
.device-item .meta { font-size: 11px; color: var(--ink-2); margin-top: 4px; display: flex; justify-content: space-between; }
.device-item .last-time { font-size: 10px; color: var(--muted); margin-top: 3px; }
.device-item .ops { display: flex; gap: 5px; margin-top: 8px; flex-wrap: wrap; }
.device-item .op { flex: 1; background: var(--bg); border: 1px solid var(--line); border-radius: 7px; padding: 5px 0; font-size: 11px; color: var(--ink-2); }
.device-item .op:hover { border-color: var(--amber); }
.device-item .del { background: none; border: none; color: var(--muted); cursor: pointer; }
.device-item .del:hover { color: var(--danger); }
.device-item .row { display: flex; align-items: center; justify-content: space-between; }
.badge-online { color: var(--ok); }
.badge-offline { color: var(--danger); }
.map-wrap { flex: 1; position: relative; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; margin-left: 12px; }
#map { width: 100%; height: 100%; }
.pet-marker { width: 20px; height: 20px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.35); }
.pet-marker.online { background: #2563EB; }
.pet-marker.offline { background: var(--muted); }
.empty { color: var(--muted); font-size: 13px; text-align: center; padding: 24px 0; }

/* 出圈告警 + 回放条 */
.alert-bar { position: fixed; top: 60px; left: 50%; transform: translateX(-50%); z-index: 1500; background: var(--danger); color: #fff; font-weight: 700; padding: 10px 24px; border-radius: 999px; box-shadow: 0 10px 30px rgba(229,72,77,.4); cursor: pointer; font-size: 14px; animation: fadeUp .3s ease; }
.player-bar { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 1400; background: var(--ink); color: #fff; display: flex; align-items: center; gap: 10px; padding: 8px 18px; border-radius: 999px; box-shadow: var(--shadow-md); font-size: 13px; }
.player-bar #player-label { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 弹窗/表单 */
.modal { position: fixed; inset: 0; background: rgba(20,24,42,.5); z-index: 2000; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(3px); }
.modal-box { background: #fff; border-radius: var(--r-lg); padding: 24px; width: 90%; max-width: 380px; }
.modal-box h3 { margin-bottom: 14px; }
.auth-input { width: 100%; padding: 11px 13px; margin-bottom: 10px; border: 1.5px solid var(--line); border-radius: var(--r-sm); font-size: 14px; outline: none; background: var(--bg); }
.auth-input:focus { border-color: var(--amber); background: #fff; }
.ghost-btn { width: 100%; background: var(--bg); color: var(--ink-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px; font-size: 14px; margin-top: 8px; }

/* 版本发布 */
.version-form { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); padding: 18px; max-width: 480px; box-shadow: var(--shadow-sm); }
.pick-file { display: inline-flex; align-items: center; gap: 8px; width: 100%; padding: 12px; border: 1.5px dashed var(--line); border-radius: var(--r-sm); color: var(--ink-2); font-size: 13px; cursor: pointer; margin-bottom: 12px; transition: border .2s; }
.pick-file:hover { border-color: var(--amber); }
.form-msg { font-size: 13px; margin-top: 10px; min-height: 18px; }
.form-msg.ok { color: var(--ok); }
.form-msg.err { color: var(--danger); }

@media (max-width: 820px) {
  .side { display: none; }
  #shell { flex-direction: column; }
  .panel { padding: 0 14px 24px; }
  .layout { flex-direction: column; height: auto; }
  .sidebar { width: 100%; min-width: 0; max-height: 40vh; }
  .map-wrap { height: 50vh; margin-left: 0; margin-top: 12px; }
}

/* ============ 全局 Toast 提示 ============ */
#toast-wrap{position:fixed;top:18px;left:50%;transform:translateX(-50%);z-index:99999;display:flex;flex-direction:column;gap:8px;align-items:center;pointer-events:none;max-width:92vw}
.toast{background:#1f2937;color:#fff;padding:10px 18px;border-radius:12px;font-size:14px;line-height:1.5;box-shadow:0 8px 24px rgba(0,0,0,.18);animation:toastIn .25s ease;max-width:88vw;text-align:center;word-break:break-all}
.toast-success{background:#16a34a}
.toast-error{background:#dc2626}
.toast-info{background:#1f2937}
.toast.hide{opacity:0;transform:translateY(-10px);transition:all .3s ease}
@keyframes toastIn{from{opacity:0;transform:translateY(-12px)}to{opacity:1;transform:translateY(0)}}
