:root { --accent: #3b5bdb; --ink: #1a1f2b; --muted: #6b7280; --line: #e5e7eb; --bg: #f7f8fa; --danger: #d6336c; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif; }
.topbar { display: flex; justify-content: space-between; align-items: center;
  background: #fff; border-bottom: 1px solid var(--line); padding: 12px 20px; }
.brand { font-weight: 600; color: var(--ink); text-decoration: none; }
.wrap { max-width: 760px; margin: 24px auto; padding: 0 16px; }
.head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
h1 { font-size: 20px; margin: 0; }
.muted { color: var(--muted); }
.err { background: #fdecef; color: var(--danger); padding: 10px 14px; border-radius: 8px; margin: 0 0 14px; }
.hint { color: var(--muted); font-size: 12px; margin: 4px 0 0; }

.btn { display: inline-block; text-decoration: none; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 7px 14px; border-radius: 8px; font-size: 14px; line-height: 1.2; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { background: #fff; border-color: #f0c2d2; color: var(--danger); }
.link { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 14px; }

table.cards { width: 100%; border-collapse: collapse; background: #fff;
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.cards th, .cards td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 14px; }
.cards th { background: #fbfbfc; color: var(--muted); font-weight: 500; }
.cards tr:last-child td { border-bottom: none; }
.cards .nm { font-weight: 500; }
.cards .ops { display: flex; gap: 8px; align-items: center; justify-content: flex-end; }
.cards .ops form { margin: 0; }

.form { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 20px; display: grid; gap: 14px; }
.form label { display: grid; gap: 6px; font-size: 14px; color: var(--muted); }
.form input { font-size: 15px; color: var(--ink); padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; }
.form input:focus { outline: none; border-color: var(--accent); }
.phones { border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.phones legend { color: var(--muted); font-size: 13px; padding: 0 6px; }
.phone-row { display: flex; gap: 8px; margin-bottom: 8px; }
.phone-row input { flex: 1; }
.phone-row select { flex: 0 0 124px; font-size: 14px; padding: 9px 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); }
.photo .preview { width: 72px; height: 72px; object-fit: cover; border-radius: 50%; border: 1px solid var(--line); }
.photo-editor { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
/* Editor stage mirrors the card's photo area exactly: same aspect (450:430)
   and same shape (slightly rounded bottom corners, no curve clip) so WYSIWYG holds. */
.photo-stage {
  width: 240px;
  aspect-ratio: 1 / 1;                            /* placeholder, overridden by JS on image load */
  flex: none; overflow: hidden;
  border-radius: 0 0 12.8px 12.8px;
  background: #efeff3;
  border: 1px solid var(--line); position: relative;
  cursor: grab; user-select: none; touch-action: none;
}
.photo-stage:active { cursor: grabbing; }
.photo-stage .ph-img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; display: block; pointer-events: none;
  transform-origin: center center;
}
.photo-placeholder {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 13px; pointer-events: none;
}
.photo-hint { position: absolute; left: 8px; bottom: 6px; color: #fff; font-size: 11px; opacity: .85; pointer-events: none; text-shadow: 0 1px 2px rgba(0,0,0,.45); }

.photo-controls { display: flex; flex-direction: column; gap: 10px; min-width: 220px; padding-top: 4px; flex: 1; }
.photo-row { display: flex; gap: 8px; align-items: center; }
.photo-row .file-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); font-size: 13.5px;
}
.photo-row .file-btn:hover { background: #fafbfc; }
.photo-row input[type=file] { display: none; }
.photo-row .file-name { font-size: 12.5px; color: var(--muted); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.photo-row .reset-btn {
  border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 8px 14px; cursor: pointer; font-size: 13.5px;
}
.zoom-row { display: flex; align-items: center; gap: 10px; }
.zoom-row .lbl { font-size: 13px; color: var(--muted); width: 36px; }
.zoom-row input[type=range] { flex: 1; height: 20px; }
.zoom-row .val { font-size: 12px; color: var(--muted); width: 36px; text-align: right; font-variant-numeric: tabular-nums; }
.photo-hint-text { font-size: 12px; color: var(--muted); line-height: 1.5; }
.login { max-width: 320px; margin: 8vh auto 0; background: #fff; border: 1px solid var(--line);
  border-radius: 12px; padding: 28px; display: grid; gap: 14px; }
.login input { padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 15px; }
