/* =========================================================
   生产设备维保管理系统 · PC 管理后台
   设计语言：Apple 风格 —— 浅色通透 · 毛玻璃 · 大留白 · 柔和阴影
   ========================================================= */
:root {
  --bg: #f5f5f7;
  --surface: rgba(255, 255, 255, 0.72);
  --solid: #ffffff;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #86868b;
  --accent: #0078f0;
  --accent-2: #5e5ce6;
  --accent-soft: rgba(0, 120, 240, 0.10);
  --ok: #34c759;
  --warn: #ff9f0a;
  --danger: #ff3b30;
  --line: rgba(0, 0, 0, 0.08);
  --line-strong: rgba(0, 0, 0, 0.12);
  --radius: 20px;
  --radius-md: 14px;
  --radius-sm: 11px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.06), 0 18px 50px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 24px 70px rgba(0, 0, 0, 0.14);
  --blur: 22px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(1100px 620px at 10% -10%, rgba(0, 120, 240, 0.11), transparent 60%),
    radial-gradient(1000px 560px at 100% 0%, rgba(94, 92, 230, 0.09), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  letter-spacing: 0.2px;
}

.hidden { display: none !important; }
.muted { color: var(--text-3); font-size: 13px; }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; letter-spacing: 0.5px; }

/* 滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.16); border-radius: 10px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.28); background-clip: content-box; }

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.rise { animation: rise 0.5s cubic-bezier(0.22, 1, 0.36, 1) both; }

/* ===================== 登录 ===================== */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card {
  position: relative; width: 460px; max-width: 100%; padding: 50px 46px; text-align: center;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(180%) blur(var(--blur));
  -webkit-backdrop-filter: saturate(180%) blur(var(--blur));
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 30px;
  box-shadow: var(--shadow-lg);
}
.login-card .badge {
  display: inline-block; font-size: 12px; font-weight: 600; letter-spacing: 0.5px;
  color: var(--accent); background: var(--accent-soft); padding: 6px 14px; border-radius: 999px; margin-bottom: 22px;
}
.login-card h2 {
  margin: 0 0 8px; font-size: 30px; font-weight: 600; letter-spacing: 0.3px;
  background: linear-gradient(120deg, #1d1d1f 30%, #0071e3);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.login-card .sub { margin: 0 0 6px; color: var(--text-2); font-size: 15px; }
.login-card .tip { margin: 0 0 22px; color: var(--text-3); font-size: 12.5px; line-height: 1.7; }

/* 登录页品牌 Logo */
.brand-mark {
  width: 260px; max-width: 80%; margin: 0 auto 24px;
  border-radius: 12px; overflow: hidden;
  background: transparent;
}
.brand-mark img { width: 100%; height: auto; object-fit: contain; display: block; }

/* 本地调试入口：默认折叠、视觉弱化，不与"自动识别身份"主流程争焦点 */
.demo-fold { margin-top: 4px; border-top: 1px solid var(--line); padding-top: 14px; }
.demo-fold summary {
  list-style: none; cursor: pointer; text-align: center; padding: 6px; user-select: none;
  font-size: 12.5px; color: var(--text-3); transition: color 0.15s ease;
}
.demo-fold summary::-webkit-details-marker { display: none; }
.demo-fold summary::before { content: "\2304  "; color: var(--text-3); }
.demo-fold[open] summary::before { content: "\2303  "; }
.demo-fold summary:hover { color: var(--text-2); }

.demo-btns { display: flex; flex-direction: column; gap: 9px; margin-top: 12px; }
.demo-btns button {
  appearance: none; cursor: pointer; padding: 10px 14px; border-radius: 12px;
  font-size: 14px; font-weight: 500; color: var(--text-2);
  background: rgba(255, 255, 255, 0.6); border: 1px solid var(--line-strong);
  transition: transform 0.16s ease, border-color 0.16s ease, color 0.16s ease, background 0.16s ease;
}
.demo-btns button:hover { transform: translateY(-1px); border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.demo-btns button:active { transform: translateY(0); }
#login-msg { margin-top: 12px; color: var(--danger); font-size: 13px; }

/* ===================== 框架 ===================== */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 250px; flex-shrink: 0; display: flex; flex-direction: column; padding: 22px 16px;
  background: rgba(255, 255, 255, 0.66);
  backdrop-filter: saturate(180%) blur(var(--blur));
  -webkit-backdrop-filter: saturate(180%) blur(var(--blur));
  border-right: 1px solid var(--line);
  position: sticky; top: 0; height: 100vh;
}
.sidebar .logo { display: flex; align-items: center; gap: 11px; font-size: 17px; font-weight: 600; color: var(--text); padding: 6px 12px 18px; }
.sidebar .logo .mark {
  width: 40px; height: 30px; border-radius: 8px; flex-shrink: 0; color: #fff;
  background: #fff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.06);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.sidebar .logo .mark.app-logo { background: #fff; }
.sidebar .logo .mark.app-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.sidebar .logo .logo-text { letter-spacing: 0.3px; }
.sidebar .user { padding: 14px 12px; margin-bottom: 8px; border-radius: 14px; background: rgba(255, 255, 255, 0.5); border: 1px solid var(--line); }
.sidebar .user #u-name { font-size: 14.5px; font-weight: 600; }
.sidebar .user #u-role { font-size: 11.5px; color: var(--text-3); margin-top: 3px; line-height: 1.5; }
.sidebar nav { flex: 1; display: flex; flex-direction: column; gap: 4px; overflow: auto; padding: 6px 0; }
.sidebar nav a {
  display: flex; align-items: center; gap: 11px; padding: 11px 14px; border-radius: 12px;
  color: var(--text-2); text-decoration: none; font-size: 14.5px; font-weight: 500;
  transition: background 0.18s ease, color 0.18s ease;
}
.sidebar nav a .ico { width: 20px; height: 20px; flex-shrink: 0; color: var(--text-3); transition: color 0.18s ease; }
.sidebar nav a .ico svg { width: 20px; height: 20px; display: block; }
.sidebar nav a:hover { background: rgba(0, 0, 0, 0.04); color: var(--text); }
.sidebar nav a:hover .ico { color: var(--accent); }
.sidebar nav a.active { background: var(--accent-soft); color: var(--accent); }
.sidebar nav a.active .ico { color: var(--accent); }
.sidebar .logout {
  margin-top: 8px; padding: 10px; border: 1px solid var(--line); background: transparent; color: var(--text-2);
  border-radius: 12px; cursor: pointer; font-size: 13.5px; transition: background 0.15s ease, color 0.15s ease;
}
.sidebar .logout:hover { background: rgba(255, 59, 48, 0.08); color: var(--danger); border-color: rgba(255, 59, 48, 0.2); }

.content { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 5; height: 64px; display: flex; align-items: center; justify-content: space-between; padding: 0 32px;
  background: rgba(245, 245, 247, 0.72);
  backdrop-filter: saturate(180%) blur(var(--blur));
  -webkit-backdrop-filter: saturate(180%) blur(var(--blur));
  border-bottom: 1px solid var(--line);
}
.topbar #page-title { font-size: 20px; font-weight: 600; letter-spacing: 0.2px; }
.topbar .ctx { font-size: 12.5px; color: var(--text-3); }
.page-body { padding: 32px; }
.page-body > .rise { animation: rise 0.5s cubic-bezier(0.22, 1, 0.36, 1) both; }

/* ===================== 看板 ===================== */
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.hero-greet { font-size: 26px; font-weight: 600; letter-spacing: 0.2px; }
.hero-sub { margin-top: 6px; color: var(--text-3); font-size: 13.5px; }
.hero-date {
  font-size: 13px; color: var(--text-2); background: var(--surface); border: 1px solid var(--line);
  padding: 8px 14px; border-radius: 999px; backdrop-filter: blur(10px);
}

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(195px, 1fr)); gap: 18px; margin-bottom: 26px; }
.stat {
  position: relative; overflow: hidden; padding: 22px; border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.70);
  backdrop-filter: saturate(180%) blur(var(--blur));
  -webkit-backdrop-filter: saturate(180%) blur(var(--blur));
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat-ico { width: 44px; height: 44px; border-radius: 13px; display: flex; align-items: center; justify-content: center; margin-bottom: 16px; color: #fff; }
.stat-ico svg { width: 23px; height: 23px; }
.stat-ico.blue { background: linear-gradient(135deg, #0a84ff, #0071e3); box-shadow: 0 8px 18px rgba(0, 113, 227, 0.30); }
.stat-ico.green { background: linear-gradient(135deg, #30d158, #28bd4b); box-shadow: 0 8px 18px rgba(52, 199, 89, 0.30); }
.stat-ico.orange { background: linear-gradient(135deg, #ffd60a, #ff9f0a); box-shadow: 0 8px 18px rgba(255, 159, 10, 0.30); }
.stat-ico.red { background: linear-gradient(135deg, #ff453a, #ff3b30); box-shadow: 0 8px 18px rgba(255, 59, 48, 0.30); }
.stat-num { font-size: 40px; font-weight: 600; line-height: 1; letter-spacing: 0.5px; font-variant-numeric: tabular-nums; }
.stat-label { margin-top: 9px; color: var(--text-2); font-size: 13.5px; }

.panel {
  background: rgba(255, 255, 255, 0.70);
  backdrop-filter: saturate(180%) blur(var(--blur));
  -webkit-backdrop-filter: saturate(180%) blur(var(--blur));
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 22px 24px;
}
.panel-h { font-size: 15px; font-weight: 600; margin-bottom: 16px; }
.cat-row { display: flex; gap: 12px; flex-wrap: wrap; }
.cat-chip {
  display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2);
  background: rgba(0, 0, 0, 0.03); border: 1px solid var(--line); padding: 9px 14px; border-radius: 999px;
}
.cat-chip b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ===================== 表格 ===================== */
.tbl-wrap { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow-sm); background: var(--solid); }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th {
  background: #fbfbfd; color: var(--text-3); font-weight: 600; font-size: 12.5px; letter-spacing: 0.4px;
  text-align: left; padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.tbl td { padding: 14px 18px; border-bottom: 1px solid var(--line); color: var(--text); vertical-align: middle; }
.tbl td b { font-weight: 600; }
.tbl td .sub { color: var(--text-3); font-size: 11.5px; margin-top: 2px; }
.tbl tbody tr { transition: background 0.15s ease; }
.tbl tbody tr:hover { background: rgba(0, 113, 227, 0.04); }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tr.overdue td:first-child b { color: var(--danger); }
.tbl tr.due_soon td:first-child b { color: #b9720a; }

/* 状态徽章 */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; padding: 5px 11px; border-radius: 999px; white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.ok { color: #1a8a3a; background: rgba(52, 199, 89, 0.14); }
.badge.warn { color: #b9720a; background: rgba(255, 159, 10, 0.16); }
.badge.danger { color: #c9342b; background: rgba(255, 59, 48, 0.14); }
.badge.normal { color: var(--text-2); background: rgba(0, 0, 0, 0.05); }

/* ===================== 占位 ===================== */
.placeholder {
  margin-top: 8px; padding: 64px 24px; text-align: center; color: var(--text-3);
  background: rgba(255, 255, 255, 0.6); border: 1px dashed var(--line-strong);
  border-radius: var(--radius); font-size: 14.5px;
}
.placeholder .ph-ico { margin-bottom: 14px; color: var(--text-3); }
.placeholder .ph-sub { margin-top: 8px; font-size: 12.5px; color: var(--text-3); }

/* ===================== 响应式 ===================== */
@media (max-width: 880px) {
  .sidebar { width: 220px; }
  .topbar { padding: 0 18px; }
  .page-body { padding: 18px; }
  .stat-num { font-size: 34px; }
  .chart-grid { grid-template-columns: 1fr; }
  .chart-flex { flex-direction: column; align-items: flex-start; }
}

/* ===================== M6 可视化看板图表 ===================== */
.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
.chart-card { display: flex; flex-direction: column; }
.chart-flex { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.chart-center { display: flex; justify-content: center; padding: 6px 0; }
.chart-note { text-align: center; color: var(--text-3); font-size: 12.5px; margin-top: 10px; }
.legend { display: flex; flex-direction: column; gap: 10px; }
.lg-item { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.lg-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.lg-label { color: var(--text-2); flex: 1; white-space: nowrap; }
.lg-val { font-weight: 600; font-variant-numeric: tabular-nums; }

/* 责任人及时率条形 */
.pbar-row { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.pbar-name { width: 116px; flex-shrink: 0; font-size: 13.5px; font-weight: 500; display: flex; flex-direction: column; }
.pbar-sub { font-size: 11px; color: var(--text-3); margin-top: 2px; font-weight: 400; }
.pbar-track { flex: 1; height: 10px; background: rgba(0, 0, 0, 0.06); border-radius: 999px; overflow: hidden; }
.pbar-fill { height: 100%; border-radius: 999px; transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1); }
.pbar-val { width: 48px; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

.donut, .ring, .bars { display: block; }
.bars { max-width: 100%; }

/* ===================== M7 AI 排查助手 ===================== */
.ai-result { margin-top: 12px; display: flex; flex-direction: column; gap: 12px; }
.ai-item { border: 1px solid rgba(0,0,0,0.07); border-radius: 12px; padding: 12px 14px; background: rgba(255,255,255,0.6); }
.ai-item-h { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.ai-steps { margin: 4px 0 0; padding-left: 20px; color: var(--text-2); font-size: 13px; line-height: 1.7; }
.ai-steps li { margin-bottom: 2px; }
