/* ============================================================
   工单管理系统 - 后台主题
   纯本地资源，无外部依赖
   ============================================================ */

:root {
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --primary-light: #eff6ff;
  --success: #10b981;
  --success-light: #ecfdf5;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --purple: #8b5cf6;
  --purple-light: #f5f3ff;
  --info: #06b6d4;
  --info-light: #ecfeff;
  --muted: #94a3b8;
  --muted-light: #f1f5f9;
  --ink: #1e293b;
  --ink-2: #475569;
  --ink-3: #64748b;
  --line: #e2e8f0;
  --bg: #f1f5f9;
  --card: #ffffff;
  --sidebar-bg: #0f172a;
  --sidebar-bg-2: #1e293b;
  --sidebar-text: #94a3b8;
  --sidebar-active: #ffffff;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.06);
  --shadow: 0 4px 16px rgba(15,23,42,.08);
  --shadow-lg: 0 12px 32px rgba(15,23,42,.14);
  --sidebar-w: 236px;
  --topbar-h: 62px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; }
h1,h2,h3,h4 { font-weight: 600; line-height: 1.35; }

/* ---------------- 布局骨架 ---------------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, #0f172a 0%, #111c33 100%);
  color: var(--sidebar-text);
  position: fixed;
  inset: 0 auto 0 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform .25s ease;
}
.sidebar-header {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  border-bottom: 1px solid rgba(148,163,184,.12);
  flex-shrink: 0;
}
.sidebar-logo {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), #22d3ee);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 17px;
  box-shadow: 0 4px 12px rgba(59,130,246,.4);
}
.sidebar-title { color: #fff; font-size: 15px; font-weight: 600; letter-spacing: .5px; }
.sidebar-sub { font-size: 11px; color: var(--sidebar-text); }

.sidebar-body { flex: 1; overflow-y: auto; padding: 14px 10px 20px; }
.sidebar-body::-webkit-scrollbar { width: 5px; }
.sidebar-body::-webkit-scrollbar-thumb { background: rgba(148,163,184,.25); border-radius: 4px; }

.nav-group { margin: 12px 0 4px; padding: 0 10px; font-size: 11px; color: #64748b; letter-spacing: 1.5px; text-transform: uppercase; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; margin: 2px 0;
  border-radius: 9px;
  color: #cbd5e1;
  font-size: 13.5px;
  font-weight: 500;
  transition: background .15s, color .15s;
  position: relative;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .85; }
.nav-item:hover { background: rgba(148,163,184,.18); color: #ffffff; }
.nav-item.active { background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(59,130,246,.35); }
.nav-item.active svg { opacity: 1; }
.nav-badge {
  margin-left: auto;
  background: var(--danger); color: #fff;
  font-size: 11px; font-weight: 600;
  min-width: 18px; height: 18px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 5px;
}

.sidebar-footer { padding: 12px 16px; border-top: 1px solid rgba(148,163,184,.12); font-size: 11px; color: #64748b; }

.main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: var(--topbar-h);
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px;
  padding: 0 22px;
  position: sticky; top: 0; z-index: 90;
}
.topbar-title { font-size: 16px; font-weight: 600; }
.topbar-search { margin-left: auto; position: relative; }
.topbar-search input {
  width: 240px; height: 36px;
  border: 1px solid var(--line); border-radius: 10px;
  padding: 0 12px 0 34px;
  font-size: 13px; background: var(--bg);
  outline: none; transition: all .15s;
}
.topbar-search input:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(59,130,246,.12); }
.topbar-search svg { position: absolute; left: 10px; top: 9px; width: 17px; height: 17px; color: var(--ink-3); }

.icon-btn {
  width: 38px; height: 38px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-2); cursor: pointer; position: relative;
  transition: all .15s;
}
.icon-btn:hover { background: var(--muted-light); color: var(--ink); }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn .dot {
  position: absolute; top: 6px; right: 7px;
  min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--danger); color: #fff;
  border-radius: 8px; font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff;
}

.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 10px 5px 5px;
  border-radius: 12px; cursor: pointer;
  border: 1px solid var(--line); background: #fff;
  transition: all .15s;
}
.user-chip:hover { background: var(--muted-light); }

.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; font-weight: 600;
  flex-shrink: 0;
}
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg { width: 52px; height: 52px; font-size: 18px; }

.content { padding: 22px; flex: 1; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 19px; }
.page-head .sub { color: var(--ink-3); font-size: 13px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}
.card-head h3 { font-size: 15px; }
.card-head .tools { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-body { padding: 18px; }
.card-body.flush { padding: 0; }
.card + .card { margin-top: 18px; }

/* ---------------- 统计卡片 ---------------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 18px; }
.stat-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; display: flex; gap: 14px; align-items: flex-start;
  box-shadow: var(--shadow-sm); transition: transform .15s, box-shadow .15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-icon {
  width: 46px; height: 46px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-value { font-size: 24px; font-weight: 700; line-height: 1.2; }
.stat-label { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.stat-note { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.stat-note .up { color: var(--success); }
.stat-note .down { color: var(--danger); }

.bg-primary { background: var(--primary-light); color: var(--primary); }
.bg-success { background: var(--success-light); color: var(--success); }
.bg-warning { background: var(--warning-light); color: var(--warning); }
.bg-danger { background: var(--danger-light); color: var(--danger); }
.bg-purple { background: var(--purple-light); color: var(--purple); }
.bg-info { background: var(--info-light); color: var(--info); }
.bg-muted { background: var(--muted-light); color: var(--ink-2); }

/* ---------------- 徽章 ---------------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 500; line-height: 1.5;
  white-space: nowrap;
}
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: #b45309; }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-purple { background: var(--purple-light); color: var(--purple); }
.badge-info { background: var(--info-light); color: #0891b2; }
.badge-muted { background: var(--muted-light); color: var(--ink-3); }
.badge-outline { background: transparent; border: 1px solid var(--line); color: var(--ink-2); }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 16px;
  border-radius: 9px; border: 1px solid transparent;
  font-size: 13.5px; font-weight: 500;
  cursor: pointer; transition: all .15s;
  white-space: nowrap; user-select: none;
}
.btn svg { width: 16px; height: 16px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 2px 6px rgba(59,130,246,.3); }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #d97706; color: #fff; }
.btn-purple { background: var(--purple); color: #fff; }
.btn-purple:hover { background: #7c3aed; color: #fff; }
.btn-outline { background: #fff; border-color: var(--line); color: var(--ink-2); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--muted-light); }
.btn-sm { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn-lg { height: 44px; padding: 0 24px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-icon { width: 32px; height: 32px; padding: 0; border-radius: 8px; }

/* ---------------- 表格 ---------------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; padding: 11px 14px;
  background: #f8fafc; color: var(--ink-3);
  font-size: 12.5px; font-weight: 600;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:hover { background: #f8fafc; }
.table tbody tr:last-child td { border-bottom: none; }
.table .row-title { font-weight: 600; color: var(--ink); }
.table .row-title a { color: var(--ink); }
.table .row-title a:hover { color: var(--primary); }
.table .sub { color: var(--ink-3); font-size: 12.5px; }
.table-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* ---------------- 表单 ---------------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.form-group label .req { color: var(--danger); }
.form-group .hint { font-size: 12px; color: var(--ink-3); }
#customFieldsBox { margin-top: 14px; }
.form-control, .form-select, textarea.form-control {
  width: 100%; height: 38px;
  border: 1px solid var(--line); border-radius: 9px;
  padding: 0 12px; font-size: 13.5px;
  font-family: inherit; color: var(--ink);
  background: #fff; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea.form-control { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; }
.form-control:focus, .form-select:focus, textarea.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}
.form-control:disabled, .form-select:disabled { background: var(--muted-light); color: var(--ink-3); }
.form-select { appearance: none; padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
input[type="date"].form-control, input[type="time"].form-control { padding-right: 8px; }

.checkbox-group { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.checkbox-group label { display: flex; align-items: center; gap: 7px; font-weight: 400; cursor: pointer; }
.checkbox-group input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); }

/* ---------------- 筛选条 ---------------- */
.filter-bar {
  display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap;
  padding: 14px 16px; margin-bottom: 16px;
}
.filter-bar .form-group { min-width: 140px; }
.filter-bar .form-group.search { flex: 1; min-width: 200px; }

