/* ============================================================
 *  i茅台控制台 · 统一设计系统 (theme.css)
 *  配色：靛蓝/紫 主色 + 翠绿/玫红/琥珀 强调；石板灰中性色
 *  图标：Bootstrap Icons（jsDelivr CDN：bootstrap-icons@1.11.3/font/bootstrap-icons.css，含字体由 CDN 相对路径加载，不落本机）
 *  动画：Vue <Transition>/<TransitionGroup> 过渡类 + 关键帧
 * ============================================================ */

:root {
  --primary: #6366f1;
  --primary-600: #4f46e5;
  --primary-700: #4338ca;
  --primary-50: #eef2ff;
  --violet: #8b5cf6;

  --bg: #f1f5f9;
  --bg-grad: radial-gradient(1200px 600px at 15% -10%, #e0e7ff 0%, transparent 55%),
             radial-gradient(1000px 500px at 110% 10%, #f3e8ff 0%, transparent 50%),
             linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f5f9;
  --border: #e6e9f0;
  --border-strong: #d4d9e4;

  --text: #0f172a;
  --text-2: #334155;
  --text-muted: #64748b;
  --text-faint: #94a3b8;

  --success: #10b981;
  --success-600: #059669;
  --success-bg: #ecfdf5;
  --danger: #f43f5e;
  --danger-600: #e11d48;
  --danger-bg: #fff1f3;
  --warning: #f59e0b;
  --warning-600: #d97706;
  --warning-bg: #fffbeb;
  --info: #0ea5e9;
  --info-600: #0284c7;
  --info-bg: #ecfeff;

  --radius: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --radius-pill: 999px;

  --shadow: 0 1px 2px rgba(15, 21, 42, .06), 0 18px 40px -18px rgba(79, 70, 229, .35);
  --shadow-sm: 0 1px 2px rgba(15, 21, 42, .06), 0 8px 20px -12px rgba(15, 21, 42, .18);
  --shadow-pop: 0 10px 30px -10px rgba(15, 21, 42, .35);

  --ease: cubic-bezier(.22, 1, .36, 1);
  --font: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg-grad);
  background-attachment: fixed;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
a { color: var(--primary-600); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
::selection { background: var(--primary-50); color: var(--primary-700); }

/* ===================== 按钮 ===================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 9px 16px; font-size: 14px; font-weight: 600; color: #fff;
  background: var(--primary); transition: transform .15s var(--ease), box-shadow .2s, filter .2s, background .2s;
  box-shadow: 0 6px 16px -8px rgba(99, 102, 241, .6);
}
.btn:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; filter: none; }
.btn .bi { font-size: 1.05em; }
.btn-primary { background: linear-gradient(135deg, var(--primary) 0%, var(--violet) 100%); }
.btn-secondary { background: #fff; color: var(--text-2); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { border-color: var(--primary); color: var(--primary-700); }
.btn-success { background: linear-gradient(135deg, #34d399 0%, var(--success-600) 100%); box-shadow: 0 6px 16px -8px rgba(16, 185, 129, .6); }
.btn-danger { background: linear-gradient(135deg, #fb7185 0%, var(--danger-600) 100%); box-shadow: 0 6px 16px -8px rgba(244, 63, 94, .6); }
.btn-ghost { background: transparent; color: var(--text-muted); box-shadow: none; }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 9px; }
.btn-lg { padding: 12px 22px; font-size: 15px; border-radius: 12px; }

/* ===================== 表单控件 ===================== */
input[type="text"], input[type="password"], input[type="number"], input[type="search"], input[type="time"],
select, textarea {
  width: 100%; padding: 10px 13px; font-size: 14px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  transition: border-color .18s, box-shadow .18s; outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, .14);
}
input:disabled, select:disabled { background: var(--surface-3); color: var(--text-faint); cursor: not-allowed; }
label { font-size: 13px; color: var(--text-muted); font-weight: 600; }

/* ===================== 卡片 ===================== */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}

/* ===================== 表格 ===================== */
.table-wrap { overflow: auto; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-sm); }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data-table thead th {
  position: sticky; top: 0; z-index: 2; text-align: left; padding: 14px 16px;
  font-size: 12px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
  color: var(--text-muted); background: linear-gradient(180deg, #fbfcfe, #f4f6fb);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.data-table tbody td { padding: 13px 16px; border-bottom: 1px solid #f1f3f8; color: var(--text-2); vertical-align: middle; }
table.data-table tbody tr { transition: background .15s; }
table.data-table tbody tr:hover { background: var(--primary-50); }
table.data-table tbody tr:last-child td { border-bottom: none; }

/* ===================== 徽标 / 标签 ===================== */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: var(--radius-pill); font-size: 12px; font-weight: 600; }
.badge-success { background: var(--success-bg); color: var(--success-600); }
.badge-danger { background: var(--danger-bg); color: var(--danger-600); }
.badge-warning { background: var(--warning-bg); color: var(--warning-600); }
.badge-info { background: var(--info-bg); color: var(--info-600); }
.badge-muted { background: var(--surface-3); color: var(--text-muted); }
.device-tag, .product-tag { display: inline-block; padding: 1px 7px; margin-left: 6px; font-size: 11.5px; border-radius: var(--radius-pill); background: var(--surface-3); color: var(--text-faint); font-family: ui-monospace, Menlo, Consolas, monospace; }
.quantity-badge { display: inline-flex; min-width: 26px; justify-content: center; padding: 2px 9px; border-radius: var(--radius-pill); background: linear-gradient(135deg, var(--primary) 0%, var(--violet) 100%); color: #fff; font-weight: 700; font-size: 12.5px; }

/* ===================== 空状态 ===================== */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 60px 20px; color: var(--text-faint); text-align: center; }
.empty-state .icon { font-size: 44px; opacity: .5; }
.empty-state h3 { color: var(--text-muted); font-size: 16px; }
.empty-state p { margin: 0; font-size: 13px; }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 50px; color: var(--text-muted); font-size: 14px; }
.loading::before { content: ""; width: 18px; height: 18px; border: 2.5px solid var(--border-strong); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; }

