/* ============================================================
 * 工厂设备管理系统 —— 样式
 * ============================================================ */
:root {
  --primary: #2f5597;
  --primary-dark: #1f3864;
  --bg: #f2f4f8;
  --card: #fff;
  --border: #e3e6ef;
  --txt: #333;
  --muted: #888;
  --green: #27ae60;
  --orange: #e67e22;
  --red: #e74c3c;
  --blue: #3498db;
  --gray: #95a5a6;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: '微软雅黑', 'Microsoft YaHei', sans-serif; background: var(--bg); color: var(--txt); font-size: 13px; }

/* 布局 */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 176px; background: var(--primary-dark); color: #fff; position: fixed; top: 0; bottom: 0; left: 0; overflow-y: auto; }
.sidebar .logo { padding: 16px 12px; font-size: 15px; font-weight: bold; border-bottom: 1px solid rgba(255,255,255,.15); line-height: 1.5; }
.sidebar .logo small { display: block; font-size: 10px; font-weight: normal; opacity: .7; }
.nav-item { display: block; padding: 11px 12px; color: rgba(255,255,255,.85); text-decoration: none; border-left: 3px solid transparent; cursor: pointer; }
.nav-item:hover { background: rgba(255,255,255,.08); }
.nav-item.active { background: rgba(255,255,255,.14); border-left-color: #fff; color: #fff; }
.main { flex: 1; margin-left: 176px; padding: 20px 24px; }

/* 移动端适配：宽度 <900px 时，侧边栏收为顶部横向导航 */
@media (max-width: 900px) {
  .layout { flex-direction: column; }
  .sidebar { position: static; width: 100%; height: auto; overflow: hidden; }
  .sidebar .logo { padding: 12px 14px; display: flex; align-items: center; gap: 8px; }
  .sidebar .logo small { display: none; }
  #sidebar-nav { display: flex; overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 0 6px; white-space: nowrap; }
  .nav-item { display: inline-block; padding: 11px 12px; border-left: none; border-bottom: 3px solid transparent; flex-shrink: 0; }
  .nav-item.active { border-left: none; border-bottom-color: #fff; }
  .sidebar-user { display: none; } /* 移动端顶栏已显示用户信息，隐藏底部条 */
  .main { margin-left: 0; padding: 12px 10px 20px; }
  .topbar { padding: 8px 12px; margin-bottom: 12px; }
  .page-head h2 { font-size: 18px; }
  .cards3 { grid-template-columns: repeat(3, 1fr); }
  .tbl { font-size: 12px; }
  .tbl th, .tbl td { padding: 6px 6px; }
  .search-bar { flex-wrap: wrap; }
  .bar { flex-wrap: wrap; gap: 6px; }
  .quick-bar { flex-wrap: wrap; }
  .is-item-cols { grid-template-columns: 1fr; }
  .is-judge-opts { gap: 8px; }
}
@media (max-width: 560px) {
  .cards3 { grid-template-columns: 1fr 1fr; }
  .modal { max-width: 96vw; }
}

/* 顶栏 */
.topbar { display: flex; justify-content: space-between; align-items: center; background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 10px 16px; margin-bottom: 16px; }
.topbar .crumb { font-size: 12px; color: var(--muted); }

/* 页头 */
.page-head { margin-bottom: 14px; }
.page-head h2 { font-size: 20px; color: var(--primary-dark); }
.page-head p { color: var(--muted); margin-top: 4px; }

/* 卡片 / 栅格 */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; margin-bottom: 14px; }
.card-title { font-size: 14px; color: var(--primary-dark); margin-bottom: 10px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-2 > .card { margin-bottom: 0; }
@media (max-width: 1100px) { .grid-2 { grid-template-columns: 1fr; } }

/* 统计卡片 */
.cards3 { display: grid; grid-template-columns: repeat(9, 1fr); gap: 10px; margin-bottom: 14px; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 12px; text-align: center; }
.stat-card .num { font-size: 22px; font-weight: bold; color: var(--primary); }
.stat-card div:last-child { color: var(--muted); font-size: 12px; margin-top: 4px; }
.stat-card.clickable { cursor: pointer; transition: all .15s; }
.stat-card.clickable:hover { border-color: var(--primary); box-shadow: 0 3px 10px rgba(47,85,151,.12); transform: translateY(-1px); }
.tip-hint { color: #b0b8cc; font-size: 10px; margin-left: 3px; }
.tip-hint::before { content: 'ⓘ '; }
/* 提示文案按设备切换：电脑悬浮、手机长按 */
.hint-desktop { display: inline; }
.hint-mobile { display: none; }
@media (hover: none) {
  .hint-desktop { display: none; }
  .hint-mobile { display: inline; }
}

/* 统计块悬浮明细浮层 */
.stat-tip { position: fixed; z-index: 300; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 28px rgba(0,0,0,.18); padding: 12px 14px; width: 300px; max-height: 340px; overflow-y: auto; display: none; }
.stat-tip.show { display: block; }
.tip-title { font-size: 13px; font-weight: 700; color: var(--primary-dark); margin-bottom: 6px; }
.tip-empty { color: var(--muted); font-size: 12px; padding: 6px 0; }
.tip-list { list-style: none; margin: 0; padding: 0; }
.tip-list li { font-size: 12px; padding: 5px 6px; border-bottom: 1px dashed #eef1f7; color: var(--txt); }
.tip-list li:last-child { border-bottom: none; }
.tip-sub { color: var(--muted); font-size: 11px; margin-left: 4px; }
.tip-more { color: var(--primary); font-style: italic; }
.txt-green { color: var(--green) !important; }
.txt-orange { color: var(--orange) !important; }
.txt-red { color: var(--red) !important; }
.txt-blue { color: var(--blue) !important; }

/* 按钮 */
.btn { display: inline-block; padding: 7px 14px; border: 1px solid var(--border); background: #fff; border-radius: 6px; cursor: pointer; font-size: 13px; color: var(--txt); text-decoration: none; }
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary { background: var(--primary); color: #fff !important; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--green); color: #fff !important; border-color: var(--green); }
.btn-danger { background: var(--red); color: #fff !important; border-color: var(--red); }
.btn-sm { padding: 3px 8px; font-size: 12px; }
.btn-lg { padding: 10px 22px; font-size: 14px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* 表格 */
.tbl { width: 100%; border-collapse: collapse; background: #fff; }
.tbl th, .tbl td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; vertical-align: middle; }
.tbl th { background: #f0f3fa; color: var(--primary-dark); font-weight: 600; white-space: nowrap; }
.tbl.small th, .tbl.small td { padding: 5px 8px; font-size: 12px; }
.act-cell { white-space: nowrap; }
.empty-row { text-align: center; color: var(--muted); padding: 24px !important; }
.tbl a { color: var(--primary); text-decoration: none; }
.tbl a:hover { text-decoration: underline; }

/* 徽章 */
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; white-space: nowrap; }
.badge-green { background: #e8f8ef; color: var(--green); }
.badge-red { background: #fdecea; color: var(--red); }
.badge-orange { background: #fef5e7; color: var(--orange); }
.badge-blue { background: #eaf4fd; color: var(--blue); }
.badge-gray { background: #f0f0f0; color: var(--gray); }

/* Tab 导航 */
.tabs { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 2px solid var(--border); }
.tabs button { padding: 8px 16px; border: none; background: none; cursor: pointer; font-size: 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -2px; }
.tabs button.on { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.page-body { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 14px; }
.page-body > .tbl { border: none; }

/* 工具栏 / 搜索 */
.bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; flex-wrap: wrap; gap: 8px; }
.bar-title { font-size: 14px; font-weight: 600; color: var(--primary-dark); }
.search-bar { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; align-items: center; }
.inp { padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; outline: none; background: #fff; }
.inp:focus { border-color: var(--primary); }
select.inp { min-width: 110px; }

/* 表单 */
.form-item { margin-bottom: 10px; }
.form-item label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.form-item input, .form-item select, .form-item textarea { width: 100%; padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; outline: none; font-family: inherit; }
.form-item input:focus, .form-item select:focus, .form-item textarea:focus { border-color: var(--primary); }

/* 键值表 */
.kv { width: 100%; border-collapse: collapse; }
.kv td { padding: 6px 8px; border-bottom: 1px dashed var(--border); vertical-align: top; }
.kv td:first-child, .kv td:nth-child(3) { color: var(--muted); width: 90px; white-space: nowrap; }
.kv.small td { font-size: 12px; padding: 4px 6px; }
.kv.small td:first-child { width: 70px; }

/* 二维码 */
.qr-box { text-align: center; }
.qr-code { font-size: 14px; font-weight: bold; margin-top: 6px; letter-spacing: 1px; }
.qr-tip { color: var(--muted); font-size: 12px; margin-top: 6px; }
.dev-pick { display: flex; gap: 12px; align-items: center; background: #f7f9fc; border: 1px dashed var(--border); border-radius: 8px; padding: 10px; margin: 10px 0; }

/* 弹窗 */
#modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: none; z-index: 100; justify-content: center; align-items: center; padding: 20px; }
#modal-overlay.show { display: flex; }
.modal { background: #fff; border-radius: 10px; width: 520px; max-width: 96vw; max-height: 90vh; overflow-y: auto; box-shadow: 0 12px 40px rgba(0,0,0,.25); }
.modal-wide { width: 700px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 15px; color: var(--primary-dark); }
.modal-x { border: none; background: none; font-size: 20px; cursor: pointer; color: var(--muted); }
.modal-body { padding: 16px 18px; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* Toast */
#toast-box { position: fixed; top: 18px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 10px 16px; border-radius: 8px; background: var(--primary-dark); color: #fff; box-shadow: 0 4px 16px rgba(0,0,0,.2); animation: slideIn .25s ease; }
.toast-warn { background: var(--orange); }
.toast-info { background: var(--primary); }
.toast.out { opacity: 0; transition: opacity .3s; }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* 待办 / 知识 / 时间线 */
.todo-list { display: flex; flex-direction: column; gap: 8px; }
.todo-item { background: #f8fafd; border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; }
.todo-item a { color: var(--primary); text-decoration: none; margin-left: 6px; }
.todo-tag { margin-right: 6px; }
.mt-urgent td { background: #fdf0f0 !important; }
.kb-item { background: #f8fafd; border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; margin-bottom: 8px; font-size: 12px; line-height: 1.7; }
.kb-item b { color: var(--primary-dark); }
.kb-card { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; margin-bottom: 10px; }
.kb-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.kb-content { font-size: 13px; line-height: 1.8; }
.kb-meta { margin-top: 6px; color: var(--muted); font-size: 12px; }
.timeline { padding-left: 4px; }
.tl-item { border-left: 2px solid var(--primary); padding: 4px 0 4px 12px; margin: 2px 0; position: relative; }
.tl-item::before { content: ''; position: absolute; left: -5px; top: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
.tl-time { color: var(--muted); font-size: 12px; margin-right: 8px; }

/* 条形图 */
.bar-row { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.bar-label { width: 60px; text-align: right; color: var(--muted); font-size: 12px; }
.bar-track { flex: 1; background: #f0f3fa; border-radius: 4px; height: 16px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--primary); border-radius: 4px; }
.bar-val { width: 30px; font-weight: bold; }

/* 快捷入口 */
.quick-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }

/* 其他 */
.muted { color: var(--muted); font-size: 12px; }
.file-row { padding: 6px 8px; border: 1px dashed var(--border); border-radius: 6px; margin-bottom: 6px; background: #fafbfe; }
.spare-row { display: inline-flex; align-items: center; gap: 8px; background: #eef4fb; border-radius: 6px; padding: 4px 10px; margin: 4px 6px 0 0; font-size: 12px; }

/* 登录 / 注册 */
.hidden { display: none !important; }
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1f3864 0%, #2f5597 60%, #3a6fb5 100%); padding: 20px; }
.auth-card { background: #fff; border-radius: 14px; width: 400px; max-width: 94vw; padding: 34px 36px; box-shadow: 0 18px 50px rgba(0,0,0,.28); }
.auth-logo { font-size: 46px; text-align: center; margin-bottom: 6px; }
.auth-card h1 { text-align: center; font-size: 20px; color: var(--primary-dark); margin-bottom: 4px; }
.auth-sub { text-align: center; color: var(--muted); font-size: 12px; margin-bottom: 22px; }
.auth-card .form-item label { color: #555; }
.btn-auth { width: 100%; padding: 12px; font-size: 15px; margin-top: 6px; }
.auth-foot { text-align: center; margin-top: 16px; font-size: 13px; color: var(--muted); }
.auth-foot a { color: var(--primary); text-decoration: none; }
.auth-foot a:hover { text-decoration: underline; }
.auth-tip { margin-top: 14px; padding: 8px 10px; background: #fef9ec; border: 1px solid #f5e3b8; border-radius: 6px; color: #8a6d3b; font-size: 12px; line-height: 1.6; }

/* 登录页 Tab（账号/手机验证码）与验证码行 */
.auth-tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.auth-tab { flex: 1; padding: 10px; background: none; border: none; cursor: pointer; color: var(--muted); font-size: 14px; border-bottom: 2px solid transparent; }
.auth-tab.on { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.sms-row { display: flex; gap: 8px; }
.sms-row input { flex: 1; }
.sms-row button { white-space: nowrap; }

/* 侧边栏底部用户信息 */
.sidebar-user { position: absolute; bottom: 0; left: 0; right: 0; padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.15); color: #fff; }
.su-name { font-size: 13px; font-weight: bold; }
.su-role { font-size: 11px; opacity: .75; margin-top: 2px; }
/* 注：.sidebar 保持 position: fixed（见布局区），移动端在 @media 中重置 */

/* 保养标准 富文本编辑器 */
.rich-box { display: block; }
.rich-toolbar { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; background: #f7f8fa; border: 1px solid var(--border); border-bottom: none; border-radius: 6px 6px 0 0; }
.rich-btn { padding: 4px 10px; font-size: 13px; background: #fff; border: 1px solid var(--border); border-radius: 4px; cursor: pointer; }
.rich-btn:hover { border-color: var(--primary); color: var(--primary); }
.rich-editor { min-height: 120px; max-height: 320px; overflow-y: auto; padding: 10px 12px; border: 1px solid var(--border); border-radius: 0 0 6px 6px; font-size: 14px; line-height: 1.7; background: #fff; }
.rich-editor:focus { outline: none; border-color: var(--primary); }
.rich-editor img { max-width: 100%; border-radius: 4px; }
.rich-editor ul, .rich-editor ol { padding-left: 22px; margin: 6px 0; }
.rich-editor h3 { margin: 6px 0; font-size: 15px; }
.rich-editor:empty::before { content: attr(data-ph); color: #bbb; }
.rich-view { font-size: 14px; line-height: 1.8; word-break: break-word; }
.rich-view img { max-width: 100%; border-radius: 4px; }
.rich-view ul, .rich-view ol { padding-left: 22px; margin: 6px 0; }
.rich-view h3 { margin: 6px 0; font-size: 15px; }

/* 点检内容(主标题) + 点检标准(子标题) 层级样式 */
.is-content-block { border: 1px solid var(--border); border-radius: 8px; background: #fff; margin: 6px 0 12px; }
.is-content-block.view { padding: 10px 12px; }
.is-content-title { display: flex; gap: 8px; align-items: center; padding: 8px 10px; background: #f0f4fb; border-bottom: 1px solid var(--border); border-radius: 8px 8px 0 0; }
.is-content-block.view .is-content-title { background: #f0f4fb; border-radius: 8px; border-bottom: none; }
.is-content-icon { font-size: 16px; }
.is-content-title-main { flex: 1; }
.is-content-title-main label, .is-content-sub label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.is-content-title-main b, .is-content-sub b { color: #3456a8; }
.is-content-input { font-weight: 600; font-size: 15px; }
.is-content-sub { padding: 8px 10px; }
.is-content-sub textarea { width: 100%; border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; font-size: 13px; min-height: 52px; }
.is-content-sub textarea:focus { outline: none; border-color: var(--primary); }
.is-sub-item { font-size: 13px; line-height: 1.9; color: #333; }
.is-std-line { margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--border); font-size: 13px; color: #555; }
.is-cell-title { font-weight: 600; font-size: 13px; color: #3456a8; }
.is-cell-std { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* 点检内容N / 点检标准N 成对分区编辑 */
.is-items-box { border: 1px solid var(--border); border-radius: 8px; margin: 6px 0 12px; background: #fff; }
.is-items-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; background: #f0f4fb; border-bottom: 1px solid var(--border); border-radius: 8px 8px 0 0; font-size: 13px; }
#is-items { padding: 8px 10px; }
.is-item-row { border: 1px solid var(--border); border-radius: 8px; margin-bottom: 10px; padding: 8px 10px; background: #fcfdfe; }
.is-item-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.is-item-no { width: 22px; height: 22px; border-radius: 50%; background: #3456a8; color: #fff; font-size: 12px; display: flex; align-items: center; justify-content: center; }
.is-item-tag { font-size: 12px; color: var(--muted); flex: 1; }
.is-item-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.is-item-col label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.is-item-col textarea { width: 100%; border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; font-size: 13px; min-height: 48px; }
.is-item-col textarea:focus { outline: none; border-color: var(--primary); }
.is-content-input { font-weight: 600; font-size: 14px; }
/* 展示：成对分区 */
.is-pair-item { display: flex; gap: 10px; padding: 8px 6px; border-bottom: 1px dashed #eee; align-items: flex-start; }
.is-pair-item:last-child { border-bottom: none; }
.is-pair-no { width: 22px; height: 22px; border-radius: 50%; background: #3456a8; color: #fff; font-size: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 2px; }
.is-pair-main { flex: 1; }
.is-pair-title { font-size: 14px; font-weight: 600; color: #333; }
.is-pair-std { font-size: 13px; color: #555; margin-top: 2px; }
/* 列表摘要 */
.is-cell-item { font-size: 12px; color: #444; line-height: 1.8; }
.is-cell-item b { color: #3456a8; }

/* 扫码点检：判断题表单 */
.is-judge-row { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; background: #fcfdfe; }
.is-judge-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.is-judge-std { font-size: 12px; flex: 1; }
.is-judge-opts { display: flex; gap: 16px; }
.is-judge-opts label { cursor: pointer; font-size: 14px; padding: 4px 10px; border: 1px solid transparent; border-radius: 6px; }
.is-judge-ok:hover { background: #eef8f0; }
.is-judge-bad:hover { background: #fdeeee; }
.is-judge-ok input, .is-judge-bad input { margin-right: 3px; }
.is-remark { margin-top: 6px; padding: 6px 8px; background: #fef9ec; border: 1px solid #f5e3b8; border-radius: 6px; }
.is-remark label { font-size: 12px; color: #8a6d3b; display: block; margin-bottom: 3px; }
.is-remark textarea { width: 100%; border: 1px solid #e3d3a8; border-radius: 6px; padding: 6px 8px; font-size: 13px; }
.is-loc-box { margin-top: 10px; padding: 10px 12px; border: 1px dashed #9ec3f5; border-radius: 8px; background: #f4f9ff; }
.is-loc-head { margin-bottom: 6px; }
.is-loc-result { font-size: 13px; margin-bottom: 6px; word-break: break-all; }

/* ICP 备案号页脚 */
.icp-footer { text-align: center; font-size: 12px; color: #9aa2b1; padding: 14px 10px 30px; line-height: 1.8; }
.icp-link a { color: #9aa2b1; text-decoration: none; margin-left: 6px; }
.icp-link a:hover { text-decoration: underline; }


