:root {
  --ink: #1e1e33;
  --ink-soft: #33334d;
  --line: #e4e7ee;
  --text: #14161f;
  --muted: #6b7280;
  --faint: #9aa1ae;
  --bg: #eef0f4;
  --card: #ffffff;
  --danger: #d93a3a;
  --ok: #12805c;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

a, button, label, .slot, .file-pick {
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

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

.wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  gap: 22px;
}

.wrap.wide { justify-content: flex-start; padding-top: 40px; }

.card {
  width: 100%;
  max-width: 600px;
  background: var(--card);
  border-radius: 14px;
  box-shadow: 0 12px 34px rgba(24, 28, 45, 0.10);
}

.card-head { border-radius: 14px 14px 0 0; }

@media (max-width: 640px) {
  .sticky-btn {
    position: sticky;
    bottom: 10px;
    z-index: 6;
    box-shadow: 0 10px 22px rgba(24, 28, 45, 0.24);
  }
}

.card.wide { max-width: 1200px; }

.card-head {
  background: var(--ink);
  padding: 34px 28px 30px;
  text-align: center;
  color: #fff;
}

.head-icon {
  width: 62px;
  height: 62px;
  margin: 0 auto 16px;
  border-radius: 14px;
  background: #2c2c46;
  display: flex;
  align-items: center;
  justify-content: center;
}

.head-icon svg { width: 38px; height: 38px; }

.card-title {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 2px;
}

.card-sub {
  margin: 10px 0 0;
  font-size: 14px;
  color: #a4aabb;
  letter-spacing: 0.5px;
}

.card-body { padding: 26px 30px 28px; }

.field { margin-bottom: 18px; }

.field label {
  display: block;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 9px;
  color: #2b2f3a;
}

input:not([type="file"]):not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]) {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  font-size: 16px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}

input:focus {
  border-color: #4c4c74;
  box-shadow: 0 0 0 3px rgba(76, 76, 116, 0.12);
}

