/* ============ 电梯安全台账AI助手 · 后台管理系统（商务风） ============ */
:root {
  --primary: #1d4ed8;
  --primary-dark: #1e3a8a;
  --sidebar-bg: linear-gradient(180deg, #0f2456 0%, #16306e 100%);
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --line: #e2e8f0;
  --success: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
  --info: #2563eb;
  --radius: 10px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: "Microsoft YaHei", "PingFang SC", -apple-system, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
.hidden { display: none !important; }
b { font-weight: 600; }

/* ---------- 登录 ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0f2456 0%, #1d4ed8 60%, #3b82f6 100%); }
.login-card { width: 380px; background: #fff; border-radius: 16px; padding: 40px 36px 28px; box-shadow: 0 20px 60px rgba(0,0,0,.35); text-align: center; }
.login-logo { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 14px; background: var(--primary); color: #fff;
  font-size: 32px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.login-card h1 { font-size: 20px; color: var(--text); }
.login-sub { color: var(--muted); font-size: 12px; margin: 6px 0 24px; }
.form-item { text-align: left; margin-bottom: 16px; }
.form-item label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.form-item input, .form-item select, .form-item textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; outline: none; background: #fff; }
.form-item input:focus, .form-item select:focus, .form-item textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(29,78,216,.1); }
.inline-input { display: flex; gap: 8px; align-items: center; }
.inline-input input { flex: 1; min-width: 0; }
.login-err { color: var(--danger); font-size: 13px; min-height: 18px; margin: 8px 0 4px; }
.login-tip { color: #94a3b8; font-size: 12px; margin-top: 12px; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: var(--sidebar-bg); color: #cbd5e1; display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; z-index: 10; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-logo { width: 38px; height: 38px; border-radius: 9px; background: var(--primary); color: #fff; font-size: 20px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex: none; }
.brand b { color: #fff; font-size: 14px; display: block; }
.brand i { font-style: normal; font-size: 11px; color: #7d95c4; }
nav { flex: 1; overflow-y: auto; padding: 10px 0; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 11px 20px; cursor: pointer; font-size: 13.5px; color: #b6c5e4; border-left: 3px solid transparent; white-space: nowrap; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: rgba(29,78,216,.25); color: #fff; border-left-color: #60a5fa; }
.nav-item .ico { width: 18px; text-align: center; font-style: normal; }
.nav-group { padding: 12px 20px 4px; font-size: 11px; color: #64809f; letter-spacing: 1px; }
.sidebar-foot { padding: 12px 16px; font-size: 11px; color: #55709c; border-top: 1px solid rgba(255,255,255,.08); }

.main { flex: 1; margin-left: 220px; display: flex; flex-direction: column; min-width: 0; }
.topbar { height: 56px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; position: sticky; top: 0; z-index: 9; }
.topbar-title { font-size: 16px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.clock { color: var(--muted); font-size: 12.5px; }
/* 顶栏全局数据筛选（时间前，全页面常驻） */
.gfilter-bar { display: flex; align-items: center; gap: 8px; }
.gfilter-bar .gf-label { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.gfilter-bar .gf-company { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 5px 10px; font-size: 12.5px; color: var(--text); white-space: nowrap; }
.gfilter-bar select { max-width: 200px; padding: 5px 8px; font-size: 12.5px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--text); outline: none; }
.gfilter-bar select:focus { border-color: var(--primary); }
.gfilter-bar .btn { padding: 5px 10px; font-size: 12.5px; white-space: nowrap; }
@media (max-width: 900px) { .gfilter-bar .gf-label { display: none; } .gfilter-bar select { max-width: 130px; } }
/* 看板当前范围信息条（筛选入口在顶栏） */
.scope-info { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; font-size: 13.5px; margin-bottom: 18px; }
.scope-info b { color: var(--primary); }
.divider { width: 1px; height: 18px; background: var(--line); }
.cur-user { color: var(--text); font-size: 13px; }
.content { padding: 20px 24px 40px; flex: 1; }

/* ---------- 卡片 / 统计 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card { background: var(--card); border-radius: var(--radius); padding: 16px 18px; border: 1px solid var(--line); position: relative; overflow: hidden; }
.stat-card .num { font-size: 26px; font-weight: 700; line-height: 1.2; }
.stat-card .lbl { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.stat-card .bar { position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }
.c-blue { color: var(--primary); } .c-blue .bar { background: var(--primary); }
.c-green { color: var(--success); } .c-green .bar { background: var(--success); }
.c-warn { color: var(--warn); } .c-warn .bar { background: var(--warn); }
.c-red { color: var(--danger); } .c-red .bar { background: var(--danger); }

.card { background: var(--card); border-radius: var(--radius); border: 1px solid var(--line); margin-bottom: 18px; }
.card-head { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.card-head h3 { font-size: 15px; }
.card-head .sub { color: var(--muted); font-size: 12px; font-weight: 400; margin-left: 8px; }
.card-body { padding: 16px 18px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 1100px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: 13px; white-space: nowrap; }
td.wrap { white-space: normal; min-width: 200px; }
th { color: var(--muted); font-weight: 500; background: #f8fafc; font-size: 12.5px; }
tr:hover td { background: #f8fbff; }
td .ellipsis { display: inline-block; max-width: 260px; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }

/* ---------- 徽标 / 按钮 ---------- */
.badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; line-height: 20px; }
.b-info { background: #eff6ff; color: var(--info); }
.b-success { background: #f0fdf4; color: var(--success); }
.b-warn { background: #fffbeb; color: var(--warn); }
.b-danger { background: #fef2f2; color: var(--danger); }
.b-gray { background: #f1f5f9; color: var(--muted); }
.b-blue { background: #eff6ff; color: var(--primary); }

.btn { border: none; border-radius: 8px; padding: 9px 18px; font-size: 13.5px; cursor: pointer; background: #e2e8f0; color: var(--text); transition: .15s; }
.btn:hover { opacity: .88; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warn { background: var(--warn); color: #fff; }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.btn-sm { padding: 4px 10px; font-size: 12.5px; border-radius: 6px; }
.btn-xs { padding: 2px 8px; font-size: 12px; border-radius: 5px; }
.btn-block { width: 100%; padding: 11px; font-size: 15px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- 工具条 / 筛选 ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar input, .toolbar select { padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px; font-size: 13px; outline: none; }
.toolbar input:focus, .toolbar select:focus { border-color: var(--primary); }

/* ---------- 弹窗 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: #fff; border-radius: 12px; width: 640px; max-width: 100%; max-height: 86vh; display: flex; flex-direction: column; box-shadow: 0 24px 60px rgba(0,0,0,.3); }
.modal-head { padding: 14px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; font-size: 15px; font-weight: 600; }
.modal-close { border: none; background: none; font-size: 22px; cursor: pointer; color: var(--muted); line-height: 1; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--line); flex: none; background: #fff; border-radius: 0 0 12px 12px; }
.modal-foot .btn { min-width: 96px; }
.detail-row { display: flex; padding: 7px 0; border-bottom: 1px dashed #eef2f7; font-size: 13px; }
.detail-row .k { width: 110px; color: var(--muted); flex: none; }
.detail-row .v { flex: 1; word-break: break-all; }
.timeline { margin: 8px 0 0; padding-left: 18px; border-left: 2px solid var(--line); }
.timeline li { margin: 0 0 14px; position: relative; list-style: none; font-size: 13px; }
.timeline li::before { content: ''; position: absolute; left: -23px; top: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
.timeline .t-act { font-weight: 600; }
.timeline .t-time { color: var(--muted); font-size: 12px; }

/* ---------- 图表（纯 CSS） ---------- */
.bar-chart { display: flex; align-items: flex-end; gap: 12px; height: 160px; padding: 10px 6px 0; }
.bar-chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar-chart .col .v { font-size: 12px; color: var(--primary); font-weight: 600; }
.bar-chart .col .b { width: 60%; max-width: 38px; background: linear-gradient(180deg, #3b82f6, #1d4ed8); border-radius: 5px 5px 0 0; min-height: 3px; transition: height .4s; }
.bar-chart .col .d { font-size: 11px; color: var(--muted); }
.hbar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 13px; }
.hbar .name { width: 110px; color: var(--muted); text-align: right; flex: none; }
.hbar .track { flex: 1; height: 14px; background: #f1f5f9; border-radius: 7px; overflow: hidden; }
.hbar .fill { height: 100%; background: linear-gradient(90deg, #3b82f6, #1d4ed8); border-radius: 7px; }
.hbar .cnt { width: 30px; font-weight: 600; }

/* ---------- 待办 ---------- */
.todo-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px dashed #eef2f7; font-size: 13px; }
.todo-item:last-child { border-bottom: none; }
.todo-item .t { color: var(--danger); font-weight: 600; margin-right: 8px; }

/* ---------- Toast ---------- */
.toast { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); background: rgba(15,23,42,.9); color: #fff; padding: 10px 22px; border-radius: 8px; font-size: 13.5px; z-index: 200; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; font-size: 13px; }

@media (max-width: 768px) {
  .sidebar { width: 64px; }
  .brand div, .nav-item span, .sidebar-foot, .nav-group { display: none; }
  .main { margin-left: 64px; }
}
