/*
 * S40.3 — QR Generator UX/UI refresh
 * Uses the HRMS theme variables for the application shell. QR output colors
 * are deliberately passed by the QR theme selector and kept high contrast.
 */

.qr-page-header { margin-bottom: 18px; }
.qr-page-actions { display:flex; gap:8px; flex-wrap:wrap; }

.qr-generator-layout {
  display:grid;
  grid-template-columns:minmax(0, 1.42fr) minmax(330px, .78fr);
  gap:18px;
  align-items:start;
}

.qr-builder-card,
.qr-preview-card,
.qr-history-section { border:1px solid var(--border); box-shadow:var(--shadow-ambient); }
.qr-builder-card { padding:20px; }
.qr-card-intro,
.qr-preview-head,
.qr-history-header,
.qr-section-heading-row,
.qr-collapsible-head {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
}
.qr-card-intro { padding-bottom:16px; margin-bottom:18px; border-bottom:1px solid var(--border); }
.qr-card-intro h2 { margin:3px 0 0; font-size:20px; }
.qr-eyebrow { display:block; font-size:10px; font-weight:800; letter-spacing:.12em; color:var(--primary); }
.qr-default-pill,
.qr-selection-badge,
.qr-preview-status,
.qr-logo-status {
  display:inline-flex; align-items:center; justify-content:center;
  min-height:27px; padding:4px 9px; border-radius:999px;
  font-size:11px; font-weight:700; white-space:nowrap;
  background:var(--surface-alt); color:var(--text-muted); border:1px solid var(--border);
}
.qr-selection-badge { color:var(--primary); background:color-mix(in srgb, var(--primary) 8%, var(--surface)); }
.qr-preview-status { font-weight:600; }
.qr-preview-status.ready { color:var(--success); background:color-mix(in srgb, var(--success) 8%, var(--surface)); border-color:color-mix(in srgb, var(--success) 30%, var(--border)); }

.qr-form-section { margin-bottom:18px; }
.qr-section-heading { margin:0; font-size:14px; color:var(--text); }
.qr-section-hint { display:block; margin-top:2px; color:var(--text-muted); font-size:11px; }
.qr-section-heading-row { margin-bottom:9px; }
.qr-field-label { font-size:12px; font-weight:700; color:var(--text-muted); margin-bottom:5px; display:block; }

.qr-builder-card input[type="text"],
.qr-builder-card input[type="url"],
.qr-builder-card input[type="email"],
.qr-builder-card input[type="tel"],
.qr-builder-card input[type="number"],
.qr-builder-card input[type="datetime-local"],
.qr-builder-card input[type="file"],
.qr-builder-card select,
.qr-builder-card textarea {
  width:100%; min-height:40px; padding:9px 11px;
  border:1px solid var(--border); border-radius:10px;
  background:var(--bg); color:var(--text); font-size:14px;
  transition:border-color .15s, box-shadow .15s;
}
.qr-builder-card textarea { min-height:90px; resize:vertical; }
.qr-builder-card input:focus,
.qr-builder-card select:focus,
.qr-builder-card textarea:focus { border-color:var(--primary); box-shadow:0 0 0 3px color-mix(in srgb, var(--primary) 12%, transparent); outline:none; }

.qr-type-picker {
  display:flex; gap:6px; overflow-x:auto; flex-wrap:nowrap;
  padding:7px; background:var(--surface-alt); border-radius:12px;
  scrollbar-width:thin;
}
.qr-type-btn {
  flex:0 0 auto; display:inline-flex; align-items:center; gap:6px;
  min-height:38px; padding:8px 12px; border:1px solid transparent; border-radius:10px;
  background:transparent; color:var(--text-muted); font-size:12px; font-weight:600; cursor:pointer;
  transition:.16s ease;
}
.qr-type-btn:hover { background:var(--surface); color:var(--text); }
.qr-type-btn.active { background:var(--bg); color:var(--primary); border-color:color-mix(in srgb, var(--primary) 18%, var(--border)); box-shadow:var(--shadow-ambient); }
.qr-type-btn svg { width:15px; height:15px; flex:0 0 auto; }

