/* 界面样式 */
:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --line: #dfe4ec;
  --text: #1f2733;
  --muted: #77839a;
  --accent: #1f6feb;
  --accent-soft: #e8f1ff;
  --danger: #d64545;
  --warn: #c98a12;
  --ok: #1f9254;
}

* { box-sizing: border-box; }

/* hidden 属性优先：否则 .draft-bar / .form-check-bar / .tab-badge 这些
   带 display:flex|inline-block 的元素藏不住（会出现空提示条、残留数字角标） */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

button { font-family: inherit; }

/* 顶栏 */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 18px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { font-size: 17px; font-weight: 700; letter-spacing: .5px; white-space: nowrap; }
.brand-sub { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 10px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.divider { width: 1px; height: 20px; background: var(--line); }

.btn {
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  transition: .15s;
}
.btn:hover { border-color: #b9c4d6; background: #fafbfd; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #1a5fd0; }
.btn.ghost { color: var(--muted); }
.btn.small { padding: 4px 10px; font-size: 13px; }

/* 布局 */
.layout { display: flex; height: calc(100vh - 53px); }

.sidebar {
  width: 262px;
  flex: none;
  background: #fff;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}
.side-head { padding: 10px; border-bottom: 1px solid var(--line); }
.side-head input {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: none;
}
.side-head { display: flex; align-items: center; gap: 6px; }
.side-head { flex-wrap: wrap; }
.side-head input { flex: 1 1 120px; min-width: 0; }
.side-toggle {
  flex: none;
  width: 30px;
  height: 32px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 7px;
  cursor: pointer;
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
}
.side-toggle:hover { color: var(--accent); border-color: #b9c4d6; background: var(--accent-soft); }
.sidebar.collapsed { display: none; }
.side-expand {
  position: absolute;
  left: 0;
  top: 58px;
  z-index: 15;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 5px;
  border: 1px solid var(--line);
  border-left: none;
  border-radius: 0 8px 8px 0;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  writing-mode: vertical-rl;
  letter-spacing: 1px;
  box-shadow: 2px 2px 8px rgba(20, 30, 50, .06);
}
.side-expand:hover { color: var(--accent); background: var(--accent-soft); }
.side-expand[hidden] { display: none; }
.layout { position: relative; }
.record-list { flex: 1; overflow: auto; }
.rec-item { padding: 10px 12px; border-bottom: 1px solid #f0f2f6; cursor: pointer; position: relative; }
.rec-item:hover { background: #f7f9fc; }
.rec-item .rec-del {
  position: absolute;
  right: 8px;
  top: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 6px;
  padding: 1px 7px;
  font-size: 12px;
  cursor: pointer;
  opacity: .55;
  transition: .15s;
}
.rec-item:hover .rec-del { opacity: 1; }
.rec-item .rec-del:hover { color: var(--danger); border-color: #f0c9c9; background: #fff8f8; }
.rec-item .rec-title { padding-right: 46px; }
.rec-item.active { background: var(--accent-soft); border-left: 3px solid var(--accent); padding-left: 9px; }
.rec-title { font-weight: 600; }
.rec-sub { color: var(--muted); font-size: 13px; }
.rec-meta { color: #9aa5b8; font-size: 12px; margin-top: 2px; }
.rec-empty { padding: 20px; color: var(--muted); text-align: center; }
.client-list { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 4px; padding: 6px 8px; }
.client-all {
  padding: 9px 12px; border-radius: 6px; cursor: pointer; font-weight: 700;
  border: 1px solid var(--line); color: var(--deep, #0b3f7e);
  background: var(--accent-soft);
}
.client-all.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.client-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 6px; cursor: pointer;
}
.client-item:hover { border-color: var(--accent); }
.client-item.active { background: var(--accent-soft); border-color: var(--accent); }
.client-item-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.client-item-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.all-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.all-head b { font-size: 15px; color: var(--deep, #0b3f7e); }
.all-head input { flex: 1; min-width: 220px; max-width: 420px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; outline: none; }
.all-head input:focus { border-color: var(--accent); }
.client-workspace { display: flex; flex-direction: column; gap: 12px; }
.client-card { border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.client-card-head {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  background: var(--thead, #135cae); color: #fff; font-size: 14px;
}
.client-card-head .muted { color: rgba(255, 255, 255, .8); }
.client-fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 14px; padding: 12px 14px; }
.client-fields .field input, .client-fields .field textarea {
  padding: 6px 8px; border: 1px solid var(--line); border-radius: 4px; font-size: 13px;
}
.client-fields .field textarea { resize: vertical; min-height: 34px; }
.client-actions { display: flex; gap: 10px; align-items: center; padding: 0 14px 12px; flex-wrap: wrap; }
.client-records-head { font-size: 14px; color: var(--deep, #0b3f7e); }
.client-records .rec-item { background: #fff; }

/* ============ 双模式：客户端顶栏菜单与切换入口 ============ */
.client-menus { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.client-menus[hidden] { display: none; }
.menu { position: relative; }
.menu summary { list-style: none; cursor: pointer; }
.menu summary::-webkit-details-marker { display: none; }
.menu-list {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 190px; z-index: 45;
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(20, 30, 50, .16); padding: 6px;
  display: flex; flex-direction: column; gap: 2px;
}
.menu-list button {
  text-align: left; border: none; background: transparent; padding: 8px 12px;
  border-radius: 6px; font-size: 13px; color: var(--text); cursor: pointer;
}
.menu-list button:hover { background: var(--accent-soft); color: var(--accent); }
.menu-foot { padding: 8px 12px 4px; margin-top: 4px; font-size: 11px; color: var(--muted); border-top: 1px solid var(--line); }
.mode-switch { color: var(--muted); font-size: 12px; text-decoration: none; white-space: nowrap; padding: 3px 10px; border: 1px dashed var(--line); border-radius: 12px; }
.mode-switch:hover { color: var(--accent); border-color: var(--accent); }
body.mode-client .gov-meta.hide-empty { display: none; }

/* ============ 客户端录单页精简 ============ */
body.mode-client .form-host { gap: 14px; }
body.mode-client .form-host > .card > .card-head,
body.mode-client #tab-edit > .card > .card-head {
  background: #eaf2fb;
  color: #0b3f7e;
  border-bottom: 1px solid #d5e3f2;
  position: sticky;
  top: 0;
  z-index: 6;
  padding-left: 16px;
}
body.mode-client .form-host > .card > .card-head::before,
body.mode-client #tab-edit > .card > .card-head::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: #135cae;
}
body.mode-client .form-host > .card > .card-head .card-title,
body.mode-client #tab-edit > .card > .card-head .card-title { color: #0b3f7e; }
body.mode-client .form-host > .card > .card-head .hint,
body.mode-client #tab-edit > .card > .card-head .hint { color: #6d7f96; }
body.mode-client .form-host > .card > .card-head .btn,
body.mode-client #tab-edit > .card > .card-head .btn,
body.mode-client .form-host > .card > .card-head .group-clear {
  background: #fff; border-color: #b9d2ec; color: #0b3f7e;
}
body.mode-client .form-host > .card > .card-head .group-clear {
  opacity: 0;
  transition: opacity .12s;
}
body.mode-client .form-host > .card > .card-head:hover .group-clear { opacity: 1; }
body.mode-client #btnClearAll {
  background: #fff; color: var(--danger); border-color: #e6b8b8;
}
body.mode-client #hsBatchHint { display: none; }
body.mode-client .items-table input::placeholder,
body.mode-client .items-table textarea::placeholder { color: #b7c2d0; }

/* ============ 客户端左侧栏 + 全部单证精简 ============ */
body.mode-client .side-foot { display: none; }
body.mode-client .side-infos-toggle {
  font-size: 12px; font-weight: 700; color: #0b3f7e;
  cursor: pointer; padding: 2px 2px; user-select: none;
}
body.mode-admin .side-infos-toggle { display: none; }
body.mode-client .side-infos .side-infos-head,
body.mode-client .side-infos .side-info-list { display: none; }
body.mode-client .side-infos.expanded .side-infos-head,
body.mode-client .side-infos.expanded .side-info-list { display: flex; }
body.mode-client #allHeadNote { display: none; }
body.mode-client .rec-item .rec-del { opacity: 0; }
body.mode-client .rec-item:hover .rec-del { opacity: 1; }

/* ============ 客户端客户工作区精简 ============ */
body.mode-client .client-more { margin: 0 14px 12px; border-top: 1px dashed var(--line); padding-top: 8px; }
body.mode-client .client-more summary {
  cursor: pointer; color: var(--accent); font-size: 13px;
  font-weight: 600; list-style: none; padding: 2px 0;
}
body.mode-client .client-more summary::-webkit-details-marker { display: none; }
body.mode-client .client-more .client-fields { padding: 8px 0 0; }
body.mode-client .client-more-menu { position: relative; }
body.mode-client .client-more-menu summary {
  display: inline-block; padding: 6px 12px; border: 1px solid var(--line);
  border-radius: 7px; font-size: 13px; color: var(--text); cursor: pointer;
  list-style: none; user-select: none;
}
body.mode-client .client-more-menu summary::-webkit-details-marker { display: none; }
body.mode-client .client-more-menu summary:hover { border-color: var(--accent); color: var(--accent); }
body.mode-client .client-more-menu .menu-list { right: auto; left: 0; }
body.mode-client .client-more-menu .menu-list button.danger { color: var(--danger); }
body.mode-client .client-more-menu .menu-list button.danger:hover { background: #fdecec; color: var(--danger); }
.rec-draft-hint {
  margin: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #fdf4e3;
  color: var(--warn);
  font-size: 12px;
  text-align: center;
}
.draft-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: #fdf4e3;
  border: 1px solid #f0e0bf;
  border-radius: 10px;
  padding: 9px 14px;
  margin-bottom: 12px;
  font-size: 13px;
  color: #8a6a1e;
}
.draft-bar .btn { flex: none; }

/* 录单页顶部工具条（一键清除） */
.edit-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  margin-bottom: 12px;
}
.edit-topbar-text { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; min-width: 0; }
.edit-topbar-text b { font-size: 14px; }
.edit-topbar-text .hint { max-width: 900px; line-height: 1.5; }
.edit-topbar .btn { flex: none; }
.btn.danger { color: var(--danger); border-color: #f0c9c9; background: #fff8f8; }
.btn.danger:hover { background: #fdecec; border-color: #e79a9a; }

.side-foot { padding: 8px 12px; border-top: 1px solid var(--line); font-size: 12px; }
.side-infos {
  border-top: 1px solid var(--line);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: none;
  max-height: 42%;
}
.side-infos-head { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.side-infos-title { font-size: 12px; color: var(--muted); font-weight: 700; margin-right: auto; letter-spacing: 1px; }
.side-info-list { display: flex; flex-direction: column; gap: 4px; overflow: auto; }
.side-info-item {
  display: flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); border-radius: 6px;
  padding: 5px 8px; cursor: pointer; font-size: 12.5px;
}
.side-info-item:hover { border-color: var(--accent); background: var(--accent-soft); }
.side-info-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.side-info-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-info-del {
  border: none; background: transparent; color: var(--muted);
  cursor: pointer; font-size: 15px; line-height: 1; padding: 0 2px;
}
.side-info-del:hover { color: var(--danger); }
.muted { color: var(--muted); }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.tabs { display: flex; gap: 6px; padding: 10px 16px 0; }
.tab-btn {
  padding: 8px 16px;
  border: 1px solid transparent;
  border-bottom: none;
  background: transparent;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  color: var(--muted);
}
.tab-btn.active { background: #fff; border-color: var(--line); color: var(--text); font-weight: 600; }
.tab-panel { display: none; flex: 1; overflow: auto; padding: 14px 16px 30px; }
.tab-panel.active { display: block; }

/* 表单 */
.form-host {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.form-host > .card { width: 100%; }
/* 每个分组里的字段横向铺开：三个一组，正好三行九格，不留空位 */
.form-host .field-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 14px;
  align-content: start;
  align-items: start;
}
@media (max-width: 980px) {
  .form-host .field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  .form-host .field-grid { grid-template-columns: minmax(0, 1fr); }
}
.form-host > .card { padding: 10px 11px; }
.form-host > .card .field-label { font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.form-host > .card .field input,
.form-host > .card .field select,
.form-host > .card .field textarea { padding: 5px 8px; font-size: 13px; }
/* 所有输入框平时都是单行高度，内容长了自动换行并自动加高 */
.form-host > .card .field textarea {
  height: 32px;
  min-height: 32px;
  line-height: 1.4;
  resize: none;
  overflow: hidden;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: inherit;
}
.form-host > .card .field textarea.num {
  text-align: right;
}
.form-host > .card .field textarea::placeholder {
  color: #9aa5b8;
}
.card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; }
.card-title { margin: 0 0 10px; font-size: 14px; font-weight: 700; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.card-head .card-title { margin-bottom: 0; }
.form-host > .card { display: flex; flex-direction: column; }
.form-host > .card .field-grid { margin-top: 10px; }
.group-clear {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 6px;
  padding: 2px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: .15s;
}
.group-clear:hover { color: var(--danger); border-color: #f0c9c9; background: #fff8f8; }
.card-tools { display: flex; align-items: center; gap: 8px; }
.hint { color: var(--muted); font-size: 12px; }

.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 8px 12px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field-label { font-size: 12px; color: var(--muted); }
.field input, .field select {
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
  background: #fff;
  font-family: inherit;
}
.field input:focus, .field select:focus { border-color: var(--accent); }

/* 明细表 */
.totals { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0; }
.total-box {
  background: #f7f9fc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 10px;
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 13px;
}
.total-label { color: var(--muted); }
.items-wrap { overflow: auto; max-height: 60vh; border: 1px solid var(--line); border-radius: 8px; }
.items-table {
  border-collapse: collapse;
  width: 100%;
  min-width: 1020px;
  table-layout: fixed;
  font-size: 12.5px;
}
.items-table th, .items-table td { border: 1px solid #eef1f6; padding: 0; }
.items-table th {
  position: sticky;
  top: 0;
  background: #f7f9fc;
  z-index: 2;
  padding: 5px 3px;
  font-weight: 600;
  white-space: nowrap;
  font-size: 12px;
}
.items-table td.idx, .items-table th.idx {
  width: 2.6%;
  text-align: center;
  color: var(--muted);
  background: #fbfcfe;
  padding: 3px;
}
.items-table td.ops, .items-table th.ops { width: 5.1%; text-align: center; }
.items-table input {
  width: 100%;
  border: none;
  padding: 5px 5px;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: 12.5px;
}
.items-table input:focus { background: var(--accent-soft); }
.items-table input.num { text-align: right; }
.items-table input.calc { color: var(--accent); font-weight: 600; }
/* 空的格子标注提示：必填=浅黄，其它=浅灰（填了内容自动消失） */
.items-table input.need-fill-req,
.items-table textarea.need-fill-req {
  background: #fff7e0;
  box-shadow: inset 0 0 0 1px #e5c476;
}
.items-table input.need-fill-opt,
.items-table textarea.need-fill-opt {
  background: #f2f6fb;
}

  /* 申报要素这类长内容格子：多行显示、自动换行，行高随内容变高 */
  .items-table textarea.cell-auto {
    display: block;
    width: 100%;
    min-height: 24px;
    border: none;
    padding: 5px 5px;
    outline: none;
    background: transparent;
    font-family: inherit;
    font-size: 12.5px;
    line-height: 1.45;
    color: inherit;
    resize: none;
    overflow: hidden;
    white-space: pre-wrap;
    word-break: break-all;
    vertical-align: top;
  }
  .items-table textarea.cell-auto:focus { background: var(--accent-soft); }
  .items-table textarea.cell-auto.cell-error {
    background: #fff5f5;
    box-shadow: inset 0 0 0 1px #e79a9a;
  }
  .items-table textarea.cell-auto.cell-warn {
    background: #fffbf2;
    box-shadow: inset 0 0 0 1px #e6c98a;
  }

  /* 申报要素待规范：整格标黄，序号里带"待规范"标签 */
  .items-table textarea.cell-auto.need-elem {
    background: #fffbe8;
    box-shadow: inset 0 0 0 1px #e8c869;
  }
  .items-table input.need-elem {
    background: #fffbe8;
    box-shadow: inset 0 0 0 1px #e8c869;
  }
  .items-table input.ok-elem {
    background: #f0faf3;
    box-shadow: inset 0 0 0 1px #b9e0c3;
  }
  .items-table td.idx .elem-dot {
    display: block;
    margin: 2px auto 0;
    padding: 1px 3px;
    border-radius: 4px;
    background: #fdf0c8;
    color: #8a6a1e;
    font-size: 10px;
    line-height: 1.3;
    width: 34px;
  }
  .items-table td.idx .elem-dot.ok {
    background: #e7f6ec;
    color: #1f9254;
  }

  /* 表格下面的"申报要素待规范"块 */
  .elem-fix { margin-top: 10px; }
  .elem-fix-box {
    border: 1px solid #f0e0bf;
    background: #fffdf5;
    border-radius: 10px;
    padding: 8px 10px;
  }
  .elem-fix-title { font-size: 12px; color: #8a6a1e; margin-bottom: 6px; line-height: 1.6; }
  .elem-fix-line {
    display: flex; align-items: flex-start; gap: 6px; flex-wrap: wrap;
    padding: 4px 0; border-top: 1px dashed #f0e4cc;
  }
  .elem-fix-item { font-size: 12px; color: var(--muted); flex: none; padding-top: 4px; min-width: 110px; }
  .elem-fix-msg { font-size: 12px; color: var(--warn); line-height: 1.6; padding-top: 4px; flex: 1 1 100%; }
  .elem-chip.need-pick {
    border-color: #e0b96a; background: #fff8e6; color: var(--warn);
    box-shadow: 0 0 0 1px #f3e2bd inset;
  }
  .elem-chip.need-fill { border-style: dashed; border-color: #d9bd83; }
.mini { border: 1px solid var(--line); background: #fff; border-radius: 5px; cursor: pointer; padding: 2px 6px; }
.mini.danger { color: var(--danger); border-color: #f0c9c9; }
.mini.hsbtn { color: var(--accent); border-color: #cfe0ff; background: #f5f9ff; margin-right: 3px; }
.mini.hsbtn:hover { background: var(--accent-soft); }
.items-table td.ops { white-space: nowrap; }

/* 预览 */
.doc-tabs { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.doc-tab {
  padding: 6px 14px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  cursor: pointer;
  color: var(--muted);
}
.doc-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.preview-scroll { overflow: auto; background: #e9edf3; border-radius: 10px; padding: 14px; }
.paper { background: #fff; padding: 8mm; box-shadow: 0 4px 18px rgba(20, 30, 50, .12); display: inline-block; }
.paper.landscape { min-width: 900px; }

/* 单证表格（预览与打印共用） */
table.sheet {
  border-collapse: collapse;
  table-layout: fixed;
  font-family: "宋体", SimSun, serif;
  font-size: 10px;
  color: #000;
}
table.sheet td.cell {
  border: 1px solid #000;
  padding: 1px 3px;
  vertical-align: middle;
  text-align: center;
  overflow: hidden;
  word-break: break-all;
  line-height: 1.25;
}
table.sheet td.cell.left { text-align: left; }
table.sheet td.cell.label { font-weight: 400; }
table.sheet td.cell.title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .5px;
  border: none;
  padding: 4px;
}
table.sheet td.cell.empty { border-color: #000; }
table.sheet tr.row-hidden { display: none; }

/* 校验 */
.check-host { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.check-summary { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.pill { padding: 3px 12px; border-radius: 999px; font-size: 13px; background: #eef1f6; }
.pill.bad { background: #fdecec; color: var(--danger); }
.pill.warn { background: #fdf4e3; color: var(--warn); }
.pill.good { background: #eaf7ef; color: var(--ok); }
.check-list { list-style: none; margin: 0; padding: 0; }
.check-list li { display: flex; gap: 10px; padding: 7px 0; border-top: 1px solid #f0f2f6; }
.check-tag { flex: none; width: 44px; text-align: center; border-radius: 4px; font-size: 12px; height: 22px; line-height: 22px; }
.check-list li.error .check-tag { background: #fdecec; color: var(--danger); }
.check-list li.warn .check-tag { background: #fdf4e3; color: var(--warn); }
.check-ok { color: var(--ok); padding: 10px 0; }

/* 提示 */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(20px);
  background: rgba(28, 36, 50, .94);
  color: #fff;
  padding: 9px 18px;
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transition: .2s;
  z-index: 60;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.print-host { display: none; }

/* 智能录单 */
.small { font-size: 12px; }
.smart-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.smart-title { margin: 0 0 4px; font-size: 16px; }
.smart-head p { margin: 0; max-width: 760px; }
.smart-grid { display: grid; grid-template-columns: minmax(320px, 1fr) minmax(420px, 1.3fr); gap: 12px; }
@media (max-width: 1080px) { .smart-grid { grid-template-columns: 1fr; } }

.drop-zone {
  border: 2px dashed #c3cddd;
  border-radius: 10px;
  padding: 22px 16px;
  text-align: center;
  cursor: pointer;
  background: #fbfcfe;
  transition: .15s;
}
.drop-zone:hover, .drop-zone.over { border-color: var(--accent); background: var(--accent-soft); }
.drop-zone strong { display: block; margin-bottom: 4px; }
.drop-zone span { color: var(--muted); font-size: 12px; }

.snap-list { margin: 10px 0; display: flex; flex-direction: column; gap: 6px; }
.snap-card { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; }
.snap-card.bad { border-color: #f0c9c9; background: #fff8f8; }
.snap-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.snap-info { color: var(--muted); font-size: 12px; margin-top: 2px; }

.row-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.chk { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }

.smart-status { margin-top: 10px; font-size: 13px; min-height: 18px; }
.smart-status.ok { color: var(--ok); }
.smart-status.warn { color: var(--warn); }
.smart-status.bad { color: var(--danger); }

.smart-result { margin-bottom: 6px; }
.result-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.result-block { border-top: 1px solid #f0f2f6; padding-top: 10px; margin-top: 10px; }
.result-block h4 { margin: 0 0 8px; font-size: 13px; }
.result-block .items-wrap { max-height: 300px; }

.mask {
  position: fixed;
  inset: 0;
  background: rgba(24, 32, 48, .45);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 60px 16px;
  z-index: 50;
  overflow: auto;
}
.mask.show { display: flex; }
.dialog {
  background: #fff;
  border-radius: 12px;
  padding: 16px 18px;
  width: 560px;
  max-width: 100%;
  box-shadow: 0 18px 40px rgba(20, 30, 50, .25);
}
.dialog-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.dialog-sub { margin: 18px 0 8px; font-size: 13px; }
.dialog .field { margin-bottom: 8px; }
.profile-list { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow: auto; }
.profile-row {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
}
.profile-row strong { flex: none; }
.profile-row .mini { margin-left: auto; }
.backup-status {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
  margin: 10px 0;
  font-size: 13px;
  background: #f7f9fc;
  color: var(--muted);
  word-break: break-all;
}
.backup-status.ok { background: #eaf7ef; border-color: #bfe3cd; color: var(--ok); }
.backup-status.bad { background: #fdecec; border-color: #f0c9c9; color: var(--danger); }
.lib-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow: auto;
}
.lib-row {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 13px;
}
.lib-row strong { flex: none; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-row .mini { margin-left: auto; }
.lib-group-title {
  font-weight: 700; font-size: 13px; color: var(--accent);
  margin: 10px 0 4px;
  border-left: 3px solid var(--accent);
  padding-left: 7px;
}
.lib-save-row { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.lib-save-row input {
  flex: 1; padding: 5px 8px; font-size: 13px;
  border: 1px solid var(--line); border-radius: 5px;
  outline: none;
}
.lib-save-row input:focus { border-color: var(--accent); }
.smart-error {
  border: 1px solid #f0c9c9;
  background: #fff8f8;
  border-radius: 10px;
  padding: 10px 12px;
  color: #8a2b2b;
  font-size: 13px;
  line-height: 1.6;
  word-break: break-all;
}
.smart-error strong { display: block; margin-bottom: 4px; color: var(--danger); }
.raw-snippet {
  background: #1e2533;
  color: #d8e0ee;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* 校验结果在录单页 / 预览页的提示 */
.tab-badge {
  display: inline-block;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  border-radius: 8px;
  font-size: 11px;
  padding: 0 5px;
  margin-left: 6px;
  text-align: center;
  color: #fff;
  vertical-align: 1px;
}
.tab-badge.bad { background: var(--danger); }
.tab-badge.warn { background: var(--warn); }

.form-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 18px 0 26px;
}
.form-footer .btn.big {
  font-size: 15px;
  padding: 11px 34px;
  border-radius: 9px;
  font-weight: 600;
  box-shadow: 0 3px 10px rgba(31, 111, 235, .22);
}

.form-check-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 12px;
  border-radius: 10px;
  margin-bottom: 12px;
  font-size: 13px;
  border: 1px solid var(--line);
  background: #fff;
}
.form-check-bar.bad { border-color: #f0c9c9; background: #fff8f8; }
.form-check-bar.warn { border-color: #f0e0bf; background: #fffcf5; }

.field.has-error input, .field.has-error select, .field.has-error textarea {
  border-color: var(--danger);
  background: #fffafa;
}
.field.has-warn input, .field.has-warn select, .field.has-warn textarea {
  border-color: #e0b96a;
  background: #fffdf7;
}
.field-msg { font-size: 12px; margin-top: 3px; line-height: 1.4; }
.field-msg.error { color: var(--danger); }
.field-msg.warn { color: var(--warn); }

.items-table tr.row-error td.idx {
  background: #fdecec;
  color: var(--danger);
  font-weight: 700;
}
.items-table tr.row-warn td.idx { background: #fdf4e3; color: var(--warn); }
.items-table input.cell-error {
  background: #fff5f5;
  box-shadow: inset 0 0 0 1px #e79a9a;
}
.items-table input.cell-warn {
  background: #fffbf2;
  box-shadow: inset 0 0 0 1px #e6c98a;
}

/* 海关编码查询结果提示 */
.hs-hint {
  margin-top: 8px;
  padding: 7px 11px;
  border-radius: 8px;
  background: #eef4ff;
  border: 1px solid #cfe0ff;
  color: #27508f;
  font-size: 12.5px;
  line-height: 1.6;
}
.hs-hint.bad { background: #fff8f8; border-color: #f0c9c9; color: var(--danger); }
.items-table input.auto-code { background: #fdf6e3; box-shadow: inset 0 0 0 1px #e6c98a; }
.items-table input.warn-code { background: #fff5f5; box-shadow: inset 0 0 0 1px #e79a9a; }
.result-block .items-table input.auto-code { background: #fdf6e3; box-shadow: inset 0 0 0 1px #e6c98a; }
.result-block .items-table input.warn-code { background: #fff5f5; box-shadow: inset 0 0 0 1px #e79a9a; }

  /* 识别结果确认页：申报要素的"资料信息"块 */
  .elem-box {
    margin-top: 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fbfcfe;
    padding: 8px 10px;
  }
  .elem-box-title { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
  .elem-bar-wrap { display: flex; flex-direction: column; gap: 3px; }
  .elem-preview { font-size: 12px; line-height: 1.6; }
  .elem-preview-tag {
    display: inline-block; margin-right: 6px; padding: 1px 6px;
    border-radius: 4px; background: var(--accent-soft); color: var(--accent); font-size: 11px;
  }
  .elem-preview-text { color: var(--text); word-break: break-all; }
  .elem-line { display: flex; align-items: flex-start; gap: 8px; padding: 3px 0; flex-wrap: wrap; }
  .elem-item { font-size: 12px; color: var(--muted); flex: none; padding-top: 3px; min-width: 96px; }
  .elem-title {
    display: inline-block;
    margin-right: 6px;
    color: var(--muted);
    font-size: 12px;
    vertical-align: middle;
  }
  .elem-bar { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; vertical-align: middle; }
  .elem-chip {
    display: inline-flex; align-items: center; gap: 3px;
    border: 1px solid var(--line); border-radius: 999px;
    background: #fff; padding: 1px 8px 1px 9px;
    font-size: 12px; color: var(--muted);
  }
  .elem-chip.has-value { border-color: #cfe0ff; background: #f5f9ff; color: var(--accent); }
  .elem-chip input, .elem-chip select {
    border: none; outline: none; background: transparent;
    font: inherit; color: var(--text); padding: 2px 0; max-width: 170px;
  }
  .elem-chip input::placeholder { color: #b6c0d0; }
  .elem-note { color: var(--muted); font-size: 12px; }

  /* 识别结果页：同名重复行的标记与"是否合并"面板 */
  .result-block .items-table tr.dup-same td { background: #fff7dc; }
  .result-block .items-table tr.dup-diff td { background: #fff1e7; }
  .result-block .items-table tr.dup-same input,
  .result-block .items-table tr.dup-diff input { background: transparent; }
  .dup-badge {
    display: inline-block;
    padding: 1px 6px;
    margin-right: 4px;
    border-radius: 8px;
    font-size: 11px;
    line-height: 1.5;
    vertical-align: middle;
  }
  .dup-badge.dup-same { background: #ffd75e; color: #5b3a00; }
  .dup-badge.dup-diff { background: #ffb27d; color: #5c2400; }
  .dup-panel { border-left: 4px solid #f0a500; padding-left: 12px; }
  .dup-list { display: flex; flex-direction: column; }
  .dup-row-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-top: 1px solid #f0f2f6;
    flex-wrap: wrap;
  }
  .dup-row-info { display: flex; flex-direction: column; gap: 2px; }
  .dup-row-acts { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
  .dup-same-tag { color: #8a5b00; font-size: 12px; }
  .dup-diff-tag { color: #b4551f; font-size: 12px; }

.preview-hint {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: #fff;
}
.preview-hint.bad { border-color: #f0c9c9; background: #fff8f8; }
.preview-hint.warn { border-color: #f0e0bf; background: #fffcf5; }
.preview-hint-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.preview-hint-head .btn { margin-left: auto; }
.preview-hint-list { list-style: none; margin: 8px 0 0; padding: 0; font-size: 13px; }
.preview-hint-list li { display: flex; gap: 8px; padding: 3px 0; }
