/* Printed licence cards and certificates (assets/js/cards.js), and the print studio around them.
   Inside a card 1em is 1 millimetre times --s, so both card sizes share one set of rules. */

/* -- the print studio ---------------------------------------------------------------------------------- */
dialog.studio { width: min(1080px, 100% - 24px); max-width: none; overflow: hidden; }
.studio-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 420px); gap: 24px; padding: 20px 24px 24px; max-height: calc(100dvh - 150px); overflow: hidden auto; }
.studio-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-content: start; }
.studio-form .row2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); }
.studio-form select, .studio-form input:not([type="checkbox"]) { width: 100%; min-width: 0; }
.studio-form .msg { margin: 0; }
.studio-choices { margin: 0; padding: 0; border: 0; display: grid; gap: 10px; min-width: 0; }
.studio-choices legend { padding: 0; margin-bottom: 8px; font-weight: 700; font-size: 0.9rem; }
.studio-choices .btn { justify-self: start; }
.studio-row { display: flex; flex-wrap: wrap; gap: 8px; }
.studio-choice { flex: 1 1 130px; text-align: left; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); cursor: pointer; }
.studio-choice b { display: block; font-size: 0.92rem; }
.studio-choice span { font-size: 0.8rem; color: var(--muted); }
.studio-choice[aria-pressed="true"] { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); background: rgba(245, 197, 66, 0.1); }
.studio-preview { position: sticky; top: 0; align-self: start; }
.studio-paper { --fit: 0.5; position: relative; width: 100%; aspect-ratio: 210 / 297; overflow: hidden; border-radius: 6px; background: #fff; box-shadow: var(--shadow); }
.studio-paper > .a4 { position: absolute; inset: 0 auto auto 0; transform: scale(var(--fit)); transform-origin: 0 0; }
.studio-count { text-align: center; margin: 10px 0 0; }
@media (max-width: 860px) {
  .studio-body { grid-template-columns: minmax(0, 1fr); padding: 16px; }
  .studio-preview { position: static; order: -1; max-width: 220px; margin-inline: auto; width: 100%; }
}

/* -- My licences and the read-only key lists ------------------------------------------------------------- */
.keys-table .pill + .pill { margin-left: 4px; }
.printed-cell { white-space: normal; min-width: 92px; color: var(--muted); font-size: 0.78rem; }
.printed-cell span { display: block; margin-top: 4px; line-height: 1.3; }
.studio-keys .field:first-child { grid-column: 1 / -1; }
/* Generated text, so Copy takes the keys alone. */
.keylist li[data-pcs]::after { content: "  " attr(data-pcs); white-space: pre; color: var(--muted); font-size: 0.85em; }
.key-layout { margin: 0 0 14px; padding: 0; border: 0; }
.key-layout legend { padding: 0; margin-bottom: 8px; font-weight: 600; font-size: 0.9rem; }
.key-layout div { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.key-layout label { position: relative; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; }
.key-layout input { position: absolute; opacity: 0; }
.key-layout b { display: block; font-size: 0.92rem; }
.key-layout span { font-size: 0.78rem; color: var(--muted); }
.key-layout label:has(input:checked) { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); background: rgba(245, 197, 66, 0.1); }
.key-layout label:has(input:focus-visible) { outline: 2px solid var(--gold); outline-offset: 2px; }
@media (max-width: 520px) { .key-layout div { grid-template-columns: 1fr; } }

/* -- paper ------------------------------------------------------------------------------------------------ */
.a4, .a4 * { box-sizing: border-box; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.a4 { position: relative; width: 210mm; height: 296.8mm; overflow: hidden; background: #fff; color: #111a30; font-family: "Inter", "Segoe UI", Arial, sans-serif; line-height: 1.25; text-align: left; }
.a4 b, .a4 strong { color: inherit; }
.a4-wallet, .a4-large { display: grid; justify-content: center; align-content: start; }
.a4-wallet { --s: 1; grid-template-columns: repeat(2, 85.6mm); grid-auto-rows: 54mm; gap: 2.6mm 6mm; padding-top: 8.2mm; }
.a4-large { --s: 1.11; grid-template-columns: repeat(2, 95mm); grid-auto-rows: 60mm; gap: 9mm 5mm; padding-top: 15mm; }

/* -- a licence card ------------------------------------------------------------------------------------- */
.kc { position: relative; width: 85.6em; height: 54em; font-size: calc(1mm * var(--s, 1)); padding: 3.6em 4em 2.8em; border-radius: 3em; overflow: hidden; display: flex; flex-direction: column; gap: 2em; break-inside: avoid; outline: 0.25mm dashed #a9b1c4; outline-offset: 0.6mm; }
.kc-navy { color: #fff; background:
  radial-gradient(46em 30em at 100% 0%, rgba(245, 197, 66, 0.34), transparent 68%),
  radial-gradient(40em 30em at 0% 100%, rgba(45, 212, 191, 0.2), transparent 70%),
  repeating-linear-gradient(118deg, rgba(255, 255, 255, 0.035) 0 0.5em, transparent 0.5em 4em),
  linear-gradient(135deg, #16274d, #0b1222 70%); }
.kc-light { color: #111a30; background: #fff; box-shadow: inset 0 0 0 0.6em #c9971f; }
.kc-top { display: flex; align-items: center; gap: 2em; height: 10.4em; }
.kc-top img { width: 10.4em; height: 10.4em; flex: none; }
.kc-brand { flex: 1; min-width: 0; }
.kc-name { display: flex; align-items: baseline; white-space: nowrap; }
.kc-name b, .kc-name i { font: 700 4.3em/1.1 "Sora", "Inter", "Segoe UI", sans-serif; letter-spacing: 0.03em; }
.kc-name i { font-weight: 500; font-size: 2.6em; margin-left: 0.4em; letter-spacing: 0.12em; color: #ffd966; }
.kc-slogan { display: block; margin-top: 0.25em; font-size: 2.15em; opacity: 0.88; white-space: nowrap; }
.kc-cover { flex: none; padding: 1.1em 2em; border-radius: 1.8em; text-align: center; color: #1d1503; background: linear-gradient(135deg, #ffe08a, #f5c542 55%, #d9a01f); }
.kc-cover b { display: block; font: 700 3.5em/1.1 "Sora", "Inter", sans-serif; white-space: nowrap; }
.kc-cover span { display: block; font-size: 1.75em; font-weight: 700; letter-spacing: 0.06em; white-space: nowrap; }
.kc-cover em { display: block; margin-top: 0.15em; font: 700 2.7em/1.1 "Inter", sans-serif; white-space: nowrap; }
.kc-light .kc-name i, .kc-light .kc-sn b { color: #93690a; }
.kc-light .kc-cover { background: #fff; box-shadow: inset 0 0 0 0.35em #c9971f; }

.kc-mid { display: flex; gap: 2.4em; height: 17.4em; }
.kc-scratch { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.9em; border-radius: 1.8em; border: 0.5em solid #f5c542; color: #111a30; background:
  repeating-linear-gradient(135deg, rgba(120, 130, 155, 0.13) 0 0.7em, transparent 0.7em 1.7em), linear-gradient(100deg, #d8dde8, #f8f9fc 42%, #e3e7ef 70%, #cfd5e2); }
.kc-light .kc-scratch { border-color: #c9971f; background: #fff; }
.kc-lab { font-size: 1.95em; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; color: #4a5470; }
.kc-key { padding: 0.3em 0.5em; border-radius: 0.35em; background: #fff; font: 700 3.72em/1.1 Consolas, "Cascadia Mono", "DejaVu Sans Mono", "Courier New", monospace; color: #0b1222; white-space: nowrap; }
.kc-hint { font-size: 1.95em; color: #3c465f; }
.kc-offer { gap: 0.5em; }
.kc-big { font: 700 7.4em/1.05 "Sora", "Inter", sans-serif; color: #111a30; }
.kc-qr { flex: none; width: 14.2em; display: flex; flex-direction: column; align-items: center; gap: 0.7em; }
.kc-qr-img { display: block; width: 14.2em; height: 14.2em; border-radius: 1em; background: #fff; color: #0b1222; overflow: hidden; }
.kc-qr-img svg, .cert-qr svg { display: block; width: 100%; height: 100%; }
.kc-qr > span:last-child { font-size: 1.8em; font-weight: 600; white-space: nowrap; }

.kc-steps { list-style: none; margin: 0; padding: 0; display: flex; justify-content: space-between; gap: 1.6em; }
.kc-steps li { display: flex; align-items: center; gap: 0.8em; white-space: nowrap; }
.kc-steps i { display: grid; place-items: center; width: 1.65em; height: 1.65em; border-radius: 50%; font: 700 1.9em/1 "Inter", sans-serif; background: #f5c542; color: #1d1503; }
.kc-steps b, .kc-steps span { font-size: 1.95em; }
.kc-foot { margin-top: auto; padding-top: 1.5em; border-top: 0.22em solid rgba(245, 197, 66, 0.6); display: flex; justify-content: space-between; align-items: flex-start; gap: 2em; min-height: 9.6em; }
.kc-seller { flex: 1; min-width: 0; }
.kc-seller b { display: block; font-size: 2.55em; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kc-seller span { display: block; font-size: 1.95em; line-height: 1.22; max-height: 2.44em; overflow: hidden; }
.kc-sn { flex: none; max-width: 26em; text-align: right; }
.kc-sn b { display: block; font-size: 2.2em; line-height: 1.3; color: #ffd966; white-space: nowrap; }
.kc-sn span { display: block; font-size: 1.85em; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }

/* -- the bulk certificate --------------------------------------------------------------------------------- */
.cert { display: flex; flex-direction: column; }
.cert-head { display: flex; align-items: center; gap: 5mm; padding: 9mm 14mm 8mm; color: #fff; border-bottom: 1.6mm solid #f5c542; background:
  radial-gradient(90mm 50mm at 100% 0%, rgba(245, 197, 66, 0.3), transparent 70%), repeating-linear-gradient(118deg, rgba(255, 255, 255, 0.03) 0 0.6mm, transparent 0.6mm 5mm), linear-gradient(120deg, #16274d, #0b1222 75%); }
.cert-head img { width: 19mm; height: 19mm; }
.cert-brand { flex: 1; }
.cert-brand b, .cert-title b { display: block; font: 700 15pt/1.2 "Sora", "Inter", sans-serif; letter-spacing: 0.03em; white-space: nowrap; }
.cert-brand span, .cert-title span { font-size: 9pt; opacity: 0.9; }
.cert-title { text-align: right; }
.cert-title b { color: #ffd966; }
.cert-light .cert-head { color: #111a30; background: #fff; }
.cert-light .cert-title b { color: #93690a; }
.cert-body { flex: 1; padding: 7mm 14mm 0; }
.cert-to { display: flex; justify-content: space-between; gap: 10mm; margin-bottom: 5mm; }
.cert-to > div:first-child { flex: 1; min-width: 0; }
.cert-to > div:last-child { text-align: right; }
.cert-to span { display: block; font-size: 8.5pt; color: #55607c; }
.cert-to b { display: block; font-size: 13pt; line-height: 1.3; min-height: 6mm; }
.cert-to > div:first-child b { border-bottom: 0.3mm solid #c5cbda; }
.cert-to > div:last-child b { font-size: 11pt; }
.cert-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4mm; margin-bottom: 6mm; }
.cert-tiles div { padding: 3.2mm 4mm; border-radius: 3mm; background: #f4f6fb; border-left: 1.2mm solid #f5c542; }
.cert-tiles b { display: block; font: 700 15pt/1.2 "Sora", "Inter", sans-serif; }
.cert-tiles span { font-size: 8.5pt; color: #55607c; }
.cert-light .cert-tiles div { background: #fff; box-shadow: inset 0 0 0 0.25mm #c5cbda; }
.cert-keys { width: 100%; border-collapse: collapse; font-size: 9pt; }
.cert-keys th { padding: 1.6mm 2mm; text-align: left; font-size: 8pt; color: #fff; background: #16274d; }
.cert-light .cert-keys th { color: #111a30; background: #fff; border-bottom: 0.5mm solid #111a30; }
.cert-keys td { height: 6.5mm; padding: 0 2mm; border-bottom: 0.2mm solid #d6dbe7; color: #111a30; vertical-align: middle; }
.cert-keys tbody tr:nth-child(even) td { background: #f7f8fc; }
.cert-light .cert-keys tbody tr:nth-child(even) td { background: #fff; }
.cert-keys td:first-child { width: 9mm; color: #55607c; }
.cert-keys td:nth-child(3) { width: 11mm; }
.cert-key { width: 66mm; font: 700 11pt/1 Consolas, "Cascadia Mono", "DejaVu Sans Mono", "Courier New", monospace; white-space: nowrap; }
.cert-sn { width: 36mm; white-space: nowrap; color: #3c465f; font-variant-numeric: tabular-nums; }
.cert-blank { max-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cert-foot { display: flex; align-items: flex-start; gap: 7mm; margin: 0 14mm 9mm; padding-top: 4mm; border-top: 0.5mm solid #f5c542; }
.cert-how { flex: 1.35; }
.cert-from { flex: 1; min-width: 0; }
.cert-how b, .cert-from b { display: block; font-size: 9.5pt; }
.cert-how span, .cert-from span { display: block; font-size: 8pt; line-height: 1.4; color: #3c465f; white-space: pre-line; }
.cert-qr { flex: none; width: 22mm; text-align: center; color: #0b1222; }
.cert-qr .kc-qr-img { width: 18mm; height: 18mm; margin: 0 auto; border-radius: 0; }
.cert-qr > span:last-child { display: block; font-size: 6.5pt; }

/* -- printing --------------------------------------------------------------------------------------------- */
.print-sheet { display: none; }
@media print {
  body.printing { display: block !important; min-height: 0 !important; background: #fff !important; overflow: visible; }
  body.printing > *:not(.print-sheet) { display: none !important; }
  body.printing .print-sheet { display: block; }
  .print-sheet .a4 { break-after: page; }
  .print-sheet .a4:last-child { break-after: auto; }
}
