/* Admin page. Loads after styles.css so the card previews look exactly like the app's cards. */
body.admin { -webkit-user-select: text; user-select: text; padding-bottom: 40px; }

.abar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: max(8px, env(safe-area-inset-top)) 16px 8px; background: #fff; border-bottom: 3px solid #222;
}
.abar h1 { flex: 1; margin: 0; font-size: clamp(20px, 3vw, 28px); }
.status { font-size: 17px; font-weight: 600; color: #1f7a2c; }
.status.bad { color: #b00020; }

.abtn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 56px; min-width: 56px; padding: 0 16px; font: 600 18px system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #111; background: #fff; border: 2px solid #222; border-radius: 10px; text-decoration: none; cursor: pointer;
}
.abtn.primary { background: #222; color: #fff; }
.abtn:disabled { opacity: .35; cursor: default; }
.file input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.file:focus-within { outline: 4px solid var(--focus); outline-offset: 3px; }

.amain { max-width: 1000px; margin: 0 auto; padding: 16px; }
.hint { color: #555; font-size: 17px; font-weight: 400; }
.error { min-height: 1.4em; color: #b00020; font-size: 18px; font-weight: 600; }

/* List */
.rows { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 10px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 8px; border: 2px solid #ccc; border-radius: 12px; }
.row img { width: 96px; aspect-ratio: 4 / 3; object-fit: contain; border: 2px solid #222; background: #fff; }
.row .words { flex: 1 1 220px; display: flex; flex-wrap: wrap; gap: 6px; font: 700 20px var(--card-font); }
.chip { padding: 2px 10px; border-radius: 8px; background: var(--c); color: var(--ink); }
.row.off img, .row.off .words { opacity: .35; }
.show { display: flex; align-items: center; gap: 8px; min-height: 56px; padding: 0 6px; font-size: 18px; }

/* Picture with cut-out boxes */
.stage { position: relative; width: min(100%, 640px); aspect-ratio: 4 / 3; border: 3px solid #222; background: #f4f4f4; overflow: hidden; }
.stage img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.stage.empty img { display: none; }
.stage.cutting { cursor: crosshair; touch-action: none; outline: 6px solid var(--c); outline-offset: 0; }
.cut { position: absolute; border: 3px dashed; pointer-events: none; }
.cut.active { border-style: solid; border-width: 4px; background: rgba(255, 255, 255, .25); }

/* Card blocks */
.amain section { margin-bottom: 28px; }
.amain h2 { margin: 0 0 10px; font-size: 22px; }
.parts { display: grid; gap: 12px; margin-bottom: 12px; }
.part { border: 3px solid var(--c); border-radius: 12px; overflow: hidden; }
.phead { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 6px 12px; background: var(--c); color: var(--ink, #000); font-size: 20px; }
.phead svg { width: 30px; height: 30px; }
.phead select { min-height: 48px; padding: 0 10px; font: 600 18px system-ui, -apple-system, "Segoe UI", sans-serif; border: 2px solid #222; border-radius: 10px; background: #fff; color: #111; }
.grow { flex: 1; }
.abtn.small { min-height: 48px; min-width: 48px; padding: 0 10px; }
.pbody { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; padding: 12px; }
.preview { --card: 150px; flex: none; }
.preview .card { cursor: default; touch-action: auto; }
.nopic { display: grid; place-items: center; color: #888; font-size: 15px; }
.pfields { flex: 1 1 260px; display: grid; gap: 10px; }
.pfields label:not(.abtn) { display: grid; gap: 4px; font-size: 16px; font-weight: 600; }
.pfields input[type=text], .pfields select { min-height: 52px; padding: 0 12px; font: 400 20px system-ui, -apple-system, "Segoe UI", sans-serif; border: 2px solid #222; border-radius: 10px; background: #fff; }
.pbtns { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; }
.amain > .pbtns { margin-bottom: 8px; }
.aactions { display: flex; justify-content: flex-end; gap: 12px; }

/* Square types */
.tchip {
  flex: none; width: 88px; aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: 6px 4px; border-radius: 8px; background: var(--c); color: var(--ink); font-weight: 700; font-size: 15px; text-align: center; overflow-wrap: anywhere;
}
.tchip svg { width: 36px; height: 36px; }
.tfields { flex: 1 1 300px; display: grid; gap: 8px; }
.tfields label { display: grid; gap: 4px; font-size: 16px; font-weight: 600; }
.tfields input[type=text] { min-height: 52px; padding: 0 12px; font: 400 20px system-ui, -apple-system, "Segoe UI", sans-serif; border: 2px solid #222; border-radius: 10px; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch { position: relative; width: 44px; height: 44px; display: grid; place-items: center; padding: 0; border: 2px solid #222; border-radius: 50%; cursor: pointer; font-size: 20px; background: #fff; }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px #fff, 0 0 0 6px #222; }
.swatch.custom input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.swatch.custom:focus-within { outline: 4px solid var(--focus); outline-offset: 3px; }

/* Picture search */
.picker { width: min(860px, 96vw); max-height: 92vh; display: none; flex-direction: column; gap: 12px; padding: 16px; }
.picker[open] { display: flex; }
.picker-head { display: flex; justify-content: space-between; align-items: center; }
.picker h2 { margin: 0; }
.picker input[type=search], .picker input[type=text] { min-height: 52px; padding: 0 12px; font: 400 20px system-ui, -apple-system, "Segoe UI", sans-serif; border: 2px solid #222; border-radius: 10px; }
.results { list-style: none; margin: 0; padding: 4px; flex: 1; min-height: 160px; overflow: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; align-content: start; }
.results li { position: relative; }
.results .hint { grid-column: 1 / -1; }
.tile { width: 100%; display: flex; flex-direction: column; padding: 4px; background: #fff; border: 2px solid #ccc; border-radius: 10px; cursor: pointer; font: inherit; color: inherit; }
.tile:hover { border-color: #222; }
.tile-pic { aspect-ratio: 1; display: block; }
.tile-pic svg, .tile-pic img { width: 100%; height: 100%; display: block; object-fit: contain; }
.tile-words { padding: 2px; font-size: 14px; line-height: 1.2; text-align: center; overflow-wrap: anywhere; }
.results [data-labels] { position: absolute; top: 4px; right: 4px; min-height: 40px; min-width: 40px; background: rgba(255, 255, 255, .9); }
.picker-upload { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; }
.picker-upload label:not(.abtn) { flex: 1 1 260px; display: grid; gap: 4px; font-size: 16px; font-weight: 600; }
