/* Admin photo manager — built for phones first */
:root {
  --ink: #0f1a2c;
  --muted: #5d6676;
  --line: #e4e0d7;
  --paper: #f6f4ef;
  --brand: #1f3bff;
  --brand-deep: #1428b8;
  --gold: #b08d57;
  --danger: #b42318;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}
.bar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: #fff; border-bottom: 1px solid var(--line);
}
.bar-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 600; }
.bar-brand img { height: 36px; width: auto; }
.bar nav { display: flex; gap: 16px; }
.bar nav a { color: var(--brand-deep); text-decoration: none; font-weight: 500; font-size: .95rem; }

.main { max-width: 720px; margin: 0 auto; padding: 16px 16px 80px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 22px 18px; margin-bottom: 16px; }
.card.narrow { max-width: 420px; margin: 40px auto; }
h1 { font-size: 1.5rem; margin: 0 0 14px; }
h2 { font-size: 1.25rem; margin: 0; }
p { margin: 0 0 14px; }
.hint { color: var(--muted); font-size: .9rem; font-weight: 400; }
.alert { background: #fdecea; color: var(--danger); padding: 10px 12px; border-radius: 8px; }
.empty { color: var(--muted); text-align: center; padding: 24px 0; margin: 0; }

label { display: block; font-weight: 600; font-size: .95rem; margin-bottom: 14px; }
input:not([type=file]), select {
  display: block; width: 100%; margin-top: 6px;
  font: inherit; font-size: 16px; /* 16px stops iPhone from zooming in */
  padding: 12px; border: 1px solid #d3cec3; border-radius: 8px; background: #fff; color: var(--ink);
}
input:focus, select:focus { outline: 2px solid var(--brand); outline-offset: 1px; }

.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  padding: 14px 18px; border: 0; border-radius: 10px; cursor: pointer;
  background: var(--brand); color: #fff; font: 600 1rem/1 inherit; text-decoration: none; text-align: center;
}
.btn:hover { background: var(--brand-deep); }
.btn-big { padding: 20px; font-size: 1.15rem; margin: 6px 0 0; }
.btn svg { width: 22px; height: 22px; stroke: currentColor; stroke-width: 2.5; fill: none; }

.progress { list-style: none; margin: 14px 0 0; padding: 0; }
.progress li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); font-size: .9rem; }
.progress .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.progress .state { flex: none; font-weight: 600; }
.progress .done .state { color: #1a7f37; }
.progress .failed .state { color: var(--danger); white-space: normal; text-align: right; }

.list-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.count { display: inline-block; background: var(--paper); border-radius: 99px; padding: 0 10px; font-size: .9rem; color: var(--muted); margin-left: 4px; }
.photos { list-style: none; margin: 0; padding: 0; }
.photo { display: grid; grid-template-columns: 110px 1fr; gap: 14px; padding: 16px 0; border-top: 1px solid var(--line); }
.photo img { width: 110px; height: 110px; object-fit: cover; border-radius: 8px; background: var(--paper); }
.photo-fields input, .photo-fields select { margin: 0 0 8px; padding: 9px 10px; }
.photo-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid #d3cec3; background: #fff; color: var(--ink);
  border-radius: 99px; padding: 7px 13px; font: 500 .9rem/1 inherit; cursor: pointer; min-height: 36px;
}
.chip.on { background: var(--gold); border-color: var(--gold); color: #fff; }
.chip.danger { color: var(--danger); margin-left: auto; }
@media (max-width: 420px) {
  .photo { grid-template-columns: 84px 1fr; gap: 12px; }
  .photo img { width: 84px; height: 84px; }
}

.toast {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom));
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 10px; font-weight: 500;
  transition: opacity .2s, transform .2s; max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); }

/* Section tabs */
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: #e9e5dc; padding: 5px; border-radius: 12px; margin-bottom: 16px; }
.tabs a {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 8px; border-radius: 9px; text-decoration: none; color: var(--muted); font-weight: 600;
}
.tabs a.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.tabs .count { margin: 0; }

/* Before & after pickers */
.pick-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 4px 0 14px; }
.pick {
  display: flex; flex-direction: column; margin: 0; cursor: pointer;
  border: 2px dashed #cfc9bd; border-radius: 12px; overflow: hidden; background: var(--paper);
}
.pick.chosen { border-style: solid; border-color: var(--gold); }
.pick-preview { aspect-ratio: 4 / 3; display: grid; place-items: center; background: #ece8df; color: var(--muted); }
.pick-preview svg { width: 34px; height: 34px; stroke: currentColor; stroke-width: 2; fill: none; }
.pick-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pick-text { padding: 10px 12px; text-align: center; }
.pick-text b { display: block; font-size: 1.05rem; }
.pick-text small { color: var(--muted); font-weight: 400; }
.btn[disabled] { background: #b8bfd8; cursor: not-allowed; }
.status-line { margin: 12px 0 0; text-align: center; font-weight: 600; min-height: 1.5em; }
.status-line.error { color: var(--danger); }

/* Before & after list items */
.photo.pair { grid-template-columns: 1fr; }
.pair-thumbs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pair-thumbs a { position: relative; display: block; }
.pair-thumbs img { width: 100%; height: auto; aspect-ratio: 4 / 3; }
.pair-thumbs span {
  position: absolute; left: 6px; top: 6px; background: rgba(15,26,44,.8); color: #fff;
  font-size: .72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; padding: 2px 7px; border-radius: 4px;
}
