/* 消防证书批量查询工具 · 浏览器版 —— 清爽商务浅色主题 */

:root {
  --primary: #2E7CD6;
  --primary-2: #3B87DE;
  --primary-dark: #2568B8;
  --primary-soft: #EAF2FC;
  --bg: #F4F6FA;
  --card: #FFFFFF;
  --line: #E6EAF2;
  --line-strong: #D5DDEA;
  --text: #1F2937;
  --muted: #6B7280;
  --ok: #059669;
  --warn: #B45309;
  --err: #DC2626;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 10px 28px -14px rgba(16, 24, 40, .16);
  --font: "Microsoft YaHei UI", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
h1, h2 { margin: 0; font-weight: 600; }
p { margin: 6px 0; }
b { font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.note  { color: var(--warn); font-size: 12.5px; }
.err   { color: var(--err); font-size: 13px; min-height: 18px; margin: 4px 0 2px; }
.link  { color: var(--primary); text-decoration: none; cursor: pointer; font-size: 13px; }
.link:hover { text-decoration: underline; }

/* ---------------- 卡片与通用元素 ---------------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; gap: 10px;
}
.card-head h2 { font-size: 15px; color: #111827; }
.card-head h2::before {
  content: ""; display: inline-block; width: 4px; height: 14px;
  background: linear-gradient(180deg, var(--primary-2), var(--primary));
  border-radius: 2px; margin-right: 9px; vertical-align: -2px;
}

.btn {
  appearance: none; border: 1px solid var(--line-strong); background: #fff;
  color: var(--text); font-family: var(--font); font-size: 14px;
  padding: 9px 20px; border-radius: 10px; cursor: pointer;
  transition: all .16s ease; text-decoration: none; display: inline-block;
  line-height: 1.4;
}
.btn:hover { border-color: #BFCBDF; background: #F8FAFD; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled, .btn.disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary {
  background: linear-gradient(180deg, var(--primary-2), var(--primary));
  border: none; color: #fff; font-weight: 600;
  box-shadow: 0 1px 2px rgba(46, 124, 214, .35), inset 0 1px 0 rgba(255, 255, 255, .18);
}
.btn-primary:hover { background: linear-gradient(180deg, #2F80DA, var(--primary-dark));
  box-shadow: 0 5px 16px rgba(46, 124, 214, .38); }
.btn-primary:disabled { box-shadow: none; }
.btn-danger-ghost { color: var(--err); border-color: #F3C6C6; }
.btn-danger-ghost:hover { background: #FEF4F4; border-color: #EBA9A9; }
.btn-block { width: 100%; padding: 11px 20px; font-size: 15px; }

.icon-btn {
  appearance: none; border: 1px solid transparent; background: transparent;
  width: 34px; height: 34px; border-radius: 9px; cursor: pointer;
  color: #4B5563; font-size: 15px; line-height: 1; transition: all .15s ease;
}
.icon-btn:hover { background: var(--primary-soft); color: var(--primary-dark); }

.chip {
  background: var(--primary-soft); color: var(--primary-dark);
  padding: 5px 12px; border-radius: 999px; font-size: 12.5px;
}

.field { display: block; margin: 12px 0; }
.field span { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.field input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line-strong);
  border-radius: 10px; font-family: var(--font); font-size: 14px;
  background: #FBFCFE; outline: none; transition: all .15s ease;
}
.field input:focus {
  border-color: var(--primary); background: #fff;
  box-shadow: 0 0 0 3px rgba(46, 124, 214, .13);
}

/* ---------------- 登录 / 初始化 ---------------- */
.auth-wrap {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 18px; padding: 24px;
  background:
    radial-gradient(900px 480px at 88% -12%, rgba(46, 124, 214, .10), transparent 62%),
    radial-gradient(760px 520px at -12% 112%, rgba(46, 124, 214, .08), transparent 62%),
    linear-gradient(172deg, #F8FBFF 0%, #F1F6FD 52%, #F8FBFF 100%);
}
.auth-card { width: min(400px, 92vw); padding: 34px 34px 30px; text-align: center; }
.auth-logo { width: 72px; height: 72px; margin-bottom: 4px; }
.auth-card h1 { font-size: 19px; margin: 8px 0 4px; }
.auth-card form { text-align: left; margin-top: 18px; }
.auth-foot { font-size: 12px; }

/* ---------------- 顶栏 ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1160px; margin: 0 auto; padding: 12px 22px;
  display: flex; align-items: center; gap: 14px;
}
.logo { width: 38px; height: 38px; }
.titles h1 { font-size: 16.5px; color: #111827; }
.titles p { margin: 1px 0 0; font-size: 12px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.conn { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.conn i {
  width: 8px; height: 8px; border-radius: 50%; background: #22C55E;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, .15); transition: all .3s ease;
}
.conn.off i { background: #CBD5E1; box-shadow: none; }

/* ---------------- 主布局 ---------------- */
.layout {
  max-width: 1160px; margin: 20px auto 40px; padding: 0 22px;
  display: grid; grid-template-columns: minmax(360px, 460px) 1fr;
  gap: 18px; align-items: start;
}
.col-left { display: flex; flex-direction: column; gap: 18px; }
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .log-card { min-height: 320px; }
}

/* ---------------- 上传区 ---------------- */
.dropzone {
  border: 2px dashed #C6D2E4; border-radius: 12px; background: #FBFCFE;
  transition: all .18s ease; cursor: pointer;
}
.dropzone:hover { border-color: #9FB6D8; background: #F7FAFE; }
.dropzone.over {
  border-color: var(--primary); background: var(--primary-soft);
  box-shadow: inset 0 0 0 1px var(--primary);
}
.drop-empty { padding: 26px 16px; text-align: center; color: #55637A; }
.drop-empty svg { width: 40px; height: 40px; color: #8CA3C6; margin-bottom: 4px; }
.drop-empty p { margin: 4px 0; font-size: 13.5px; }
.file-chip {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
}
.file-chip svg { width: 26px; height: 26px; color: var(--primary); flex: none; }
.file-meta { flex: 1; min-width: 0; }
.file-meta b { display: block; font-size: 13.5px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.preview {
  list-style: none; margin: 10px 0 0; padding: 10px 14px;
  background: #F8FAFD; border: 1px solid var(--line); border-radius: 10px;
  font-size: 12.5px; color: #44506B;
}
.preview li { padding: 2px 0; display: flex; justify-content: space-between; gap: 10px; }
.preview .pid { font-family: var(--mono); color: var(--muted); }

/* ---------------- 操作区 ---------------- */
.actions { display: flex; align-items: center; gap: 12px; margin: 4px 0 12px; }
.actions.end { justify-content: flex-end; margin: 16px 0 0; }
.progress {
  height: 10px; background: #E8EEF6; border-radius: 999px; overflow: hidden;
}
.progress i {
  display: block; height: 100%; width: 0; border-radius: 999px;
  background: linear-gradient(90deg, var(--primary-2), var(--primary));
  transition: width .4s ease;
}
.progress.running i {
  background-image: linear-gradient(45deg,
    rgba(255, 255, 255, .28) 25%, transparent 25%, transparent 50%,
    rgba(255, 255, 255, .28) 50%, rgba(255, 255, 255, .28) 75%, transparent 75%);
  background-size: 22px 22px;
  animation: stripes .8s linear infinite;
}
@keyframes stripes { to { background-position: 22px 0; } }

/* ---------------- 结果 ---------------- */
.stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  margin-bottom: 14px;
}
.stat {
  background: #F8FAFD; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; text-align: center;
}
.stat b { display: block; font-size: 20px; line-height: 1.25; }
.stat span { font-size: 12px; color: var(--muted); }
.stat.total b { color: var(--primary); }
.stat.pass  b { color: var(--ok); }
.stat.fail  b { color: var(--warn); }
.stat.none  b { color: var(--muted); }
.stat.error b { color: var(--err); }

/* ---------------- 日志 ---------------- */
.log-card { display: flex; flex-direction: column; }
.log {
  font-family: var(--mono); font-size: 12.5px; line-height: 1.75;
  background: #F8FAFC; border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; height: 560px; overflow-y: auto;
  white-space: pre-wrap; word-break: break-all; color: #334155;
  scroll-behavior: smooth;
}
@media (max-width: 980px) { .log { height: 300px; } }
.log-line { animation: fadein .25s ease; }
.log-line .t { color: #94A3B8; margin-right: 8px; }
.log-line.ok  { color: var(--ok); }
.log-line.err { color: var(--err); }
.log-line.info{ color: #64748B; }
.log-empty { color: #94A3B8; padding: 4px 2px; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

/* ---------------- 结果列表 ---------------- */
.rows-card { grid-column: 1 / -1; }
.rows-wrap {
  border: 1px solid var(--line); border-radius: 10px;
  overflow: auto; max-height: 400px; background: #FFFFFF;
}
.rows-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.rows-table th {
  position: sticky; top: 0; z-index: 1; text-align: left;
  background: #F8FAFD; color: #55637A; font-weight: 600;
  padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.rows-table td {
  padding: 8px 10px; border-bottom: 1px solid #F1F4F9;
  white-space: nowrap; max-width: 230px; overflow: hidden; text-overflow: ellipsis;
}
.rows-table tr:last-child td { border-bottom: none; }
.rows-table tbody tr { animation: fadein .25s ease; }
.rows-table tbody tr:hover td { background: #F8FBFF; }
.vchip { padding: 2px 10px; border-radius: 999px; font-size: 12px; }
.vchip.pass  { background: #E7F6EF; color: var(--ok); }
.vchip.fail  { background: #FDF1E3; color: var(--warn); }
.vchip.none  { background: #F1F3F7; color: var(--muted); }
.vchip.error { background: #FDECEC; color: var(--err); }
.rows-empty { padding: 14px 12px; margin: 0; }

/* ---------------- 设置弹窗 ---------------- */
.modal {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(15, 23, 42, .30); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-card { width: min(460px, 94vw); animation: pop .18s ease; }
.modal-card p.muted { font-size: 12.5px; line-height: 1.7; }
@keyframes pop { from { transform: scale(.97); opacity: .6; } to { transform: none; opacity: 1; } }

/* ---------------- Toast ---------------- */
.toast-wrap {
  position: fixed; top: 76px; right: 18px; z-index: 90;
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--ok);
  border-radius: 10px; box-shadow: var(--shadow); padding: 11px 16px;
  font-size: 13.5px; max-width: 340px; animation: slide .22s ease;
}
.toast.error { border-left-color: var(--err); }
@keyframes slide { from { transform: translateX(16px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------------- 门户：工具列表 ---------------- */
.portal { max-width: 1160px; margin: 26px auto 40px; padding: 0 22px; }
.portal-title { font-size: 14px; color: #111827; margin: 6px 0 14px; }
.portal-title::before {
  content: ""; display: inline-block; width: 4px; height: 14px;
  background: linear-gradient(180deg, var(--primary-2), var(--primary));
  border-radius: 2px; margin-right: 9px; vertical-align: -2px;
}
.tool-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.tool-card {
  display: flex; flex-direction: column; align-items: flex-start;
  gap: 8px; padding: 22px 22px 20px; transition: all .18s ease;
}
.tool-card:hover { transform: translateY(-2px);
  box-shadow: 0 3px 6px rgba(16,24,40,.06), 0 16px 36px -16px rgba(16,24,40,.22); }
.tool-card img { width: 44px; height: 44px; }
.tool-card h3 { margin: 2px 0 0; font-size: 15.5px; }
.tool-card p { flex: 1; font-size: 12.5px; line-height: 1.7; }
.tool-card .btn { margin-top: 6px; }
.tool-card.planned { opacity: .65; }
.tool-card.planned:hover { transform: none; box-shadow: var(--shadow); }
.portal-foot { margin-top: 22px; }

/* ---------------- 工具页：返回链接 ---------------- */
.back {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 22px; line-height: 1; color: #4B5563; text-decoration: none;
  transition: all .15s ease;
}
.back:hover { background: var(--primary-soft); color: var(--primary-dark); }
