:root {
  --bg1: #f2f6fc;
  --bg2: #eaf4ff;
  --ink: #2b3445;
  --muted: #6b7c93;
  --blue: #4a9bf0;
  --blue-deep: #3d7fd6;
  --line: #e3ecf7;
  --card: #ffffff;
  --ok: #22a06b;
  --fail: #e0483f;
  --radius: 18px;
  --shadow: 0 8px 24px rgba(74, 134, 200, .12);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* hidden 属性优先于任何 display 声明 */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 50% -10%, #ffffff 0%, rgba(255, 255, 255, 0) 60%),
    linear-gradient(180deg, var(--bg1) 0%, var(--bg2) 100%);
  background-attachment: fixed;
  padding: 14px 12px calc(88px + env(safe-area-inset-bottom));
}

.app { max-width: 520px; margin: 0 auto; }

/* 顶栏 */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 4px 0;
}
.brand-mini { display: flex; align-items: center; gap: 8px; }
.shield {
  width: 30px; height: 30px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: #fff; box-shadow: var(--shadow);
}
.brand-text { font-size: 17px; font-weight: 600; letter-spacing: .3px; }
.report {
  color: var(--fail);
  font-size: 14px;
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(224, 72, 63, .08);
}

/* 功能按钮行 */
.toolrow {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 14px 0 4px;
}
.pill {
  border: none;
  background: #fff;
  color: var(--blue-deep);
  font-size: 15px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 14px;
  box-shadow: var(--shadow);
  cursor: pointer;
}
.pill.icon {
  width: 44px; padding: 0; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px; color: var(--blue-deep);
}
.pill:active { transform: translateY(1px); }

/* 标题 */
.hero {
  margin: 18px 0 20px;
  text-align: center;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: .5px;
}
.hero .grad {
  background: linear-gradient(92deg, #7fe0b6 0%, #58b6f5 55%, #4a9bf0 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero .dark { color: #2b3445; }

/* 拖拽区 */
.dropzone {
  border: 2px dashed #7db9f0;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .55);
  padding: 30px 16px;
  text-align: center;
  color: #5b7fa6;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s;
}
.dropzone:active { transform: scale(.995); }
.dropzone.dragover {
  background: rgba(74, 155, 240, .12);
  border-color: var(--blue-deep);
}
.dropzone .cam { line-height: 0; margin-bottom: 8px; }
.dropzone p { margin: 6px 0 2px; font-size: 16px; font-weight: 600; color: #3f82c9; }
.dropzone .hint { font-size: 12px; color: var(--muted); }

/* 面板 */
.board {
  background: var(--card);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 12px;
  margin-top: 18px;
}
.board-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #fff;
  border-radius: 16px;
}
.stats { display: flex; align-items: center; gap: 14px; padding-left: 4px; }
.stat { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; }
.stat i { line-height: 0; display: inline-flex; }
.stat b { font-weight: 700; }
.stat.ok b { color: var(--ok); }
.stat.fail b { color: var(--fail); }

.actions {
  display: inline-flex;
  gap: 2px;
  background: linear-gradient(180deg, #59a8f6, #3f8ee6);
  border-radius: 16px;
  padding: 5px;
}
.actions button {
  width: 42px; height: 36px;
  border: none;
  background: transparent;
  border-radius: 12px;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.actions button + button { box-shadow: inset 1px 0 0 rgba(255, 255, 255, .28); }
.actions button:active { background: rgba(255, 255, 255, .18); }

/* 列表 */
.list { margin-top: 12px; display: flex; flex-direction: column; gap: 12px; }
.empty {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  padding: 26px 10px 18px;
}

.card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px 10px 12px;
  background: #fff;
}
.card-head {
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: #3b4658;
  margin: 2px 0 10px;
  word-break: break-all;
}
.card-body { display: flex; gap: 10px; align-items: flex-start; }
.thumb {
  width: 62px; height: 62px; flex: 0 0 62px;
  border-radius: 10px;
  background: #f2f6fc;
  border: 1px solid var(--line);
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .placeholder { font-size: 11px; color: var(--muted); }

.fields { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.field { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.field .label {
  flex: 0 0 78px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: #4a86c8;
  background: #e8f2ff;
  border-radius: 8px;
  padding: 6px 4px;
}
.field .value {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  color: #56657c;
  background: #f4f8fd;
  border: none;
  border-radius: 8px;
  padding: 7px 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.side { display: flex; flex-direction: column; gap: 8px; }
.round {
  width: 38px; height: 38px; border-radius: 50%;
  border: none; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.round.copy { background: #5aa7f7; }
.round.del { background: #f0615b; }
.round:active { filter: brightness(.94); }
.round:disabled { opacity: .45; cursor: not-allowed; }

.badge {
  align-self: center;
  font-size: 11px;
  color: var(--muted);
  padding: 2px 0;
}
.card.pending { opacity: .85; }
.card.error { border-color: #f6cdca; background: #fff8f8; }
.card .err { color: var(--fail); font-size: 12px; text-align: center; padding: 4px 0 0; }

/* 底部保存 */
.savebar { display: flex; justify-content: center; margin: 22px 0 6px; }
.save {
  border: none;
  background: #f0f3f8;
  color: #7d889a;
  font-size: 16px;
  font-weight: 700;
  padding: 12px 52px;
  border-radius: 14px;
  box-shadow: 0 6px 16px rgba(74, 134, 200, .08);
  cursor: pointer;
}
.save.active { background: linear-gradient(180deg, #59a8f6, #3f8ee6); color: #fff; }

/* 悬浮菜单 */
.fab {
  position: fixed;
  right: 16px;
  bottom: calc(22px + env(safe-area-inset-bottom));
  width: 52px; height: 52px;
  border-radius: 16px;
  border: none;
  background: #fff;
  box-shadow: 0 10px 26px rgba(74, 134, 200, .22);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  z-index: 40;
}

/* 抽屉 */
.drawer, .modal {
  position: fixed; inset: 0;
  background: rgba(24, 33, 48, .35);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 60;
  padding: 12px;
}
.modal { align-items: center; }
.drawer-panel, .modal-panel {
  width: 100%;
  max-width: 520px;
  background: #fff;
  border-radius: 20px;
  padding: 16px;
  box-shadow: 0 18px 40px rgba(24, 33, 48, .25);
}
.drawer-panel h3, .modal-panel h3 { margin: 2px 4px 12px; font-size: 16px; }
.drawer-panel button {
  display: block; width: 100%;
  text-align: left;
  border: none;
  background: #f5f8fd;
  color: var(--ink);
  font-size: 15px;
  padding: 13px 14px;
  border-radius: 12px;
  margin-bottom: 8px;
  cursor: pointer;
}
.drawer-panel button.ghost { background: #fff; color: var(--muted); text-align: center; }
.drawer-panel button:active { background: #e9f1fb; }

.modal-body { font-size: 14px; color: #4d5a6e; line-height: 1.7; margin-bottom: 14px; }
.modal-body code {
  background: #f0f4fa;
  border-radius: 6px;
  padding: 1px 5px;
  font-size: 12.5px;
}
.modal-panel .save { display: block; margin: 0 auto; }

/* 提示 */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(90px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: rgba(24, 33, 48, .9);
  color: #fff;
  font-size: 13px;
  padding: 9px 16px;
  border-radius: 22px;
  z-index: 80;
  max-width: 88vw;
  text-align: center;
}

@media (max-width: 380px) {
  .hero { font-size: 28px; }
  .field .label { flex-basis: 66px; font-size: 11px; }
  .thumb { width: 54px; height: 54px; flex-basis: 54px; }
}
