:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --panel-2: #f7f8fa;
  --border: #e6e8ec;
  --text: #2b2d31;
  --muted: #8a909a;
  --ink: #38383a;
  --primary: #ff6b35;
  --primary-2: #ff8857;
  --green: #2f9e44;
  --green-bg: #ebfbee;
  --red: #e03131;
  --red-bg: #fff0f0;
  --amber: #b8860b;
  --amber-bg: #fff9e6;
  --shadow: 0 2px 12px rgba(20, 24, 40, .06);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
#app { max-width: 520px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }

.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 20px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.logo { height: 26px; width: auto; display: block; }
.topbar-sub {
  font-size: 14px; color: var(--muted); font-weight: 600;
  padding-left: 14px; border-left: 1px solid var(--border); line-height: 1;
}

.tabs { display: flex; border-bottom: 1px solid var(--border); background: var(--panel); }
.tab {
  flex: 1; padding: 14px 0; font-size: 15px; font-weight: 600;
  background: none; border: none; color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent; transition: all .15s ease;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.content { flex: 1; padding: 18px 16px 40px; }
.view { display: none; }
.view.active { display: block; }

.notice {
  background: #fff4ee; border: 1px solid #ffd9c7; color: #a8431a;
  border-radius: 12px; padding: 12px 14px; font-size: 13px; line-height: 1.7;
  margin-bottom: 16px;
}

.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 16px; padding: 18px; box-shadow: var(--shadow);
}
.field { display: block; margin-bottom: 16px; }
.label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 7px; font-weight: 600; }
.label i { color: var(--primary); font-style: normal; }
.field input, .field textarea {
  width: 100%; padding: 12px 14px; font-size: 15px;
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text); outline: none;
  font-family: inherit; resize: vertical;
}
.field input::placeholder, .field textarea::placeholder { color: #b3b8c0; }
.field input:focus, .field textarea:focus { border-color: var(--primary); background: #fff; }

[hidden] { display: none !important; }
.hint { font-size: 12px; color: var(--muted); margin: 8px 2px 0; }

/* SN 行：文本框 + 上传图标同一行 */
.sn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; }
.sn-row textarea { flex: 1 1 180px; min-height: 84px; margin: 0; }
.sn-row .multi { margin-top: 0; flex: 0 0 auto; }

/* 多图上传 */
.multi { margin-top: 10px; }
.thumbs { display: flex; flex-wrap: wrap; gap: 10px; }
.thumb {
  position: relative; width: 84px; height: 84px; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--border); background: #f0f1f3;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-remove {
  position: absolute; top: 3px; right: 3px; width: 20px; height: 20px;
  border: none; border-radius: 50%; background: rgba(0, 0, 0, .55); color: #fff;
  font-size: 15px; line-height: 20px; cursor: pointer; padding: 0; text-align: center;
}
.add-tile {
  width: 84px; height: 84px; border-radius: 10px; cursor: pointer;
  border: 1.5px dashed var(--border); background: var(--panel-2);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  color: var(--muted); font-size: 11px; line-height: 1.3; text-align: center; padding: 4px;
  transition: border-color .15s ease, color .15s ease; font-family: inherit;
}
.add-tile:hover { border-color: var(--primary); color: var(--primary); }
.add-tile .add-icon { font-size: 22px; }

.btn {
  border: 1px solid var(--border); border-radius: 12px;
  padding: 13px 16px; font-size: 16px; cursor: pointer;
  background: var(--panel-2); color: var(--text);
  transition: all .15s ease; font-weight: 600;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  border-color: transparent; color: #fff;
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.msg { margin: 14px 0 0; padding: 11px 14px; border-radius: 10px; font-size: 14px; display: none; }
.msg.show { display: block; }
.msg.ok { background: var(--green-bg); color: var(--green); border: 1px solid #c3e6cb; }
.msg.err { background: var(--red-bg); color: var(--red); border: 1px solid #f5c2c2; }

/* 查询结果 */
#query-results { margin-top: 16px; display: flex; flex-direction: column; gap: 14px; }
.result {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 14px; padding: 16px; box-shadow: var(--shadow);
}
.result-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 10px; }
.result-store { font-weight: 700; font-size: 15px; color: var(--text); }
.badge { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.badge.pending { background: var(--amber-bg); color: var(--amber); }
.badge.granted { background: var(--green-bg); color: var(--green); }
.badge.rejected { background: var(--red-bg); color: var(--red); }
.result-row { display: flex; gap: 8px; font-size: 13px; margin-top: 6px; }
.result-row .k { color: var(--muted); flex-shrink: 0; min-width: 70px; }
.result-row .v { color: var(--text); word-break: break-all; }

.card-box {
  margin-top: 14px; padding: 14px; border-radius: 12px;
  background: linear-gradient(135deg, #fff4ee, #fef0f6);
  border: 1px solid #ffd9c7;
}
.card-box .title { font-size: 13px; color: var(--primary); font-weight: 700; margin-bottom: 10px; }
.card-line { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.card-line .k { color: var(--muted); font-size: 13px; min-width: 56px; }
.card-line .code {
  flex: 1; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 15px; letter-spacing: .5px; word-break: break-all; color: var(--text);
  background: #fff; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border);
}
.copy-btn {
  border: 1px solid var(--border); background: #fff; color: var(--text);
  border-radius: 8px; padding: 8px 12px; font-size: 13px; cursor: pointer; flex-shrink: 0;
}
.copy-btn:hover { border-color: var(--primary); color: var(--primary); }

.empty { text-align: center; color: var(--muted); font-size: 14px; padding: 30px 0; }