.qr-fields-wrap { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:13px; margin:0 0 18px; padding:14px; border:1px solid var(--border); border-radius:12px; background:var(--surface-alt); }
.qr-fields-wrap > * { min-width:0; }
.qr-fields-wrap > textarea,
.qr-fields-wrap > label.qr-field-checkbox,
.qr-fields-wrap > input[type="file"] { grid-column:1 / -1; }
.qr-field-checkbox { display:flex; align-items:center; gap:8px; color:var(--text-muted); font-size:12px; }
.qr-field-checkbox input { width:auto; }

.qr-style-controls { padding:14px; border:1px solid var(--border); border-radius:12px; background:var(--surface-alt); }
.qr-control-grid { display:grid; grid-template-columns:1.25fr 1fr 1fr; gap:12px; }
.qr-font-preview { display:flex; align-items:center; gap:12px; margin-top:10px; padding:10px 12px; border-radius:10px; background:var(--bg); border:1px dashed var(--border); }
.qr-font-preview-label { font-size:10px; font-weight:800; text-transform:uppercase; letter-spacing:.08em; color:var(--text-muted); white-space:nowrap; }
.qr-font-preview-text { color:var(--text); font-weight:700; line-height:1.25; transition:font-size .15s; }

.qr-collapsible-section { margin-bottom:12px; border:1px solid var(--border); border-radius:12px; overflow:hidden; background:var(--surface); }
.qr-collapsible-head { padding:13px 14px; }
.qr-selected-summary { display:block; margin-top:2px; font-size:11px; color:var(--text-muted); }
.qr-toggle-btn { display:inline-flex; align-items:center; gap:7px; border:0; background:transparent; color:var(--primary); font-size:12px; font-weight:800; cursor:pointer; padding:7px 5px; }
.qr-chevron { font-size:15px; line-height:1; transition:transform .16s; }
.qr-toggle-btn[aria-expanded="true"] .qr-chevron { transform:rotate(180deg); }
.qr-collapsible-body { padding:0 14px 14px; border-top:1px solid var(--border); }
.qr-control-note { font-size:11px; line-height:1.45; margin:12px 0; }

