/* 服务订单系统 · 轻量样式（浅色主题） */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #f3f5f9;
  --card: #ffffff;
  --line: #e3e8ef;
  --text: #1f2733;
  --muted: #7a8699;
  --primary: #2563eb;
  --primary-d: #1d4ed8;
  --danger: #dc2626;
  --warn: #d97706;
  --ok: #16a34a;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .08);
}
body {
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px;
}
.hidden { display: none !important; }

/* ---------- 按钮 / 表单 ---------- */
.btn {
  border: 1px solid var(--line); background: #fff; color: var(--text);
  padding: 8px 16px; border-radius: 8px; cursor: pointer; font-size: 14px;
  transition: all .15s;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-d); color: #fff; }
.btn-danger { background: #fff; border-color: #f3c1c1; color: var(--danger); }
.btn-danger:hover { background: #fef2f2; border-color: var(--danger); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.input {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 14px; background: #fff; color: var(--text); outline: none;
  transition: border-color .15s;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
textarea.input { resize: vertical; min-height: 80px; font-family: inherit; }
.select { width: auto; }
.field { display: block; margin-bottom: 14px; font-size: 13px; color: var(--muted); }
.field .input { margin-top: 6px; }

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #e8effc 0%, #f3f5f9 60%);
  padding: 20px;
}
.login-card {
  width: 380px; background: var(--card); border-radius: 16px; padding: 40px 36px;
  box-shadow: 0 10px 40px rgba(16, 24, 40, .12); text-align: center;
}
.login-logo { width: 72px; height: 72px; border-radius: 16px; margin-bottom: 8px; object-fit: cover; }
.login-card h1 { font-size: 22px; margin-bottom: 4px; }
.login-sub { color: var(--muted); margin-bottom: 24px; }
.login-card .field { text-align: left; }
.login-msg { color: var(--danger); font-size: 13px; min-height: 18px; margin-bottom: 10px; }

/* 验证码 + 记住密码 */
.captcha-row { display: flex; gap: 10px; margin-bottom: 14px; align-items: stretch; }
.captcha-row img {
  width: 160px; height: 50px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: #f1f5f9; flex: none;
}
.captcha-row .input { letter-spacing: 4px; text-transform: uppercase; font-size: 16px; text-align: center; }
.remember-row {
  display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted);
  margin-bottom: 14px; cursor: pointer; user-select: none;
}
.remember-row input { accent-color: var(--primary); width: 15px; height: 15px; cursor: pointer; }

