:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --line: #e3e7ed;
  --text: #1f2733;
  --muted: #7a8598;
  --accent: #2b6cff;
  --accent-dark: #1f52c9;
  --ok: #17914f;
  --warn: #b26b00;
  --err: #d13b3b;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.small { font-size: 13px; }
.muted { color: var(--muted); }
.total { margin: 12px 0 0; }

.view[hidden] { display: none; }
.view-center {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

/* ---------------------------------------------------------- 卡片 */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 18px;
}
.card-narrow { width: 100%; max-width: 360px; }
.title { margin: 0 0 4px; font-size: 20px; }
.card-title { margin: 0 0 16px; font-size: 16px; }

/* ---------------------------------------------------------- 表单 */

.label {
  display: block;
  margin: 18px 0 6px;
  font-weight: 600;
  font-size: 14px;
}
.label:first-of-type { margin-top: 0; }
.label-sub { font-weight: 400; color: var(--muted); margin-left: 6px; font-size: 12px; }

.hint {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}
.hint b { color: var(--text); font-weight: 600; }

kbd {
  display: inline-block;
  padding: 0 5px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: #fafbfc;
  font: 12px/1.6 ui-monospace, monospace;
  color: var(--text);
}

.input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(43, 108, 255, .13);
}
.input-area {
  resize: vertical;
  min-height: 74px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13.5px;
  line-height: 1.6;
  word-break: break-all;
}
.input-sm { padding: 6px 10px; font-size: 13px; width: auto; }

/* ---------------------------------------------------------- 拖放区 */

.dropzone {
  position: relative;
  border-radius: 10px;
  transition: box-shadow .12s, background .12s;
}
.dropzone.dragover {
  background: rgba(43, 108, 255, .06);
  box-shadow: 0 0 0 2px var(--accent);
}
.dropzone.dragover::after {
  content: "松手即可识别二维码";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(255, 255, 255, .9);
  color: var(--accent);
  font-weight: 600;
  pointer-events: none;
}

.row-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}
.row-inline .msg { flex: 1; margin: 0; }

/* 视觉隐藏但保留在无障碍树和自动化工具中 */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------------------------------------------------------- 消息条 */

.msg {
  padding: 7px 11px;
  border-radius: 7px;
  font-size: 13px;
  line-height: 1.6;
  word-break: break-all;
  background: #eef3ff;
  color: #2c4a86;
}
.msg[hidden] { display: none; }
.msg-ok { background: #e8f7ee; color: var(--ok); }
.msg-err { background: #fdecec; color: var(--err); }
.msg-warn { background: #fdf4e3; color: var(--warn); }
.msg-busy { background: #eef3ff; color: #2c4a86; }

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

.btn {
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: background .12s, border-color .12s, opacity .12s;
  white-space: nowrap;
}
.btn:hover { background: #f7f8fa; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }

.btn-ghost { background: transparent; }
.btn-danger { color: var(--err); border-color: #f0cccc; }
.btn-danger:hover { background: #fdf0f0; }

.btn-sm { padding: 5px 11px; font-size: 13px; }
.btn-block { width: 100%; margin-top: 14px; }

.actions { display: flex; align-items: center; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.actions .msg { margin: 0; }

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.topbar .title { margin: 0; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 24px 20px 60px; }

/* ---------------------------------------------------------- 结果卡 */

.card-result { border-color: #b9f0cf; background: #f4fdf8; }
.result-body { display: flex; gap: 20px; align-items: center; }
.result-info { flex: 1; min-width: 0; }
.result-label { font-size: 13px; color: var(--ok); font-weight: 600; }
.result-url {
  font-size: 20px;
  font-weight: 600;
  word-break: break-all;
  margin: 4px 0 2px;
  color: #0d6b3a;
}
.result-qr {
  border-radius: 8px;
  background: #fff;
  padding: 6px;
  border: 1px solid var(--line);
  flex-shrink: 0;
}

/* ---------------------------------------------------------- 列表 */

.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.list-head .card-title { margin: 0; }
.list-tools { display: flex; gap: 8px; }

.table-scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td {
  text-align: left;
  padding: 10px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.table th {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
  background: #fafbfc;
}
.table tbody tr:hover { background: #fafbfc; }
.table tbody tr.is-off { opacity: .5; }
.th-act { width: 1%; white-space: nowrap; }

.cell-code { white-space: nowrap; }
.cell-code a { color: var(--accent); text-decoration: none; font-weight: 600; }
.cell-code a:hover { text-decoration: underline; }
.cell-target { max-width: 260px; }
.cell-target .url { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-remark { max-width: 220px; }
.cell-remark .txt { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}
.badge-on { background: #e8f7ee; color: var(--ok); }
.badge-off { background: #f0f2f5; color: var(--muted); }

.row-act { display: flex; gap: 6px; }
.row-act .btn { padding: 4px 9px; font-size: 12px; }

.edit-cell { display: flex; flex-direction: column; gap: 4px; }
.edit-actions { display: flex; gap: 6px; margin-top: 8px; }

.empty { text-align: center; color: var(--muted); padding: 28px 0; margin: 0; }

/* ---------------------------------------------------------- Toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: #1f2733;
  color: #fff;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 14px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .2);
  z-index: 99;
  max-width: 90vw;
}
.toast[hidden] { display: none; }

/* ---------------------------------------------------------- 二维码弹窗 */

.modal { position: fixed; inset: 0; z-index: 100; display: flex; }
.modal[hidden] { display: none; }
.modal-mask { position: absolute; inset: 0; background: rgba(20, 26, 36, .55); }

.modal-box {
  position: relative;
  margin: auto;
  background: #fff;
  border-radius: 12px;
  padding: 26px 28px 22px;
  width: min(380px, calc(100vw - 32px));
  text-align: center;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .28);
}

.modal-close {
  position: absolute;
  top: 8px; right: 12px;
  border: 0; background: transparent;
  font-size: 26px; line-height: 1;
  color: #a8b0bd; cursor: pointer;
  padding: 4px 8px;
}
.modal-close:hover { color: var(--text); }

.modal-label { font-size: 13px; color: var(--muted); font-weight: 600; }

.modal-qr {
  display: block;
  margin: 14px auto 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 8px;
}

.modal-url {
  font-size: 15px;
  font-weight: 600;
  word-break: break-all;
  margin-bottom: 2px;
}
.modal-actions {
  display: flex; gap: 8px; justify-content: center;
  margin-top: 16px; flex-wrap: wrap;
}
.modal-actions .btn { text-decoration: none; display: inline-block; }
.modal-hint {
  margin: 14px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

@media (max-width: 640px) {
  .result-body { flex-direction: column; align-items: flex-start; }
  .cell-target, .cell-remark { max-width: 150px; }
  .topbar { padding: 12px 16px; }
  .wrap { padding: 16px 12px 40px; }
}