/* ===================== Toast ===================== */
.toast-container { position: fixed; right: 20px; bottom: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; max-width: 360px; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-pop);
  border: 1px solid var(--border); border-left: 4px solid var(--primary); font-size: 13.5px;
}
.toast .bi { font-size: 17px; }
.toast .msg { flex: 1; }
.toast .close-btn { border: none; background: none; color: var(--text-faint); font-size: 14px; cursor: pointer; padding: 2px 4px; border-radius: 6px; }
.toast .close-btn:hover { background: var(--surface-3); color: var(--text); }
.toast.success { border-left-color: var(--success); } .toast.success .bi { color: var(--success); }
.toast.error { border-left-color: var(--danger); } .toast.error .bi { color: var(--danger); }
.toast.warning { border-left-color: var(--warning); } .toast.warning .bi { color: var(--warning); }
.toast.info { border-left-color: var(--info); } .toast.info .bi { color: var(--info); }

/* ===================== 模态框 ===================== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center;
  background: rgba(15, 23, 42, .45); backdrop-filter: blur(4px); padding: 20px;
}
.modal {
  width: min(560px, 100%); max-height: 88vh; overflow: auto; background: var(--surface);
  border-radius: var(--radius); box-shadow: var(--shadow-pop); padding: 26px;
}
.modal h2 { font-size: 19px; margin-bottom: 18px; display: flex; align-items: center; gap: 9px; }
.modal h2 .bi { color: var(--primary); }
.form-row { margin-bottom: 15px; display: flex; flex-direction: column; gap: 6px; }
.form-row .hint { font-size: 12px; color: var(--text-faint); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

/* ===================== 关键帧动画 ===================== */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse-online {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, .5); }
  70% { box-shadow: 0 0 0 7px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-7px); }
  40%, 80% { transform: translateX(7px); }
}
@keyframes float-y { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

/* ===================== Vue 过渡（全局） ===================== */
/* 淡入淡出 */
.fade-enter-active, .fade-leave-active { transition: opacity .25s var(--ease); }
.fade-enter-from, .fade-leave-to { opacity: 0; }

/* 上浮淡入（登录卡片等） */
.fade-up-enter-active { transition: opacity .5s var(--ease), transform .5s var(--ease); }
.fade-up-leave-active { transition: opacity .2s, transform .2s; }
.fade-up-enter-from { opacity: 0; transform: translateY(24px) scale(.98); }
.fade-up-leave-to { opacity: 0; transform: translateY(-10px); }

/* 列表项进出（设备卡 / 表格行 / 记录） */
.list-enter-active, .list-leave-active { transition: opacity .4s var(--ease), transform .4s var(--ease); }
.list-enter-from { opacity: 0; transform: translateY(14px) scale(.97); }
.list-leave-to { opacity: 0; transform: scale(.94); }

/* 右侧滑入面板（IP统计 / 批量 / 调度） */
.slide-enter-active, .slide-leave-active { transition: opacity .28s var(--ease), transform .28s var(--ease); }
.slide-enter-from, .slide-leave-to { opacity: 0; transform: translateX(24px); }

/* Toast 进出 */
.toast-enter-active, .toast-leave-active { transition: opacity .3s var(--ease), transform .3s var(--ease); }
.toast-enter-from, .toast-leave-to { opacity: 0; transform: translateX(30px); }

/* 模态框缩放 */
.modal-enter-active, .modal-leave-active { transition: opacity .25s var(--ease); }
.modal-enter-active .modal, .modal-leave-active .modal { transition: transform .3s var(--ease); }
.modal-enter-from, .modal-leave-to { opacity: 0; }
.modal-enter-from .modal, .modal-leave-to .modal { transform: translateY(20px) scale(.96); }

/* ============================================================
 *  登录页 (login.html)
 * ============================================================ */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card {
  width: min(400px, 100%); background: var(--surface); border-radius: 24px; box-shadow: var(--shadow);
  padding: 40px 34px; border: 1px solid var(--border);
}
.login-logo {
  width: 76px; height: 76px; margin: 0 auto 18px; display: grid; place-items: center;
  border-radius: 22px; font-size: 38px; color: #fff;
  background: linear-gradient(135deg, var(--primary) 0%, var(--violet) 100%);
  box-shadow: 0 14px 30px -10px rgba(99, 102, 241, .6); animation: float-y 4s ease-in-out infinite;
}
.login-card h1 { text-align: center; font-size: 23px; }
.login-sub { text-align: center; color: var(--text-muted); margin: 6px 0 26px; font-size: 13.5px; }
.login-form { display: grid; grid-template-columns: max-content 1fr; column-gap: 16px; row-gap: 16px; align-items: center; }
.login-form label { display: block; text-align: right; }
.login-form label .bi { color: var(--primary); }
.login-input-wrap { position: relative; }
.login-form button { grid-column: 1 / -1; margin-top: 8px; }
.login-input-wrap .bi { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-faint); }
.login-form input { padding-left: 38px; height: 46px; }
.login-btn {
  margin-top: 22px; height: 48px; width: 100%; border: none; border-radius: 12px; color: #fff;
  font-size: 16px; font-weight: 700; background: linear-gradient(135deg, var(--primary) 0%, var(--violet) 100%);
  box-shadow: 0 12px 26px -10px rgba(99, 102, 241, .65); transition: transform .15s var(--ease), filter .2s;
}
.login-btn:hover:not(:disabled) { filter: brightness(1.05); transform: translateY(-1px); }
.login-btn:disabled { opacity: .6; cursor: progress; }
.login-error { color: var(--danger-600); font-size: 13px; text-align: center; min-height: 20px; margin-top: 14px; }
.login-error.shake { animation: shake .4s; }
.login-hint { text-align: center; color: var(--text-faint); font-size: 12px; margin-top: 10px; }
.login-toggle { text-align: center; color: var(--text-faint); font-size: 13px; margin-top: 14px; cursor: pointer; user-select: none; }
.login-toggle a { color: var(--primary); font-weight: 700; cursor: pointer; }

