/* MT 扫码登录控制台样式（从 index.html 拆出） */
  * { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", "Microsoft YaHei", sans-serif;
    background: #f2f3f5; color: #191919; min-height: 100vh; min-height: 100dvh;
    display: flex; flex-direction: column; align-items: center;
    padding: calc(24px + env(safe-area-inset-top)) 16px calc(48px + env(safe-area-inset-bottom)) 16px;
    overflow-x: hidden;
  }
  .page { width: 100%; max-width: 480px; }
  .hero { text-align: center; margin-bottom: 20px; }
  .hero h1 { font-size: 20px; font-weight: 600; letter-spacing: .5px; }
  .hero p { font-size: 13px; color: #888; margin-top: 6px; }
  .card {
    background: #fff; border-radius: 12px; padding: 20px 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,.05); margin-bottom: 14px;
  }
  .field { margin-bottom: 14px; }
  .field:last-child { margin-bottom: 0; }
  .field label { display: block; font-size: 13px; color: #555; margin-bottom: 6px; }
  .field label .opt { color: #aaa; font-size: 12px; }
  .field input {
    width: 100%; height: 42px; border: 1px solid #e2e2e2; border-radius: 8px;
    padding: 0 12px; font-size: 16px; outline: none; background: #fafafa;
    transition: border-color .15s, background .15s;
  }
  .field input:focus { border-color: #07c160; background: #fff; }
  .hint { font-size: 12px; color: #aaa; margin-top: 5px; line-height: 1.5; }
  .btn {
    width: 100%; height: 46px; border: none; border-radius: 10px;
    background: #07c160; color: #fff; font-size: 16px; font-weight: 600;
    cursor: pointer; transition: opacity .15s;
  }
  .btn:active { opacity: .8; }
  .btn:disabled { background: #c8e8d6; cursor: not-allowed; }
  .btn.gray { background: #ededed; color: #333; margin-top: 10px; }
  /* 破坏性操作：与常规操作在视觉上明确区分，避免误点 */
  .btn.danger { background: #fdecec; color: #d54941; border: 1px solid #f5c2c0; }
  .btn.danger:disabled { background: #f3f3f3; color: #bbb; border-color: #e8e8e8; }
  /* 必填标记：红点前缀，与可选字段明确区分 */
  .req { color: #d54941; font-weight: 700; margin-right: 3px; }
  /* ── 门禁屏 ── */
  #gate {
    position: fixed; inset: 0; z-index: 100; background: #f2f3f5;
    display: flex; align-items: safe center; justify-content: safe center;
    padding: calc(20px + env(safe-area-inset-top)) calc(20px + env(safe-area-inset-right))
             calc(20px + env(safe-area-inset-bottom)) calc(20px + env(safe-area-inset-left));
    overflow-y: auto; -webkit-overflow-scrolling: touch;
    transition: opacity .25s;
  }
  /* 只设 opacity:0 时元素仍在无障碍树中，密码输入框还能被 Tab 聚焦 ——
     键盘用户会把内容打进一个看不见的框里。淡出结束后用 visibility 彻底移出。 */
  #gate.hide {
    opacity: 0; pointer-events: none; visibility: hidden;
    transition: opacity .25s, visibility 0s .25s;
  }
  .gate-card {
    width: 100%; max-width: 360px; background: #fff; border-radius: 14px;
    padding: 32px 24px; box-shadow: 0 4px 24px rgba(0,0,0,.08); text-align: center;
  }
  .gate-icon { font-size: 40px; line-height: 1; margin-bottom: 12px; }
  .gate-card h2 { font-size: 18px; font-weight: 600; margin-bottom: 6px; }
  .gate-card p { font-size: 13px; color: #999; margin-bottom: 18px; }
  .gate-err { font-size: 13px; color: #fa5151; min-height: 18px; margin-bottom: 8px; }
  .gate-card input {
    width: 100%; height: 44px; border: 1px solid #e2e2e2; border-radius: 8px;
    padding: 0 12px; font-size: 16px; outline: none; background: #fafafa;
    text-align: center; letter-spacing: 2px; margin-bottom: 14px;
  }
  .gate-card input:focus { border-color: #07c160; background: #fff; }
  /* ── 模式切换 ── */
  .tabs { display: flex; padding: 6px; gap: 6px; background: #ededed; border-radius: 10px; margin-bottom: 14px; }
  /* 作用域必须限定在 .tabs 内：此前裸 .tab 会把 flex:1 传播给筛选栏的 .tab，
     宽屏下四个筛选项被拉成等宽大块（1440px 时每块 217px），视觉严重失衡。 */
  .tabs .tab {
    flex: 1; height: 38px; border: none; border-radius: 8px; background: transparent;
    font-size: 14px; color: #666; cursor: pointer; transition: all .15s;
  }
  .tabs .tab.on { background: #fff; color: #191919; font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
  /* ── 账号 chip ── */
  /* ── 账号状态区：总览条 / 筛选栏 / 行式列表 / 工具栏 ──
     设计取舍：18 个账号时 chip 网格无法沿列扫读（状态标签随备注长短漂移），
     改为行式列表；操作从 4 个全宽按钮收敛为一行工具栏。 */
  .ov { display: flex; align-items: center; gap: 12px; padding: 12px 2px 10px; flex-wrap: wrap; }
  .ov-title { font-size: 14px; font-weight: 600; color: #333; }
  .pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px;
          padding: 3px 9px; border-radius: 20px; background: #f5f5f5; color: #666; }
  .pill b { font-weight: 600; }
  .pill.ok { background: #e8f8ef; color: #0a7d43; }
  .pill.exp { background: #fdecec; color: #c0392b; }
  .pill.sh { background: #fff7e8; color: #b7791f; }
  .pill.err { background: #fff1e8; color: #c05621; }
  .ov-time { margin-left: auto; font-size: 12px; color: #aaa; }

  .list-bar { display: flex; align-items: center; gap: 6px; padding: 6px 0 8px;
              border-bottom: 1px solid #f0f0f0; flex-wrap: wrap; }
  .list-bar .tab { flex: 0 0 auto; font-size: 13px; padding: 5px 10px;
                   border-radius: 8px; cursor: pointer; color: #666; }
  .list-bar .tab.on { background: #f2f3f5; font-weight: 600; color: #111; }
  .list-bar .tab .n { color: #aaa; font-weight: 400; margin-left: 4px; font-size: 12px; }
  .list-bar .spacer { margin-left: auto; }
  .list-bar .link { font-size: 12px; color: #888; cursor: pointer; padding: 4px 2px; }
  .list-bar .link:hover { color: #07c160; }

  .acc-list { margin: 2px 0 0; max-height: 360px; overflow-y: auto; }
  .acc-row { display: grid; grid-template-columns: 10px 1fr 44px 78px 46px;
             align-items: center; gap: 10px; padding: 9px 4px;
             border-bottom: 1px solid #f5f5f5; font-size: 13px;
             cursor: pointer; user-select: none; }
  .acc-row:hover { background: #fafafa; }
  .acc-row.sel { background: #e8f8ef; }
  .acc-row.hide { display: none; }
  .acc-row .r-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
                     font-weight: 500; color: #333; }
  .acc-row .r-idx { color: #aaa; font-size: 12px; }
  .tag { font-size: 11px; padding: 2px 7px; border-radius: 20px; text-align: center;
         white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tag.t-ok { background: #e8f8ef; color: #0a7d43; }
  .tag.t-shallow { background: #fff7e8; color: #b7791f; }
  .tag.t-expired { background: #fdecec; color: #c0392b; }
  .tag.t-failed { background: #fff1e8; color: #c05621; }
  .tag.t-unknown { background: #f2f2f2; color: #999; }
  .mini { font-size: 11px; padding: 3px 8px; border: 1px solid #ddd; background: #fff;
          border-radius: 6px; cursor: pointer; color: #666; }
  .mini:hover { border-color: #07c160; color: #07c160; }
  .list-empty { font-size: 13px; color: #aaa; padding: 14px 4px; }

  /* 状态色点：绿=有效 红=失效 橙=失败 灰=未知 */
  .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
  .dot.ok { background: #07c160; }
  .dot.expired { background: #fa5151; }
  .dot.failed { background: #ff976a; }
  .dot.unknown { background: #c8c8c8; }

  .status-tip { font-size: 12px; color: #aaa; margin: 8px 0 0; line-height: 1.6; }

  /* 工具栏：主操作在左，破坏性操作右对齐并弱化为文字按钮 */
  .toolbar-row { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
  .toolbar-danger { display: flex; justify-content: flex-end; margin-top: 10px;
                    padding-top: 8px; border-top: 1px solid #f2f2f2; }
  .btn.sm { width: auto; height: 38px; padding: 0 16px; font-size: 14px; border-radius: 9px; }
  .btn.ghost { background: #fff; color: #444; border: 1px solid #ddd; font-weight: 500; }
  .btn.ghost:disabled { background: #f7f7f7; color: #bbb; border-color: #eee; }
  /* 破坏性操作：默认弱化（文字按钮），hover 才显红，避免与主操作争夺注意力 */
  .link-danger {
    background: none; border: none; color: #999; font-size: 13px;
    padding: 8px 4px; cursor: pointer; font-weight: 500;
  }
  .link-danger:hover:not(:disabled) { color: #d54941; text-decoration: underline; }
  .link-danger:disabled { color: #ccc; cursor: not-allowed; }
  .alert {
    display: none; border-radius: 8px; padding: 10px 12px; font-size: 13px;
    line-height: 1.5; margin-bottom: 14px;
  }
  .alert.show { display: block; }
  .alert.err { background: #fdecec; color: #d54941; }
  .alert.warn { background: #fff7e8; color: #b26a00; }
  .alert.ok { background: #e8f8ef; color: #0a7d43; }
  #cards { display: none; }
  #cards.show { display: block; }
  .acc-card { margin-bottom: 14px; overflow: hidden; }
  .acc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
  .acc-title { font-size: 15px; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
  .acc-name { font-size: 12px; color: #888; font-weight: 400; margin-left: 6px; }
  .badge {
    font-size: 12px; padding: 3px 10px; border-radius: 20px; color: #fff; white-space: nowrap; flex: none;
  }
  .badge.waiting { background: #1989fa; }
  .badge.success { background: #07c160; }
  .badge.failed { background: #fa5151; }
  .badge.timeout { background: #ff976a; }
  .qr-wrap { text-align: center; padding: 16px 0 6px; }
  .qr-wrap img {
    width: 240px; max-width: min(240px, 62vw); height: auto; aspect-ratio: 1 / 1;
    border-radius: 8px; background: #fff; border: 1px solid #eee; display: inline-block;
  }
  .qr-none {
    width: min(240px, 62vw); height: auto; aspect-ratio: 1 / 1; min-height: 160px; margin: 0 auto; border-radius: 8px;
    border: 1px dashed #ddd; color: #aaa; font-size: 13px;
    display: flex; align-items: center; justify-content: center; text-align: center; padding: 12px;
  }
  .acc-msg { text-align: center; font-size: 13px; color: #666; padding: 8px 0 2px; }
  .acc-msg.ok { color: #0a7d43; }
  .acc-msg.bad { color: #d54941; }
  .summary { display: none; text-align: center; font-size: 14px; color: #333; padding: 6px 0 2px; }
  .summary.show { display: block; }
  /* 退出访问：右下角悬浮按钮（FAB），滚动时常驻可见、中性不抢眼 */
  /* 页脚的低干扰文字链接：替代原先右下角浮动按钮。
     浮动按钮会压住最后一行操作按钮（实测 375 下与「领券」相交、误触即登出），
     而它的唯一用途是「清掉本地口令以重新输密码」，用一行小字即可胜任。 */
  .link-quiet {
    display: inline-block; margin-top: 8px; font-size: 12px; color: #b5b5b5;
    text-decoration: none; padding: 2px 4px; cursor: pointer;
  }
  .link-quiet:hover { color: #07c160; text-decoration: underline; }
  .footer { margin-top: 14px; text-align: center; font-size: 12px; color: #b5b5b5; line-height: 1.7; }
  /* ══ 响应式：小屏 / 横屏短视口 / 桌面放宽 ══ */
  /* 窄屏（常见手机 375/390）：
     1) 徽章缩小间距与内边距，争取 4 个同排；时间独占一行，避免与「异常 N」混排被误读
     2) 主操作按钮两行均分，末个占满整行，避免最后一行只剩一个左对齐的孤儿按钮 */
  @media (max-width: 420px) {
    .ov { gap: 8px; }
    .ov .pill { padding: 2px 8px; font-size: 12px; }
    .ov-time { flex-basis: 100%; margin-left: 0; font-size: 11px; }
    .toolbar-row .btn.sm { flex: 1 1 calc(50% - 4px); padding: 0 10px; }
    .toolbar-row .btn.sm:last-child { flex-basis: 100%; }
  }
  @media (max-width: 360px) {
    /* 超窄屏：主操作按钮均分整行，避免最后一行只剩一个窄按钮 */
    .toolbar-row .btn.sm { flex: 1 1 calc(50% - 4px); padding: 0 10px; }
  }
  @media (max-width: 380px) {
    body { padding-left: 12px; padding-right: 12px; }
    .hero h1 { font-size: 18px; }
    .card { padding: 16px 12px; }
    .field input { height: 40px; }
    .gate-card { padding: 24px 18px; }
    .btn { height: 44px; }
    .qr-wrap img, .qr-none { max-width: min(200px, 60vw); }
  }
  @media (max-height: 460px) and (orientation: landscape) {
    body { padding-top: 12px; padding-bottom: 16px; }
    .hero { margin-bottom: 10px; }
    .hero h1 { font-size: 17px; }
    .card { padding: 12px 16px; margin-bottom: 10px; }
    .field { margin-bottom: 10px; }
    .tabs { margin-bottom: 10px; }
    .gate-card { padding: 18px 24px; }
    .gate-icon { font-size: 30px; margin-bottom: 8px; }
    .qr-wrap { padding: 8px 0 4px; }
    .qr-wrap img, .qr-none { width: 180px; max-width: 42vh; }
  }
  /* ── 平板：放宽单列，容纳更长的备注与更宽松的行距 ── */
  @media (min-width: 600px) {
    .page { max-width: 640px; }
    .acc-list { max-height: 440px; }
    .gate-card { padding: 32px 28px; }
    .card { padding: 22px 20px; }
  }
  /* ── 小桌面：继续放宽，列表可视区更高，减少滚动 ── */
  @media (min-width: 900px) {
    .page { max-width: 800px; }
    .acc-list { max-height: 520px; }
    .hero h1 { font-size: 22px; }
    .hero p { font-size: 14px; }
    /* 主操作给最小宽度，避免按钮文字长短导致排列跳动 */
    .toolbar-row .btn.sm { min-width: 124px; }
  }
  /* ── 大桌面：账号列表转双列，把横向空间用起来 ──
     1280 以下的窗口不启用，避免每列过窄导致备注被截断。
     双列后行按「行优先」排列（1,2 / 3,4 …），阅读顺序仍然自然。 */
  @media (min-width: 1280px) {
    .page { max-width: 1000px; }
    .acc-list {
      display: grid; grid-template-columns: 1fr 1fr;
      column-gap: 24px; align-content: start;
    }
    .acc-list .list-empty { grid-column: 1 / -1; }
    .acc-list { max-height: 560px; }
  }
