/* ===== 众匡SAAS · 现代简洁商务风（蓝色系） ===== */
* { box-sizing: border-box; }
:root {
  --blue: #2563eb;
  --blue-d: #1d4ed8;
  --blue-l: #eff6ff;
  --ink: #17202b;
  --sub: #64748b;
  --line: #e2e8f0;
  --bg: #f6f8fb;
  --ok: #16a34a;
  --bad: #dc2626;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 24px rgba(16, 24, 40, .06);
  /* 手机档（≤430px）要改的几个值：默认就是桌面值，窄屏媒体查询只改这一组变量，
     不用 !important 硬压——那会连行内 style 写的列数、宽度一起压掉（工单详情靠行内列数排版）。 */
  --kv-cols: 92px 1fr;
  --pop-min: 172px;
  --qr-size: 230px;
}
html, body { margin: 0; padding: 0; }
body {
  font: 14px/1.6 -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 12px; font-weight: 600; }
p { margin: 0 0 10px; }

/* ---------- 表格 ---------- */
table.tb { width: 100%; border-collapse: collapse; background: #fff; }
.tb th, .tb td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; font-size: 13px; vertical-align: middle; }
.tb th { background: #f8fafc; color: var(--sub); font-weight: 600; white-space: nowrap; }
.tb tbody tr:hover { background: var(--blue-l); }
/* 操作列里的按钮排不下就换行，不再拿 nowrap 硬撑一行：
   工单和账单最多一行有 7 颗按钮，nowrap 会把整张表撑出横向滚动条，还会让人点错相邻那颗。
   line-height 拉开两行按钮的间距，比给每颗按钮加 margin 更省事（margin 会和 .btn-sm + .btn-sm 打架） */
.tb .ops { white-space: normal; line-height: 2; }
/* 长单号、长地址不能把表格撑破：单元格内允许断词（操作列自己换行，见上） */
.tb td { word-break: break-word; }
.tb td .btn-sm + .btn-sm, .tb td .btn-sm + a.btn-sm { margin-left: 6px; }
.tb tr > td:first-child { padding-left: 12px; }
.wrap-table { overflow-x: auto; border-radius: var(--radius); box-shadow: var(--shadow); }

/* ---------- 卡片 ---------- */
.card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px; }
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.card-title .more { margin-left: auto; font-size: 13px; font-weight: 400; }
.grid { display: grid; gap: 14px; }
.grid.c2 { grid-template-columns: repeat(2, 1fr); }
.grid.c3 { grid-template-columns: repeat(3, 1fr); }
.grid.c4 { grid-template-columns: repeat(4, 1fr); }
.grid.c5 { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 1100px) { .grid.c5 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 1100px) { .grid.c4 { grid-template-columns: repeat(2, 1fr); } .grid.c3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 680px) { .grid.c2, .grid.c3, .grid.c4, .grid.c5 { grid-template-columns: 1fr; } }