.qr-template-grid,
.qr-theme-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; padding-top:12px; }
.qr-template-option,
.qr-color-option {
  position:relative; display:flex; flex-direction:column; gap:7px; min-width:0;
  padding:8px; border:1px solid var(--border); border-radius:11px; background:var(--bg); cursor:pointer;
  transition:border-color .15s, transform .15s, box-shadow .15s;
}
.qr-template-option:hover,
.qr-color-option:hover { transform:translateY(-1px); border-color:color-mix(in srgb, var(--primary) 45%, var(--border)); }
.qr-template-option.selected,
.qr-color-option.selected { border-color:var(--primary); box-shadow:0 0 0 2px color-mix(in srgb, var(--primary) 12%, transparent); }
.qr-template-option input,
.qr-color-option input { position:absolute; opacity:0; inset:0; cursor:pointer; }
.qr-option-name { font-size:11px; font-weight:700; color:var(--text); text-align:center; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.qr-template-preview,
.qr-color-preview { height:74px; display:flex; align-items:center; justify-content:center; background:var(--surface-alt); border-radius:8px; overflow:hidden; }
.qr-mini-code { width:42px; height:42px; border:4px solid #fff; background:
  linear-gradient(90deg,#111 10%,transparent 10% 20%,#111 20% 31%,transparent 31% 42%,#111 42% 56%,transparent 56% 68%,#111 68% 79%,transparent 79% 88%,#111 88%),
  linear-gradient(#111 10%,transparent 10% 21%,#111 21% 33%,transparent 33% 45%,#111 45% 57%,transparent 57% 67%,#111 67% 78%,transparent 78% 89%,#111 89%); }
.qr-template-preview--bordered { border:3px solid var(--text); }
.qr-template-preview--rounded_card { border-radius:14px; box-shadow:var(--shadow-ambient); }
.qr-template-preview--labeled { position:relative; padding-bottom:20px; }
.qr-template-preview--labeled::after { content:'SCAN'; position:absolute; bottom:5px; font-size:7px; font-weight:900; color:var(--text-muted); letter-spacing:.12em; }
.qr-template-preview--corner_brackets { position:relative; }
.qr-template-preview--corner_brackets::before { content:''; position:absolute; inset:10px; border:2px solid var(--text); border-bottom-color:transparent; border-right-color:transparent; border-radius:3px; }
.qr-template-preview--double_border { border:2px solid var(--text); outline:1px solid var(--text); outline-offset:-7px; }
.qr-template-preview--dashed_border { border:2px dashed var(--text); }
.qr-template-preview--shadow_card { box-shadow:7px 7px 0 color-mix(in srgb, var(--text) 12%, transparent); }
.qr-color-preview { background:linear-gradient(135deg,var(--qr-theme-bg),var(--surface)); }
.qr-color-preview .qr-mini-code { background:
  linear-gradient(90deg,var(--qr-theme-module) 10%,transparent 10% 20%,var(--qr-theme-module) 20% 31%,transparent 31% 42%,var(--qr-theme-module) 42% 56%,transparent 56% 68%,var(--qr-theme-module) 68% 79%,transparent 79% 88%,var(--qr-theme-module) 88%),
  linear-gradient(var(--qr-theme-module) 10%,transparent 10% 21%,var(--qr-theme-module) 21% 33%,transparent 33% 45%,var(--qr-theme-module) 45% 57%,transparent 57% 67%,var(--qr-theme-module) 67% 78%,transparent 78% 89%,var(--qr-theme-module) 89%); border-color:var(--qr-theme-bg); }
.qr-color-preview--custom { background:conic-gradient(var(--border) 25%,var(--bg) 0 50%,var(--border) 0 75%,var(--bg) 0) 0/14px 14px; }
.qr-theme-custom-inputs { display:none; grid-template-columns:1fr 1fr; gap:10px; margin-top:12px; }
.qr-theme-custom-inputs.active { display:grid; }
.qr-theme-custom-inputs input[type="color"] { width:100%; height:42px; padding:4px; border:1px solid var(--border); border-radius:9px; background:var(--bg); }

.qr-logo-section { padding-top:2px; }
.qr-upload-box { display:flex; align-items:center; gap:11px; padding:12px; border:1px dashed var(--border); border-radius:11px; background:var(--surface-alt); cursor:pointer; }
.qr-upload-box:hover { border-color:var(--primary); }
.qr-upload-box input { display:none; }
.qr-upload-box svg { width:22px; height:22px; }
.qr-upload-box strong,.qr-upload-box small { display:block; }
.qr-upload-box strong { font-size:12px; color:var(--text); }
.qr-upload-box small { font-size:10px; color:var(--text-muted); margin-top:2px; }

.qr-form-actions { display:flex; gap:10px; margin-top:18px; }
.qr-preview-action,.qr-generate-action { flex:1; min-height:44px; justify-content:center; }
.qr-generate-note { margin:9px 0 0; color:var(--text-muted); font-size:10px; line-height:1.45; text-align:center; }

.qr-preview-card { position:sticky; top:16px; padding:18px; min-height:520px; }
.qr-preview-head { margin-bottom:13px; }
.qr-preview-head h3 { margin:3px 0 0; font-size:18px; }
.qr-preview-panel { min-height:365px; display:flex; align-items:center; justify-content:center; padding:18px; border:1px dashed var(--border); border-radius:14px; background:var(--surface-alt); overflow:hidden; }
.qr-preview-empty { display:flex; flex-direction:column; align-items:center; gap:7px; text-align:center; color:var(--text-muted); max-width:240px; }
.qr-empty-icon { display:grid; place-items:center; width:54px; height:54px; border:1px solid var(--border); border-radius:14px; background:var(--bg); font-size:29px; color:var(--primary); }
.qr-preview-empty strong { color:var(--text); font-size:13px; }
.qr-preview-empty span { font-size:11px; line-height:1.45; }
.qr-output { width:min(100%,340px); display:flex; flex-direction:column; align-items:center; gap:10px; padding:18px; background:#fff; color:#111; border-radius:10px; position:relative; }
.qr-output svg { width:min(100%,270px); height:auto; display:block; }
.qr-output__label { font-weight:700; text-align:center; line-height:1.2; max-width:100%; word-break:break-word; }
.qr-output__title { font-size:11px; font-weight:600; opacity:.62; text-align:center; max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.qr-output--classic { background:#fff; }
.qr-output--bordered { border:3px solid #111; }
.qr-output--rounded_card { border-radius:24px; box-shadow:0 10px 28px rgba(0,0,0,.12); }
.qr-output--labeled { padding-bottom:14px; }
.qr-output--corner_brackets { border:0; }
.qr-output--corner_brackets::before { content:''; position:absolute; inset:7px; border:3px solid #111; border-bottom-color:transparent; border-right-color:transparent; border-radius:3px; pointer-events:none; }
.qr-output--double_border { border:3px solid #111; outline:2px solid #111; outline-offset:-9px; }
.qr-output--dashed_border { border:3px dashed #111; }
.qr-output--shadow_card { box-shadow:11px 11px 0 rgba(0,0,0,.12); }
.qr-code-stage { position:relative; display:flex; align-items:center; justify-content:center; width:min(100%,270px); }
.qr-code-stage svg { width:100%; }
.qr-center-logo { position:absolute; width:18%; max-width:52px; aspect-ratio:1; object-fit:contain; padding:5px; background:#fff; border-radius:10px; box-shadow:0 1px 5px rgba(0,0,0,.18); }
.qr-center-badge { position:absolute; width:17%; max-width:48px; aspect-ratio:1; display:grid; place-items:center; border-radius:12px; background:#fff; color:#111; font-size:8px; font-weight:900; box-shadow:0 1px 5px rgba(0,0,0,.18); }
.qr-preview-meta { display:flex; flex-wrap:wrap; gap:6px; margin-top:10px; }
.qr-meta-chip { padding:5px 8px; border-radius:999px; background:var(--surface-alt); border:1px solid var(--border); font-size:10px; color:var(--text-muted); }
.qr-preview-actions { display:flex; gap:8px; justify-content:center; margin-top:12px; }
.qr-preview-actions .btn { flex:1; justify-content:center; }

.qr-history-section { margin-top:18px; padding:18px; scroll-margin-top:20px; }
.qr-history-header { margin-bottom:15px; }
.qr-history-header h2 { margin:3px 0; font-size:19px; }
.qr-history-filter { margin-bottom:13px; }
.qr-history-list { display:flex; flex-direction:column; gap:8px; }
.qr-history-item { display:grid; grid-template-columns:42px minmax(0,1fr) auto; align-items:center; gap:12px; padding:11px; border:1px solid var(--border); border-radius:11px; background:var(--surface); }
.qr-history-icon { display:grid; place-items:center; width:42px; height:42px; border-radius:10px; background:var(--surface-alt); color:var(--primary); }
.qr-history-icon svg { width:20px; height:20px; }
.qr-history-title-row { display:flex; align-items:center; gap:8px; min-width:0; }
.qr-history-title-row strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:13px; }
.qr-history-date { display:block; margin-top:3px; color:var(--text-muted); font-size:10px; }
.qr-history-actions { display:flex; gap:6px; align-items:center; flex-wrap:wrap; justify-content:flex-end; }
.qr-history-actions form { margin:0; }
.qr-history-empty { padding:32px 15px; text-align:center; color:var(--text-muted); border:1px dashed var(--border); border-radius:11px; }
.qr-total-records { margin:12px 0 0; font-size:11px; }

.qr-render-error { color:var(--danger); font-size:12px; text-align:center; line-height:1.5; }
.qr-busy { opacity:.7; pointer-events:none; }

@media (max-width: 1100px) {
  .qr-generator-layout { grid-template-columns:1fr; }
  .qr-preview-card { position:relative; top:auto; min-height:0; }
  .qr-preview-panel { min-height:330px; }
}
@media (max-width: 760px) {
  .qr-control-grid { grid-template-columns:1fr; }
  .qr-fields-wrap { grid-template-columns:1fr; }
  .qr-template-grid,.qr-theme-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .qr-history-item { grid-template-columns:38px minmax(0,1fr); }
  .qr-history-icon { width:38px; height:38px; }
  .qr-history-actions { grid-column:1 / -1; justify-content:flex-start; padding-top:4px; border-top:1px solid var(--border); }
  .qr-card-intro { align-items:flex-start; flex-direction:column; }
  .qr-form-actions { flex-direction:column; }
}
@media (max-width: 460px) {
  .qr-builder-card,.qr-preview-card,.qr-history-section { padding:13px; }
  .qr-page-actions { width:100%; }
  .qr-page-actions .btn { flex:1; justify-content:center; }
  .qr-template-grid,.qr-theme-grid { gap:7px; }
  .qr-output { width:100%; }
}


/* =====================================================================
   S40.2 — refinements
   ===================================================================== */

/* numbered step headers */
.qr-step-head { display:flex; align-items:center; gap:10px; margin:22px 0 12px; }
.qr-step-head:first-of-type { margin-top:0; }
.qr-step-head h3 { margin:0; font-size:15px; color:var(--text); }
.qr-step-num {
  display:inline-grid; place-items:center; flex:0 0 auto;
  width:26px; height:26px; border-radius:50%;
  background:var(--primary); color:#fff; font-size:12px; font-weight:800;
}
.qr-step-head::after { content:''; flex:1; height:1px; background:var(--border); }

/* content-type picker: wrapped tiles instead of a scrolling strip */
.qr-type-picker {
  display:grid; grid-template-columns:repeat(auto-fill, minmax(92px, 1fr)); gap:8px;
  overflow:visible; padding:0; background:transparent; border-radius:0;
}
.qr-type-btn {
  flex-direction:column; justify-content:center; gap:6px; text-align:center;
  min-height:70px; padding:10px 6px; line-height:1.25;
  background:var(--surface); border:1px solid var(--border); border-radius:12px;
}
.qr-type-btn svg { width:20px; height:20px; }
.qr-type-btn:hover { border-color:color-mix(in srgb, var(--primary) 45%, var(--border)); transform:translateY(-1px); }
.qr-type-btn.active {
  color:var(--primary); background:color-mix(in srgb, var(--primary) 8%, var(--surface));
  border-color:var(--primary); box-shadow:0 0 0 3px color-mix(in srgb, var(--primary) 12%, transparent);
}

/* fields grid */
.qr-fields-wrap--empty { display:none; }
.qr-field--wide { grid-column:1 / -1; }
.qr-field { min-width:0; }
.qr-builder-card input:not([type="color"]):not([type="checkbox"]):not([type="radio"]):not([type="file"]):hover,
.qr-builder-card select:hover,
.qr-builder-card textarea:hover { border-color:color-mix(in srgb, var(--primary) 40%, var(--border)); }

/* S11 date-time picker inside the QR form: same look as the rest of the system */
.qr-dt-field { width:100%; }
.qr-dt-field .s11-picker-input-row { width:100%; }
.qr-dt-field .s11-picker-display { width:100%; }
.qr-history-filter .s11-picker-field { min-width:150px; }

/* template / theme tiles a little tighter now that they are open by default */
.qr-template-preview,
.qr-color-preview { height:64px; }
.qr-collapsible-section { background:var(--bg); }
.qr-collapsible-head { cursor:default; }

/* preview panel */
.qr-preview-panel {
  background:
    linear-gradient(45deg, color-mix(in srgb, var(--border) 45%, transparent) 25%, transparent 25% 75%, color-mix(in srgb, var(--border) 45%, transparent) 75%),
    linear-gradient(45deg, color-mix(in srgb, var(--border) 45%, transparent) 25%, transparent 25% 75%, color-mix(in srgb, var(--border) 45%, transparent) 75%),
    var(--surface-alt);
  background-size:16px 16px, 16px 16px, auto;
  background-position:0 0, 8px 8px, 0 0;
  border-style:solid;
}
.qr-preview-empty { background:var(--bg); padding:22px 18px; border-radius:14px; border:1px solid var(--border); }

/* download box */
.qr-download-box { margin-top:14px; padding:14px; border:1px solid var(--border); border-radius:12px; background:var(--bg); }
.qr-download-head { margin-bottom:10px; }
.qr-download-head strong { display:inline-flex; align-items:center; gap:7px; font-size:13px; color:var(--text); }
.qr-download-head svg { width:16px; height:16px; color:var(--primary); }
.qr-download-row { margin-bottom:10px; }
.qr-download-row[hidden] { display:none; }
.qr-download-label { display:block; margin-bottom:5px; font-size:11px; font-weight:700; color:var(--text-muted); }
.qr-segment { display:flex; padding:3px; gap:3px; border-radius:10px; background:var(--surface-alt); border:1px solid var(--border); }
.qr-segment-btn {
  flex:1; min-height:34px; padding:6px 8px; border:0; border-radius:8px;
  background:transparent; color:var(--text-muted); font-size:12px; font-weight:700; cursor:pointer;
  transition:background .15s, color .15s, box-shadow .15s;
}
.qr-segment-btn:hover { color:var(--text); }
.qr-segment-btn.active { background:var(--primary); color:#fff; box-shadow:0 1px 3px rgba(0,0,0,.18); }
.qr-segment--wrap { flex-wrap:wrap; }
.qr-segment--wrap .qr-segment-btn { flex:1 1 30%; font-size:11px; line-height:1.25; }
.qr-format-hint { margin:0 0 12px; font-size:11px; line-height:1.5; color:var(--text-muted); }
.qr-download-box .qr-preview-actions { margin-top:0; }
.qr-download-action { min-height:44px; font-size:14px; }
.qr-download-action:disabled { opacity:.55; cursor:not-allowed; }
.qr-scan-tip { margin:10px 0 0; font-size:10px; text-align:center; color:var(--text-muted); }

/* history rows */
.qr-history-item { transition:border-color .15s, box-shadow .15s; }
.qr-history-item:hover { border-color:color-mix(in srgb, var(--primary) 40%, var(--border)); box-shadow:var(--shadow-ambient); }
.qr-history-actions .btn svg { width:13px; height:13px; }

@media (max-width: 760px) {
  .qr-type-picker { grid-template-columns:repeat(3, minmax(0, 1fr)); }
  .qr-segment--wrap .qr-segment-btn { flex:1 1 100%; }
}


/* =====================================================================
   S40.3 — one-row content types, illustrated template/theme tiles
   ===================================================================== */

/* content type: single row + "See more" */
.qr-type-wrap { position:relative; }
.qr-type-picker { padding:4px; margin:-4px; grid-auto-rows:72px; }
.qr-type-picker:not(.is-expanded) { max-height:80px; overflow:hidden; }
.qr-type-btn { min-height:72px; height:72px; }
.qr-type-more {
  display:flex; align-items:center; justify-content:center; gap:7px;
  margin:10px auto 0; padding:6px 14px 6px 16px; min-height:32px;
  border:1px solid var(--border); border-radius:999px; background:var(--surface);
  color:var(--primary); font-size:12px; font-weight:800; cursor:pointer;
  transition:border-color .15s, background .15s, box-shadow .15s;
}
.qr-type-more[hidden] { display:none; }
.qr-type-more:hover { border-color:var(--primary); background:color-mix(in srgb, var(--primary) 7%, var(--surface)); }
.qr-type-more:focus-visible { outline:none; box-shadow:0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent); }
.qr-type-more-count {
  display:inline-grid; place-items:center; min-width:22px; height:20px; padding:0 6px;
  border-radius:999px; background:var(--primary); color:#fff; font-size:10px; font-weight:800;
}
.qr-type-more-count:empty { display:none; }
.qr-type-more-chev { width:14px; height:14px; transition:transform .18s; }
.qr-type-more[aria-expanded="true"] .qr-type-more-chev { transform:rotate(180deg); }

/* show / hide toggles on Template + Color sections */
.qr-toggle-btn {
  gap:6px; padding:5px 11px 5px 12px; min-height:30px;
  border:1px solid var(--border); border-radius:999px; background:var(--surface);
  transition:border-color .15s, background .15s;
}
.qr-toggle-btn:hover { border-color:var(--primary); background:color-mix(in srgb, var(--primary) 7%, var(--surface)); }
.qr-toggle-btn:focus-visible { outline:none; box-shadow:0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent); }
.qr-chevron { width:14px; height:14px; font-size:0; transition:transform .18s; }
.qr-selected-summary { font-weight:600; color:var(--primary); }

/* tiles */
.qr-template-grid,
.qr-theme-grid { grid-template-columns:repeat(4, minmax(0, 1fr)); gap:10px; }
.qr-template-option,
.qr-color-option { padding:8px 8px 9px; gap:8px; border-radius:12px; }
.qr-template-preview,
.qr-color-preview {
  height:96px; border-radius:9px; padding:0;
  display:flex; align-items:center; justify-content:center;
  background:var(--surface-alt);
}
.qr-tpl-svg { height:84px; width:auto; display:block; overflow:visible; }
.qr-tpl-svg .tc { fill:#fff; stroke:color-mix(in srgb, var(--text) 16%, transparent); stroke-width:1; }
.qr-tpl-svg .tf { stroke:#111; }
.qr-tpl-svg .tq .m { fill:#111; }
.qr-tpl-svg .tq .b { fill:#fff; }
.qr-tpl-svg .ts { fill:rgba(0,0,0,.14); }
.qr-tpl-svg .ts2 { fill:rgba(0,0,0,.22); }
.qr-tpl-svg .tl { fill:#111; }
.qr-template-option:hover .qr-tpl-svg,
.qr-template-option.selected .qr-tpl-svg { transform:scale(1.03); }
.qr-tpl-svg { transition:transform .16s; }

.qr-swatch-svg { height:74px; width:74px; display:block; overflow:visible;
  filter:drop-shadow(0 1px 2px rgba(0,0,0,.14)); }
.qr-swatch-svg .b { fill:var(--qr-theme-bg, #fff); stroke:color-mix(in srgb, #000 12%, transparent); stroke-width:.12; }
.qr-swatch-svg .m { fill:var(--qr-theme-module, #000); }
.qr-color-preview--custom.is-rainbow .qr-swatch-svg .m { fill:url(#qr-rainbow); }
.qr-color-preview--custom.is-rainbow .qr-swatch-svg .b { fill:#fff; }
.qr-color-preview { background:var(--surface-alt); }

/* selected check badge */
.qr-template-option::after,
.qr-color-option::after {
  content:''; position:absolute; top:6px; right:6px; width:18px; height:18px; border-radius:50%;
  background:var(--primary) 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.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center/11px no-repeat;
  opacity:0; transform:scale(.6); transition:opacity .15s, transform .15s; pointer-events:none;
}
.qr-template-option.selected::after,
.qr-color-option.selected::after { opacity:1; transform:scale(1); }

@media (max-width: 760px) {
  .qr-template-grid,.qr-theme-grid { grid-template-columns:repeat(2, minmax(0,1fr)); }
}


/* ---- Content-type tile labels stay on ONE line (e.g. "Crypto/Payment") ---- */
.qr-type-picker { grid-template-columns:repeat(auto-fill, minmax(108px, 1fr)); }
.qr-type-btn { padding-inline:4px; }
.qr-type-btn span { white-space:nowrap; font-size:11.5px; max-width:100%; overflow:hidden; text-overflow:ellipsis; }

/* ---- History: standard data table ---- */
.qr-history-table th, .qr-history-table td { vertical-align:middle; }
.qr-cell-title { display:block; max-width:200px; overflow:hidden; text-overflow:ellipsis; font-size:13px; }
.qr-cell-target { display:block; max-width:260px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:12px; color:var(--text-muted); }
a.qr-cell-target { color:var(--primary); text-decoration:none; }
a.qr-cell-target:hover { text-decoration:underline; }
.qr-history-table .qr-col-actions { text-align:right; }
.qr-history-table .qr-history-actions { flex-wrap:nowrap; }
td.qr-history-empty { text-align:center; padding:32px 15px; color:var(--text-muted); }


/* ═══════════════════════════════════════════════════════════════════
   QR Generator Access Control (admin/qr_access.php) — responsive FIX
   Plain `.data-table` inside `.table-wrap` (same pattern as Departments /
   Employees): on phones it scrolls sideways inside its own card with the
   Actions column pinned to the right; on tablets it fits the card.
   ═══════════════════════════════════════════════════════════════════ */
.qr-access-user-name { display: block; font-weight: 700; }
.qr-access-user-email,
.qr-access-reason { display: block; margin-top: 2px; font-size: .78rem; }
.qr-access-source .badge { vertical-align: middle; white-space: nowrap; }
.qr-access-table td.actions > form { display: inline-flex; margin: 0 2px; }

/* Tablet: fit the card — wrap the long text columns instead of scrolling */
@media (min-width: 768px) and (max-width: 991.98px) {
    .qr-access-wrap { padding: 16px; }
    .qr-access-table { min-width: 0 !important; }
    .qr-access-table th,
    .qr-access-table td { white-space: normal; padding: 10px; }
    .qr-access-wrap .qr-access-table:not(.table-card) td.actions,
    .qr-access-wrap .qr-access-table:not(.table-card) th:last-child {
        width: 1% !important; min-width: 0 !important; max-width: none !important;
        white-space: nowrap;
    }
    .qr-access-table .qr-access-user-email,
    .qr-access-table .qr-access-reason { max-width: 240px; overflow-wrap: anywhere; }
}

/* Phones: real table, scrolls inside the card, Actions pinned right */
@media (max-width: 767.98px) {
    .qr-access-wrap.table-wrap.card { padding: 0; overflow-x: auto !important; -webkit-overflow-scrolling: touch; }
    .qr-access-table { min-width: 820px; }
    .qr-access-table .qr-access-reason { max-width: 280px; white-space: normal; }
    .qr-access-wrap .qr-access-table:not(.table-card) td.actions,
    .qr-access-wrap .qr-access-table:not(.table-card) th:last-child {
        position: sticky; right: 0; z-index: 3;
        width: 1% !important; min-width: 0 !important; max-width: none !important;
        text-align: right !important;
        box-shadow: -8px 0 8px -8px rgba(0, 0, 0, .18);
    }
    .qr-access-wrap .qr-access-table:not(.table-card) td.actions { background: var(--surface); }
    .qr-access-wrap .qr-access-table:not(.table-card) th:last-child { background: var(--surface-alt); }
}

/* S40 patch — edit mode banner */
.qr-edit-banner {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    margin: 0 0 16px; padding: 12px 16px;
    background: var(--surface); color: var(--text);
    border: 1px solid var(--primary); border-left-width: 4px; border-radius: 12px;
    box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 6px 16px rgba(0,0,0,.06);
}
.qr-edit-banner[hidden] { display: none; }
.qr-edit-banner-text { display: flex; align-items: center; gap: 8px; min-width: 0; overflow-wrap: anywhere; }
.qr-edit-banner-text svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--primary); }
