/* QR Studio (member-qr.html). Page-scoped; every class is vvqr-.
   Member-portal wireframe rules: hairline borders, two radii (--radius,
   --radius-sm), no elevation except focus rings and the toast, colours only
   through tokens so the day/night switch works. */

.vvqr { --vvqr-err: #b42318; --vvqr-ok: #166534; }
:root[data-theme="dark"] .vvqr { --vvqr-err: #f19a8f; --vvqr-ok: #6fcf97; }

.vvqr *:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.vvqr [hidden] { display: none !important; }
.vvqr-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Tabs */
.vvqr-tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin: 0 0 1.25rem; overflow-x: auto; }
.vvqr-tab {
    appearance: none; background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
    padding: .65rem .9rem; font: 600 .875rem/1.2 var(--font-sans); color: var(--muted); cursor: pointer;
    display: inline-flex; align-items: center; gap: .45rem; white-space: nowrap;
    transition: color .2s ease-out, border-color .2s ease-out;
}
.vvqr-tab:hover { color: var(--heading); }
.vvqr-tab[aria-selected="true"] { color: var(--heading); border-bottom-color: var(--teal); }
.vvqr-tab .vv-mono-ic { width: 16px; height: 16px; }
.vvqr-count { font-size: .7rem; font-weight: 700; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: .05rem .45rem; }

/* Create layout */
.vvqr-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 360px); gap: 1.25rem; align-items: start; }
.vvqr-preview-col { position: sticky; top: 5rem; }
@media (max-width: 960px) {
    .vvqr-layout { grid-template-columns: minmax(0, 1fr); }
    .vvqr-preview-col { position: static; }
}
.vvqr-step { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 1.1rem 1.15rem 1.2rem; margin: 0 0 1.25rem; min-width: 0; }
.vvqr-step-title { display: flex; align-items: center; gap: .55rem; font: 700 1rem/1.3 var(--font-sans); color: var(--heading); margin: 0 0 .85rem; padding: 0; }
.vvqr-step-num { flex: 0 0 auto; width: 1.55rem; height: 1.55rem; border: 1px solid var(--teal); color: var(--accent-text); border-radius: 50%; display: inline-grid; place-items: center; font-size: .78rem; }
.vvqr-sub-title { font: 600 .8125rem/1.3 var(--font-sans); color: var(--heading); margin: 1.1rem 0 .5rem; padding: 0; }
.vvqr-help { font-size: .78rem; color: var(--muted); margin: .3rem 0 0; line-height: 1.45; }
.vvqr-note { font-size: .8125rem; color: var(--text); border: 1px solid var(--border); border-left: 3px solid var(--gold); border-radius: var(--radius-sm); padding: .6rem .75rem; margin: .75rem 0 0; background: var(--bg); line-height: 1.45; }

/* Step 1: type cards (native radios) */
.vvqr-type-fs { border: 0; margin: 0; padding: 0; min-width: 0; }
.vvqr-group + .vvqr-group { margin-top: .9rem; }
.vvqr-group-label { font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 0 .4rem; }
.vvqr-type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .5rem; }
.vvqr-type { position: relative; display: flex; align-items: center; gap: .55rem; padding: .6rem .7rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; font-size: .8125rem; font-weight: 600; color: var(--text); transition: border-color .2s ease-out, background-color .2s ease-out; min-width: 0; }
.vvqr-type:hover { border-color: var(--accent-line); }
.vvqr-type input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.vvqr-type .vv-mono-ic { width: 18px; height: 18px; flex: 0 0 auto; stroke: var(--muted); }
.vvqr-type span { min-width: 0; overflow-wrap: anywhere; }
.vvqr-type:has(input:checked) { border-color: var(--teal); background: var(--accent-tint); color: var(--heading); }
.vvqr-type:has(input:checked) .vv-mono-ic { stroke: var(--teal); }
.vvqr-type:has(input:focus-visible) { outline: 2px solid var(--teal); outline-offset: 2px; }
.vvqr-type.is-checked { border-color: var(--teal); background: var(--accent-tint); color: var(--heading); }

