/* The one creative card (UX-4 / L3): templates/_creative_card.html, tick behaviour in creative_card.js.
   Linked once from base.html. Colours come from base.html's theme variables, so light and dark need no rules here.
   Grid: 2 cards in a row under 480 px (three at ~100 px were too tight), 3 from 480 to 720, auto-fill above (6-8 on a
   1440 px page); the card is never wider than its cell and the cards of one row are equally tall. */
.crv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; align-items: stretch; min-width: 0; }
@media (max-width: 720px) { .crv-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; } }
@media (max-width: 479px) { .crv-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } }
.crv { position: relative; display: flex; flex-direction: column; gap: 6px; min-width: 0; height: 100%; box-sizing: border-box; padding: 6px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); }
.crv[data-mode="pick"] { cursor: pointer; -webkit-tap-highlight-color: transparent; user-select: none; }
.crv[data-mode="pick"]:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.crv:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.crv.on { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent); }
.crv.has-warn { border-color: color-mix(in srgb, var(--warn) 45%, var(--border)); }
/* the real field stays in the DOM (and in the form post) but is not drawn: the card is the control */
.crv-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; margin: 0; }
.crv-thumb { position: relative; display: block; aspect-ratio: 1 / 1; border-radius: 8px; overflow: hidden; background: var(--surface-2); }
.crv-thumb img, .crv-thumb video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.crv-ph { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--text-dim); }
.crv-kind, .crv-dur { position: absolute; bottom: 6px; display: inline-flex; align-items: center; padding: 3px 6px; border-radius: 6px; background: rgba(0, 0, 0, .6); color: #fff; font-size: 11.5px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.crv-kind { left: 6px; }
.crv-dur { right: 6px; }
.crv-ord { position: absolute; top: 6px; right: 6px; min-width: 24px; height: 24px; padding: 0 7px; box-sizing: border-box; border-radius: 999px; background: var(--accent); color: #fff; font-size: 12.5px; font-weight: 700; display: none; align-items: center; justify-content: center; }
.crv.on .crv-ord { display: inline-flex; }
/* a tick for the picked card even before the number is known (the order number replaces it when there is one) */
.crv[data-mode="pick"] .crv-thumb::after { content: ""; position: absolute; top: 6px; left: 6px; width: 20px; height: 20px; box-sizing: border-box; border-radius: 6px; border: 2px solid #fff; background: rgba(0, 0, 0, .35); }
.crv[data-mode="pick"].on .crv-thumb::after { background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 14px no-repeat; border-color: var(--accent); }
.crv-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 0 2px 2px; }
.crv-name { font-size: 12.5px; font-weight: 650; line-height: 1.3; word-break: normal; overflow-wrap: anywhere; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crv-meta { font-size: 11.5px; line-height: 1.3; color: var(--text-dim); word-break: normal; overflow-wrap: break-word; hyphens: auto; }
.crv-bad { color: var(--danger); }
.crv-chip { display: inline-flex; align-items: center; gap: 4px; width: fit-content; max-width: 100%; padding: 1px 8px; border-radius: 999px; font-size: 11px; line-height: 1.5; background: var(--surface-2); color: var(--text-dim); overflow-wrap: break-word; hyphens: auto; }
.crv-chip.crv-exp { white-space: nowrap; font-size: 10.5px; padding: 1px 6px; }
.crv-chip.soon, .crv-chip.warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); font-weight: 600; }
.crv-chip.err { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); font-weight: 600; }
.crv-chip.pin { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.crv-chip.new { position: absolute; top: 6px; left: 32px; background: var(--accent-2); color: #04281f; font-weight: 700; }
.crv-used { display: flex; gap: 4px; flex-wrap: nowrap; max-width: 100%; min-width: 0; overflow: hidden; }
.crv-used .chip { font-size: 11px; padding: 1px 7px; max-width: 100%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 0 1 auto; }
.crv-used .crv-more-n { flex-shrink: 0; }
/* manage: every action in one fold under the card; the buttons are full-width 44 px targets */
.crv-more { margin: auto 0 0; border-top: 1px solid var(--border); }
.crv-more > summary { display: flex; align-items: center; justify-content: center; min-height: 44px; list-style: none; cursor: pointer; font-size: 13px; color: var(--accent); }
.crv-more > summary::-webkit-details-marker { display: none; }
.crv-actions { display: flex; flex-direction: column; gap: 6px; padding: 0 2px 6px; }
.crv-actions form.inline, .crv-actions .cr-pin { display: block; margin: 0; }
.crv-act { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; min-height: 44px; box-sizing: border-box; cursor: pointer; text-decoration: none; }
.crv-actions .cr-rename > summary { list-style: none; }
.crv-actions .cr-rename > summary::-webkit-details-marker { display: none; }
.crv-actions .cr-rename form { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.crv-actions .cr-rename input[name="name"] { flex: 1 1 100%; min-width: 0; min-height: 44px; box-sizing: border-box; }
.crv-actions .cr-rename .btn-sm { min-height: 44px; }
.crv-actions .cr-rename .small { flex-basis: 100%; }
/* a view card in a tight strip (home, preset, launch status): no hover, no pointer */
.crv[data-mode="view"] .crv-name { font-size: 12px; }
/* glossary «?» (templates/_hint.html): a 24px tap target; the sentence is position: fixed and placed by the script below, so no table's overflow cuts it */
.gl { display: inline-block; margin-left: 2px; vertical-align: middle; font-weight: 400; }
.gl-b { width: 24px; height: 24px; padding: 0; border-radius: 50%; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-dim); font-size: 12px; line-height: 1; cursor: help; }
.gl-b:focus-visible { outline: 2px solid var(--text-dim); outline-offset: 1px; }
.gl-tip { display: none; position: fixed; z-index: 60; top: 0; left: 16px; width: 260px; max-width: calc(100vw - 32px); padding: 8px 10px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); color: var(--text); font-size: 12.5px; line-height: 1.4; text-align: left; white-space: normal; text-transform: none; letter-spacing: 0; }
.gl-on .gl-tip { display: block; }
/* The one toast (UX-4 / L4, static/toast.js): top right on a desktop, at the bottom above the demo bar / wizard panel
   on a phone (--adf-bottom-bar is the bar's height, --adf-toast-lift lets a page with its own sticky panel lift it). */
#adf-toasts { position: fixed; z-index: 1000; top: 16px; right: 16px; width: min(380px, calc(100vw - 32px)); display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
#adf-toasts:empty { display: none; }
.adf-toast { pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; padding: 12px 6px 12px 14px; border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: 12px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); font-size: 14px; line-height: 1.45; animation: adf-toast-in .18s ease-out; }
.adf-toast.ok { border-left-color: var(--accent-2); }
.adf-toast.err { border-left-color: var(--danger); }
.adf-toast.warn { border-left-color: var(--warn); }
.adf-toast-text { flex: 1; min-width: 0; overflow-wrap: anywhere; padding-top: 2px; }
.adf-toast-act { flex: none; align-self: center; padding: 6px 4px; border: 0; background: none; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.adf-toast-act:hover { text-decoration: underline; }
.adf-toast-x { flex: none; width: 32px; height: 32px; border: 0; border-radius: 8px; background: none; color: var(--text-dim); font-size: 20px; line-height: 1; cursor: pointer; }
.adf-toast-x:hover { background: var(--surface-2); color: var(--text); }
@keyframes adf-toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
/* 720, not 560: the same line as the demo bar (_demo_bar.html) and the launch wizard (launch_wizard.js) — the toast
   moves to the bottom exactly where those two panels do, so it never meets them at the top. */
@media (max-width: 720px) {
  #adf-toasts { top: auto; left: 12px; right: 12px; width: auto; bottom: calc(var(--adf-bottom-bar, 0px) + var(--adf-toast-lift, 0px) + 12px + env(safe-area-inset-bottom, 0px)); }
  .adf-toast { animation-name: adf-toast-in-up; }
  .adf-toast-x { width: 44px; height: 44px; margin: -6px 0; }
  .adf-toast-act { min-height: 44px; }
}
@keyframes adf-toast-in-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .adf-toast { animation: none; } }
