:root {
    --sidebar-bg: #1e293b; --sidebar-hover: #334155; --sidebar-active: #3b82f6;
    --primary: #3b82f6; --primary-hover: #2563eb; --success: #10b981;
    --danger: #ef4444; --warning: #f59e0b; --text-dark: #1e293b;
    --text-muted: #64748b; --bg: #f1f5f9; --card-bg: #ffffff; --border: #e2e8f0;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text-dark); font-size: 14px; line-height: 1.5; }
.container { display: flex; min-height: 100vh; }
.sidebar { width: 240px; background: var(--sidebar-bg); color: #e2e8f0; display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; z-index: 100; }
.sidebar-brand { padding: 20px; border-bottom: 1px solid rgba(255,255,255,0.08); display: flex; align-items: center; gap: 12px; }
.sidebar-brand .logo { width: 36px; height: 36px; background: linear-gradient(135deg, #3b82f6, #8b5cf6); border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 700; color: white; flex-shrink: 0; }
.sidebar-brand span { font-size: 15px; font-weight: 600; }
.sidebar-nav { padding: 12px 8px; flex: 1; }
.sidebar-nav a { display: flex; align-items: center; gap: 10px; padding: 10px 14px; color: #94a3b8; text-decoration: none; border-radius: 8px; margin-bottom: 2px; font-size: 14px; transition: all 0.15s; }
.sidebar-nav a:hover { background: var(--sidebar-hover); color: #e2e8f0; }
.sidebar-nav a.active { background: var(--sidebar-active); color: white; }
.sidebar-footer { padding: 12px 8px; border-top: 1px solid rgba(255,255,255,0.08); }
.sidebar-footer a { display: flex; align-items: center; gap: 10px; padding: 10px 14px; color: #f87171; text-decoration: none; border-radius: 8px; font-size: 14px; }
.sidebar-footer a:hover { background: rgba(239,68,68,0.15); }
.main { flex: 1; margin-left: 240px; padding: 24px 28px; min-height: 100vh; }
.header { margin-bottom: 24px; }
.header h1 { font-size: 20px; font-weight: 700; color: var(--text-dark); }
.header p { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.card { background: var(--card-bg); border-radius: 12px; padding: 20px; margin-bottom: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); border: 1px solid var(--border); }
.card h3 { font-size: 14px; font-weight: 600; color: var(--text-dark); margin-bottom: 16px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-card { background: var(--card-bg); border-radius: 12px; padding: 16px 18px; border: 1px solid var(--border); display: flex; align-items: center; gap: 14px; }
.stat-icon { width: 42px; height: 42px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-info h4 { font-size: 12px; color: var(--text-muted); font-weight: 500; margin-bottom: 2px; }
.stat-info .value { font-size: 24px; font-weight: 700; color: var(--text-dark); }
table { width: 100%; border-collapse: collapse; }
th { padding: 10px 12px; text-align: left; font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; background: #f8fafc; border-bottom: 2px solid var(--border); }
td { padding: 10px 12px; border-bottom: 1px solid #f1f5f9; font-size: 13px; }
tbody tr:hover { background: #f8fafc; }
.info-table td { padding: 8px 12px; border-bottom: 1px solid #f1f5f9; }
.info-table td:first-child { color: var(--text-muted); width: 100px; font-size: 13px; }
.info-table td:last-child { font-weight: 500; }
.badge { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 6px; font-size: 12px; font-weight: 500; }
.badge-success { background: #ecfdf5; color: #059669; }
.badge-danger { background: #fef2f2; color: #dc2626; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 16px; border-radius: 8px; text-decoration: none; font-size: 13px; font-weight: 500; cursor: pointer; border: none; transition: all 0.15s; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { background: var(--danger); color: white; }
.btn-outline { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-outline:hover { background: #f8fafc; color: var(--text-dark); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 500; color: var(--text-dark); }
.form-group input, .form-group select { width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; outline: none; transition: border-color 0.15s, box-shadow 0.15s; background: white; }
.form-group input:focus, .form-group select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,0.1); }
.search-box { margin-bottom: 16px; }
.search-box form { display: flex; gap: 8px; }
.search-box input { flex: 1; padding: 9px 14px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; outline: none; background: white; }
.pagination { display: flex; gap: 4px; margin-top: 16px; }
.pagination a, .pagination span { padding: 6px 12px; border: 1px solid var(--border); border-radius: 6px; text-decoration: none; font-size: 13px; color: var(--text-muted); }
.pagination a:hover { background: #f8fafc; }
.pagination span.current { background: var(--primary); color: white; border-color: var(--primary); }
.progress { height: 6px; background: #e2e8f0; border-radius: 3px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 3px; }
.progress-green { background: var(--success); }
.progress-yellow { background: var(--warning); }
.progress-red { background: var(--danger); }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.alert-success { background: #ecfdf5; color: #059669; padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; border: 1px solid #a7f3d0; }
pre { background: #1e293b; color: #e2e8f0; padding: 16px; border-radius: 8px; overflow-x: auto; font-size: 13px; line-height: 1.6; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.actions-bar { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.actions-bar .form-group { margin-bottom: 0; }
.login-container { width: 100%; max-width: 400px; padding: 20px; }
.login-card { background: white; border-radius: 16px; padding: 36px; box-shadow: 0 25px 50px rgba(0,0,0,0.25); }
.login-header { text-align: center; margin-bottom: 28px; }
.login-header .logo { width: 56px; height: 56px; background: linear-gradient(135deg, #3b82f6, #8b5cf6); border-radius: 14px; display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; font-size: 22px; font-weight: 700; color: white; }
.login-header h1 { font-size: 20px; color: #1e293b; margin-bottom: 4px; }
.login-header p { font-size: 13px; color: #94a3b8; }
.btn-login { width: 100%; padding: 12px; background: linear-gradient(135deg, #3b82f6, #6366f1); color: white; border: none; border-radius: 10px; font-size: 15px; font-weight: 600; cursor: pointer; }
.btn-login:hover { opacity: 0.9; }
.error-msg { background: #fef2f2; color: #dc2626; padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 18px; border: 1px solid #fecaca; }
.footer-text { text-align: center; margin-top: 20px; font-size: 12px; color: rgba(255,255,255,0.4); }

/* ===== 工具类（抽离高频内联 style） ===== */
.icon-blue { background: linear-gradient(135deg, #3b82f6, #6366f1); }
.icon-green { background: linear-gradient(135deg, #10b981, #34d399); }
.icon-purple { background: linear-gradient(135deg, #8b5cf6, #a78bfa); }
.icon-orange { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.icon-red { background: linear-gradient(135deg, #ef4444, #f87171); }
.icon-cyan { background: linear-gradient(135deg, #06b6d4, #22d3ee); }
.svg-20 { width: 20px; height: 20px; }
.mono-cell { font-family: monospace; font-size: 12px; }
.flex-center { display: flex; align-items: center; gap: 8px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.login-bg { background: linear-gradient(135deg, #1e293b 0%, #334155 100%); display: flex; align-items: center; justify-content: center; min-height: 100vh; }

/* ===== 工具类（N-2/N-3 抽离 devices.html / device-detail.html 内联 style） ===== */
.text-muted { color: var(--text-muted); }
.text-muted-sm { font-size: 13px; color: var(--text-muted); }
.text-xs { font-size: 12px; }
.text-muted-xs { font-size: 11px; color: var(--text-muted); }
.text-muted-md { font-size: 12px; color: var(--text-muted); }
.min-w-120 { min-width: 120px; }
.quota-row { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 4px; }
.detail-header { display: flex; align-items: center; gap: 12px; }
.mt-12 { margin-top: 12px; }
.progress-thin { height: 8px; }
.inline-form { display: flex; gap: 8px; }
.w-100 { width: 100px; }
.mb-16 { margin-bottom: 16px; }
.section-label { margin-bottom: 8px; font-size: 14px; color: #666; }
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 16px; background: #f5f5f5; font-size: 13px; }
.mode-chip { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 10px; background: #f0f0f0; font-size: 12px; margin-right: 4px; }
.dot-sm { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot-md { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.text-empty { color: #ccc; }
.empty-state { color: #999; text-align: center; padding: 20px 0; }
.alert-error { background: #fef2f2; color: #dc2626; padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; border: 1px solid #fecaca; }

/* 日志内容展开块（设备详情页“查看内容”） */
.log-body { margin-top: 6px; }
.log-body b { font-size: 12px; color: #6b7280; }
.log-body pre { margin: 4px 0 0; padding: 8px; background: #f8fafc; border: 1px solid #e5e7eb; border-radius: 6px; font-size: 11px; max-height: 220px; overflow: auto; white-space: pre-wrap; word-break: break-all; }

/* ── 系统配置页：页签/布局/折叠 ─────────────────────────── */
/* 胶囊页签（与客户端品牌语言一致） */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tab-btn {
    padding: 8px 18px; border-radius: 8px; border: 1px solid var(--border);
    background: var(--card-bg); color: var(--text-muted); font-size: 13px;
    font-weight: 500; cursor: pointer;
}
.tab-btn:hover { border-color: var(--primary); color: var(--primary); }
.tab-btn.active {
    background: var(--primary); border-color: var(--primary); color: #fff;
    font-weight: 600;
}

/* 三栏表单网格 */
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* 统一 textarea 外观（此前全靠内联 style） */
.form-group textarea {
    width: 100%; padding: 9px 12px; border: 1px solid var(--border);
    border-radius: 8px; font-size: 13px; font-family: inherit;
    background: #fff; color: inherit;
}
.form-group textarea:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

/* 原生折叠区样式化（类目提示词等） */
.fold {
    border: 1px solid var(--border); border-radius: 8px;
    margin-bottom: 16px; background: #fafbfc;
}
.fold summary {
    cursor: pointer; padding: 10px 14px; font-size: 13px; font-weight: 600;
    color: var(--text-muted); user-select: none; list-style: none;
}
.fold summary::-webkit-details-marker { display: none; }
.fold summary::before { content: "▸ "; color: var(--primary); }
.fold[open] summary::before { content: "▾ "; }
.fold[open] summary { border-bottom: 1px solid var(--border); color: #333; }
.fold .fold-body { padding: 14px; }

/* 底部粘性保存条（长表单不用滚到底） */
.save-bar {
    position: sticky; bottom: 0; z-index: 5;
    background: var(--card-bg); border-top: 1px solid var(--border);
    padding: 12px 0 4px; margin-top: 8px;
    display: flex; align-items: center; gap: 12px;
}
.save-bar .text-muted-sm { margin-left: auto; }