/* Step 2: form */
.vvqr-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem .9rem; }
.vvqr-field { min-width: 0; }
.vvqr-field--wide { grid-column: 1 / -1; }
@media (max-width: 560px) { .vvqr-fields { grid-template-columns: minmax(0, 1fr); } }
.vvqr-label { display: block; font-size: .78rem; font-weight: 600; color: var(--heading); margin: 0 0 .3rem; }
.vvqr-req { color: var(--accent-text); font-weight: 700; }
.vvqr-input, .vvqr-select, .vvqr-textarea {
    width: 100%; min-width: 0; font: 400 .875rem/1.4 var(--font-sans); color: var(--text); background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .55rem .7rem;
    transition: border-color .2s ease-out;
}
.vvqr-textarea { min-height: 5.5rem; resize: vertical; }
.vvqr-input:hover, .vvqr-select:hover, .vvqr-textarea:hover { border-color: var(--accent-line); }
.vvqr-input[aria-invalid="true"], .vvqr-select[aria-invalid="true"], .vvqr-textarea[aria-invalid="true"] { border-color: var(--vvqr-err); }
.vvqr-err { font-size: .76rem; color: var(--vvqr-err); margin: .3rem 0 0; font-weight: 600; }
.vvqr-err:empty { display: none; }
.vvqr-check { display: flex; align-items: center; gap: .5rem; font-size: .8125rem; color: var(--text); cursor: pointer; padding-top: 1.4rem; }
.vvqr-check input { width: 16px; height: 16px; accent-color: var(--teal); }

/* Colours */
.vvqr-colors { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem; }
@media (max-width: 560px) { .vvqr-colors { grid-template-columns: minmax(0, 1fr); } }
.vvqr-color-row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.vvqr-swatches { display: flex; gap: .35rem; flex-wrap: wrap; }
.vvqr-swatch { width: 1.75rem; height: 1.75rem; border-radius: var(--radius-sm); border: 1px solid var(--border); cursor: pointer; padding: 0; transition: border-color .2s ease-out; }
.vvqr-swatch[aria-pressed="true"] { border: 2px solid var(--heading); }
.vvqr-color-input { width: 2.25rem; height: 2rem; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; }
.vvqr-hex { width: 6.5rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; text-transform: uppercase; }

/* Segmented radios (ECC) */
.vvqr-seg { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.vvqr-seg label { position: relative; text-align: center; padding: .5rem .25rem; font-size: .78rem; font-weight: 600; color: var(--muted); cursor: pointer; border-left: 1px solid var(--border); transition: background-color .2s ease-out, color .2s ease-out; }
.vvqr-seg label:first-child { border-left: 0; }
.vvqr-seg input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.vvqr-seg small { display: block; font-weight: 500; font-size: .68rem; }
.vvqr-seg label:has(input:checked) { background: var(--accent-tint-strong); color: var(--heading); }
.vvqr-seg label:has(input:focus-visible) { outline: 2px solid var(--teal); outline-offset: -2px; }
.vvqr-size-row { display: flex; align-items: center; gap: .75rem; }
.vvqr-size-row input[type="range"] { flex: 1 1 auto; min-width: 0; accent-color: var(--teal); }
.vvqr-size-row .vvqr-input { width: 6rem; flex: 0 0 auto; }

/* Suggestions */
.vvqr-suggest { margin-top: .6rem; }
.vvqr-suggest-box { border: 1px dashed var(--border); border-radius: var(--radius-sm); padding: .7rem; margin-top: .5rem; }
.vvqr-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }
.vvqr-chip { appearance: none; border: 1px solid var(--accent-line); background: var(--surface); color: var(--heading); border-radius: 999px; padding: .3rem .7rem; font: 500 .78rem/1.3 var(--font-sans); cursor: pointer; transition: border-color .2s ease-out, background-color .2s ease-out; max-width: 100%; text-align: left; }
.vvqr-chip:hover { background: var(--accent-tint); border-color: var(--teal); }

/* Buttons (page-local, matches btn tokens) */
.vvqr-btn { appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font: 600 .8125rem/1.2 var(--font-sans); padding: .55rem .9rem; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--heading); cursor: pointer; text-decoration: none; transition: border-color .2s ease-out, background-color .2s ease-out, transform .2s ease-out; }
.vvqr-btn:hover:not(:disabled) { border-color: var(--accent-text); color: var(--accent-text); }
.vvqr-btn:active:not(:disabled) { transform: translateY(1px); }
.vvqr-btn:disabled { opacity: .5; cursor: not-allowed; }
.vvqr-btn .vv-mono-ic { width: 15px; height: 15px; }
.vvqr-btn--primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.vvqr-btn--primary:hover:not(:disabled) { background: var(--teal-dark); border-color: var(--teal-dark); color: #fff; }
.vvqr-btn--danger { color: var(--vvqr-err); }
.vvqr-btn--danger:hover:not(:disabled) { border-color: var(--vvqr-err); color: var(--vvqr-err); }
.vvqr-btn--sm { padding: .35rem .6rem; font-size: .75rem; }
.vvqr-link { appearance: none; background: none; border: 0; padding: 0; font: 600 .78rem/1.3 var(--font-sans); color: var(--accent-text); cursor: pointer; text-decoration: underline; }

/* Step 3: preview */
.vvqr-preview-box { aspect-ratio: 1 / 1; width: 100%; max-width: 320px; margin: 0 auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); display: grid; place-items: center; overflow: hidden; padding: .75rem; transition: opacity .2s ease-out; }
.vvqr-preview-box svg { width: 100%; height: 100%; display: block; }
.vvqr-preview-box.is-captioned { aspect-ratio: auto; }
.vvqr-preview-box.is-captioned svg { height: auto; }
.vvqr-preview-box.is-busy { opacity: .55; }
.vvqr-preview-empty { text-align: center; color: var(--muted); font-size: .8125rem; padding: 1rem; }
.vvqr-preview-empty .vv-mono-ic { width: 40px; height: 40px; stroke: var(--border); display: block; margin: 0 auto .5rem; }
.vvqr-status { font-size: .8rem; color: var(--muted); margin: .65rem 0 0; text-align: center; min-height: 1.2em; overflow-wrap: anywhere; }
.vvqr-status.is-error { color: var(--vvqr-err); font-weight: 600; }
.vvqr-status.is-ready { color: var(--vvqr-ok); }
.vvqr-dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .45rem; margin: .9rem 0 0; }
.vvqr-save { border-top: 1px solid var(--border); margin-top: 1rem; padding-top: 1rem; }
.vvqr-save-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .6rem; align-items: center; }
.vvqr-editing { font-size: .78rem; color: var(--accent-text); font-weight: 600; margin: 0 0 .5rem; }

