/* =========================================================
   会计开票工作台 · workbench.css
   主色：#123a5e / #1f5fa8  背景：#f2f5f9  圆角：14px  字体：微软雅黑
   ========================================================= */
:root {
  --navy: #123a5e;
  --navy-deep: #0d2b46;
  --navy-light: #1b4a75;
  --blue: #1f5fa8;
  --blue-hover: #184d8a;
  --blue-soft: #e8f1fc;
  --bg: #f2f5f9;
  --card: #ffffff;
  --line: #e3eaf3;
  --line-soft: #eef2f8;
  --text: #1e2a3a;
  --text-2: #51607a;
  --text-3: #8b98ad;
  --ok: #157347;
  --ok-bg: #e7f6ec;
  --warn: #a15c07;
  --warn-bg: #fdf3e0;
  --bad: #b42318;
  --bad-bg: #fdecea;
  --info: #1f5fa8;
  --info-bg: #e8f1fc;
  --muted: #5b6b82;
  --muted-bg: #eef1f6;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(18, 58, 94, 0.05), 0 10px 28px rgba(18, 58, 94, 0.06);
  --shadow-sm: 0 1px 2px rgba(18, 58, 94, 0.06), 0 4px 12px rgba(18, 58, 94, 0.05);
  --font: "Microsoft YaHei", "微软雅黑", "PingFang SC", "Segoe UI", system-ui, sans-serif;
  --mono: "Consolas", "SFMono-Regular", "Courier New", monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  min-width: 320px;
}
h1, h2, h3, h4, p { margin: 0; }
a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-hover); }
button { font-family: inherit; }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.2px; }
.strong { font-weight: 700; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------------- 登录页 ---------------- */
.login-page {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 32px 20px;
  overflow: hidden;
  background:
    radial-gradient(1200px 620px at 12% -10%, rgba(31, 95, 168, 0.12), transparent 60%),
    radial-gradient(900px 520px at 100% 100%, rgba(18, 58, 94, 0.10), transparent 55%),
    linear-gradient(160deg, #eef3fa 0%, #f2f5f9 45%, #e9eff7 100%);
}
.login-deco {
  position: absolute;
  border-radius: 999px;
  filter: blur(2px);
  pointer-events: none;
}
.login-deco-a {
  width: 420px;
  height: 420px;
  top: -160px;
  right: -80px;
  background: radial-gradient(circle at 30% 30%, rgba(31, 95, 168, 0.18), rgba(31, 95, 168, 0) 68%);
}
.login-deco-b {
  width: 520px;
  height: 520px;
  bottom: -240px;
  left: -140px;
  background: radial-gradient(circle at 60% 40%, rgba(18, 58, 94, 0.14), rgba(18, 58, 94, 0) 66%);
}
.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 424px;
  padding: 34px 34px 30px;
  background: var(--card);
  border: 1px solid rgba(227, 234, 243, 0.9);
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(18, 58, 94, 0.14), 0 2px 6px rgba(18, 58, 94, 0.06);
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 26px;
}
.login-brand-text h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: 0.5px;
}
.login-brand-text p {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-3);
}
.brand-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  border-radius: 16px;
  background: linear-gradient(140deg, var(--navy) 0%, var(--blue) 100%);
  color: #fff;
  font-size: 24px;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(31, 95, 168, 0.28);
}
.brand-logo-sm {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 11px;
  font-size: 17px;
  box-shadow: none;
}
.login-form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field-label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.login-hint { font-size: 12px; color: var(--text-3); text-align: center; }
.login-foot {
  position: relative;
  z-index: 1;
  margin-top: 22px;
  font-size: 12px;
  color: var(--text-3);
}
.form-error {
  padding: 9px 12px;
  font-size: 13px;
  color: var(--bad);
  background: var(--bad-bg);
  border: 1px solid #f6c9c4;
  border-radius: 10px;
}