/* 单行过滤栏（员工管理等）：不换行，窄屏允许横向滚动 */
.filter-bar-nowrap { flex-wrap: nowrap; overflow-x: auto; }
.filter-bar-nowrap .form-group { min-width: 120px; }
.filter-bar-nowrap .form-group.search { flex: 1; min-width: 160px; }

/* ---------------- 页签 ---------------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tab {
  padding: 9px 16px; font-size: 13.5px; font-weight: 500;
  color: var(--ink-3); cursor: pointer; border: none; background: none;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  display: inline-flex; align-items: center; gap: 6px;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ---------------- 时间线 ---------------- */
.timeline { position: relative; padding-left: 24px; }
.timeline::before {
  content: ''; position: absolute; left: 7px; top: 6px; bottom: 6px;
  width: 2px; background: var(--line);
}
.tl-item { position: relative; padding: 0 0 24px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-dot {
  position: absolute; left: -24px; top: 3px;
  width: 16px; height: 16px; border-radius: 50%;
  border: 3px solid #fff; box-shadow: 0 0 0 2px var(--line);
  background: var(--ink-3);
}
.tl-item.primary .tl-dot { background: var(--primary); box-shadow: 0 0 0 2px var(--primary-light); }
.tl-item.success .tl-dot { background: var(--success); box-shadow: 0 0 0 2px var(--success-light); }
.tl-item.warning .tl-dot { background: var(--warning); box-shadow: 0 0 0 2px var(--warning-light); }
.tl-item.danger .tl-dot { background: var(--danger); box-shadow: 0 0 0 2px var(--danger-light); }
.tl-item.purple .tl-dot { background: var(--purple); box-shadow: 0 0 0 2px var(--purple-light); }
.tl-head { font-weight: 600; font-size: 13.5px; }
.tl-time { font-size: 12px; color: var(--ink-3); margin-top: 1px; }
.tl-note { margin-top: 6px; font-size: 13px; color: var(--ink-2); background: #f8fafc; border-radius: 8px; padding: 10px 12px; }

/* ---------------- 评论 ---------------- */
.comment-item { display: flex; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.comment-item:last-child { border-bottom: none; }
.comment-body { flex: 1; min-width: 0; }
.comment-meta { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-3); }
.comment-meta .name { color: var(--ink); font-weight: 600; font-size: 13px; }
.comment-text { margin-top: 6px; font-size: 13.5px; white-space: pre-wrap; word-break: break-word; }

/* ---------------- 进度条 ---------------- */
.progress { height: 8px; background: var(--muted-light); border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; border-radius: 99px; background: var(--primary); transition: width .4s ease; }
.progress.success > div { background: var(--success); }
.progress.warning > div { background: var(--warning); }

/* ---------------- 模态框 ---------------- */
.modal-mask {
  position: fixed; top: 0; right: 0; bottom: 0; left: var(--sidebar-w); z-index: 200;
  background: rgba(15,23,42,.5);
  backdrop-filter: blur(2px);
  display: none; overflow-y: auto;
  padding: 16px;
}
.modal-mask.show { display: flex; }
.modal {
  background: #fff; border-radius: 14px;
  width: 100%; max-width: 560px;
  box-shadow: var(--shadow-lg);
  animation: modalIn .18s ease;
  max-height: calc(100vh - 32px); display: flex; flex-direction: column;
  margin: auto;
}
.modal.lg { max-width: 760px; }
.modal-head {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.modal-head h3 { font-size: 15.5px; }
.modal-close { margin-left: auto; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot {
  padding: 14px 20px; border-top: 1px solid var(--line);
  display: flex; justify-content: flex-end; gap: 10px;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: none; } }

/* ---------------- Toast ---------------- */
.toast-wrap { position: fixed; right: 20px; bottom: 20px; z-index: 300; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: #fff; border-radius: 11px; box-shadow: var(--shadow-lg);
  padding: 12px 16px; min-width: 260px; max-width: 380px;
  display: flex; gap: 10px; align-items: flex-start;
  border-left: 4px solid var(--primary);
  animation: toastIn .25s ease;
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast .t-icon { margin-top: 1px; }
.toast .t-msg { font-size: 13.5px; color: var(--ink); }
@keyframes toastIn { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }

/* ---------------- 下拉菜单 ---------------- */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 8px);
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow-lg); min-width: 200px;
  padding: 6px; z-index: 150;
  display: none;
}
.dropdown-menu.show { display: block; animation: modalIn .15s ease; }
.dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px;
  font-size: 13.5px; color: var(--ink-2); cursor: pointer;
}
.dropdown-item:hover { background: var(--muted-light); color: var(--ink); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item svg { width: 16px; height: 16px; }
.dropdown-divider { height: 1px; background: var(--line); margin: 6px 4px; }
.dropdown-head { padding: 10px 12px 6px; font-size: 12px; color: var(--ink-3); }

/* ---------------- 通知面板 ---------------- */
.notify-panel { width: 340px; max-height: 420px; flex-direction: column; }
.notify-panel.show { display: flex; }
.notify-list { overflow-y: auto; }
.notify-item { display: flex; gap: 10px; padding: 11px 12px; border-radius: 9px; }
.notify-item:hover { background: var(--muted-light); }
.notify-item.unread { background: var(--primary-light); }
.notify-item .n-title { font-size: 13px; font-weight: 600; color: var(--ink); }
.notify-item .n-time { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }

/* ---------------- 分页 ---------------- */
.pagination { display: flex; align-items: center; gap: 6px; padding: 14px 16px; flex-wrap: wrap; }
.page-info { font-size: 12.5px; color: var(--ink-3); margin-right: 8px; }
.page-link {
  min-width: 32px; height: 32px; padding: 0 8px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; border: 1px solid var(--line);
  font-size: 13px; color: var(--ink-2); background: #fff;
}
.page-link:hover { border-color: var(--primary); color: var(--primary); }
.page-link.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------------- 空状态 ---------------- */
.empty { text-align: center; padding: 48px 20px; color: var(--ink-3); }
.empty svg { width: 52px; height: 52px; color: var(--line); margin-bottom: 12px; }
.empty p { font-size: 14px; }

/* ---------------- 详情信息 ---------------- */
.detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px 18px; }
.detail-item .k { font-size: 12px; color: var(--ink-3); margin-bottom: 4px; }
.detail-item .v { font-size: 13.5px; font-weight: 500; color: var(--ink); word-break: break-all; }