.stat { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
.stat b { display: block; font-size: 24px; color: var(--blue); line-height: 1.3; }
.stat span { color: var(--sub); font-size: 13px; }
.stat.warn b { color: #d97706; }
.stat.bad b { color: var(--bad); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 7px 14px; border-radius: 8px; font-size: 13px; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn:hover { border-color: var(--blue); color: var(--blue); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-d); border-color: var(--blue-d); color: #fff; }
.btn-danger { background: #fff; border-color: #fecaca; color: var(--bad); }
.btn-danger:hover { background: #fef2f2; border-color: var(--bad); color: var(--bad); }
.btn-sm { padding: 4px 9px; font-size: 12px; border-radius: 6px; }
.btn-block { width: 100%; justify-content: center; padding: 10px; font-size: 15px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pg-info { margin-right: auto; font-size: 12px; color: var(--sub); }
.spin { display: inline-block; width: 12px; height: 12px; border: 2px solid rgba(255,255,255,.45); border-top-color: #fff; border-radius: 50%; animation: rot .7s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }

/* ---------- 表单 ---------- */
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 13px; color: var(--sub); margin-bottom: 5px; }
input[type=text], input[type=tel], input[type=password], input[type=date], input[type=datetime-local],
input[type=number], input[type=email], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 14px; font-family: inherit; color: var(--ink); background: #fff;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37, 99, 235, .1); }
input:disabled { background: #f1f5f9; color: var(--sub); }
textarea { min-height: 72px; resize: vertical; }
.hint { color: var(--sub); font-size: 12px; line-height: 1.5; }
.hint.warn { color: #b45309; }
/* 只改颜色的三颗 class：页面里不再散写 style="color:#xxx"，调色只动这一处
   （.hint.warn 是给整段提示用的，这三颗是给一小段文字用的，不改字号） */
.txt-ok { color: #15803d; }
.txt-warn { color: #b45309; }
.txt-bad { color: var(--bad); }
/* 两栏/三栏字段行：控制台里的弹窗和卡片不在 <form> 内，所以选择器不能带 form 前缀，
   否则整站两栏栅格静默退化成竖排（发单页「填的不居中」就是这么来的） */
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.row > .field { margin-bottom: 0; }
.row.r3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 900px) { .row.r3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 680px) { .row, .row.r3 { grid-template-columns: 1fr; } }
label.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink); }

/* ---------- 提示条 ---------- */
.msg { display: none; padding: 10px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 12px; }
.msg.ok { display: block; background: #f0fdf4; border: 1px solid #bbf7d0; color: #15803d; }
.msg.err { display: block; background: #fef2f2; border: 1px solid #fecaca; color: var(--bad); }
.msg.info { display: block; background: var(--blue-l); border: 1px solid #bfdbfe; color: var(--blue-d); }

.pop-host { position: fixed; right: 16px; bottom: 20px; z-index: 300; display: flex; flex-direction: column; gap: 8px; max-width: 86vw; }
.pop-item { padding: 10px 14px; border-radius: 8px; color: #fff; font-size: 13px; box-shadow: var(--shadow); transition: opacity .4s; }
.pop-item.good { background: #16a34a; }
.pop-item.bad { background: #dc2626; }

/* ---------- 标签 ---------- */
.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; border: 1px solid transparent; white-space: nowrap; }
.tag-blue { background: var(--blue-l); color: var(--blue-d); border-color: #bfdbfe; }
.tag-green { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.tag-red { background: #fef2f2; color: var(--bad); border-color: #fecaca; }
.tag-orange { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }
.tag-purple { background: #faf5ff; color: #7e22ce; border-color: #e9d5ff; }
.tag-cyan { background: #ecfeff; color: #0e7490; border-color: #a5f3fc; }
.tag-gray { background: #f1f5f9; color: var(--sub); border-color: var(--line); }

/* ---------- 登录页 ---------- */
.login-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px;
  background: radial-gradient(1000px 500px at 15% -10%, #dbeafe 0%, transparent 60%),
              radial-gradient(900px 480px at 110% 110%, #e0e7ff 0%, transparent 55%), var(--bg); }
.login-main { width: 100%; display: flex; justify-content: center; }
.env-badge { position: fixed; top: 12px; right: 14px; font-size: 11px; color: #94a3b8; letter-spacing: .5px; }
.login-card { position: relative; overflow: hidden; width: 100%; max-width: 396px; border-radius: 16px; padding: 28px 26px;
  background: rgba(255, 255, 255, .78); -webkit-backdrop-filter: blur(30px) saturate(200%); backdrop-filter: blur(30px) saturate(200%);
  border: 1px solid rgba(255, 255, 255, .75); box-shadow: 0 20px 50px rgba(15, 23, 42, .12); }
.login-card::before { content: ''; position: absolute; inset: 0 0 auto; height: 3px;
  background: linear-gradient(90deg, transparent, var(--blue), #22d3ee, transparent); background-size: 200% 100%;
  animation: lbSweep 5s linear infinite; }
@keyframes lbSweep { to { background-position: -200% 0; } }
.login-brand { display: flex; gap: 10px; align-items: center; justify-content: center; margin-bottom: 5px; }
.login-brand h1 { font-size: 19px; margin: 0; color: var(--blue-d); }
.login-brand .lb-dot { width: 24px; height: 24px; border-radius: 8px; flex: 0 0 24px; background: linear-gradient(135deg, #2563eb, #22d3ee);
  display: flex; align-items: center; justify-content: center; color: #fff; }
.login-brand .lb-dot svg { width: 14px; height: 14px; }
.login-brand p { width: 100%; text-align: center; color: var(--sub); font-size: 13px; margin: 2px 0 0; }
.lb-sub { text-align: center; color: var(--sub); font-size: 13px; margin: 0 0 16px; }
.lb-kind { display: flex; justify-content: center; margin-bottom: 10px; }
.lb-kind span { font-size: 11px; letter-spacing: 2px; padding: 3px 11px; border-radius: 999px;
  color: var(--blue-d); background: rgba(37, 99, 235, .10); border: 1px solid rgba(37, 99, 235, .18); }
.lb-alt { margin-top: 14px; text-align: center; font-size: 12px; }
.lb-alt a { color: var(--sub); border-bottom: 1px dashed var(--line); padding-bottom: 1px; }
.lb-alt a:hover { color: var(--blue-d); text-decoration: none; border-bottom-color: var(--blue-d); }
/* 服务商入口：同一套卡片骨架，换成深蓝身份标识（徽标/标签/顶部流光/底色） */
.login-body.lk-provider { background: radial-gradient(1000px 500px at 15% -10%, #bfdbfe 0%, transparent 60%),
              radial-gradient(900px 480px at 110% 110%, #93c5fd 0%, transparent 55%), #e7edf6; }
.login-card.is-provider .lb-kind span { color: #fff; background: linear-gradient(135deg, #1e3a8a, #2563eb); border-color: transparent; }
.login-card.is-provider .lb-dot { background: linear-gradient(135deg, #1e3a8a, #2563eb); }
.login-card.is-provider .login-brand h1 { color: #1e3a8a; }
.login-card.is-provider::before { background: linear-gradient(90deg, transparent, #1d4ed8, #38bdf8, transparent); background-size: 200% 100%; }
.io { position: relative; }
.io > svg { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; opacity: .35; pointer-events: none; }
.io > input { padding-right: 34px; }
.lb-foot { margin-top: 16px; text-align: center; font-size: 11px; color: #b6c2d2; letter-spacing: 1px; }
.login-tip { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line); color: var(--sub); font-size: 12px; text-align: center; }
.login-tip a { margin: 0 4px; }

/* ---------- 控制台外壳：顶部两行导航（品牌条 + 分组条） ---------- */
.app-body { min-height: 100vh; }
.top-nav { position: sticky; top: 0; z-index: 120; background: #0b1220; color: #cbd5e1; }
/* 品牌条压深、分组条提亮一档，中间一条蓝色细线：两行不再糊成一条 */
.tn-brand { display: flex; gap: 8px; align-items: center; padding: 10px 16px 9px;
  background: linear-gradient(90deg, #0f172a 0%, #16233c 55%, #0f172a 100%);
  border-bottom: 1px solid rgba(37, 99, 235, .35); }
.tn-brand .dot { width: 24px; height: 24px; border-radius: 7px; background: linear-gradient(135deg, #2563eb, #22d3ee); flex: 0 0 24px; }
/* 企业自己上传的标志（应用「界面个性化」）：尺寸一点不放大，白底才看得见透明底的深色 logo */
.tn-brand .dot.has-logo { background: #fff; padding: 2px; }
.tn-brand .dot img { width: 100%; height: 100%; object-fit: contain; display: block; border-radius: 5px; }
.tn-brand b { color: #fff; font-size: 14px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tn-brand small { color: #7d8ca3; font-size: 12px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tn-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.tn-right .who { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #cbd5e1; }
.tn-link { color: #93a4bb; font-size: 12px; white-space: nowrap; }
.tn-link:hover { color: #fff; text-decoration: none; }
.tn-btn { background: none; border: 1px solid #334155; color: #cbd5e1; padding: 5px 10px; border-radius: 6px; cursor: pointer; font-size: 12px; white-space: nowrap; }
.tn-btn:hover { border-color: var(--blue); color: #fff; }

.tn-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 6px 12px;
  background: #1e293b; box-shadow: inset 0 1px 0 rgba(148, 163, 184, .18); }
.tn-item, .tn-tab { display: inline-flex; align-items: center; gap: 5px; padding: 7px 13px; border-radius: 8px; color: #cbd5e1; font-size: 13px; background: none; border: 0; cursor: pointer; white-space: nowrap; font-family: inherit; }
.tn-item:hover, .tn-tab:hover { background: #334155; color: #fff; text-decoration: none; }
.tn-item.on, .tn-tab.on { background: var(--blue); color: #fff; box-shadow: 0 2px 10px rgba(37, 99, 235, .4); }
.tn-group { position: relative; flex: 0 0 auto; }
.tn-tab i { width: 0; height: 0; border: 3.5px solid transparent; border-top-color: currentColor; margin-top: 3px; }
/* 下拉面板必须是 .tn-group 的子孙且父级不能滚动裁剪，所以分组条用换行而不是 overflow-x */
.tn-pop { display: none; position: absolute; top: calc(100% + 5px); left: 0; min-width: var(--pop-min); background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 14px 34px rgba(15, 23, 42, .18); padding: 6px; z-index: 130; }
.tn-group.open .tn-pop { display: block; }
/* 最后一个分组（设置）靠右边界，下拉再往右展开就会顶出屏幕 */
.tn-group:last-child .tn-pop { left: auto; right: 0; }
.tn-pop a { display: block; padding: 8px 10px; border-radius: 7px; color: var(--ink); font-size: 13px; white-space: nowrap; }
.tn-pop a:hover { background: var(--blue-l); color: var(--blue-d); text-decoration: none; }
.tn-pop a.on { background: var(--blue); color: #fff; }

.main { min-width: 0; padding: 18px; max-width: 1280px; margin: 0 auto; width: 100%; }
.main .page-title { font-size: 18px; margin-bottom: 14px; display: flex; align-items: center; gap: 10px; }
.main .page-title small { font-size: 12px; color: var(--sub); font-weight: 400; }

@media (max-width: 820px) {
  .tn-brand { padding: 8px 12px 7px; }
  .tn-right { gap: 8px; }
  .tn-right .who { display: none; }
  .tn-bar { padding: 4px 8px; }
  .main { padding: 12px; }
}

/* ---------- 弹窗 ---------- */
.modal { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: none; align-items: flex-start; justify-content: center; padding: 24px 12px; z-index: 200; overflow-y: auto; }
.modal.on { display: flex; }
.modal-box { background: #fff; border-radius: 12px; width: 100%; max-width: 560px; box-shadow: 0 20px 50px rgba(15, 23, 42, .25); }
.modal-box.lg { max-width: 820px; }
.modal-box.sm { max-width: 420px; }
.modal-head { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; }
.modal-head h3 { margin: 0; font-size: 15px; }
.modal-head .x { margin-left: auto; background: none; border: 0; font-size: 20px; color: var(--sub); cursor: pointer; line-height: 1; }
.modal-body { padding: 16px; max-height: 74vh; overflow-y: auto; }
/* 页脚按钮必须能换行：三个按钮的弹窗（保养计划、设备二维码）在窄屏上原本会把最后一个顶出盒子外点不到 */
.modal-foot { padding: 12px 16px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }

/* ---------- 应用图标 / 应用市场 ---------- */
.app-ic { width: 20px; height: 20px; vertical-align: -4px; color: var(--blue); flex: none; }
.app-tile { display: flex; align-items: center; gap: 10px; }
.app-tile .ic-box { width: 38px; height: 38px; border-radius: 9px; background: var(--blue-l); display: flex; align-items: center; justify-content: center; flex: none; }
.app-tile .ic-box .app-ic { width: 22px; height: 22px; }
.market-card { display: flex; flex-direction: column; gap: 10px; }
.market-card .mc-body { flex: 1; min-width: 0; }
.market-card .mc-desc { color: var(--sub); font-size: 12.5px; line-height: 1.6; margin-top: 4px; min-height: 40px; }
.market-card .mc-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; }
.market-card .mc-foot > .hint { margin-right: auto; }
.mc-acts { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
/* 应用市场按分类分区 */
.market-cat { margin-bottom: 18px; }
.market-cat:last-child { margin-bottom: 0; }
.mc-cat-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--blue); margin-bottom: 10px; }
.mc-cat-title::before { content: ''; width: 3px; height: 13px; border-radius: 2px; background: var(--blue); }
.market-card .mc-price { font-size: 12.5px; font-weight: 600; color: var(--blue-d); white-space: nowrap; }
/* 企业侧「服务与缴费」的续费档位卡 */
.renew-way { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; background: #fff; }
.renew-way .rw-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 2px; }
.renew-way .rw-head b { font-size: 15px; }
.renew-way .hint { margin-bottom: 2px; }
.renew-way .btn { margin-top: 8px; }
/* 后台「应用管理」的分类统计 */
.cat-stat { position: relative; }
.cat-ops { margin-top: 6px; display: flex; gap: 10px; }
.lnk { background: none; border: 0; padding: 0; color: var(--blue); font-size: 12px; cursor: pointer; font-family: inherit; }
.lnk:hover { text-decoration: underline; }
.lnk.bad { color: var(--bad); }

/* ---------- 权限点矩阵（角色权限页） ---------- */
.perm-app { display: flex; align-items: center; gap: 7px; margin: 14px 0 8px; font-size: 13px; font-weight: 700; color: var(--blue); }
.perm-app::before { content: ''; width: 3px; height: 13px; border-radius: 2px; background: var(--blue); }
.perm-group { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; overflow: hidden; }
.perm-group-title { padding: 8px 12px; background: #f8fafc; color: var(--sub); font-size: 13px; font-weight: 600; border-bottom: 1px solid var(--line); }
.perm-row { display: flex; align-items: center; gap: 12px; padding: 7px 12px; border-bottom: 1px solid #f1f5f9; }
.perm-row:last-child { border-bottom: 0; }
.perm-row:hover { background: var(--blue-l); }
.perm-name { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; }
.perm-name code { font-size: 11px; color: #94a3b8; background: #f1f5f9; padding: 1px 5px; border-radius: 4px; }
.perm-row input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--blue); cursor: pointer; }
.perm-row select { width: 190px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; background: #fff; }
.perm-row select:disabled, .perm-row input:disabled { opacity: .55; cursor: not-allowed; }
@media (max-width: 680px) {
  .perm-row { flex-wrap: wrap; }
  .perm-row select { width: 100%; }
}

/* ---------- 站内通知（顶栏铃铛 + 消息列表） ---------- */
.tn-brand .sb-txt { flex: 1; min-width: 0; }
.bell { position: relative; margin-left: auto; flex: 0 0 auto; width: 26px; height: 28px; padding: 0; border: 0; border-radius: 8px; background: none; color: #93a4bb; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.bell:hover { background: #1e293b; color: #fff; }
.bell svg { display: block; }
.bell-dot { position: absolute; top: 1px; right: 1px; min-width: 15px; height: 15px; padding: 0 4px; border-radius: 8px; background: var(--bad); color: #fff; font-size: 10px; line-height: 15px; text-align: center; font-weight: 600; }
.nh-acts { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.nh-acts .x { margin-left: 0; }
.notif-list { padding: 6px 0; max-height: 62vh; }
.notif-empty { padding: 26px 16px; text-align: center; color: var(--sub); font-size: 13px; }
.notif-item { display: flex; gap: 10px; padding: 11px 16px; border-bottom: 1px solid var(--line); cursor: pointer; }
.notif-item:last-child { border-bottom: 0; }
.notif-item:hover { background: var(--blue-l); text-decoration: none; }
.notif-item .ndot { flex: 0 0 8px; width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: #cbd5e1; }
.notif-item.unread .ndot { background: var(--blue); }
.notif-item.unread.lv-warn .ndot { background: #ea580c; }
.notif-item.unread.lv-bad .ndot { background: var(--bad); }
.notif-item .nmain { flex: 1; min-width: 0; }
.notif-item .ntitle { font-size: 13px; color: var(--sub); word-break: break-word; }
.notif-item.unread .ntitle { color: var(--ink); font-weight: 600; }
.notif-item .nbody { font-size: 12px; color: var(--sub); margin-top: 2px; word-break: break-word; }
.notif-item .nago { font-size: 11px; color: #9aa8bb; margin-top: 3px; }
.notif-tip { margin-right: auto; font-size: 12px; color: var(--sub); }

/* ---------- 工单 ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 18px; border-left: 2px solid var(--line); }
.timeline li:last-child { border-left-color: transparent; }
.timeline li::before { content: ''; position: absolute; left: -6px; top: 3px; width: 10px; height: 10px; border-radius: 50%; background: var(--blue); }
.timeline .t-act { font-weight: 600; }
.timeline .t-meta { color: var(--sub); font-size: 12px; }

.photo-block { margin-top: 14px; }
.photo-title { font-size: 13px; color: var(--sub); margin-bottom: 8px; }
.photo-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.thumb { display: block; width: 84px; height: 84px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb:hover { border-color: var(--blue); }
.kv { display: grid; grid-template-columns: var(--kv-cols); gap: 6px 10px; font-size: 13px; }
.kv dt { color: var(--sub); }
.kv dd { margin: 0; word-break: break-all; }
.stars { font-size: 18px; color: #f59e0b; letter-spacing: 2px; }
.stars .off { color: #d7dde5; }

.bar { height: 8px; border-radius: 999px; background: #eef2f7; overflow: hidden; }
.sign-block { margin-top: 14px; }
.sign-canvas { width: 100%; height: 150px; border: 1px dashed var(--line); border-radius: 8px; background: #fff; touch-action: none; cursor: crosshair; display: block; }
.sign-preview { max-width: 240px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, #2563eb, #22d3ee); }

/* ---------- 移动端（外勤） ---------- */
.m-top { position: sticky; top: 0; background: var(--blue); color: #fff; padding: 12px 14px; display: flex; align-items: center; gap: 8px; z-index: 10; }
.m-top b { font-size: 15px; }
.m-top .who { margin-left: auto; font-size: 12px; opacity: .9; }
.m-card { background: #fff; border-radius: 12px; box-shadow: var(--shadow); padding: 14px; margin: 12px; }
.m-card .no { font-size: 12px; color: var(--sub); }
.m-card h4 { margin: 4px 0 8px; font-size: 15px; }
.m-card .line { font-size: 13px; margin-bottom: 4px; }
/* 外勤卡片底部按钮：详情+开工+完工 三个并排，窄屏必须能换行，否则每个按钮被压到点不准 */
.m-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.m-actions .btn { flex: 1; justify-content: center; }
.m-empty { text-align: center; color: var(--sub); padding: 48px 12px; }
.m-tabs { display: flex; gap: 6px; padding: 10px 12px 0; }
.m-tabs button { flex: 1; padding: 8px; border-radius: 8px 8px 0 0; border: 1px solid var(--line); background: #fff; font-size: 13px; cursor: pointer; }
.m-tabs button.on { border-color: var(--blue); color: var(--blue); font-weight: 600; }
input[type=file].cam { display: none; }
.sheet { position: fixed; inset: 0; background: rgba(15, 23, 42, .55); display: none; align-items: flex-end; z-index: 60; }
.sheet.on { display: flex; }
.sheet-box { background: #fff; width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto; border-radius: 16px 16px 0 0; padding: 14px 14px calc(14px + env(safe-area-inset-bottom)); animation: sheetUp .22s ease-out; }
@keyframes sheetUp { from { transform: translateY(40%); opacity: .6; } to { transform: none; opacity: 1; } }
.sheet-title { font-size: 14px; font-weight: 600; margin-bottom: 10px; color: var(--ink); }
.sheet-box .m-actions { flex-wrap: wrap; }
.sheet-box .hint { font-size: 12px; color: var(--sub); margin-top: 8px; }

/* ---------- 其它 ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.toolbar input, .toolbar select { width: auto; min-width: 140px; }
/* 一张表单的页面（发单、个性化设置）收成居中的一栏：以前只给卡片写 max-width，
   桌面 1280 的宽度里它就贴左墙，右边一大片空白，看着像没排完 */
.narrow { max-width: 760px; margin: 0 auto 16px; }
/* 选填项折叠：默认收起，展开后仍是正常的两栏栅格 */
details.fold { border: 1px solid var(--line); border-radius: 8px; padding: 0 12px; margin-bottom: 14px; background: #fff; }
details.fold > summary { cursor: pointer; font-size: 13px; color: var(--blue); padding: 9px 0; list-style: none; user-select: none; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::before { content: '＋ '; }
details.fold[open] > summary::before { content: '－ '; }
details.fold > .fold-body { padding-top: 4px; }
details.fold > .fold-body > :last-child { margin-bottom: 12px; }
/* 个性化设置页的「现在的样子」：照抄顶栏那一小块，深色底才看得出标志在真实背景上是什么效果 */
.brand-preview { display: flex; gap: 8px; align-items: center; background: #0f172a; border-radius: 8px; padding: 10px 12px; }
.brand-preview .dot { width: 24px; height: 24px; border-radius: 7px; background: linear-gradient(135deg, #2563eb, #22d3ee); flex: 0 0 24px; overflow: hidden; }
.brand-preview .dot.has-logo { background: #fff; padding: 2px; }
.brand-preview .dot img { width: 100%; height: 100%; object-fit: contain; display: block; }
.brand-preview b { display: block; color: #fff; font-size: 14px; }
.brand-preview small { display: block; color: #7d8ca3; font-size: 12px; }
.pill-list { display: flex; flex-wrap: wrap; gap: 6px; }
.pill-list span { background: var(--blue-l); color: var(--blue-d); border-radius: 6px; padding: 2px 8px; font-size: 12px; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.copy-field { display: flex; gap: 8px; align-items: center; }
.copy-field input { flex: 1; }
.muted { color: var(--sub); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* ---------- 打印：A4 工单处理单（公文证书风：宋体 + 双框，屏幕上不显示） ---------- */
#printArea { display: none; }
.ps-sheet { font-family: SimSun, "宋体", "Songti SC", serif; color: #000; font-size: 12pt; line-height: 1.7; }
.ps-head { text-align: center; border-bottom: 3px double #000; padding-bottom: 6px; margin-bottom: 4px; }
.ps-org { font-size: 10.5pt; letter-spacing: 2px; }
.ps-title { font-size: 18pt; font-weight: 700; letter-spacing: 6px; margin: 2px 0; }
.ps-meta { display: flex; justify-content: space-between; font-size: 10.5pt; padding: 0 2px 6px; }
.ps-tb { width: 100%; border-collapse: collapse; }
.ps-tb th, .ps-tb td { border: 1px solid #000; padding: 4px 8px; text-align: left; vertical-align: top; font-weight: 400; }
.ps-tb th { width: 5em; background: #f2f2f2; font-family: inherit; font-weight: 700; }
.ps-sec { font-size: 12pt; font-weight: 700; margin: 10px 0 2px; }
.ps-desc { border: 1px solid #000; padding: 6px 8px; min-height: 3em; white-space: pre-wrap; }
.ps-imgs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.ps-imgs img { width: 30%; max-width: 190px; border: 1px solid #666; }
.ps-sign { display: flex; align-items: flex-end; gap: 24px; margin-top: 14px; font-size: 11pt; }
.ps-sign img { max-height: 60px; border-bottom: 1px solid #000; }
.ps-foot { margin-top: 18px; display: flex; justify-content: space-between; font-size: 11pt; }

/* 设备报修标签（插件应用「设备扫码报修」）：屏幕上是弹窗里的一张码，打印时是 A4 标签页 */
.qr-host { display: inline-block; padding: 10px; background: #fff; border: 1px solid var(--line, #e2e8f0); border-radius: 10px; }
.qr-host svg { width: var(--qr-size); height: var(--qr-size); display: block; }
.qr-sheet .qr-grid { display: flex; flex-wrap: wrap; gap: 6mm; padding: 4mm 0 0; }
.qr-sheet .qr-cell { width: 55mm; border: 1px solid #000; padding: 3mm 2mm; text-align: center; page-break-inside: avoid; }
.qr-sheet .qr-cell svg { width: 46mm; height: 46mm; display: block; margin: 0 auto 2mm; }
.qr-sheet .qr-no { font-size: 12pt; font-weight: 700; letter-spacing: .5px; }
.qr-sheet .qr-name { font-size: 10pt; }
.qr-sheet .qr-loc { font-size: 9pt; color: #333; }
.qr-sheet .qr-hint { font-size: 8pt; letter-spacing: .5px; margin-top: 1.5mm; }
/* ---------- 手机档（≤430px：用户后台和收银台在手机上打开的真实宽度） ----------
   680 那一档只是把两栏收成单栏，390 还嫌挤：搜索框、下拉各自占一整行，页头内边距收一半，
   弹窗贴边、二维码缩小到屏宽以内，标签名和值上下排。 */
@media (max-width: 430px) {
  :root { --kv-cols: 1fr; --pop-min: 148px; --qr-size: min(230px, calc(100vw - 96px)); }
  .main { padding: 10px; }
  .card { padding: 12px; margin-bottom: 12px; }
  .modal { padding: 12px 8px; }
  .modal-body { padding: 12px; }
  .modal-head, .modal-foot { padding: 10px 12px; }
  /* 工具条：搜索框占满一行，按钮跟在下面换行（原来靠 min-width 140 把三个控件挤成一排溢出） */
  .toolbar input, .toolbar select { min-width: 0; width: 100%; }
  .toolbar .btn { flex: 1 1 auto; }
  /* 工单详情、企业档案的标签列改成上下排（--kv-cols 已在上面收成 1fr） */
  .perm-row select { width: 100%; }
  .login-card { padding: 22px 16px; }
  .m-card { margin: 8px; }
}

@media print {
  @page { size: A4 portrait; margin: 14mm 12mm; }
  body > * { display: none !important; }
  body #printArea { display: block !important; }
  body { background: #fff !important; }
  .ps-imgs img { page-break-inside: avoid; }
}