/* ============================================================
 *  主控框架 (index.html) — 侧边栏 + iframe
 * ============================================================ */
.app { display: flex; height: 100vh; overflow: hidden; }
.sidebar {
  width: 248px; flex-shrink: 0; display: flex; flex-direction: column;
  background: linear-gradient(180deg, #1e1b4b 0%, #312e81 55%, #4338ca 100%);
  color: #e0e2ff; transition: width .3s var(--ease); position: relative; z-index: 5;
}
.sidebar.collapsed { width: 76px; }
.sidebar-header { display: flex; align-items: center; gap: 10px; padding: 20px 18px; }
.sidebar-header .logo-text { font-size: 17px; font-weight: 800; letter-spacing: .02em; white-space: nowrap; }
.sidebar-header .logo-text small { font-size: 11px; font-weight: 500; opacity: .6; }
.sidebar.collapsed .logo-text { display: none; }
.toggle-btn {
  margin-left: auto; width: 30px; height: 30px; border: none; border-radius: 9px; color: #c7d2fe;
  background: rgba(255, 255, 255, .08); font-size: 14px; transition: background .2s;
}
.toggle-btn:hover { background: rgba(255, 255, 255, .16); }
.sidebar.collapsed .toggle-btn { margin-left: 0; }

.sidebar-nav { display: flex; flex-direction: column; gap: 4px; padding: 8px 12px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: none; border-radius: 12px;
  background: transparent; color: #c7d2fe; font-size: 14.5px; font-weight: 600; text-align: left;
  transition: background .2s, color .2s; position: relative; white-space: nowrap;
}
.nav-item .bi { font-size: 19px; flex-shrink: 0; }
.nav-item:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nav-item.active { background: rgba(255, 255, 255, .14); color: #fff; }
.nav-item.active::before { content: ""; position: absolute; left: 0; top: 18%; bottom: 18%; width: 4px; border-radius: 4px; background: #fff; }
.sidebar.collapsed .nav-text { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 12px; }

.sidebar-footer { padding: 14px; border-top: 1px solid rgba(255, 255, 255, .1); display: flex; flex-direction: column; gap: 12px; }
.user-bar { display: flex; align-items: center; gap: 10px; }
.user-info { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.user-avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .14); color: #fff; font-size: 17px; flex-shrink: 0; }
.user-name { font-size: 13.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar.collapsed .user-name { display: none; }
.logout-btn { border: 1px solid rgba(255, 255, 255, .2); background: transparent; color: #e0e2ff; border-radius: 9px; padding: 6px 10px; font-size: 12.5px; transition: background .2s; }
.logout-btn:hover { background: rgba(255, 255, 255, .12); }

.ws-status-sidebar { display: flex; align-items: center; gap: 8px; font-size: 12.5px; padding: 7px 10px; border-radius: 10px; background: rgba(0, 0, 0, .18); }
.ws-status-sidebar .status-text { white-space: nowrap; }
.sidebar.collapsed .ws-status-sidebar .status-text { display: none; }
.ws-dot-sidebar { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; background: var(--text-faint); }
.ws-status-sidebar.connected .ws-dot-sidebar { background: var(--success); animation: pulse-online 2s infinite; }
.ws-status-sidebar.connecting .ws-dot-sidebar { background: var(--warning); }
.ws-status-sidebar.disconnected .ws-dot-sidebar { background: var(--danger); }

.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat-item { display: flex; align-items: center; gap: 9px; padding: 9px 11px; border-radius: 12px; background: rgba(255, 255, 255, .07); }
.stat-item .stat-icon { font-size: 17px; color: #c7d2fe; flex-shrink: 0; }
.stat-item .stat-number { font-size: 18px; font-weight: 800; line-height: 1; }
.stat-item .stat-number.online { color: #6ee7b7; }
.stat-item .stat-number.offline { color: #cbd5e1; }
.stat-item .stat-number.success { color: #fcd34d; }
.stat-item .stat-label { font-size: 11px; color: #a5b4fc; white-space: nowrap; }
.sidebar.collapsed .stat-label { display: none; }
.sidebar.collapsed .stat-item { justify-content: center; padding: 9px; }
.time-display { text-align: center; font-size: 12.5px; color: #a5b4fc; font-variant-numeric: tabular-nums; }
.sidebar.collapsed .time-display { display: none; }

/* 折叠态布局修正：76px 宽内避免 stats / user-bar 等内容溢出到 iframe */
.sidebar { overflow: hidden; }
.sidebar.collapsed .sidebar-header { justify-content: center; padding: 20px 0; }
.sidebar.collapsed .logo { display: none; }
.sidebar.collapsed .user-bar { flex-direction: column; gap: 6px; }
.sidebar.collapsed .user-info { flex: 0 0 auto; justify-content: center; }
.sidebar.collapsed .logout-btn { padding: 5px 8px; }
.sidebar.collapsed .ws-status-sidebar { justify-content: center; }
.sidebar.collapsed .stats-grid { grid-template-columns: 1fr; }
.sidebar.collapsed .stat-item { flex-direction: column; gap: 2px; padding: 7px 4px; justify-content: center; }

.main-content { flex: 1; min-width: 0; }
.main-content iframe { width: 100%; height: 100%; border: none; background: transparent; }

/* ============================================================
 *  控制台 (control.html)
 * ============================================================ */
.console-wrap { max-width: 1240px; margin: 0 auto; padding: 22px; }

/* 工具栏 */
.toolbar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between;
  margin-bottom: 18px;
}
.toolbar-primary { display: flex; gap: 10px; flex-wrap: wrap; }
.tb-btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 10px 16px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-weight: 600; font-size: 13.5px;
  box-shadow: var(--shadow-sm); transition: transform .15s var(--ease), background .2s, color .2s, border-color .2s;
}
.tb-btn .bi { font-size: 1.05em; }
.tb-btn:hover { transform: translateY(-1px); border-color: var(--primary); color: var(--primary-700); }
.tb-btn-start { color: var(--success-600); }
.tb-btn-stop { color: var(--warning-600); }
.tb-btn-exit { color: var(--danger-600); }
.tb-btn:active { transform: translateY(0); }

/* 设备网格 */
.device-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 16px; align-content: start; }
.device-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 16px; display: flex; flex-direction: column; gap: 13px;
  transition: box-shadow .25s, transform .25s var(--ease), border-color .25s;
}
.device-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.device-card.offline { opacity: .62; filter: grayscale(.35); }
.card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.device-name { font-size: 15px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.device-version { font-size: 11px; font-weight: 600; color: var(--primary-600); background: var(--primary-50); padding: 1px 7px; border-radius: var(--radius-pill); }
.edit-name-btn, .delete-device-btn { cursor: pointer; font-size: 13px; opacity: .55; transition: opacity .2s, transform .2s; }
.edit-name-btn:hover { opacity: 1; transform: scale(1.15); color: var(--primary); }
.delete-device-btn:hover { opacity: 1; transform: scale(1.15); color: var(--danger); }
.device-id { font-size: 11.5px; color: var(--text-faint); margin-top: 4px; font-family: ui-monospace, Menlo, Consolas, monospace; cursor: pointer; transition: color .2s; }
.device-id:hover { color: var(--primary); }

.card-status-area { display: flex; align-items: center; gap: 7px; flex-shrink: 0; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; background: var(--text-faint); }
.status-dot.online { background: var(--success); animation: pulse-online 2s infinite; }
.status-dot.offline { background: #cbd5e1; }
.status-text { font-size: 12.5px; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.status-text.running { color: var(--success-600); }

.card-battery { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 12.5px; color: var(--text-muted); }
.battery-left { display: flex; align-items: center; gap: 8px; }
.battery-left .bi { color: var(--text-muted); }
.battery-bar { width: 70px; height: 7px; border-radius: 5px; background: var(--surface-3); overflow: hidden; }
.battery-bar .fill { display: block; height: 100%; border-radius: 5px; background: var(--success); transition: width .4s var(--ease), background .3s; }
.battery-bar .fill.mid { background: var(--warning); }
.battery-bar .fill.low { background: var(--danger); }
.battery-ip { display: flex; align-items: center; justify-content: flex-end; gap: 5px; flex: 1; min-width: 0; font-size: 12px; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.battery-ip .bi { color: var(--info); }

.card-config { display: flex; flex-direction: column; gap: 10px; padding-top: 12px; border-top: 1px dashed var(--border); }
.config-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-muted); }
.config-row label { display: flex; align-items: center; gap: 6px; flex: 1; flex-wrap: wrap; }
.config-row input[type="range"] { flex: 1; min-width: 80px; accent-color: var(--primary); }
.config-row input[type="number"] { width: 70px; padding: 5px 8px; }
.config-row .unit { color: var(--text-faint); font-size: 11.5px; }

.qty-product-row { display: flex; gap: 12px; flex-wrap: wrap; }
.product-control, .qty-control { display: flex; flex-direction: column; gap: 6px; }
.product-control { flex: 1; min-width: 120px; }
.product-control > span, .qty-control > span { font-size: 12.5px; color: var(--text-muted); font-weight: 600; }
.product-select { width: 100%; padding: 8px 10px; font-size: 13px; }
.qty-btn-group { display: flex; gap: 6px; flex-wrap: wrap; }
.qty-btn-item {
  min-width: 34px; height: 32px; padding: 0 8px; border: 1px solid var(--border-strong); border-radius: 9px;
  background: var(--surface); color: var(--text-2); font-weight: 700; font-size: 13px; transition: all .18s var(--ease);
}
.qty-btn-item:hover:not(:disabled) { border-color: var(--primary); color: var(--primary-700); }
.qty-btn-item.qty-btn-active { background: linear-gradient(135deg, var(--primary) 0%, var(--violet) 100%); border-color: transparent; color: #fff; box-shadow: 0 6px 14px -6px rgba(99, 102, 241, .6); }
.qty-btn-item:disabled { opacity: .4; cursor: not-allowed; }

.card-actions { display: flex; gap: 8px; }
.card-actions button {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 9px 6px;
  border: none; border-radius: 11px; font-weight: 700; font-size: 13px; color: #fff; transition: transform .15s var(--ease), filter .2s;
}
.card-actions button .bi { font-size: 1.05em; }
.card-actions button:hover:not(:disabled) { filter: brightness(1.06); transform: translateY(-1px); }
.card-actions button:disabled { opacity: .4; cursor: not-allowed; transform: none; filter: none; }
.btn-start { background: linear-gradient(135deg, #34d399 0%, var(--success-600) 100%); }
.btn-stop { background: linear-gradient(135deg, #fbbf24 0%, var(--warning-600) 100%); }
.btn-exit { background: linear-gradient(135deg, #fb7185 0%, var(--danger-600) 100%); }

/* 侧滑面板通用 */
.slide-panel {
  position: fixed; top: 0; right: 0; height: 100vh; width: min(360px, 92vw); z-index: 900;
  background: var(--surface); box-shadow: -12px 0 40px -16px rgba(15, 21, 42, .4);
  border-left: 1px solid var(--border); display: flex; flex-direction: column;
}
.slide-panel-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); font-size: 16px; font-weight: 700; }
.slide-panel-header .bi { color: var(--primary); }
.slide-panel-close { width: 32px; height: 32px; border: none; border-radius: 9px; background: var(--surface-3); color: var(--text-muted); font-size: 15px; transition: background .2s; }
.slide-panel-close:hover { background: var(--danger-bg); color: var(--danger-600); }
.slide-panel-body { padding: 18px 20px; overflow: auto; flex: 1; display: flex; flex-direction: column; gap: 16px; }

.batch-group { display: flex; flex-direction: column; gap: 7px; }
.batch-group > label { font-size: 12.5px; }
.tb-select, .tb-number { padding: 9px 11px; font-size: 13.5px; }
.filter-chips { display: flex; gap: 8px; }
.tb-btn-filter { flex: 1; padding: 9px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); color: var(--text-muted); font-weight: 600; font-size: 13px; transition: all .18s; }
.tb-btn-filter:hover { border-color: var(--primary); color: var(--primary-700); }
.tb-btn-filter-active { background: linear-gradient(135deg, var(--primary) 0%, var(--violet) 100%); border-color: transparent; color: #fff; }

/* IP 统计 */
.ip-stat-item { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.ip-stat-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ip-stat-address { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 13.5px; color: var(--text); font-family: ui-monospace, Menlo, Consolas, monospace; }
.ip-stat-count { font-size: 12px; color: var(--info-600); font-weight: 700; }
.ip-stat-devices { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ip-stat-device-name { font-size: 12px; padding: 2px 9px; border-radius: var(--radius-pill); background: var(--primary-50); color: var(--primary-700); }
.ip-stat-empty { color: var(--text-faint); text-align: center; padding: 30px 0; font-size: 13px; }

.schedule-row { display: flex; flex-direction: column; gap: 6px; }
.schedule-row > label { font-size: 13px; display: flex; align-items: center; gap: 8px; }
.schedule-row input[type="time"], .schedule-row input[type="number"] { padding: 9px 11px; }

/* ============================================================
 *  通用页面容器（产品 / 记录）
 * ============================================================ */
.page { max-width: 1200px; margin: 0 auto; padding: 26px 22px; }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-title { font-size: 22px; display: flex; align-items: center; gap: 11px; }
.page-title .title-icon { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; font-size: 21px; color: #fff; background: linear-gradient(135deg, var(--primary) 0%, var(--violet) 100%); box-shadow: 0 10px 22px -10px rgba(99, 102, 241, .6); }
.page-title small { font-size: 13px; font-weight: 500; color: var(--text-faint); }
.header-actions { display: flex; gap: 10px; }

/* 筛选栏 */
.filter-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.filter-bar label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-muted); white-space: nowrap; }
.filter-bar label .bi { color: var(--primary); }
.filter-bar input, .filter-bar select { width: auto; min-width: 160px; }
.filter-bar .hint { font-size: 12px; color: var(--text-faint); }
.filter-actions { display: flex; gap: 8px; margin-left: auto; }

.stats-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; font-size: 13.5px; color: var(--text-muted); }
.stats-bar .total { font-weight: 600; }
.stats-bar .total span { color: var(--primary-700); }

/* 搜索框（用户管理 / 账号绑定 共用） */
.search-box { position: relative; display: flex; align-items: center; }
.search-box .bi-search { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-faint); font-size: 15px; pointer-events: none; }
.search-box input { padding-left: 38px; height: 42px; }

/* 分页 */
.pagination { display: flex; align-items: center; gap: 10px; margin-top: 16px; font-size: 13.5px; color: var(--text-muted); flex-wrap: wrap; }
.pagination .page-info { font-variant-numeric: tabular-nums; }
.pagination select { width: auto; }

/* 表格内联操作 */
.actions-cell { display: flex; gap: 6px; }
.row-btn { width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text-muted); transition: all .18s; }
.row-btn:hover { border-color: var(--primary); color: var(--primary-700); transform: translateY(-1px); }
.row-btn.danger:hover { border-color: var(--danger); color: var(--danger-600); background: var(--danger-bg); }
.row-btn .bi { font-size: 15px; }

/* 响应式 */
@media (max-width: 720px) {
  .sidebar { position: absolute; height: 100%; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .console-wrap { padding: 14px; }
  .filter-bar input, .filter-bar select { min-width: 120px; }
}
