/* ntcom-qr.css - NTCOM: QR code page (dashboard/ntcom-qr.js). Theme colours come from the
   variables of console.css / style.css, so light and dark mode follow the rest of the app. */
.nqr { display: flex; flex-direction: column; gap: 14px; max-width: 1180px; }
/* Buttons here use display:inline-flex, which beats the [hidden] attribute unless said so. */
.nqr [hidden] { display: none !important; }
.nqr-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.nqr-tabs { display: inline-flex; gap: 4px; padding: 4px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-1); }
.nqr-tabs button, .nqr-agent, .nqr-btn, .nqr-chips button {
  display: inline-flex; align-items: center; gap: 6px; font: inherit; cursor: pointer; color: var(--text);
}
.nqr-tabs button { border: 0; background: transparent; padding: 7px 14px; border-radius: 7px; color: var(--text2); }
.nqr-tabs button.on { background: var(--accent); color: var(--on-accent, #fff); }
.nqr-tabs button svg, .nqr-btn svg, .nqr-agent svg { width: 16px; height: 16px; flex: 0 0 auto; }
.nqr-agent { border: 1px solid var(--accent-line, var(--border)); background: var(--accent-wash, transparent); padding: 7px 12px; border-radius: 8px; }
.nqr-btn { border: 1px solid var(--border); background: var(--surface-1); padding: 7px 12px; border-radius: 8px; text-decoration: none; }
.nqr-btn:hover:not([disabled]) { border-color: var(--accent); color: var(--accent); }
.nqr-btn[disabled] { opacity: .5; cursor: default; }
.nqr-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent, #fff); }
.nqr-primary:hover:not([disabled]) { color: var(--on-accent, #fff); filter: brightness(1.08); }
.nqr-link { border: 0; background: none; color: var(--accent); cursor: pointer; font: inherit; padding: 0 4px; text-decoration: underline; }
.nqr-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.nqr-msg { padding: 9px 12px; border-radius: 8px; border: 1px solid var(--info-line, var(--border)); background: var(--info-wash, var(--surface-1)); color: var(--text); }
.nqr-msg.nqr-err, .nqr-err { border-color: var(--red); color: var(--red); }
.nqr-muted, .nqr-hint { color: var(--text3); font-size: 12.5px; }
.nqr-empty { color: var(--text3); }

/* scan */
.nqr-scan { display: flex; flex-direction: column; gap: 10px; max-width: 720px; }
.nqr-video-wrap { position: relative; width: 100%; aspect-ratio: 4 / 3; max-height: 62vh; background: #000; border-radius: 12px; overflow: hidden; }
.nqr-video-wrap video { width: 100%; height: 100%; object-fit: cover; display: block; }
.nqr-aim { position: absolute; inset: 18% 22%; border: 2px solid rgba(255, 255, 255, .85); border-radius: 14px; box-shadow: 0 0 0 9999px rgba(0, 0, 0, .25); pointer-events: none; }
.nqr-video-off { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: #ddd; text-align: center; padding: 20px; background: #111; }
.nqr-video-off svg { width: 40px; height: 40px; opacity: .7; }
.nqr-video-off[hidden] { display: none; }
.nqr-status { color: var(--text2); font-size: 13px; min-height: 1.2em; }
.nqr-results { display: flex; flex-direction: column; gap: 8px; }
.nqr-res-head { display: flex; justify-content: space-between; align-items: center; }
.nqr-res { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: var(--surface-1); display: flex; flex-direction: column; gap: 6px; }
.nqr-res-meta { color: var(--text3); font-size: 12px; }
.nqr-res-text { margin: 0; white-space: pre-wrap; word-break: break-all; font-family: var(--mono, ui-monospace, monospace); font-size: 13px; user-select: all; }
.nqr-dl { display: grid; grid-template-columns: max-content 1fr; gap: 2px 12px; margin: 0; font-size: 13px; }
.nqr-dl dt { color: var(--text3); }
.nqr-dl dd { margin: 0; word-break: break-all; }
.nqr-dl dd.ok { color: var(--green); }
.nqr-dl dd.bad { color: var(--red); font-weight: 600; }
.nqr-dl pre { margin: 0; white-space: pre-wrap; }

/* create + batch */
.nqr-create { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(280px, 420px); gap: 18px; align-items: start; }
.nqr-form { display: flex; flex-direction: column; gap: 10px; }
.nqr-field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text2); }
.nqr-field[hidden] { display: none; }
.nqr-field input, .nqr-field select, .nqr-field textarea, .nqr-size input[type=number], .nqr-size select {
  font: inherit; color: var(--text); background: var(--bg2, var(--surface-1)); border: 1px solid var(--border); border-radius: 7px; padding: 7px 9px; min-width: 0;
}
.nqr-field textarea { resize: vertical; font-family: var(--mono, ui-monospace, monospace); }
.nqr-field input[type=color] { padding: 2px; height: 34px; width: 64px; }
.nqr-req { color: var(--red); font-style: normal; }
.nqr-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text2); }
.nqr-set { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 10px; margin: 0; }
.nqr-set legend { padding: 0 6px; color: var(--text2); font-size: 13px; }
.nqr-size { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text2); }
.nqr-size input[type=number] { width: 110px; }
.nqr-size input[type=range] { width: 100%; accent-color: var(--accent); }
.nqr-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.nqr-chips button { border: 1px solid var(--border); background: var(--surface-1); border-radius: 999px; padding: 3px 10px; font-size: 12px; }
.nqr-chips button:hover { border-color: var(--accent); color: var(--accent); }
.nqr-colors { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.nqr-logo { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text2); flex-wrap: wrap; }
.nqr-seg { display: flex; gap: 14px; font-size: 13px; }
.nqr-preview { display: flex; flex-direction: column; gap: 10px; position: sticky; top: 8px; }
/* Checkerboard behind the preview so a transparent background is visible as such. */
.nqr-canvas {
  min-height: 260px; border: 1px solid var(--border); border-radius: 12px; display: flex; align-items: center; justify-content: center; padding: 14px;
  background-color: #fff; background-image: linear-gradient(45deg, #e6e6e6 25%, transparent 25%), linear-gradient(-45deg, #e6e6e6 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e6e6e6 75%), linear-gradient(-45deg, transparent 75%, #e6e6e6 75%);
  background-size: 18px 18px; background-position: 0 0, 0 9px, 9px -9px, -9px 0;
}
.nqr-canvas img { max-width: 100%; max-height: 380px; image-rendering: pixelated; }
.nqr-canvas .nqr-muted, .nqr-canvas .nqr-err { background: rgba(255, 255, 255, .9); padding: 6px 10px; border-radius: 6px; color: #555; }
.nqr-canvas .nqr-err { color: #c62828; }
.nqr-dl-row { display: flex; flex-wrap: wrap; gap: 6px; }
.nqr-payload pre { white-space: pre-wrap; word-break: break-all; font-size: 12px; margin: 6px 0 0; }
.nqr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.nqr-cell { border: 1px solid var(--border); border-radius: 10px; padding: 8px; display: flex; flex-direction: column; gap: 6px; align-items: center; background: var(--surface-1); }
.nqr-cell img { width: 100%; aspect-ratio: 1; object-fit: contain; background: #fff; border-radius: 6px; image-rendering: pixelated; }
.nqr-cell small { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text3); }
.nqr-cell-bad { border-color: var(--red); color: var(--red); font-size: 12px; align-items: flex-start; }
.nqr-file { width: 100%; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; border: 1px dashed var(--border); border-radius: 6px; color: var(--text3); font-weight: 600; }

@media (max-width: 820px) {
  .nqr-create { grid-template-columns: 1fr; }
  /* Phone: preview and download buttons first, the long form below them. */
  .nqr-preview { position: static; order: -1; }
  .nqr-canvas { min-height: 180px; }
  .nqr-canvas img { max-height: 240px; }
  .nqr-tabs button span { display: inline; }
}
