/* ================================================================
   地址上传工作台 · 样式
   调性：内部效率工具。克制、高信息密度、不装饰。
   ================================================================ */

/* ⚠️ 必须放在最前：本文件里 .gate / .stats 等显式写了 display，
   会盖掉浏览器默认的 [hidden]{display:none}——导致 JS 设了 hidden 也隐藏不掉
   （曾导致「口令输对了仍卡在门禁页」）。这条兜底保证 hidden 一定生效。 */
[hidden] { display: none !important; }

:root {
  --bg:        #F4F5F7;
  --surface:   #FFFFFF;
  --surface-2: #FAFBFC;
  --line:      #E4E6EA;
  --line-soft: #EEF0F3;

  --ink:       #17191C;
  --ink-2:     #4B5058;
  --ink-3:     #868C96;
  --ink-4:     #AEB4BD;

  --brand:     #1F4BD8;
  --brand-dk:  #1739A8;
  --brand-bg:  #EEF2FE;

  --ok:        #0F8A5F;
  --ok-bg:     #E8F6F0;
  --warn:      #B26A00;
  --warn-bg:   #FDF3E3;
  --bad:       #C7362F;
  --bad-bg:    #FCEDEC;
  --l3:        #A2532B;
  --l3-bg:     #FBEFE8;

  --r:  10px;
  --r-s: 7px;
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 1px 3px rgba(16,24,40,.06);
  --shadow-lg: 0 12px 32px rgba(16,24,40,.12);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "PingFang SC", -apple-system, BlinkMacSystemFont, "Helvetica Neue",
               "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h2, h3 { margin: 0; font-weight: 600; }
button { font-family: inherit; cursor: pointer; }
code { font-family: var(--mono); font-size: .85em; background: var(--line-soft);
       padding: 1px 5px; border-radius: 4px; color: var(--ink-2); }

/* ---------------------------------------------------------------- 顶栏 */

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 20px;
  padding: 0 22px; height: 62px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--brand); color: #fff;
  display: grid; place-items: center;
  font-size: 16px; font-weight: 600;
}
.brand-name { font-size: 14px; font-weight: 600; letter-spacing: .01em; }
.brand-sub  { font-size: 11px; color: var(--ink-3); margin-top: -1px; }

.stats { display: flex; align-items: center; gap: 18px; margin-left: 10px; }
.stat { display: flex; align-items: baseline; gap: 5px; }
.stat-n { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat-n.ok   { color: var(--ok); }
.stat-n.warn { color: var(--warn); }
.stat-n.bad  { color: var(--bad); }
.stat-n.chip-l1 { color: var(--ok); }
.stat-n.chip-l2 { color: var(--warn); }
.stat-n.chip-l3 { color: var(--l3); }
.stat-l { font-size: 11px; color: var(--ink-3); }
.stat-divider { width: 1px; height: 20px; background: var(--line); }

.topbar-actions { margin-left: auto; display: flex; gap: 8px; }

/* ---------------------------------------------------------------- 按钮 */

.btn {
  border: 1px solid transparent; border-radius: var(--r-s);
  padding: 7px 14px; font-size: 13px; font-weight: 500;
  transition: background .12s, border-color .12s, color .12s;
}
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--brand-dk); }
.btn.ghost { background: var(--surface); border-color: var(--line); color: var(--ink-2); }
.btn.ghost:hover:not(:disabled) { background: var(--surface-2); border-color: var(--ink-4); }
.btn:disabled { opacity: .42; cursor: not-allowed; }

.link {
  background: none; border: none; padding: 0;
  color: var(--brand); font-size: 12.5px;
}
.link:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- 布局 */

.wrap { max-width: 1080px; margin: 0 auto; padding: 22px 22px 80px; }