input::placeholder { color: #b7bdc9; }

.optional {
  font-weight: 400;
  color: var(--faint);
  font-size: 13px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 520px) {
  .field-row { grid-template-columns: 1fr; gap: 0; }
}

select {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  font-size: 16px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  font-family: inherit;
}

select:focus { border-color: #4c4c74; box-shadow: 0 0 0 3px rgba(76, 76, 116, 0.12); }

.head-user {
  margin-top: 14px;
  font-size: 13px;
  color: #a4aabb;
}

.head-user b { color: #fff; font-weight: 600; }

.head-user button {
  margin-left: 10px;
  background: transparent;
  border: 1px solid #45456a;
  color: #cfd3e0;
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
}

.head-user button:hover { border-color: #7d7dad; color: #fff; }

.banner {
  margin: 0 0 16px;
  padding: 11px 14px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.6;
  border: 1px solid transparent;
}

.banner.ok { background: #e7f6ef; color: var(--ok); border-color: #c4e7d9; }
.banner.warn { background: #fdf3e0; color: #96650c; border-color: #f3e2c2; }

.existing-photos {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 14px;
}

.existing-thumb {
  position: relative;
  display: block;
  width: 76px;
  height: 76px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #f5f6f9;
}

.existing-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: blur(24px);
  transform: scale(1.18);
}

.field-hint {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

.btn-row {
  display: flex;
  gap: 10px;
}

.btn-row .btn { margin-top: 0; }

.btn {
  width: 100%;
  height: 52px;
  margin-top: 6px;
  border: 0;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 2px;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, opacity .15s;
}

.btn:hover:not(:disabled) { background: #2d2d4d; }

.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn.ghost {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  font-weight: 600;
  letter-spacing: 0;
  height: 42px;
  font-size: 15px;
}

.btn.ghost:hover:not(:disabled) { background: #f6f7fa; }

.btn.small {
  width: auto;
  height: 38px;
  padding: 0 16px;
  font-size: 14px;
  letter-spacing: 0;
  margin: 0;
}

.alert {
  margin: 16px 0 0;
  padding: 11px 14px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.5;
  background: #fdecec;
  color: #a52626;
}

.alert.ok { background: #e7f6ef; color: var(--ok); }

.hint {
  margin: 16px 0 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

.notice {
  margin: 12px 0 0;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
  font-size: 12px;
  color: var(--faint);
  line-height: 1.7;
}

.section-title {
  margin: 22px 0 14px;
  font-size: 16px;
  font-weight: 600;
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

@media (max-width: 640px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
  .card-body { padding: 22px 18px 24px; }
  .card-title { font-size: 24px; }
  .wrap.wide { padding-top: 20px; }
}

.slot {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
  background: #f5f6f9;
  border: 1px solid var(--line);
  cursor: pointer;
}

.slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: blur(24px);
  transform: scale(1.18);
}

.hide-cover {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: rgba(255, 255, 255, .3);
  color: #4b5262;
  font-size: 12px;
  letter-spacing: .5px;
  pointer-events: none;
}

.hide-cover .lock {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  background: #6b7280;
  position: relative;
  display: block;
}

.hide-cover .lock::before {
  content: "";
  position: absolute;
  left: 2.5px;
  top: -6px;
  width: 11px;
  height: 9px;
  border: 2px solid #6b7280;
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
}

.slot .del, .slot .tag { z-index: 2; }

.slot.add {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #a9b0bd;
  font-size: 30px;
  border-style: dashed;
  transition: color .15s, border-color .15s;
}

.slot.add:hover { color: var(--ink); border-color: #b9bed0; }

.slot .tag {
  position: absolute;
  left: 6px;
  bottom: 6px;
  background: rgba(20, 22, 31, .68);
  color: #fff;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
}

.slot .del {
  position: absolute;
  right: 5px;
  top: 5px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 0;
  background: rgba(20, 22, 31, .68);
  color: #fff;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}

.slot .del:hover { background: var(--danger); }

.counter {
  margin: 14px 0 0;
  font-size: 14px;
  color: var(--muted);
}

.counter b { color: var(--ink); }

/* ---------- 记录 / 后台 ---------- */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}

.toolbar .grow { flex: 1; min-width: 180px; }

.record {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 12px;
  background: #fcfcfe;
}

.record-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  font-size: 14px;
  color: var(--muted);
}

.record-head .phone {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.5px;
}

.record-head .spacer { flex: 1; }

.record-photos {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.record-photos a {
  display: block;
  width: 84px;
  height: 84px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.record-photos img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

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

.login-box { max-width: 420px; margin: 0 auto; }

/* ---------- 大图查看 ---------- */

.viewer {
  position: fixed;
  inset: 0;
  background: rgba(12, 14, 24, .88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 40;
}

.viewer img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
}

.viewer .close {
  position: absolute;
  top: 18px;
  right: 22px;
  color: #fff;
  font-size: 26px;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.loading {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 8px;
  border: 2px solid rgba(255, 255, 255, .4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: -2px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 后台：统计卡片 ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.stat {
  background: #f7f8fb;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
}

.stat b {
  display: block;
  font-size: 22px;
  line-height: 1.25;
  color: var(--ink);
  letter-spacing: 0.5px;
}

.stat span {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}

.stat.accent b { color: #b06a06; }
.stat.good b { color: var(--ok); }

/* ---------- 后台：订单表格 ---------- */

.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }

table.orders {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 990px;
}

table.orders th {
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  background: #f7f8fb;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

table.orders td {
  padding: 9px 10px;
  border-bottom: 1px solid #eef0f5;
  vertical-align: middle;
}

table.orders tr:last-child td { border-bottom: 0; }

table.orders tbody tr:hover { background: #fafbfe; }

.cell-main {
  font-size: 14px;
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
}

.phone { font-size: 15px; letter-spacing: 0.4px; }

.pw {
  font-family: Consolas, "Courier New", monospace;
  font-size: 14px;
  color: #16324f;
  white-space: nowrap;
}

.campus-chip {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  background: #eaeefb;
  color: #3d4a80;
  font-size: 13px;
  white-space: nowrap;
}

.cell-sub {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--faint);
  font-weight: 400;
}

.mini-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  margin-left: 6px;
  white-space: nowrap;
}

.mini-btn:hover { border-color: #b9bed0; color: var(--ink); }
.mini-btn.active { background: #e7f6ef; border-color: #bfe4d5; color: var(--ok); }

.mini-btn.danger {
  border-color: #f0cccc;
  color: #b83a3a;
}

.mini-btn.danger:hover {
  border-color: #d93a3a;
  background: #fdecec;
  color: #a52626;
}

.mini-btn.danger:disabled { opacity: .6; cursor: not-allowed; }

.inline-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.inline-cell .mini-btn { margin-left: 0; }

.mini-select {
  height: 38px;
  min-width: 122px;
  width: auto;
  padding: 0 10px;
  font-size: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-family: inherit;
}

.actions { white-space: nowrap; }

.read-chip {
  border: 1px solid #c9dbfb;
  background: #eaf1fe;
  color: #1f5fd0;
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  margin-right: 6px;
  white-space: nowrap;
}

.read-chip.read {
  border-color: var(--line);
  background: #f5f6f9;
  color: var(--faint);
}

.unread-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2f7cf6;
  display: inline-block;
  flex: 0 0 auto;
  box-shadow: 0 0 0 3px rgba(47, 124, 246, .16);
}

table.orders tr.unread td:first-child { box-shadow: inset 3px 0 0 #2f7cf6; }

.edited-chip {
  margin-left: 8px;
  padding: 2px 7px;
  border-radius: 20px;
  background: #eef0f6;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
}

.stat.unread b { color: #1f5fd0; }

/* ---------- 后台：可拖拽的照片条 ---------- */

tr.photo-row td {
  background: #fafbfe;
  border-bottom: 1px solid #eef0f5;
  padding: 12px 14px 14px;
}

.drag-hint {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

.drag-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 14px;
}

.drag-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.drag-thumb {
  width: 66px;
  height: 66px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  cursor: grab;
  background: #fff;
  -webkit-user-drag: element;
}

.drag-thumb:active { cursor: grabbing; }

.drag-all {
  padding: 8px 14px;
  border: 1px dashed #b9bed0;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  cursor: grab;
  white-space: nowrap;
}

.drag-all:active { cursor: grabbing; }

/* ---------- 后台：手机版卡片 ---------- */

.m-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
  background: #fff;
}

.m-card.unread {
  border-left: 4px solid #2f7cf6;
  background: #fbfcff;
}

.m-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.m-head .spacer { flex: 1; }

.m-phone {
  font-size: 19px;
  letter-spacing: 0.5px;
  color: var(--ink);
}

.m-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 5px 0;
  font-size: 14px;
  border-bottom: 1px dashed #f0f2f6;
}

.m-line:last-of-type { border-bottom: 0; }

.m-label {
  flex: 0 0 82px;
  color: var(--faint);
  font-size: 13px;
}

.m-value {
  color: var(--text);
  font-weight: 600;
  word-break: break-all;
}

.m-line .pw {
  font-size: 16px;
  color: #16324f;
  font-weight: 600;
}

.m-line .mini-btn { margin-left: auto; }

.m-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.m-actions .mini-btn {
  margin-left: 0;
  padding: 8px 14px;
  font-size: 14px;
}

.m-photos { margin-top: 12px; }
/* ---------- 后台 ---------- */

.group-title {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 22px 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
  color: var(--muted);
}

.group-title b { color: var(--ink); font-size: 16px; }

.group-title:first-child { margin-top: 4px; }

.record-head .who {
  font-size: 14px;
  color: #3d4353;
  background: #eef0f6;
  padding: 2px 9px;
  border-radius: 20px;
}

.badge {
  font-size: 12px;
  color: #9a6a12;
  background: #fdf3e0;
  border: 1px solid #f3e2c2;
  padding: 3px 9px;
  border-radius: 20px;
  white-space: nowrap;
}
