/* ==========================================================================
   检测助手 · 数据平台  |  样式
   轻量、克制、以数据为主角的工程感配色（青蓝主色）
   ========================================================================== */
:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e3e8ef;
  --border-strong: #cfd8e3;
  --text: #16202b;
  --text-2: #475569;
  --muted: #7c8a9c;
  --primary: #0e7490;
  --primary-700: #0b5f76;
  --primary-soft: #e6f4f8;
  --accent: #f59e0b;
  --danger: #dc2626;
  --danger-soft: #fdecec;
  --ok: #059669;
  --ok-soft: #e7f6f0;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(16, 32, 48, .05);
  --shadow-md: 0 6px 20px -6px rgba(16, 32, 48, .16);
  --shadow-lg: 0 24px 60px -20px rgba(16, 32, 48, .3);
  --sidebar-w: 244px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
}

* { box-sizing: border-box; }
/* 关键：.modal/.lightbox/.progress 用了 display:grid，会盖掉浏览器对 [hidden] 的默认隐藏 */
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--font); color: var(--text);
  background: var(--bg); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* ------------------------------- 通用控件 ------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: var(--radius);
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text-2); font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, box-shadow .15s, color .15s;
}
.btn svg { width: 16px; height: 16px; flex: none; }
.btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.btn:active { transform: translateY(1px); }
.btn--primary {
  background: var(--primary); border-color: var(--primary); color: #fff;
  box-shadow: 0 1px 2px rgba(14, 116, 144, .3);
}
.btn--primary:hover { background: var(--primary-700); border-color: var(--primary-700); color: #fff; }
.btn--ghost { background: var(--surface); }
.btn--danger { color: var(--danger); border-color: #f3c7c7; background: var(--danger-soft); }
.btn--danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn--sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn--block { width: 100%; justify-content: center; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.iconbtn {
  width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px;
  border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer;
}
.iconbtn svg { width: 17px; height: 17px; }
.iconbtn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.field__label .req { color: var(--danger); margin-left: 2px; }
.field input, .field select, .field textarea {
  height: 38px; padding: 0 12px; border: 1px solid var(--border-strong);
  border-radius: var(--radius); background: var(--surface); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field textarea { height: auto; padding: 10px 12px; resize: vertical; min-height: 72px; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(14, 116, 144, .12);
}
.select, .search input, .datefield input {
  height: 36px; border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface); outline: none; padding: 0 10px;
}
.select:focus, .search input:focus, .datefield input:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(14, 116, 144, .12);
}

/* --------------------------------- 品牌 --------------------------------- */
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 16px; }
.brand__mark { width: 34px; height: 34px; color: var(--primary); flex: none; }
.brand__mark svg { width: 100%; height: 100%; display: block; }
.brand__text { display: flex; flex-direction: column; line-height: 1.25; }
.brand__text b { font-size: 15px; letter-spacing: .2px; }
.brand__text i { font-style: normal; font-size: 11.5px; color: var(--muted); letter-spacing: .4px; }
.brand--lg { padding: 0 0 4px; }
.brand--lg .brand__mark { width: 40px; height: 40px; }
.brand--lg .brand__text b { font-size: 17px; }

/* --------------------------------- 登录 --------------------------------- */
.login {
  min-height: 100%; display: grid; place-items: center; position: relative;
  background:
    radial-gradient(900px 500px at 15% -10%, #dff1f6 0%, transparent 60%),
    radial-gradient(700px 460px at 100% 100%, #e8eefb 0%, transparent 55%),
    linear-gradient(160deg, #f7fafc 0%, #eef2f7 100%);
  overflow: hidden;
}
.login__glow {
  position: absolute; inset: 0;
  background-image: linear-gradient(rgba(14, 116, 144, .05) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(14, 116, 144, .05) 1px, transparent 1px);
  background-size: 34px 34px; mask-image: radial-gradient(circle at 50% 35%, #000 0%, transparent 72%);
}
.login__card {
  position: relative; width: 384px; max-width: calc(100% - 32px);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; padding: 30px 30px 24px;
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column; gap: 14px;
}
.login__title { font-size: 20px; margin: 10px 0 0; letter-spacing: .2px; }
.login__sub { margin: 0 0 8px; color: var(--muted); font-size: 13px; }
.login__error {
  margin: 0; color: var(--danger); background: var(--danger-soft);
  border: 1px solid #f6d3d3; border-radius: 8px; padding: 8px 10px; font-size: 13px;
}
.login__hint { margin: 4px 0 0; text-align: center; font-size: 12px; color: var(--muted); }
.login__hint code { background: var(--surface-2); border: 1px solid var(--border); padding: 1px 6px; border-radius: 5px; }

/* --------------------------------- 骨架 --------------------------------- */
.app { display: flex; min-height: 100%; }
.sidebar {
  width: var(--sidebar-w); flex: none; background: var(--surface);
  border-right: 1px solid var(--border); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.nav { padding: 4px 12px; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.nav__label {
  margin: 10px 8px 6px; font-size: 11px; letter-spacing: 1.2px;
  color: var(--muted); text-transform: uppercase; font-weight: 600;
}
.nav__item {
  display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 12px;
  border-radius: 9px; text-decoration: none; color: var(--text-2);
  font-weight: 500; position: relative; transition: background .15s, color .15s;
}
.nav__item:hover { background: var(--surface-2); color: var(--text); }
.nav__item.active { background: var(--primary-soft); color: var(--primary-700); font-weight: 600; }
.nav__item.active::before {
  content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--primary);
}
.nav__ico { width: 18px; height: 18px; flex: none; }
.nav__badge {
  margin-left: auto; font-style: normal; font-size: 12px; font-weight: 600;
  min-width: 24px; height: 20px; padding: 0 7px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center;
}
.nav__item.active .nav__badge { background: #fff; color: var(--primary-700); }
.sidebar__foot { padding: 12px; border-top: 1px solid var(--border); display: grid; gap: 10px; }
.sync { display: flex; align-items: center; gap: 8px; padding: 0 4px; }
.sync__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.sync__text { font-size: 12px; color: var(--muted); }

.main { flex: 1; min-width: 0; }
.page { padding: 22px 26px 40px; }
.page__head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 18px; flex-wrap: wrap; margin-bottom: 16px;
}
.page__title { font-size: 19px; margin: 0 0 3px; letter-spacing: .2px; }
.page__sub { margin: 0; color: var(--muted); font-size: 12.5px; }
.page__actions { display: flex; align-items: center; gap: 9px; }

/* --------------------------------- KPI --------------------------------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 14px 16px; box-shadow: var(--shadow-sm); display: flex; align-items: center; gap: 12px;
}
.kpi__ico { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex: none;
  background: var(--primary-soft); color: var(--primary); }
.kpi__ico svg { width: 19px; height: 19px; }
.kpi--amber .kpi__ico { background: #fef4e5; color: #b45309; }
.kpi--green .kpi__ico { background: var(--ok-soft); color: var(--ok); }
.kpi--violet .kpi__ico { background: #eef0fd; color: #4f46e5; }
.kpi__meta { display: flex; flex-direction: column; min-width: 0; }
.kpi__value { font-size: 21px; font-weight: 650; letter-spacing: -.4px; line-height: 1.15; }
.kpi__value--sm { font-size: 15px; letter-spacing: 0; font-weight: 600; }
.kpi__label { font-size: 12px; color: var(--muted); }

/* --------------------------------- 卡片 --------------------------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.card__bar {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  border-bottom: 1px solid var(--border); background: var(--surface); flex-wrap: wrap;
}
.card__bar--filters { gap: 8px; }
.card__count { margin-left: auto; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.search { position: relative; flex: 1 1 240px; max-width: 360px; display: flex; align-items: center; }
.search svg { position: absolute; left: 10px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.search input { width: 100%; padding-left: 32px; }
.datefield { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.datefield input { padding: 0 8px; }

/* --------------------------------- 表格 --------------------------------- */
.tablewrap { overflow: auto; max-height: calc(100vh - 330px); }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table thead th {
  position: sticky; top: 0; z-index: 2; background: var(--surface-2);
  text-align: left; font-weight: 600; font-size: 12.5px; color: var(--text-2);
  padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table tbody td { padding: 11px 12px; border-bottom: 1px solid #eef2f7; vertical-align: middle; }
.table tbody tr:hover td { background: #fafcfe; }
.table tbody tr:last-child td { border-bottom: none; }
.table .num { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12.5px; }
.table .strong { font-weight: 600; }
.table .muted { color: var(--muted); }
.table .clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.table .actions { display: flex; gap: 6px; }
/* 操作列固定在右侧，横向滚动时始终可见 */
.table th.col-actions, .table td.col-actions {
  position: sticky; right: 0; background: var(--surface);
  box-shadow: -10px 0 14px -10px rgba(16, 32, 48, .16);
}
.table thead th.col-actions { background: var(--surface-2); }
.table tbody tr:hover td.col-actions { background: #fafcfe; }
.table--tasks tbody tr { cursor: pointer; }
.table--tasks tbody tr.open td { background: var(--primary-soft); }

.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px;
  border-radius: 999px; font-size: 12px; background: var(--surface-2);
  border: 1px solid var(--border); color: var(--text-2); white-space: nowrap;
}
.chip--type { background: var(--primary-soft); border-color: #cfe9f0; color: var(--primary-700); font-weight: 500; }
.chip--warn { background: #fef4e5; border-color: #f8e0b8; color: #b45309; }
.chip--photo { background: var(--ok-soft); border-color: #cdeadf; color: var(--ok); }
.chip--dataline { display: block; height: auto; border-radius: 7px; padding: 3px 8px; font-size: 12px; margin: 2px 0; }
.chip--dataline b { font-weight: 500; color: var(--muted); margin-right: 4px; }
.thumbs { display: flex; gap: 5px; align-items: center; }
.thumbs img {
  width: 34px; height: 34px; object-fit: cover; border-radius: 6px;
  border: 1px solid var(--border); cursor: zoom-in; background: var(--surface-2);
}
.thumbs .more { font-size: 11.5px; color: var(--muted); }

.empty { padding: 46px 20px; text-align: center; color: var(--muted); }
.empty p { margin: 0 0 4px; font-weight: 600; color: var(--text-2); }
.empty span { font-size: 12.5px; }

/* -------------------------------- 详情行 -------------------------------- */
.detail td { background: var(--surface-2) !important; padding: 0 !important; }
.detail__inner { padding: 14px 18px 18px; display: grid; gap: 14px; }
.detail__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px 18px; }
.detail__item { display: flex; flex-direction: column; gap: 2px; }
.detail__k { font-size: 11.5px; color: var(--muted); }
.detail__v { font-size: 13.5px; }
.detail__section h4 { margin: 0 0 8px; font-size: 12.5px; color: var(--muted); font-weight: 600; letter-spacing: .3px; }
.detail__photos { display: flex; gap: 10px; flex-wrap: wrap; }
.detail__photos figure { margin: 0; }
.detail__photos img {
  width: 128px; height: 96px; object-fit: cover; border-radius: 9px;
  border: 1px solid var(--border); cursor: zoom-in;
}
.detail__photos figcaption { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* --------------------------------- 下拉 --------------------------------- */
.dropdown { position: relative; }
.dropdown__menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; min-width: 268px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-md); padding: 6px; display: flex; flex-direction: column;
}
.dropdown__menu button {
  text-align: left; border: none; background: transparent; padding: 9px 10px;
  border-radius: 7px; cursor: pointer; color: var(--text-2); font-size: 13px;
}
.dropdown__menu button:hover { background: var(--primary-soft); color: var(--primary-700); }
.caret { width: 14px !important; height: 14px !important; opacity: .7; }

/* --------------------------------- 弹层 --------------------------------- */
.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; }
.modal__mask { position: absolute; inset: 0; background: rgba(16, 32, 48, .38); backdrop-filter: blur(2px); }
.modal__panel {
  position: relative; width: 660px; max-width: calc(100% - 32px); max-height: 88vh;
  background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; overflow: hidden;
  animation: pop .16s ease-out;
}
@keyframes pop { from { transform: translateY(8px) scale(.99); opacity: 0 } to { transform: none; opacity: 1 } }
.modal__head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.modal__head h3 { margin: 0; font-size: 16px; }
.modal__body { padding: 18px; overflow: auto; }
.modal__foot { padding: 14px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 9px; background: var(--surface-2); }
.formgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.formgrid .span2 { grid-column: 1 / -1; }
.formsection { grid-column: 1 / -1; margin-top: 4px; font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .6px; border-top: 1px dashed var(--border); padding-top: 12px; }
.confirm { display: flex; gap: 12px; align-items: flex-start; }
.confirm__ico { width: 38px; height: 38px; flex: none; border-radius: 50%; background: var(--danger-soft); color: var(--danger); display: grid; place-items: center; }
.confirm__ico svg { width: 20px; height: 20px; }
.confirm h4 { margin: 0 0 4px; font-size: 14.5px; }
.confirm p { margin: 0; color: var(--text-2); font-size: 13px; }
.confirm ul { margin: 8px 0 0; padding-left: 18px; color: var(--text-2); font-size: 12.5px; }

/* ------------------------------- 图片查看 ------------------------------- */
.lightbox { position: fixed; inset: 0; z-index: 90; background: rgba(9, 18, 28, .9); display: grid; place-items: center; }
.lightbox img { max-width: 88vw; max-height: 82vh; border-radius: 10px; box-shadow: var(--shadow-lg); }
.lightbox__close { position: absolute; top: 18px; right: 22px; background: transparent; border: none; color: #fff; font-size: 34px; cursor: pointer; line-height: 1; }
.lightbox__cap { position: absolute; bottom: 22px; color: #cbd5e1; font-size: 12.5px; }

/* -------------------------------- 提示条 -------------------------------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 9px; }
.toast {
  min-width: 240px; max-width: 380px; background: #12212e; color: #e7eef5;
  border-radius: 10px; padding: 11px 14px; font-size: 13px; box-shadow: var(--shadow-md);
  display: flex; gap: 9px; align-items: flex-start; animation: slidein .18s ease-out;
}
@keyframes slidein { from { transform: translateX(14px); opacity: 0 } to { transform: none; opacity: 1 } }
.toast--ok { background: #0d3b31; }
.toast--err { background: #46151a; }
.toast svg { width: 16px; height: 16px; flex: none; margin-top: 1px; }

/* -------------------------------- 进度条 -------------------------------- */
.progress {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 100;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 16px; box-shadow: var(--shadow-md); width: 340px; display: grid; gap: 8px;
}
.progress__bar { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress__bar i { display: block; height: 100%; width: 0; background: var(--primary); transition: width .2s; }
.progress span { font-size: 12.5px; color: var(--text-2); text-align: center; }

@media (max-width: 1080px) {
  :root { --sidebar-w: 74px; }
  .brand__text, .nav__item span, .nav__label, .sync__text { display: none; }
  .nav__item { justify-content: center; }
  .nav__badge { display: none; }
}