.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--shadow);
  margin-bottom: 18px; overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; gap: 12px;
  padding: 15px 20px; border-bottom: 1px solid var(--line-soft);
}
.panel-head h2 { font-size: 14px; }
.head-tools { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.mini-check { display: flex; align-items: center; gap: 6px;
              font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
.mini-check input { accent-color: var(--brand); }
.muted { color: var(--ink-3); font-weight: 400; font-size: 12.5px; }

/* ---------------------------------------------------------------- 上传 */

.tabs { display: flex; gap: 2px; padding: 14px 20px 0; }
.tab {
  background: none; border: none; border-bottom: 2px solid transparent;
  padding: 6px 2px; margin-right: 18px;
  font-size: 13px; color: var(--ink-3);
}
.tab.active { color: var(--ink); border-bottom-color: var(--brand); font-weight: 500; }

.tab-pane { display: none; padding: 16px 20px 20px; }
.tab-pane.active { display: block; }

.drop {
  border: 1.5px dashed var(--line); border-radius: var(--r);
  background: var(--surface-2);
  padding: 36px 20px; text-align: center;
  color: var(--ink-3); cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.drop:hover { border-color: var(--ink-4); }
.drop.over { border-color: var(--brand); background: var(--brand-bg); color: var(--brand); }
.drop-icon { width: 40px; height: 40px; color: var(--brand); opacity: .75; }
.drop-title { font-size: 14.5px; color: var(--ink); margin-top: 8px; }
.drop-hint { font-size: 12.5px; margin-top: 4px; }
.drop-note { font-size: 12px; color: var(--ink-3); margin-top: 12px; line-height: 1.7; }

textarea {
  width: 100%; border: 1px solid var(--line); border-radius: var(--r-s);
  padding: 11px 13px; font-size: 13px; line-height: 1.7;
  font-family: inherit; resize: vertical; color: var(--ink);
  background: var(--surface-2);
}
textarea:focus { outline: none; border-color: var(--brand); background: #fff;
                 box-shadow: 0 0 0 3px var(--brand-bg); }
.row-end { display: flex; justify-content: flex-end; margin-top: 12px; }

/* ---------------------------------------------------------------- 空态 */

.empty { text-align: center; padding: 58px 20px 40px; }
.empty-k { font-size: 15px; font-weight: 600; }
.empty-s { font-size: 13px; color: var(--ink-3); margin-top: 6px; }
.empty-steps {
  display: inline-block; text-align: left;
  margin: 26px 0 0; padding: 0; list-style: none;
  counter-reset: s;
}
.empty-steps li {
  counter-increment: s; position: relative;
  padding: 9px 0 9px 36px;
  font-size: 13px; color: var(--ink-2);
  border-top: 1px solid var(--line-soft);
}
.empty-steps li:first-child { border-top: none; }
.empty-steps li::before {
  content: counter(s);
  position: absolute; left: 0; top: 11px;
  width: 21px; height: 21px; border-radius: 50%;
  background: var(--brand-bg); color: var(--brand);
  font-size: 11px; font-weight: 600;
  display: grid; place-items: center;
}
.empty-steps b { color: var(--ink); }

/* ---------------------------------------------------------------- 清单 */

.list { padding: 8px 12px 14px; }

.card {
  border: 1px solid var(--line-soft); border-radius: var(--r-s);
  margin-top: 8px; background: var(--surface);
  transition: border-color .12s, box-shadow .12s;
}
.card:hover { border-color: var(--line); }
.card.done   { background: var(--surface-2); border-color: var(--line-soft); opacity: .62; }
.card.dropped{ display: none; }
.card.blocked{ border-color: #F0C9C6; background: #FFFCFC; }
.card.open   { box-shadow: var(--shadow); border-color: var(--line); }

.card-main {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 11px 14px 11px 12px; cursor: pointer;
}

.seq {
  flex-shrink: 0; width: 24px; height: 24px; border-radius: 6px;
  background: var(--line-soft); color: var(--ink-3);
  font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums;
  display: grid; place-items: center; margin-top: 1px;
}
.card.done .seq { background: var(--ok-bg); color: var(--ok); }
.card.blocked .seq { background: var(--bad-bg); color: var(--bad); }

.card-body { flex: 1; min-width: 0; }

.line-1 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rname { font-size: 14px; font-weight: 600; letter-spacing: .01em; }
.rname.empty { color: var(--ink-4); font-weight: 400; font-style: italic; }

.phone { font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); }

.tag {
  font-size: 10.5px; font-weight: 500; padding: 1.5px 7px; border-radius: 4px;
  letter-spacing: .02em; white-space: nowrap;
}
.tag.src  { background: var(--line-soft); color: var(--ink-3); }
.tag.mail { background: #EAF3EE; color: #1E7A46; cursor: default; }
.tag.L1   { background: var(--ok-bg);   color: var(--ok); }
.tag.L2   { background: var(--warn-bg); color: var(--warn); }
.tag.L3   { background: var(--l3-bg);   color: var(--l3); }
.tag.done-tag { background: var(--ok-bg); color: var(--ok); }
.tag.warn-tag { background: var(--warn-bg); color: var(--warn); }
.tag.bad-tag  { background: var(--bad-bg);  color: var(--bad); }

.addr { font-size: 12.5px; color: var(--ink-2); margin-top: 3px;
        word-break: break-all; line-height: 1.6; }

.card-acts { display: flex; gap: 4px; flex-shrink: 0; align-items: center; }
.iconbtn {
  width: 26px; height: 26px; border-radius: 6px;
  border: 1px solid transparent; background: none;
  color: var(--ink-4); display: grid; place-items: center;
}
.iconbtn:hover { background: var(--line-soft); color: var(--ink-2); }
.iconbtn.yes:hover { background: var(--ok-bg); color: var(--ok); }
.iconbtn.no:hover  { background: var(--bad-bg); color: var(--bad); }
.iconbtn svg { width: 14px; height: 14px; }

/* 展开区 */
.card-more {
  display: none; padding: 2px 14px 14px 50px;
  border-top: 1px solid var(--line-soft); margin-top: 2px; padding-top: 13px;
}
.card.open .card-more { display: block; }

.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.fl { display: flex; flex-direction: column; gap: 4px; }
.fl.full { grid-column: 1 / -1; }
.fl span { font-size: 11px; color: var(--ink-3); }
.fl input, .fl textarea, .fl select {
  border: 1px solid var(--line); border-radius: 6px; padding: 6px 9px;
  font-size: 12.5px; font-family: inherit; background: var(--surface-2); color: var(--ink);
}
.fl input:focus, .fl select:focus { outline: none; border-color: var(--brand); background: #fff;
                  box-shadow: 0 0 0 3px var(--brand-bg); }

.warns { margin-top: 11px; }
.warn-item {
  font-size: 12px; color: var(--warn); background: var(--warn-bg);
  border-radius: 6px; padding: 6px 10px; margin-top: 5px;
}
.warn-item.bad { color: var(--bad); background: var(--bad-bg); }

/* 信息提示：正常现象，不与告警争抢注意力 */
.notes { margin-top: 11px; }
.note-item {
  font-size: 11.5px; color: var(--ink-3); line-height: 1.6;
  padding-left: 14px; position: relative;
}
.note-item::before {
  content: ""; position: absolute; left: 3px; top: 8px;
  width: 4px; height: 4px; border-radius: 50%; background: var(--ink-4);
}

.meta-line { font-size: 11.5px; color: var(--ink-3); margin-top: 10px;
             display: flex; gap: 14px; flex-wrap: wrap; }
.meta-line b { color: var(--ink-2); font-weight: 500; }

/* ---------------------------------------------------------------- 抽屉 */

.drawer-mask { position: fixed; inset: 0; background: rgba(16,24,40,.28); z-index: 50; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 380px; z-index: 51;
  background: var(--surface); box-shadow: var(--shadow-lg);
  padding: 20px; overflow-y: auto;
}
.drawer-head { display: flex; align-items: center; justify-content: space-between;
               margin-bottom: 6px; }
.drawer-head h3 { font-size: 15px; }
.fieldset { padding: 16px 0; border-top: 1px solid var(--line-soft); }
.fieldset-title { font-size: 12px; font-weight: 600; color: var(--ink-2);
                  margin-bottom: 10px; }
.hint { font-size: 11.5px; color: var(--ink-3); line-height: 1.65; margin-bottom: 8px; }
.fl { margin-bottom: 10px; }
.radio { display: flex; align-items: flex-start; gap: 8px; font-size: 13px;
         color: var(--ink-2); margin-bottom: 8px; cursor: pointer; }
.radio input { margin-top: 4px; accent-color: var(--brand); }

/* ---------------------------------------------------------------- 提示 */

.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%);
  background: #17191C; color: #fff; font-size: 13px;
  padding: 10px 18px; border-radius: 8px; z-index: 80;
  box-shadow: var(--shadow-lg); max-width: 76vw;
  animation: pop .18s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translate(-50%, 8px); } }

@media (max-width: 860px) {
  .stats { display: none !important; }
  .fields { grid-template-columns: 1fr; }
  .drawer { width: 100%; }
}

/* ================================================================
   纯浏览器版增量
   ================================================================ */

/* 顶栏「本机解析」徽标——持续提示数据不出本机 */
.local-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 500;
  color: var(--ok); background: var(--ok-bg);
  padding: 3px 9px; border-radius: 20px;
  white-space: nowrap;
}
.local-badge::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--ok);
}