/* ---------------- 顶部栏 ---------------- */
.app { min-height: 100vh; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 60px;
  padding: 0 20px;
  color: #fff;
  background: linear-gradient(118deg, var(--navy) 0%, #174a76 58%, var(--blue) 100%);
  box-shadow: 0 2px 12px rgba(13, 43, 70, 0.22);
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; }
.brand:hover { color: #fff; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 15px; letter-spacing: 0.5px; }
.brand-text small { font-size: 10.5px; color: rgba(255, 255, 255, 0.62); letter-spacing: 0.6px; text-transform: uppercase; }
.topbar .topbar-menu {
  display: none;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.18);
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 15px;
  color: var(--text-2);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.icon-btn:hover { color: var(--navy); background: var(--blue-soft); border-color: #cfe0f4; }
.adapter-badges { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.adapter-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.topbar-divider { width: 1px; height: 26px; background: rgba(255, 255, 255, 0.18); }
.user-chip { display: flex; align-items: center; gap: 8px; }
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
  background: #e9f1fb;
  border: 1px solid rgba(255, 255, 255, 0.45);
}
.user-meta { display: flex; flex-direction: column; line-height: 1.2; }
.user-meta strong { font-size: 13px; }
.user-meta small { font-size: 10.5px; color: rgba(255, 255, 255, 0.62); }
.topbar .btn-ghost {
  color: #eaf2fc;
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.06);
}
.topbar .btn-ghost:hover { color: #fff; background: rgba(255, 255, 255, 0.16); border-color: rgba(255, 255, 255, 0.38); }

/* ---------------- 侧栏 ---------------- */
.shell { display: flex; align-items: flex-start; min-height: calc(100vh - 60px); }
.sidebar {
  position: sticky;
  top: 60px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 0 0 216px;
  width: 216px;
  height: calc(100vh - 60px);
  padding: 16px 12px;
  background: var(--card);
  border-right: 1px solid var(--line);
  overflow-y: auto;
}
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-2);
  border-radius: 10px;
  border-left: 3px solid transparent;
  transition: all 0.15s ease;
}
.nav-item:hover { color: var(--navy); background: #f3f6fb; }
.nav-item.active {
  color: var(--blue);
  background: var(--blue-soft);
  border-left-color: var(--blue);
}
.nav-ico { width: 18px; text-align: center; font-size: 15px; opacity: 0.85; }
.sidebar-foot { padding: 12px; margin-top: 18px; border-top: 1px solid var(--line-soft); }
.sidebar-foot-title { font-size: 11px; font-weight: 700; color: var(--text-3); letter-spacing: 0.6px; }
.service-state { margin-top: 6px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.service-ok { color: var(--ok); }
.service-bad { color: var(--bad); }
.sidebar-foot-note { margin-top: 4px; font-size: 11px; color: var(--text-3); }
body.sidebar-collapsed .sidebar { display: none; }
body.sidebar-collapsed .topbar-menu { display: inline-flex; }

.main {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  max-width: 1760px;
  margin: 0 auto;
  padding: 20px 22px 48px;
  outline: none;
}

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 15px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
  user-select: none;
}
.btn:hover { border-color: #cddcee; background: #f7fafe; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-primary {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
  box-shadow: 0 4px 12px rgba(31, 95, 168, 0.24);
}
.btn-primary:hover { background: var(--blue-hover); border-color: var(--blue-hover); color: #fff; }
.btn-danger {
  color: #fff;
  background: var(--bad);
  border-color: var(--bad);
  box-shadow: 0 4px 12px rgba(180, 35, 24, 0.2);
}
.btn-danger:hover { background: #9d1e14; border-color: #9d1e14; color: #fff; }
.btn-danger-ghost { color: var(--bad); border-color: #f0c4bf; background: #fff; }
.btn-danger-ghost:hover { background: var(--bad-bg); border-color: #e8aaa3; color: var(--bad); }
.btn-ghost { color: var(--text-2); background: #fff; }
.btn-ghost:hover { color: var(--navy); }
.btn-sm { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 9px; }
.btn-xs { height: 26px; padding: 0 9px; font-size: 12px; border-radius: 8px; }
.btn-block { width: 100%; height: 42px; font-size: 14px; }
.btn.is-busy { opacity: 0.68; pointer-events: none; }
.btn.is-busy::after {
  content: "";
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.btn-ghost.is-busy::after, .btn.is-busy:not(.btn-primary):not(.btn-danger)::after { border-color: rgba(31, 95, 168, 0.25); border-top-color: var(--blue); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- 表单控件 ---------------- */
.input {
  width: 100%;
  height: 36px;
  padding: 0 11px;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  background: #fff;
  border: 1px solid #d8e2ee;
  border-radius: 10px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input::placeholder { color: #a7b3c4; }
.input:hover { border-color: #c3d3e6; }
.input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(31, 95, 168, 0.13); }
.textarea { height: auto; min-height: 72px; padding: 9px 11px; line-height: 1.55; resize: vertical; }
select.input { padding-right: 28px; appearance: none; background-image: linear-gradient(45deg, transparent 50%, #7c8ba1 50%), linear-gradient(135deg, #7c8ba1 50%, transparent 50%); background-position: calc(100% - 16px) 15px, calc(100% - 11px) 15px; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; cursor: pointer; }
.form-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.search-field { position: relative; }
.search-field .input { padding-left: 32px; width: 260px; }
.search-field::before { content: "🔍"; position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-size: 12px; opacity: 0.55; }
.input-invalid { border-color: var(--bad) !important; background: #fff8f7; }

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--card);
  border: 1px solid rgba(227, 234, 243, 0.95);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card + .card { margin-top: 16px; }
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
}
.card-title { font-size: 14.5px; font-weight: 700; color: var(--navy); display: inline-flex; align-items: center; gap: 8px; }
.card-head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-body { padding: 16px 18px; }
.card-body.no-pad { padding: 0; }
.count-pill {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--blue);
  background: var(--blue-soft);
  border-radius: 999px;
}
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 18px 20px; border-bottom: none; background: transparent; }
.page-title { font-size: 21px; font-weight: 700; color: var(--navy); letter-spacing: 0.4px; }
.page-sub { margin-top: 5px; font-size: 12.5px; color: var(--text-3); }
.cell-strong { font-weight: 600; color: var(--text); }
.cell-sub { font-size: 12px; color: var(--text-3); }
.text-right { text-align: right; }

/* ---------------- 统计卡 ---------------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.stat-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 16px 18px;
  text-align: left;
  background: var(--card);
  border: 1px solid rgba(227, 234, 243, 0.95);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.stat-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--blue);
  opacity: 0.9;
}
.stat-card::after {
  content: "";
  position: absolute;
  right: -30px;
  top: -34px;
  width: 108px;
  height: 108px;
  border-radius: 50%;
  background: rgba(31, 95, 168, 0.06);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #cfdff2; }
.stat-label { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.stat-arrow { font-size: 12px; color: var(--text-3); opacity: 0; transform: translateX(-4px); transition: all 0.15s ease; }
.stat-card:hover .stat-arrow { opacity: 1; transform: translateX(0); color: var(--blue); }
.stat-value { font-size: 30px; font-weight: 700; line-height: 1.2; color: var(--navy); letter-spacing: 0.5px; }
.stat-sub { font-size: 12px; color: var(--text-3); }
.stat-primary::before { background: var(--warn); }
.stat-primary .stat-value { color: var(--warn); }
.stat-info::before { background: var(--blue); }
.stat-danger::before { background: var(--bad); }
.stat-danger .stat-value { color: var(--bad); }
.stat-success::before { background: var(--ok); }
.stat-success .stat-value { color: var(--ok); }

/* ---------------- Tabs / 筛选 ---------------- */
.tabs { display: inline-flex; align-items: center; gap: 3px; padding: 3px; background: #f1f5fa; border-radius: 11px; flex-wrap: wrap; }
.tab {
  height: 29px;
  padding: 0 13px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  background: transparent;
  border: none;
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.tab:hover { color: var(--navy); background: rgba(255, 255, 255, 0.7); }
.tab.active { color: var(--blue); background: #fff; box-shadow: 0 1px 3px rgba(18, 58, 94, 0.14); }
.filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------------- 表格 ---------------- */
.table-wrap { width: 100%; overflow-x: auto; }
.data-table { width: 100%; min-width: 960px; border-collapse: separate; border-spacing: 0; }
.data-table thead th {
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  text-align: left;
  white-space: nowrap;
  background: #f7f9fc;
  border-bottom: 1px solid var(--line);
}
.data-table thead th.num { text-align: right; }
.data-table tbody td { padding: 12px 14px; font-size: 13px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #f7fafe; }
.data-table tbody tr.row-click { cursor: pointer; }
.data-table .badge { white-space: nowrap; }
.data-table td .cell-sub { margin-top: 1px; }
.empty-cell { padding: 0 !important; }

/* ---------------- 徽标 ---------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge-ok { color: var(--ok); background: var(--ok-bg); border-color: #c8e9d4; }
.badge-warn { color: var(--warn); background: var(--warn-bg); border-color: #f3ddb0; }
.badge-bad { color: var(--bad); background: var(--bad-bg); border-color: #f4c6c1; }
.badge-info { color: var(--info); background: var(--info-bg); border-color: #cfe2f7; }
.badge-muted { color: var(--muted); background: var(--muted-bg); border-color: #dde3ec; }
.badge-navy { color: #fff; background: var(--navy); border-color: var(--navy); }
.flag {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
}
.flag-warn { color: var(--warn); background: var(--warn-bg); }
.mini-warn { margin-left: 5px; font-size: 11px; color: var(--warn); font-weight: 600; }
.tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  background: var(--muted-bg);
  border-radius: 6px;
  white-space: nowrap;
}

/* ---------------- 分页 ---------------- */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line-soft); flex-wrap: wrap; }
.pager-info { font-size: 12.5px; color: var(--text-3); }
.pager-btns { display: flex; gap: 8px; }

/* ---------------- 加载 / 空 / 错误 ---------------- */
.skeleton {
  background: linear-gradient(90deg, #eef2f7 25%, #f7fafd 37%, #eef2f7 63%);
  background-size: 400% 100%;
  border-radius: 8px;
  animation: shimmer 1.35s ease infinite;
}
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.skeleton-panel { padding: 18px; }
.skeleton-table { display: flex; flex-direction: column; gap: 12px; }
.sk-row { height: 40px; }
.skeleton-card { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.sk-label { width: 42%; height: 13px; }
.sk-value { width: 34%; height: 26px; }
.sk-sub { width: 60%; height: 11px; }
.skeleton-lines { display: flex; flex-direction: column; gap: 10px; padding: 16px 18px; }
.sk-line { height: 34px; }
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 52px 24px;
  text-align: center;
}
.empty-icon { font-size: 34px; line-height: 1; opacity: 0.55; margin-bottom: 6px; }
.empty-title { font-size: 15px; font-weight: 700; color: var(--text-2); }
.empty-desc { max-width: 420px; font-size: 12.5px; color: var(--text-3); }
.error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 56px 24px;
  text-align: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.error-icon { font-size: 34px; line-height: 1; }
.error-title { font-size: 16px; font-weight: 700; color: var(--bad); }
.error-msg { max-width: 560px; font-size: 13px; color: var(--text-2); }
.error-code { font-size: 11.5px; color: var(--text-3); }
.error-actions { display: flex; gap: 8px; margin-top: 10px; }
.error-inline {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 36px 20px;
  text-align: center;
}
.error-inline .error-title { font-size: 14px; }
.error-inline .error-msg { font-size: 12.5px; }

/* ---------------- 工单详情：三栏 ---------------- */
.ticket-layout {
  display: grid;
  grid-template-columns: 226px minmax(0, 1fr) 324px;
  gap: 16px;
  align-items: start;
}
.ticket-main { min-width: 0; }
.ticket-main > * { margin-bottom: 16px; }
.ticket-main > *:last-child { margin-bottom: 0; }
.ticket-side { min-width: 0; position: sticky; top: 76px; }
.ticket-side > * { margin-bottom: 16px; }
.ticket-side > *:last-child { margin-bottom: 0; }
.ticket-queue { position: sticky; top: 76px; }
.queue-mini { max-height: calc(100vh - 210px); overflow-y: auto; padding: 6px; }
.queue-mini-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 10px;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.queue-mini-item:hover { background: #f5f9fe; }
.queue-mini-item.is-current { background: var(--blue-soft); border-color: #cfe2f7; }
.qm-dot { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; background: var(--text-3); }
.qm-dot.tone-warn { background: #e0a03a; }
.qm-dot.tone-info { background: var(--blue); }
.qm-dot.tone-ok { background: var(--ok); }
.qm-dot.tone-bad { background: var(--bad); }
.qm-dot.tone-muted { background: #b5c0d0; }
.qm-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.qm-no { font-size: 12px; font-weight: 700; color: var(--navy); }
.qm-sub { font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qm-state { font-size: 10.5px; color: var(--text-3); white-space: nowrap; }
.queue-mini-empty { padding: 26px 12px; text-align: center; font-size: 12.5px; color: var(--text-3); }

.ticket-head .card-body { padding: 18px 20px 16px; }
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); }
.breadcrumb a { color: var(--text-3); }
.breadcrumb a:hover { color: var(--blue); }
.crumb-sep { color: #c3cddb; }
.ticket-title { margin-top: 4px; font-size: 22px; font-weight: 700; color: var(--navy); letter-spacing: 0.4px; }
.ticket-meta-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.meta-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 18px; margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line); }
.meta-item { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.meta-label { font-size: 11.5px; color: var(--text-3); }
.meta-value { font-size: 13px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.info-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 20px; }
.info-item { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.info-label { font-size: 11.5px; color: var(--text-3); }
.info-value { font-size: 13px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; }
.radio-group { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.radio {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  background: #f6f9fd;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.radio:hover { border-color: #c9daee; }
.radio input { accent-color: var(--blue); width: 15px; height: 15px; margin: 0; cursor: pointer; }
.radio.checked { color: var(--blue); background: var(--blue-soft); border-color: #bcd6f2; }
.radio.disabled { opacity: 0.62; cursor: not-allowed; }
.form-note { font-size: 12px; color: var(--text-3); }
.form-note.warn { color: var(--warn); }

/* ---------------- 明细行编辑（自适应卡片布局） ---------------- */
.line-list { display: flex; flex-direction: column; }
.line-item { padding: 13px 16px; border-bottom: 1px solid var(--line-soft); }
.line-item:last-child { border-bottom: none; }
.line-item-head { display: flex; align-items: center; gap: 9px; }
.line-index {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--blue);
  background: var(--blue-soft);
  border-radius: 7px;
}
.line-item-head .line-name {
  flex: 1 1 auto;
  height: 34px;
  font-size: 13px;
  font-weight: 600;
  background: #fff;
  border-color: #dfe8f4;
}
.line-item-ops { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; }
.line-item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 9px 10px;
  margin-top: 9px;
  padding-left: 31px;
}
.line-field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.line-field > span { font-size: 11px; color: var(--text-3); }
.line-field .input-cell { height: 32px; background: #fff; border-color: #e3ebf5; }
.line-field.need-fill > span { color: var(--bad); }
.line-field.need-fill .input-cell { background: #fff8f7; border-color: #f0c4bf; }
.line-item.line-missing .line-index { color: var(--bad); background: var(--bad-bg); }
.line-empty { padding: 28px 16px; text-align: center; font-size: 12.5px; color: var(--text-3); }
.input-cell {
  width: 100%;
  height: 32px;
  padding: 0 9px;
  font-family: inherit;
  font-size: 12.5px;
  color: var(--text);
  background: #f8fafc;
  border: 1px solid transparent;
  border-radius: 8px;
  outline: none;
  transition: all 0.12s ease;
}
.input-cell:hover { background: #fff; border-color: #dbe5f1; }
.input-cell:focus { background: #fff; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(31, 95, 168, 0.12); }
.input-cell.num { text-align: right; }
.input-cell[disabled] { background: #f6f9fd; color: var(--text-2); }
.lines-lock-hint { padding: 10px 18px; font-size: 12.5px; color: var(--text-3); background: #fafcfe; border-top: 1px solid var(--line-soft); }
.suggest-slot:not(:empty) { margin: 10px 0 2px 31px; }
.suggest-box { display: flex; flex-direction: column; gap: 8px; }
.suggest-title { font-size: 11.5px; font-weight: 700; color: var(--blue); letter-spacing: 0.3px; }
.suggest-list { display: flex; flex-wrap: wrap; gap: 8px; }
.suggest-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 11px;
  font-family: inherit;
  font-size: 12.5px;
  color: var(--text);
  background: #fff;
  border: 1px solid #d5e4f5;
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.suggest-item:hover { border-color: var(--blue); box-shadow: 0 3px 10px rgba(31, 95, 168, 0.14); transform: translateY(-1px); }
.suggest-name { font-weight: 600; }
.suggest-meta { font-size: 11.5px; color: var(--text-3); }
.suggest-score { font-size: 11px; font-weight: 700; color: var(--ok); background: var(--ok-bg); padding: 1px 7px; border-radius: 999px; }
.suggest-empty { font-size: 12.5px; color: var(--text-3); }
.suggest-close { align-self: flex-start; }
.lines-summary { display: flex; align-items: center; gap: 26px; flex-wrap: wrap; padding: 14px 18px; background: #fafcff; border-top: 1px solid var(--line-soft); }
.sum-item { display: flex; flex-direction: column; gap: 1px; }
.sum-item span { font-size: 11.5px; color: var(--text-3); }
.sum-item strong { font-size: 15px; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }
.sum-item .sum-money { font-size: 19px; color: var(--blue); }
.lines-warn { padding: 8px 18px; font-size: 12.5px; color: var(--bad); background: var(--bad-bg); border-top: 1px solid #f6d3cf; }
.action-bar { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.action-hint { margin-top: 12px; font-size: 12.5px; color: var(--text-3); }

/* ---------------- 时间线 / 沟通 ---------------- */
.timeline-body { max-height: 420px; overflow-y: auto; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 4px; }
.timeline-item { position: relative; display: flex; gap: 12px; padding: 0 0 16px 0; }
.timeline-item:last-child { padding-bottom: 2px; }
.timeline-item::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 16px;
  bottom: 0;
  width: 1px;
  background: var(--line);
}
.timeline-item:last-child::before { display: none; }
.timeline-dot {
  position: relative;
  z-index: 1;
  flex: 0 0 11px;
  width: 11px;
  height: 11px;
  margin-top: 4px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--blue);
  box-shadow: 0 0 0 3px #fff;
}
.timeline-dot.tone-ok { border-color: var(--ok); }
.timeline-dot.tone-warn { border-color: #d99a2b; }
.timeline-dot.tone-bad { border-color: var(--bad); }
.timeline-dot.tone-muted { border-color: #aab6c7; }
.timeline-body-text { min-width: 0; flex: 1; }
.timeline-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.timeline-line strong { font-size: 12.5px; font-weight: 700; color: var(--text); }
.timeline-detail { margin-top: 3px; font-size: 12.5px; color: var(--text-2); word-break: break-word; }
.timeline-time { display: block; margin-top: 3px; font-size: 11px; color: var(--text-3); }
.contact-list { display: flex; flex-direction: column; gap: 10px; max-height: 260px; overflow-y: auto; margin-bottom: 12px; }
.contact-item { padding: 10px 12px; background: #f8fafd; border: 1px solid var(--line-soft); border-radius: 10px; }
.contact-head { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.contact-channel { padding: 0 7px; font-size: 11px; font-weight: 700; border-radius: 6px; color: var(--blue); background: var(--blue-soft); }
.contact-channel.phone { color: var(--ok); background: var(--ok-bg); }
.contact-by { font-size: 11.5px; color: var(--text-2); font-weight: 600; }
.contact-time { margin-left: auto; font-size: 11px; color: var(--text-3); }
.contact-content { font-size: 12.5px; color: var(--text-2); word-break: break-word; }
.contact-empty { padding: 18px 8px; font-size: 12.5px; color: var(--text-3); text-align: center; }
.contact-form { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px dashed var(--line); }
.contact-form-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.contact-form select.input { width: 116px; height: 32px; font-size: 12.5px; }
.contact-form .btn { align-self: flex-end; }
.contact-form .textarea { min-height: 62px; font-size: 12.5px; }

/* ---------------- 商品库 / 客户 / RPA / 设置 ---------------- */
.toolbar-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.search-field-inline { display: flex; align-items: center; gap: 8px; }
.link-ellipsis { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: middle; font-family: var(--mono); font-size: 11.5px; color: var(--text-3); }
.header-note { font-size: 12px; color: var(--text-3); }
.select-inline { width: 92px; height: 30px; font-size: 12.5px; padding: 0 24px 0 9px; }
.rpa-toolbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.switch { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-2); cursor: pointer; user-select: none; }
.switch input { width: 15px; height: 15px; accent-color: var(--blue); cursor: pointer; margin: 0; }
.rpa-error { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--bad); }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.settings-grid > .card + .card { margin-top: 0; }
.adapter-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.adapter-card { padding: 14px; background: #fafcff; border: 1px solid var(--line); border-radius: 12px; }
.adapter-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.adapter-name { font-size: 13px; font-weight: 700; color: var(--navy); }
.adapter-desc { font-size: 12px; color: var(--text-2); line-height: 1.5; word-break: break-word; }
.adapter-key { margin-top: 8px; font-family: var(--mono); font-size: 11px; color: var(--text-3); }
.info-rows { display: flex; flex-direction: column; }
.info-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.info-row:last-child { border-bottom: none; }
.info-row-label { color: var(--text-2); }
.info-row-value { font-weight: 600; color: var(--text); text-align: right; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.quota-form { display: grid; grid-template-columns: minmax(0, 1fr) 160px auto; gap: 10px; align-items: end; }
.quota-form .field { gap: 5px; }
.quota-hint { margin-top: 12px; font-size: 12px; color: var(--text-3); }
.tagline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stack-16 > * + * { margin-top: 16px; }

/* ---------------- 弹窗 ---------------- */
body.modal-open { overflow: hidden; }
.modal-host { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal-mask { position: absolute; inset: 0; background: rgba(10, 26, 45, 0.46); animation: fadeIn 0.16s ease; }
.modal-card {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 64px);
  overflow-y: auto;
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 28px 70px rgba(9, 26, 45, 0.32);
  animation: modalIn 0.18s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(0.985); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px 12px; }
.modal-head h3 { font-size: 16px; font-weight: 700; color: var(--navy); }
.modal-body { padding: 6px 22px 18px; }
.modal-text { font-size: 13.5px; color: var(--text-2); line-height: 1.65; }
.modal-desc { margin-bottom: 14px; font-size: 12.5px; color: var(--text-3); }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 14px 22px 20px; }
.modal-form-grid { display: flex; flex-direction: column; gap: 13px; }
.modal-field { display: flex; flex-direction: column; gap: 5px; }
.modal-field .field-label { font-size: 12.5px; }
.modal-field .field-label em { color: var(--bad); font-style: normal; margin-left: 2px; }
.modal-check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.modal-check input { width: 15px; height: 15px; accent-color: var(--blue); margin: 0; cursor: pointer; }
.modal-hint { font-size: 11.5px; color: var(--text-3); }
.modal-error { margin-top: 4px; padding: 8px 11px; font-size: 12.5px; color: var(--bad); background: var(--bad-bg); border-radius: 8px; }
.modal-foot .btn { min-width: 88px; }

/* 客户专属二维码 */
.qr-body { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.qr-customer { font-size: 13px; font-weight: 600; color: var(--text-2); text-align: center; }
.qr-box { background: #fff; padding: 10px; border: 1px solid var(--line); border-radius: 12px; }
.qr-box svg { display: block; width: 220px; height: 220px; }
.qr-link { max-width: 100%; word-break: break-all; text-align: center; font-size: 12px; color: var(--text-3); font-family: Consolas, Monaco, monospace; }

/* ---------------- Toast ---------------- */
.toast-host { position: fixed; top: 74px; right: 22px; z-index: 120; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  min-width: 230px;
  max-width: 380px;
  padding: 11px 14px;
  font-size: 13px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 12px;
  box-shadow: 0 14px 34px rgba(15, 36, 60, 0.18);
  pointer-events: auto;
  animation: toastIn 0.22s ease;
  word-break: break-word;
}
@keyframes toastIn { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }
.toast.toast-out { opacity: 0; transform: translateX(18px); transition: all 0.24s ease; }
.toast-dot { flex: 0 0 8px; width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--blue); }
.toast-success { border-left-color: var(--ok); }
.toast-success .toast-dot { background: var(--ok); }
.toast-error { border-left-color: var(--bad); }
.toast-error .toast-dot { background: var(--bad); }
.toast-warn { border-left-color: #d99a2b; }
.toast-warn .toast-dot { background: #d99a2b; }
.toast-text { flex: 1; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1440px) {
  .ticket-layout { grid-template-columns: 210px minmax(0, 1fr) 300px; }
  .meta-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .search-field .input { width: 220px; }
}
@media (max-width: 1279px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ticket-layout { grid-template-columns: minmax(0, 1fr) 300px; }
  .ticket-queue { display: none; }
  .settings-grid { grid-template-columns: minmax(0, 1fr); }
  .adapter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar .topbar-menu { display: inline-flex; }
  .sidebar { position: fixed; left: 0; top: 60px; z-index: 35; box-shadow: 8px 0 24px rgba(15, 36, 60, 0.12); }
  body.sidebar-collapsed .sidebar { display: flex; }
}
@media (max-width: 1100px) {
  .ticket-layout { grid-template-columns: minmax(0, 1fr); }
  .ticket-side { position: static; }
  .main { padding: 16px 14px 40px; }
  .quota-form { grid-template-columns: minmax(0, 1fr); }
  .adapter-grid { grid-template-columns: minmax(0, 1fr); }
  .topbar { padding: 0 12px; }
  .topbar-divider, .user-meta { display: none; }
}
@media (max-width: 760px) {
  .stats-grid { grid-template-columns: minmax(0, 1fr); }
  .info-grid { grid-template-columns: minmax(0, 1fr); }
  .meta-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .brand-text { display: none; }
  .search-field .input { width: 160px; }
  .ticket-title { font-size: 19px; }
  .card-head { padding: 12px 14px; }
  .card-body { padding: 14px; }
}