.info-list { display: flex; flex-direction: column; }
.info-row { display: flex; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.info-row:last-child { border-bottom: none; }
.info-row .k { width: 110px; color: var(--ink-3); flex-shrink: 0; }
.info-row .v { flex: 1; color: var(--ink); word-break: break-all; }

/* ---------------- 工单卡片（列表） ---------------- */
.wo-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 10px;
  display: flex; gap: 14px; align-items: flex-start;
  box-shadow: var(--shadow-sm); transition: all .15s;
  cursor: pointer;
}
.wo-card:hover { box-shadow: var(--shadow); border-color: #cbd5e1; transform: translateY(-1px); }
.wo-icon {
  width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.wo-icon svg { width: 20px; height: 20px; }
.wo-main { flex: 1; min-width: 0; }
.wo-title { font-weight: 600; font-size: 14px; color: var(--ink); }
.wo-meta { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 5px; font-size: 12.5px; color: var(--ink-3); }
.wo-right { text-align: right; flex-shrink: 0; }

/* ---------------- 登录页 ---------------- */
.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 55%, #3b82f6 100%);
  padding: 20px;
  position: relative; overflow: hidden;
}
.login-page::before, .login-page::after {
  content: ''; position: absolute; border-radius: 50%;
  background: rgba(255,255,255,.06);
}
.login-page::before { width: 420px; height: 420px; left: -120px; bottom: -140px; }
.login-page::after { width: 300px; height: 300px; right: -80px; top: -100px; }
.login-card {
  background: #fff; border-radius: 18px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 420px; padding: 30px 36px 26px;
  position: relative; z-index: 1;
}
.login-logo {
  width: 52px; height: 52px; border-radius: 14px; margin: 0 auto 16px;
  background: linear-gradient(135deg, var(--primary), #22d3ee);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 24px; font-weight: 700;
  box-shadow: 0 8px 20px rgba(59,130,246,.4);
}
.login-title { text-align: center; font-size: 20px; font-weight: 700; }
.login-sub { text-align: center; color: var(--ink-3); font-size: 13px; margin: 6px 0 18px; }
.login-form .form-group { margin-bottom: 13px; }
.login-error {
  background: var(--danger-light); color: var(--danger);
  border-radius: 9px; padding: 10px 14px; font-size: 13px;
  margin-bottom: 14px; display: none;
}
.login-tip {
  margin-top: 20px; padding: 12px 14px;
  background: var(--muted-light); border-radius: 10px;
  font-size: 12px; color: var(--ink-3); line-height: 1.8;
}

/* ---------------- 知识库 ---------------- */
.kb-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; cursor: pointer; transition: all .15s;
  display: flex; flex-direction: column; gap: 8px;
}
.kb-card:hover { box-shadow: var(--shadow); border-color: #cbd5e1; transform: translateY(-2px); }
.kb-title { font-size: 14.5px; font-weight: 600; color: var(--ink); }
.kb-desc { font-size: 13px; color: var(--ink-3); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.kb-meta { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--ink-3); }

/* ---------------- 标签 ---------------- */
.tag {
  display: inline-flex; align-items: center;
  padding: 2px 10px; border-radius: 99px;
  background: var(--muted-light); color: var(--ink-2);
  font-size: 12px;
}

/* ---------------- 评分 ---------------- */
.stars { display: inline-flex; gap: 2px; font-size: 18px; color: #f59e0b; }
.stars .off { color: #e2e8f0; }
.star-input { display: inline-flex; gap: 4px; }
.star-input span { font-size: 26px; cursor: pointer; color: #e2e8f0; transition: color .1s; }
.star-input span.on { color: #f59e0b; }

/* ---------------- 工具类 ---------------- */
.flex { display: flex; }
.items-center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.ml-auto { margin-left: auto; }
.text-muted { color: var(--ink-3); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary); }
.text-sm { font-size: 12.5px; }
.text-xs { font-size: 11.5px; }
.fw-600 { font-weight: 600; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-3 > .card, .grid-2 > .card { height: 100%; }
.grid-2 > .card + .card, .grid-3 > .card + .card, .grid-4 > .card + .card { margin-top: 0; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.cost-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }
.cost-box { background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; min-width: 0; }
.cost-box-label { font-size: 12px; color: var(--ink-3); }
.cost-box-value { font-size: 17px; font-weight: 700; color: var(--ink); margin-top: 5px; font-variant-numeric: tabular-nums; }
.cost-box-detail { margin-top: 6px; font-size: 12px; color: var(--ink-3); word-break: break-all; }
.cost-box.total { background: var(--primary-light); border-color: var(--primary); }
.cost-box.total .cost-box-value { color: var(--primary); font-size: 18px; }
.cost-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cost-form-grid .form-group { margin-bottom: 0; }
.cost-form-grid .span-2 { grid-column: span 2; }
/* 附件选择控件 */
.attach-picker { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.attach-file-btn { cursor: pointer; }
.form-group label.attach-file-btn { color: #fff; }
.attach-file-btn svg { width: 18px; height: 18px; }
.attach-file-hint { margin-top: 8px; font-size: 12px; color: var(--ink-3); line-height: 1.6; }
.attach-file-name { font-size: 12.5px; color: var(--ink-3); max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-file-input[hidden] { display: none; }
/* 期望完成时间快捷选择 */
.due-row { display: flex; align-items: flex-start; gap: 10px; }
.due-row > .form-control { flex: 0 0 200px; width: 200px; }
.due-presets { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.due-chip { display: inline-flex; align-items: center; gap: 5px; padding: 6px 12px; border: 1px solid #bfdbfe; border-radius: 8px; background: #eff6ff; color: var(--primary); font-size: 12.5px; font-weight: 600; cursor: pointer; transition: all .15s; white-space: nowrap; }
.due-chip:hover { background: #dbeafe; border-color: var(--primary); }
.due-chip.active { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 2px 6px rgba(59,130,246,.3); }
/* 位置级联选择 */
.loc-cascade { display: flex; gap: 8px; }
.loc-cascade select { flex: 1; min-width: 0; }



.cost-note { margin-top: 10px; padding: 10px 12px; background: #f8fafc; border-radius: 8px; font-size: 12.5px; color: var(--ink-2); line-height: 1.7; }
.cost-note svg { vertical-align: -2px; margin-right: 4px; }

/* SLA 倒计时 */
.sla-countdown { margin-top: 5px; font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 3px; }
.sla-countdown.ok { color: #f59e0b; }
.sla-countdown.overdue { color: #ef4444; }
.sla-badge.ok { color: #fff; }
.badge.sla-badge { font-variant-numeric: tabular-nums; }

/* 报表热力图 */
.heatmap-wrap { overflow-x: auto; }
.heatmap-table { border-collapse: separate; border-spacing: 4px; font-size: 12.5px; }
.heatmap-table th, .heatmap-table td { padding: 8px 10px; text-align: center; border-radius: 6px; white-space: nowrap; }
.heatmap-table th { background: #f1f5f9; color: var(--ink-2); font-weight: 600; }
.heatmap-table td.corner { background: transparent; }
.heatmap-table td.cell { color: #0f172a; font-weight: 700; min-width: 56px; }
.heatmap-table td.cell.zero { background: #f8fafc; color: #cbd5e1; font-weight: 400; }
.heatmap-legend { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-3); margin-top: 10px; flex-wrap: wrap; }
.heatmap-legend .swatch { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }

.chart-box { position: relative; height: 260px; }
.chart-box canvas { width: 100%; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 10px 18px; font-size: 12.5px; color: var(--ink-2); }
.legend .swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 6px; }
.alert {
  border-radius: 10px; padding: 12px 16px; font-size: 13.5px;
  display: flex; gap: 10px; align-items: flex-start;
}
.alert-info { background: var(--info-light); color: #0e7490; }
.alert-success { background: var(--success-light); color: #047857; }
.alert-warning { background: var(--warning-light); color: #b45309; }
.alert-danger { background: var(--danger-light); color: #b91c1c; }

.file-chip {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); border-radius: 9px;
  padding: 6px 12px; font-size: 13px; background: #f8fafc;
}
.file-chip svg { width: 16px; height: 16px; color: var(--primary); }

.section-title { font-size: 13px; font-weight: 700; color: var(--ink-2); margin: 20px 0 12px; letter-spacing: .5px; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1200px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .detail-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .main { margin-left: 0; }
  .menu-toggle { display: flex !important; }
  .modal-mask { left: 0; }
}
@media (max-width: 768px) {
  .content { padding: 14px; }
  .stat-grid, .grid-2, .grid-3, .grid-4, .form-grid, .detail-grid { grid-template-columns: 1fr; }
  .topbar-search { display: none; }
  .page-head .actions { margin-left: 0; width: 100%; }
}

.menu-toggle { display: none; }

/* ---------------- 打印 ---------------- */
@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .main { margin-left: 0; }
  .modal-mask { left: 0; }
  .card { border: none; box-shadow: none; }
  body { background: #fff; }
}
/* ---------------- 图片附件预览（PC） ---------------- */
.att-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 12px; }
.att-thumb { position: relative; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: #fff; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .1s; }
.att-thumb:hover { border-color: var(--primary); box-shadow: 0 4px 14px rgba(59, 130, 246, .18); }
.att-thumb:active { transform: scale(.98); }
.att-thumb img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: var(--muted-light); }
.att-thumb .att-name { display: block; font-size: 12px; color: var(--ink); padding: 7px 9px 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-thumb .text-xs { display: block; padding: 0 9px 8px; }
.att-thumb .att-del { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%; background: rgba(15, 23, 42, .55); color: #fff; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .15s; }
.att-thumb:hover .att-del { opacity: 1; }
.att-del:hover { background: var(--danger); }

.img-viewer { position: fixed; inset: 0; z-index: 2000; display: none; }
.img-viewer.show { display: flex; align-items: center; justify-content: center; }
.iv-mask { position: absolute; inset: 0; background: rgba(2, 6, 23, .94); }
.iv-box { position: relative; max-width: 96vw; max-height: 92vh; display: flex; align-items: center; justify-content: center; }
.iv-box img { max-width: min(560px, 86vw); max-height: 62vh; object-fit: contain; border-radius: 8px; box-shadow: 0 10px 40px rgba(0, 0, 0, .5); cursor: zoom-in; transition: max-width .25s ease, max-height .25s ease; }
.img-viewer.enlarged .iv-box img { max-width: 94vw; max-height: 88vh; cursor: zoom-out; }
.iv-close { position: absolute; top: -46px; right: 0; width: 38px; height: 38px; border-radius: 50%; background: rgba(255, 255, 255, .14); color: #fff; font-size: 16px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.iv-close:hover { background: rgba(255, 255, 255, .3); }
.iv-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 42px; height: 64px; border-radius: 12px; background: rgba(255, 255, 255, .12); color: #fff; font-size: 28px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.iv-nav:hover { background: rgba(255, 255, 255, .28); }
.iv-prev { left: -70px; } .iv-next { right: -70px; }
.iv-foot { position: absolute; left: 0; right: 0; bottom: -44px; display: flex; gap: 14px; align-items: center; justify-content: center; color: #cbd5e1; font-size: 13px; }
.iv-foot #ivName { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iv-foot #ivCount { color: #94a3b8; }
.iv-dl { color: #93c5fd; }
.iv-dl:hover { color: #fff; }
.iv-zoom { color: #93c5fd; background: none; border: none; cursor: pointer; font-size: 13px; padding: 2px 0; line-height: 1; }
.iv-zoom:hover { color: #fff; }
@media (max-width: 900px) {
  .iv-prev { left: 6px; } .iv-next { right: 6px; }
  .iv-foot { bottom: 14px; flex-wrap: wrap; }
  .att-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}