/* 口令门禁 */
.gate {
  position: fixed; inset: 0; z-index: 90;
  background: var(--bg);
  display: grid; place-items: center;
  padding: 24px;
}
.gate-card {
  width: 100%; max-width: 348px; text-align: center;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--shadow-lg);
  padding: 34px 28px 28px;
}
.gate-mark {
  width: 46px; height: 46px; border-radius: 12px; margin: 0 auto 16px;
  background: var(--brand); color: #fff;
  display: grid; place-items: center; font-size: 22px; font-weight: 600;
}
.gate-title { font-size: 16px; font-weight: 600; }
.gate-sub { font-size: 12.5px; color: var(--ink-3); margin-top: 6px; line-height: 1.7; }
.gate-form { margin-top: 22px; display: flex; flex-direction: column; gap: 10px; }
.gate-input {
  width: 100%; border: 1px solid var(--line); border-radius: var(--r-s);
  padding: 10px 13px; font-size: 14px; font-family: inherit; text-align: center;
  letter-spacing: .06em; background: var(--surface-2); color: var(--ink);
}
.gate-input:focus { outline: none; border-color: var(--brand); background: #fff;
                    box-shadow: 0 0 0 3px var(--brand-bg); }
.gate-err { font-size: 12.5px; color: var(--bad); min-height: 18px; }
.gate-note { font-size: 11.5px; color: var(--ink-4); margin-top: 18px; line-height: 1.7; }

/* 队列交接条（复制 / 下载） */
.handoff {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 20px; border-top: 1px solid var(--line-soft);
  background: var(--surface-2); font-size: 12.5px; color: var(--ink-2);
}
.handoff .spacer { flex: 1; }
.btn.sm { padding: 5px 11px; font-size: 12.5px; }

/* 解析中 */
.busy { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-3); }
.spin {
  width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--brand);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

