/* ============ 组件：卡片 / 表格 / 弹窗 / 抽屉 / 提示 ============ */
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-h {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 15px 18px 0;
}
.card-h h3 { font-size: 14px; font-weight: 600; }
.card-h .hint { font-size: 11.5px; color: var(--muted); }
.card-b { padding: 14px 18px 18px; }
.card-b.tight { padding: 8px 18px 12px; }

/* ---------- 工具条 ---------- */
.toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 12px;
}
.search { min-width: 220px; flex: 1; max-width: 320px; }
.seg {
  display: inline-flex; background: #ecefe9; border-radius: 9px;
  padding: 3px; gap: 2px; flex-wrap: wrap;
}
.seg button {
  border: 0; background: transparent; padding: 6px 11px; border-radius: 7px;
  font-size: 12.5px; color: #5b665f; cursor: pointer;
}
.seg button.on {
  background: #fff; color: var(--ink); font-weight: 600;
  box-shadow: 0 1px 3px rgba(20, 30, 25, .12);
}

/* ---------- 表格 ---------- */
.tbl-wrap {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: auto;
}
table { width: 100%; border-collapse: collapse; }
th {
  font-size: 11.5px; font-weight: 500; color: var(--muted);
  text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line);
  white-space: nowrap; background: #fbfcfa; position: sticky; top: 0; z-index: 1;
}
td { padding: 12px 14px; border-bottom: 1px solid #f1f2ef; font-size: 13px; vertical-align: middle; }
tbody tr { transition: .12s; }
tbody tr:hover { background: #fafbf8; }
tbody tr:last-child td { border-bottom: 0; }
tr[data-open] { cursor: pointer; }
.cell-main { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.cell-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.cust-cell { display: flex; gap: 10px; align-items: center; min-width: 170px; }
.health { display: flex; align-items: center; gap: 8px; min-width: 92px; }
.health .bar { flex: 1; }
.health span { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.row-actions .btn-icon { width: 30px; height: 30px; border-radius: 7px; }
.table-foot {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; font-size: 12px; color: var(--muted);
  border-top: 1px solid var(--line); background: #fbfcfa;
}

/* ---------- 列表行 ---------- */
.list-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 0; border-bottom: 1px dashed #eceee9;
}
.list-row:last-child { border-bottom: 0; padding-bottom: 2px; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .name { font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 7px; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(13, 24, 19, .45);
  display: flex; align-items: center; justify-content: center;
  padding: 24px; animation: fadeIn .16s ease both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%; max-width: 560px; max-height: calc(100vh - 48px);
  background: #fff; border-radius: 16px; box-shadow: 0 24px 64px rgba(10, 20, 15, .28);
  display: flex; flex-direction: column; animation: popIn .18s ease both;
}
@keyframes popIn { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }
.modal.wide { max-width: 760px; }
.modal-h {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  padding: 18px 20px 10px;
}
.modal-h h3 { font-size: 16px; font-weight: 650; }
.modal-h p { font-size: 12px; color: var(--muted); margin-top: 2px; }
.modal-b { padding: 6px 20px 8px; overflow: auto; }
.modal-f {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 20px 18px;
}
.close-x {
  width: 30px; height: 30px; border-radius: 8px; border: 0;
  background: #f4f6f3; color: #6b756f; font-size: 16px; cursor: pointer;
  line-height: 1; flex: 0 0 30px;
}
.close-x:hover { background: #ecefe9; color: var(--ink); }

/* ---------- 抽屉 ---------- */
.drawer-mask {
  position: fixed; inset: 0; z-index: 70; background: rgba(13, 24, 19, .38);
  animation: fadeIn .16s ease both;
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 71;
  width: min(620px, 100%); background: #fff;
  box-shadow: -24px 0 60px rgba(10, 20, 15, .22);
  display: flex; flex-direction: column;
  animation: slideIn .22s ease both;
}
@keyframes slideIn { from { transform: translateX(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.drawer-h {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  padding: 20px 22px 14px; border-bottom: 1px solid var(--line);
}
.drawer-h h2 { font-size: 18px; font-weight: 650; display: flex; align-items: center; gap: 9px; }
.drawer-h p { font-size: 12px; color: var(--muted); margin-top: 4px; }
.drawer-b { flex: 1; overflow: auto; padding: 18px 22px 40px; }
.drawer-f {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 12px 22px; border-top: 1px solid var(--line); background: #fbfcfa;
}

/* ---------- 详情块 ---------- */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }
.detail-item { font-size: 13px; }
.detail-item label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.detail-item .v { font-weight: 500; word-break: break-all; }
.section-title {
  font-size: 12px; color: var(--muted); letter-spacing: 1px;
  margin: 18px 0 8px; display: flex; align-items: center; gap: 8px;
}
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tabs button {
  border: 0; background: none; padding: 8px 12px; font-size: 13px; color: var(--muted);
  cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button.on { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.tab-panel { animation: fadeUp .18s ease both; }

.status-line { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

/* ---------- 时间线 ---------- */
.timeline { position: relative; padding-left: 18px; }
.timeline::before {
  content: ""; position: absolute; left: 4px; top: 6px; bottom: 6px;
  width: 1px; background: var(--line);
}
.tl-item { position: relative; padding: 0 0 16px; }
.tl-item::before {
  content: ""; position: absolute; left: -17px; top: 5px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--brand2); box-shadow: 0 0 0 3px #eef5f1;
}
.tl-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tl-head strong { font-size: 13px; }
.tl-date { font-size: 11.5px; color: var(--muted); }
.tl-body { font-size: 12.5px; color: var(--ink2); margin-top: 4px; line-height: 1.6; }
.tl-next { font-size: 11.5px; color: var(--amber); margin-top: 4px; }

/* ---------- Toast ---------- */
.toast-root {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%);
  z-index: 200; display: flex; flex-direction: column; gap: 8px;
  align-items: center; pointer-events: none;
}
.toast {
  background: #10231c; color: #f2f7f4;
  padding: 9px 16px; border-radius: 10px; font-size: 13px;
  box-shadow: 0 12px 30px rgba(10, 20, 15, .3);
  animation: toastIn .2s ease both;
  max-width: 80vw;
}
.toast.ok { background: #0f5c4c; }
.toast.err { background: #8f2f1f; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---------- 开关 ---------- */
.switch { position: relative; display: inline-block; width: 38px; height: 22px; flex: 0 0 38px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch i {
  position: absolute; inset: 0; background: #d8ddd7; border-radius: 99px;
  transition: .18s; cursor: pointer;
}
.switch i::after {
  content: ""; position: absolute; left: 3px; top: 3px;
  width: 16px; height: 16px; background: #fff; border-radius: 50%;
  transition: .18s; box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
}
.switch input:checked + i { background: var(--brand2); }
.switch input:checked + i::after { transform: translateX(16px); }

/* ---------- 关键字输入 ---------- */
.chip-input {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  border: 1px solid var(--line); border-radius: 9px; padding: 7px 9px; background: #fff;
}
.chip-input .kw {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--brand-soft); color: var(--brand);
  font-size: 12px; padding: 3px 8px; border-radius: 6px;
}
.chip-input .kw button { border: 0; background: none; color: #6c8e82; cursor: pointer; padding: 0; font-size: 13px; line-height: 1; }
.chip-input input { border: 0; outline: none; flex: 1; min-width: 100px; font-size: 12.5px; font-family: inherit; background: transparent; }