/* My QR codes */
.vvqr-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 180px) minmax(0, 200px); gap: .65rem; align-items: end; margin-bottom: 1rem; }
@media (max-width: 720px) { .vvqr-toolbar { grid-template-columns: minmax(0, 1fr); } }
.vvqr-list { list-style: none; margin: 0; padding: 0; }
.vvqr-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .75rem 1rem; align-items: center; padding: .85rem 0; border-top: 1px solid var(--border); }
.vvqr-row:first-child { border-top: 0; }
.vvqr-row-ic { width: 2.25rem; height: 2.25rem; border: 1px solid var(--border); border-radius: var(--radius-sm); display: grid; place-items: center; }
.vvqr-row-ic .vv-mono-ic { width: 18px; height: 18px; stroke: var(--teal); }
.vvqr-row-name { font-weight: 700; color: var(--heading); font-size: .9rem; overflow-wrap: anywhere; margin: 0; }
.vvqr-row-meta { font-size: .75rem; color: var(--muted); margin: .15rem 0 0; overflow-wrap: anywhere; }
.vvqr-row-sum { font-size: .8rem; color: var(--text); margin: .2rem 0 0; overflow-wrap: anywhere; }
.vvqr-row-actions { display: flex; flex-wrap: wrap; gap: .35rem; justify-content: flex-end; }
@media (max-width: 720px) {
    .vvqr-row { grid-template-columns: auto minmax(0, 1fr); }
    .vvqr-row-actions { grid-column: 1 / -1; justify-content: flex-start; }
}
.vvqr-empty { text-align: center; padding: 2.25rem 1rem; color: var(--muted); font-size: .875rem; }
.vvqr-empty .vv-mono-ic { width: 36px; height: 36px; stroke: var(--border); display: block; margin: 0 auto .6rem; }
.vvqr-empty p { margin: 0 0 .75rem; }
.vvqr-empty.is-error { color: var(--vvqr-err); }

/* Confirm dialog (native <dialog>) */
.vvqr-dialog { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); padding: 1.25rem; width: min(26rem, calc(100vw - 2rem)); }
.vvqr-dialog::backdrop { background: rgba(10, 37, 64, .45); }
.vvqr-dialog h2 { font: 700 1rem/1.3 var(--font-sans); color: var(--heading); margin: 0 0 .5rem; }
.vvqr-dialog p { font-size: .875rem; margin: 0 0 1rem; overflow-wrap: anywhere; }
.vvqr-dialog-actions { display: flex; justify-content: flex-end; gap: .5rem; flex-wrap: wrap; }

/* Toast: the page's single live region. A floating overlay, so it keeps a shadow. */
.vvqr-toast { position: fixed; left: 50%; bottom: 1.25rem; transform: translate(-50%, .5rem); max-width: calc(100vw - 2rem); background: var(--navy); color: #f4f6f8; border-radius: var(--radius-sm); padding: .6rem 1rem; font-size: .8125rem; box-shadow: 0 8px 24px rgba(0, 0, 0, .22); opacity: 0; pointer-events: none; transition: opacity .2s ease-out, transform .2s ease-out; z-index: 90; text-align: center; }
.vvqr-toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.vvqr-toast.is-error { background: #7a1f12; }

@media (prefers-reduced-motion: reduce) {
    .vvqr *, .vvqr-toast { transition: none !important; animation: none !important; }
}