/* ---------- 布局 ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; background: var(--card); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { font-size: 17px; font-weight: 700; padding: 16px 20px 12px; color: #dc2626; display: flex; align-items: center; gap: 10px; }
.brand img { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; }
.nav { flex: 1; padding: 8px 12px; display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  text-align: left; border: none; background: transparent; padding: 10px 12px;
  border-radius: 8px; cursor: pointer; font-size: 14px; color: var(--muted);
}
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active { background: #eaf0fe; color: var(--primary); font-weight: 600; }
.sidebar-footer { padding: 14px 20px; border-top: 1px solid var(--line); }
.me-info { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.me-info b { color: var(--text); }

.main { flex: 1; padding: 24px 28px; min-width: 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.page-head h2 { font-size: 20px; }
.page-sub { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* ---------- 卡片 / 表格 ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 4px 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.toolbar { display: flex; gap: 10px; margin-bottom: 14px; }
.toolbar .input { max-width: 320px; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
  padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line);
  white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis;
}
.table th:last-child, .table td:last-child {
  max-width: none; overflow: visible; white-space: normal;
}
.table td:last-child .btn { margin-bottom: 4px; }
.table th { font-size: 12px; color: var(--muted); font-weight: 600; background: #fafbfd; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #fafbfd; }
.table .empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* ---------- 状态 / 标签 ---------- */
.tag {
  display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
}
.tag.pending   { background: #fef3c7; color: #b45309; }
.tag.assigned  { background: #e0edff; color: #1d4ed8; }
.tag.progress  { background: #ede9fe; color: #6d28d9; }
.tag.onsite    { background: #cffafe; color: #0e7490; }
.tag.completed { background: #dcfce7; color: #15803d; }
.tag.cancelled { background: #f1f5f9; color: #64748b; }
.tag.danger { background: #fee2e2; color: var(--danger); }
.tag.warn   { background: #ffedd5; color: var(--warn); }
.tag.ok     { background: #dcfce7; color: var(--ok); }

/* ---------- 仪表盘 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 20px;
}
.stat-card .num { font-size: 28px; font-weight: 700; margin-top: 6px; }
.stat-card .lbl { color: var(--muted); font-size: 13px; }
.stat-card.stat-link { cursor: pointer; transition: transform .12s, box-shadow .12s; }
.stat-card.stat-link:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,.10); }
.stat-card.stat-link:active { transform: translateY(0); }
.recent-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.recent-item:last-child { border-bottom: none; }
.recent-item:hover { background: #fafbfd; }
.recent-item .no { font-weight: 600; font-size: 13px; }
.recent-item .info { flex: 1; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .45);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 100;
}
.modal {
  background: var(--card); border-radius: 14px; width: 560px; max-width: 96vw;
  max-height: 90vh; overflow-y: auto; padding: 24px 26px; box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.modal h3 { font-size: 17px; margin-bottom: 16px; display: flex; align-items: center; justify-content: space-between; }
.modal .close { border: none; background: transparent; font-size: 20px; cursor: pointer; color: var(--muted); }
.modal .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.modal .form-grid .full { grid-column: 1 / -1; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

.detail-sec { border-top: 1px dashed var(--line); margin-top: 16px; padding-top: 14px; }
.detail-sec h4 { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.kv { display: grid; grid-template-columns: 90px 1fr; gap: 6px 10px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { word-break: break-all; }

/* 处理过程时间线 */
.log-item { padding: 8px 0 8px 12px; border-left: 2px solid #cffafe; margin-bottom: 6px; }
.log-time { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.log-content { font-size: 14px; white-space: pre-wrap; word-break: break-all; }

/* ---------- 提示 ---------- */
.toast {
  background: #101828; color: #fff; padding: 10px 20px; border-radius: 8px; font-size: 14px;
  box-shadow: 0 6px 20px rgba(0,0,0,.25); animation: fadein .2s;
}
.toast.err { background: var(--danger); }
.toast-root { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; }

/* ---------- 批量导入 / 多行录入 ---------- */
.imp-tools { background: #f8fafc; border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin-bottom: 12px; }
.imp-tools textarea { width: 100%; }
.imp-err { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; border-radius: 8px; padding: 10px 12px; font-size: 13px; margin-bottom: 10px; }
.imp-row input, .imp-row select { min-width: 0; }
.imp-row td { padding: 4px 6px; }
@keyframes fadein { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; } }

/* ---------- 配件管理 tab ---------- */
.tab-bar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.tab-btn {
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  padding: 8px 18px; border-radius: 8px; cursor: pointer; font-size: 14px;
}
.tab-btn:hover { border-color: var(--primary); color: var(--primary); }
.tab-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

@media (max-width: 800px) {
  .sidebar { width: 64px; }
  .brand, .me-info, .nav-item span { display: none; }
  .main { padding: 16px; }
  .modal .form-grid { grid-template-columns: 1fr; }
}

/* ---------- 可搜索下拉（物料录入） ---------- */
.ss-mount { display: block; }
.ss { position: relative; display: block; }
.ss-input { width: 100%; }
.ss-panel {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 60;
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(16,24,40,.14); max-height: 240px; overflow: auto;
}
.ss-panel[hidden] { display: none; }
.ss-opt {
  padding: 9px 12px; font-size: 14px; cursor: pointer; display: flex;
  justify-content: space-between; align-items: center; gap: 8px;
  border-bottom: 1px solid #f1f4f9; word-break: break-all;
}
.ss-opt:last-child { border-bottom: 0; }
.ss-opt:hover, .ss-opt.on { background: #eff6ff; color: var(--primary-d); }
.ss-code { color: var(--muted); font-size: 12px; }
.ss-stock { color: var(--ok); font-size: 12px; white-space: nowrap; }
.ss-empty { padding: 10px 12px; font-size: 13px; color: var(--muted); }
