/* IP Guard — light single-theme UI modelled on the client reference design (red accent, card grid). */
:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --line: #e6e8ec;
  --line-soft: #eef0f4;
  --text: #1f2328;
  --muted: #6b7280;
  --accent: #e0242c;
  --accent-dark: #c31d24;
  --accent-soft: #fdecec;
  --amber: #b7791f;
  --amber-soft: #fff7e6;
  --green: #1e7a45;
  --green-soft: #eaf7ef;
  --radius: 10px;
  /* System UI fonts only: a CJK webfont is megabytes and Google Fonts is unreachable from China. */
  --font-ja: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Hiragino Kaku Gothic ProN",
             "Yu Gothic UI", "Noto Sans JP", Meiryo, sans-serif;
  --font-zh: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
             "Microsoft YaHei", "Noto Sans SC", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.65 var(--font-ja);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
/* Japanese and simplified Chinese disagree on the shape of shared kanji: pick the reader's own font. */
html[lang^="zh"] body { font-family: var(--font-zh); }
/* Counters and progress figures change in place — keep the digits from jittering. */
.stat b, .progress-text, .job-line, .pagination, .envlist dd, td.status .conf, .thumb-more {
  font-variant-numeric: tabular-nums;
}
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.micro { font-size: 12px; }

/* ---------- top bar ---------- */
.topbar { background: var(--card); border-bottom: 1px solid var(--line); }
.topbar-inner {
  max-width: 1180px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  width: 34px; height: 34px; flex: none; border-radius: 9px;
  background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center;
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text b { font-size: 15px; font-weight: 700; letter-spacing: .005em; }
.brand-text small { font-size: 11px; color: var(--muted); }
.topnav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.langswitch { display: inline-flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; margin-right: 4px; }
.langswitch a { padding: 5px 11px; font-size: 12px; color: var(--muted); background: #fff; }
.langswitch a + a { border-left: 1px solid var(--line); }
.langswitch a:hover { background: #f3f4f6; }
.langswitch a.active { background: #eef0f4; color: var(--text); font-weight: 600; }
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 12px; font-size: 12px; border-radius: 7px;
  border: 1px solid var(--line); color: var(--muted); background: #fff;
}
.pill:hover { background: #f3f4f6; }
.pill-active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.pill-active:hover { background: var(--accent); }

/* ---------- page ---------- */
.page { max-width: 1180px; margin: 0 auto; padding: 18px 20px 40px; }

.banner {
  display: flex; gap: 10px; align-items: flex-start;
  background: #fffaf0; border: 1px solid #f3e3c3; border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 16px;
}
.banner-icon { color: var(--accent); flex: none; line-height: 0; margin-top: 2px; }
.banner b { display: block; font-size: 13px; }
.banner p { margin: 2px 0 0; font-size: 12px; color: #6d6250; }

.cols { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 16px; align-items: start; }
.col-left, .col-right { min-width: 0; display: flex; flex-direction: column; gap: 16px; }

/* ---------- cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card-title { display: flex; align-items: center; gap: 7px; margin: 0 0 12px; font-size: 13.5px; font-weight: 700; letter-spacing: .005em; }
.card-title svg { color: var(--accent); flex: none; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-sub { margin: -8px 0 12px; font-size: 12px; color: var(--muted); }
.head-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* ---------- drop zone ---------- */
.drop {
  border: 1.5px dashed #d9b8b8; background: #fffbfb; border-radius: 9px;
  padding: 22px 14px; text-align: center; cursor: pointer; color: var(--muted);
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop-icon { display: block; color: var(--accent); line-height: 0; margin-bottom: 8px; }
.drop strong { display: block; font-size: 12.5px; font-weight: 500; color: var(--text); }
.drop strong u { color: var(--accent); text-underline-offset: 2px; }
.drop small { display: block; font-size: 11px; margin-top: 5px; }

.drop.busy { cursor: progress; border-style: solid; border-color: var(--accent); background: var(--accent-soft); }
.drop.busy strong, .drop.busy small { display: none; }
.drop-busy { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 12.5px; color: var(--text); }
.spinner {
  width: 14px; height: 14px; flex: none; border-radius: 50%;
  border: 2px solid #e6c9c9; border-top-color: var(--accent); animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- picked files (visible confirmation that the upload was taken) ---------- */
.picked {
  border: 1.5px solid var(--green); background: var(--green-soft); border-radius: 9px;
  padding: 12px 12px 10px; animation: picked-in .22s ease-out;
}
.picked.empty { border-color: #f0e0bd; background: var(--amber-soft); }
@keyframes picked-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.picked-head { display: flex; align-items: flex-start; gap: 9px; }
.picked-icon {
  width: 24px; height: 24px; flex: none; border-radius: 50%; line-height: 0;
  background: var(--green); color: #fff; display: flex; align-items: center; justify-content: center;
}
.picked.empty .picked-icon { background: var(--amber); }
.picked-icon .ic-warn, .picked.empty .picked-icon .ic-ok { display: none; }
.picked.empty .picked-icon .ic-warn { display: block; }
.picked-text { flex: 1; min-width: 0; }
.picked-text b { display: block; font-size: 13.5px; color: var(--text); }
.picked-text small { display: block; font-size: 11px; color: var(--muted); word-break: break-all; }
.picked-thumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.picked-thumbs:empty { display: none; }
.picked-thumbs img {
  width: 40px; height: 40px; object-fit: cover; border-radius: 5px;
  border: 1px solid rgba(30, 122, 69, .35); background: #fff;
}
.thumb-more { font-size: 11px; color: var(--muted); margin-left: 2px; }
.picked-foot { display: flex; align-items: flex-end; gap: 8px; margin-top: 9px; }
.picked-hint { flex: 1; margin: 0; font-size: 11.5px; color: var(--muted); }
.picked-foot .btn { flex: none; background: #fff; }

.section-label { margin: 14px 0 6px; font-size: 11px; color: var(--muted); }
.btn-row { display: flex; gap: 8px; }
.check { display: flex; align-items: center; gap: 6px; margin: 8px 0 12px; font-size: 12px; color: var(--muted); }
.check input { margin: 0; }
.note { margin: 10px 0 0; font-size: 12px; color: var(--muted); }
.fake { margin: 10px 0 0; font-size: 12px; color: var(--amber); background: var(--amber-soft); border: 1px solid #f0e0bd; border-radius: 6px; padding: 6px 8px; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-size: 13px; padding: 7px 14px; border: 1px solid transparent;
  border-radius: 7px; cursor: pointer; background: #fff; color: var(--text); white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn-primary:hover:not(:disabled) { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-primary:disabled { background: #e9ebef; border-color: #e9ebef; color: #9aa1ac; opacity: 1; }
.btn-outline { border-color: var(--line); color: var(--text); }
.btn-outline:hover:not(:disabled) { background: #f3f4f6; }
.btn-ghost { border-color: transparent; color: var(--muted); }
.btn-ghost:hover:not(:disabled) { background: #f3f4f6; }
.btn-block { width: 100%; }
.btn-lg { padding: 10px 14px; margin-top: 4px; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
a.btnlink { text-decoration: none; }
a.btnlink[href] button { opacity: 1; }
.form-control {
  font: inherit; font-size: 13px; padding: 6px 10px; border: 1px solid var(--line);
  border-radius: 7px; background: #fff; color: var(--text); height: 32px; max-width: 100%;
}
.form-control.block { width: 100%; margin-top: 10px; }
.group { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- env list ---------- */
.envlist { margin: 0; font-size: 12px; }
.envlist > div { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-top: 1px solid var(--line-soft); }
.envlist > div:first-child { border-top: 0; }
.envlist dt { color: var(--muted); flex: none; }
.envlist dd { margin: 0; text-align: right; color: var(--accent); }
.envlist dd b { font-weight: 600; }
.envlist dd .muted { display: block; font-size: 11px; }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 4px 0 14px; }
.stat {
  border: 1px solid var(--line); border-radius: 9px; background: #fafbfc;
  padding: 10px 8px; text-align: center; display: flex; flex-direction: column; gap: 2px;
}
.stat span { font-size: 11px; color: var(--muted); letter-spacing: .02em; }
.stat b { font-size: 23px; font-weight: 700; line-height: 1.15; letter-spacing: -.01em; }
.stat-ng { background: var(--accent-soft); border-color: #f6d5d5; } .stat-ng b { color: var(--accent); }
.stat-warn { background: var(--amber-soft); border-color: #f0e2c2; } .stat-warn b { color: var(--amber); }
.stat-safe { background: var(--green-soft); border-color: #cfe8d9; } .stat-safe b { color: var(--green); }

/* ---------- progress ---------- */
.job-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 12px; margin-bottom: 8px; }
.progress { height: 8px; background: #eceef2; border-radius: 99px; overflow: hidden; position: relative; }
.progress > span { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 99px; }
.progress .up { background: #f6c9cb; }
.progress .done { background: var(--accent); }
.progress-text { display: flex; justify-content: space-between; gap: 10px; font-size: 11px; color: var(--muted); margin: 5px 0 12px; }

/* ---------- alerts ---------- */
.alert { padding: 9px 12px; border: 1px solid transparent; border-radius: 7px; margin-bottom: 12px; font-size: 12px; }
.alert.warn { background: var(--amber-soft); border-color: #f0e0bd; color: #7a5b12; }
.alert.ok { background: var(--green-soft); border-color: #cfe8d9; color: #15603a; }
.alert.info { background: #eef4fb; border-color: #d3e2f5; color: #24527f; }

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 9px; }
table.table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.table th, .table td { padding: 9px 10px; text-align: left; vertical-align: top; line-height: 1.55; }
.table thead th { background: #fafbfc; border-bottom: 1px solid var(--line); color: var(--muted); font-weight: 600; white-space: nowrap; font-size: 11.5px; letter-spacing: .02em; }
.table tbody td { border-top: 1px solid var(--line-soft); }
.table tbody tr:hover { background: #fafbfc; }
td.thumb img, td.thumb .ph { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 5px; background: #f1f2f5; display: block; object-fit: cover; }
img.zoomable { cursor: zoom-in; }
img.zoomable:hover { border-color: var(--accent); }

/* ---------- hover zoom overlay ---------- */
.zoom {
  position: fixed; z-index: 60; pointer-events: none;
  background: #fff; border: 1px solid var(--line); border-radius: 9px;
  box-shadow: 0 10px 30px rgba(16, 20, 26, .18); padding: 6px;
  max-width: 356px;
}
.zoom.pinned { pointer-events: auto; border-color: var(--accent); }
.zoom img { display: block; max-width: 340px; max-height: 340px; border-radius: 5px; background: #f1f2f5; }
.zoom-cap {
  display: block; max-width: 340px; margin-top: 5px; font-size: 11px; color: var(--muted);
  overflow-wrap: anywhere;
}
td.file { min-width: 150px; max-width: 220px; overflow-wrap: anywhere; }
td.file small { display: block; color: var(--muted); font-size: 11px; }
td.reason { min-width: 240px; }
td.reason .sub, td.target small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
td.status .conf { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }
.table td.empty { text-align: center; color: var(--muted); padding: 44px 12px; }
.table td.empty svg { color: #c8ccd4; margin-bottom: 8px; }
.table td.empty p { margin: 0; font-size: 12px; }

/* ---------- badges ---------- */
.badge { display: inline-block; padding: 2.5px 9px; font-size: 11px; font-weight: 600; border-radius: 99px; white-space: nowrap; border: 1px solid transparent; letter-spacing: .01em; }
.badge.SAFE { background: var(--green-soft); color: var(--green); border-color: #cfe8d9; }
.badge.WARNING { background: var(--amber-soft); color: var(--amber); border-color: #f0e2c2; }
.badge.NG { background: var(--accent-soft); color: var(--accent); border-color: #f6d5d5; }
.badge.pending, .badge.uploading, .badge.queued, .badge.processing { background: #f1f2f5; color: var(--muted); font-weight: 500; }
.badge.error, .badge.lost { background: #eceef2; color: #4b5563; }

/* ---------- pagination ---------- */
.pagination { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-top: 12px; font-size: 12px; color: var(--muted); }
.pages { display: inline-flex; }
.pages a { display: inline-block; min-width: 30px; text-align: center; padding: 4px 7px; border: 1px solid var(--line); margin-left: -1px; color: var(--muted); background: #fff; }
.pages a:first-child { border-radius: 6px 0 0 6px; margin-left: 0; }
.pages a:last-child { border-radius: 0 6px 6px 0; }
.pages a:hover { background: #f3f4f6; }
.pages a.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.pages a.disabled, .pages a.gap { color: #c1c6cf; pointer-events: none; }

/* ---------- footer ---------- */
.foot { border-top: 1px solid var(--line); background: var(--card); text-align: center; padding: 14px; font-size: 11px; color: var(--muted); }

@media (max-width: 900px) {
  .cols { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- login ---------- */
.login { position: fixed; inset: 0; background: var(--bg); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 10; }
.login-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px 24px; width: 100%; max-width: 360px; text-align: center; }
.login-card h1 { font-size: 15px; margin: 12px 0 2px; }
.login-card > p { margin: 0 0 18px; font-size: 12px; color: var(--muted); }
.login-card .brand-mark { margin: 0 auto; }
.field { display: block; text-align: left; margin-bottom: 12px; font-size: 12px; color: var(--muted); }
.field .form-control { margin-top: 4px; height: 36px; }
.login-err { margin: 0 0 12px; font-size: 12px; color: var(--accent); background: var(--accent-soft); border: 1px solid #f6d5d5; border-radius: 7px; padding: 7px 10px; text-align: left; }
.login-lang { margin-top: 16px; }
.who { font-size: 12px; color: var(--muted); margin-left: 4px; }
button.pill { font: inherit; font-size: 12px; cursor: pointer; }
.form-control:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(224, 36, 44, .12); }
