/* 蓝白配色；前台走经典"质检报告查询"风格，后台偏工具化 */
:root {
  --blue: #1a4fc8;
  --blue-dark: #0f3a9e;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f4f6fb;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
/* hidden 属性必须最高优先级，防止 display:flex 等布局样式覆盖导致"隐藏失效" */
[hidden] { display: none !important; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
}
.page { max-width: 900px; margin: 0 auto; padding: 24px 16px 60px; }

/* ===== 顶栏横幅 ===== */
.banner {
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dark) 100%);
  color: #fff; border-radius: 10px;
  padding: 22px 26px; margin-bottom: 18px;
}
.banner h1 { font-size: 22px; letter-spacing: 1px; }
.banner .sub { font-size: 13px; opacity: .85; margin-top: 6px; }

/* ===== 搜索区 ===== */
.search-panel { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.search-input {
  flex: 1; min-width: 220px; height: 42px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 8px; font-size: 15px;
  background: #fff; outline: none;
}
.search-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(26,79,200,.12); }
.search-select {
  height: 42px; padding: 0 10px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; font-size: 14px; outline: none;
}
.btn {
  height: 42px; padding: 0 24px; border: 0; border-radius: 8px;
  font-size: 15px; cursor: pointer; background: var(--blue); color: #fff;
}
.btn:hover { background: var(--blue-dark); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-ghost {
  height: 36px; padding: 0 16px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 14px; cursor: pointer; background: #fff; color: var(--ink);
}
.btn-ghost:hover { border-color: var(--blue); color: var(--blue); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b91c1c; }

/* ===== 结果表格 ===== */
.result-info { font-size: 13px; color: var(--muted); margin: 4px 0 8px; }
.table-wrap {
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  overflow-x: auto; /* 竖屏表格超宽时可横向滑动，操作列固定不随滚动 */
}
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--line); font-size: 14px; }
th { background: #f8fafc; color: var(--muted); font-weight: 600; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f8faff; }
.td-title { min-width: 200px; max-width: 320px; }
.td-title .remark { font-size: 12px; color: var(--muted); margin-top: 3px; }
.td-spec { min-width: 150px; white-space: nowrap; }

/* 操作列固定在最右：竖屏无需横向滑动即可点查看/下载/编辑/删除 */
.col-act { position: sticky; right: 0; background: #fff; z-index: 1; box-shadow: -8px 0 8px -6px rgba(0, 0, 0, 0.12); }
th:last-child { position: sticky; right: 0; background: #f8fafc; z-index: 2; box-shadow: -8px 0 8px -6px rgba(0, 0, 0, 0.12); }
.row-reviewing .col-act { background: #fffbeb; }
.row-reviewing:hover .col-act { background: #fef3c7; }
.tag {
  display: inline-block; padding: 2px 10px; border-radius: 20px;
  background: #eef3ff; color: var(--blue); font-size: 12px; white-space: nowrap;
}
.col-act { white-space: nowrap; text-align: right; }
.link { color: var(--blue); text-decoration: none; margin-left: 12px; font-size: 14px; }
.link:hover { text-decoration: underline; }
.empty { padding: 48px 0; text-align: center; color: var(--muted); font-size: 14px; }

/* ===== 页脚 ===== */
.foot {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 16px; font-size: 12px; color: var(--muted);
}
.admin-link { color: var(--muted); text-decoration: none; }
.admin-link:hover { color: var(--blue); }

/* ===== 卡片与表单（后台） ===== */
.card {
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 18px 20px; margin-bottom: 16px;
}
.card h2 { font-size: 16px; margin-bottom: 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%; height: 38px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 7px; font-size: 14px;
  background: #fff; outline: none; font-family: inherit;
}
.field textarea { height: auto; padding: 8px 10px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--blue); box-shadow: 0 0 0 3px rgba(26,79,200,.12);
}
.field .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.file-box {
  border: 1.5px dashed var(--line); border-radius: 8px; padding: 16px;
  text-align: center; color: var(--muted); font-size: 13px; cursor: pointer;
}
.file-box:hover { border-color: var(--blue); color: var(--blue); }
.file-box.has-file { border-style: solid; border-color: var(--blue); color: var(--blue); }

/* ===== 顶栏（后台） ===== */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 18px; margin-bottom: 16px;
}
.topbar h1 { font-size: 17px; color: var(--blue); }
.topbar .actions { display: flex; gap: 8px; }

/* ===== 登录视图 ===== */
.login-wrap { display: flex; justify-content: center; align-items: center; min-height: 78vh; }
.login-panel { width: 360px; }
.login-head {
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dark) 100%);
  color: #fff; border-radius: 12px 12px 0 0;
  padding: 26px 20px; text-align: center;
}
.login-head h2 { font-size: 19px; letter-spacing: 1px; }
.login-head p { font-size: 12px; opacity: .85; margin-top: 5px; }
.login-body {
  background: #fff; border: 1px solid var(--line); border-top: 0;
  border-radius: 0 0 12px 12px; padding: 22px 20px;
}
.login-foot { margin-top: 14px; text-align: center; font-size: 13px; }
.login-foot a { color: var(--muted); text-decoration: none; }
.login-foot a:hover { color: var(--blue); }
.msg { font-size: 13px; margin-top: 10px; }
.msg-error { color: var(--danger); }
.msg-ok { color: #16a34a; }

/* ===== 弹窗 ===== */
dialog {
  /* position/inset/margin 显式声明，保证弹窗始终居中于视口 */
  position: fixed; inset: 0; margin: auto;
  border: 0; border-radius: 12px; padding: 22px 24px; width: 460px; max-width: calc(100vw - 32px);
  max-height: calc(100vh - 48px); overflow: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
dialog::backdrop { background: rgba(15,23,42,.45); }
dialog h3 { font-size: 16px; margin-bottom: 16px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* ===== 图片预览与旋转 ===== */
#previewWrap { display: flex; flex-direction: column; align-items: center; gap: 10px; }
#imgPreview { max-width: 260px; max-height: 340px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }

/* ===== 分类管理弹窗 ===== */
.cat-add { display: flex; gap: 8px; margin-bottom: 6px; }
.cat-add input {
  flex: 1; min-width: 0; height: 38px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 7px; font-size: 14px; outline: none;
}
.cat-add input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(26,79,200,.12); }
.cat-list { margin-top: 8px; }
.cat-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px;
}
.cat-row:last-child { border-bottom: 0; }
.cat-input {
  flex: 1; min-width: 0; height: 32px; padding: 0 8px;
  border: 1px solid transparent; border-radius: 6px; font-size: 14px; outline: none;
  background: transparent;
}
.cat-input:hover { border-color: var(--line); background: #fff; }
.cat-input:focus { border-color: var(--blue); background: #fff; }
.cat-count { color: var(--muted); font-size: 12px; white-space: nowrap; }
.cat-row .btn-ghost { height: 30px; padding: 0 12px; font-size: 13px; }
.cat-empty { padding: 16px 0; text-align: center; color: var(--muted); font-size: 13px; }

/* ===== 管理后台宽屏优化:页面加宽至 2 倍,列表放大便于核对 ===== */
body.admin-page .page { max-width: 1800px; }
body.admin-page th,
body.admin-page td { font-size: 15px; padding: 14px 16px; }
body.admin-page .td-title { min-width: 240px; max-width: 600px; }
body.admin-page .td-title .remark { font-size: 13px; }
body.admin-page .td-spec { min-width: 180px; }
body.admin-page .col-act .link { font-size: 15px; margin-left: 16px; }
/* 手机访问后台仍走窄屏紧凑版 */
@media (max-width: 640px) {
  body.admin-page .page { max-width: none; }
  body.admin-page th,
  body.admin-page td { font-size: 13px; padding: 9px 8px; }
  body.admin-page .td-title { max-width: 320px; }
  body.admin-page .col-act .link { margin-left: 8px; font-size: 14px; }
}

/* ===== 响应式 ===== */
@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
  th, td { padding: 9px 8px; font-size: 13px; }
  .col-act .link { margin-left: 8px; }
  .page { padding: 12px 8px 40px; }
  .banner { padding: 16px 18px; }
  .banner h1 { font-size: 18px; }
}

/* ===== 报告状态与批量上传（2026-09-15 新增） ===== */
.row-reviewing { background: #fffbeb; }
.row-reviewing:hover { background: #fef3c7; }
.tag {
  display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; white-space: nowrap;
}
.tag-reviewing { background: #fef3c7; color: #b45309; border: 1px solid #fcd34d; }
.tag-confirmed { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.filter-btn.is-active { background: var(--blue); color: #fff; border-color: var(--blue); }
.batch-progress { margin-top: 14px; }
.batch-summary { font-size: 14px; margin-bottom: 8px; color: var(--ink); }
.batch-table { width: 100%; border-collapse: collapse; }
.batch-table th, .batch-table td { padding: 8px 10px; font-size: 13px; border-bottom: 1px solid var(--line); text-align: left; }
.batch-table th { color: var(--muted); font-weight: 500; }
.batch-err { color: var(--danger); }
.upload-dialog { width: 640px; }
.upload-dialog .form-grid { grid-template-columns: 1fr 1fr; }
