/* Widgets workspace */
.widgets-content {
  box-sizing: border-box;
  min-height: calc(100vh - 104px);
  padding: 8px clamp(18px, 3vw, 42px) 36px;
}
.widgets-content:has(#widget-config-view:not([hidden])) { padding-top: 0; }

.widgets-content[hidden],
.widget-create-view[hidden],
.widgets-home[hidden] { display: none; }

.widgets-home,
.widget-create-view { width: min(1280px, 100%); margin: 0 auto; }

.widgets-toolbar-row { display: flex; flex-direction: row-reverse; align-items: center; justify-content: space-between; gap: 16px; margin: 4px 0 18px; }
.widgets-section-heading { display: flex; min-width: 0; align-items: center; justify-content: space-between; margin: 0; }
.widgets-section-heading h2,
.widget-create-heading h2 { margin: 0; color: #edf2f5; font: 650 17px/1.3 Inter, "Helvetica Neue", Arial, sans-serif; letter-spacing: -.02em; }

.widgets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr));
  gap: 14px;
}

.widgets-empty {
  box-sizing: border-box;
  display: flex;
  min-height: 290px;
  grid-column: 1 / -1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 30px 20px;
  border: 1px dashed #424a52;
  border-radius: 15px;
  background: rgba(255,255,255,.012);
  color: #9ba6af;
  text-align: center;
}

.widgets-empty-icon {
  display: grid;
  width: 56px;
  height: 56px;
  margin-bottom: 3px;
  border: 1px solid rgba(93,204,219,.2);
  border-radius: 17px;
  background: rgba(46,166,183,.09);
  color: #79ced9;
  font-size: 20px;
  place-items: center;
}

.widgets-empty strong { color: #e5ebef; font: 600 13px/1.35 Inter, "Helvetica Neue", Arial, sans-serif; }
.widgets-empty p { max-width: 270px; margin: 0; color: #929da7; font: 400 11px/1.5 Inter, "Helvetica Neue", Arial, sans-serif; }

.widgets-header-actions { display: flex; align-items: center; gap: 8px; }
.widgets-header-actions[hidden] { display: none; }
.widget-header-button {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid #424a52;
  border-radius: 9px;
  background: #252a2f;
  color: #cbd4da;
  cursor: pointer;
  font: 550 11px/1 Inter, "Helvetica Neue", Arial, sans-serif;
  white-space: nowrap;
  transition: border-color .16s ease, background .16s ease, color .16s ease, transform .16s ease;
}
.widget-create-button { border-color: #3099a8; background: linear-gradient(135deg, #198b9c, #147383); color: #f3feff; }
.widget-create-button:hover { transform: translateY(-1px); filter: brightness(1.1); }
.widget-templates-button:disabled { color: #7e8992; opacity: .62; cursor: not-allowed; }
.widget-header-button:focus-visible,
.widget-back-button:focus-visible,
.widget-type-option:focus-visible { outline: 2px solid #72d3df; outline-offset: 3px; }

.widget-create-toolbar { margin: 0 0 18px; }
.widget-back-button {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid #414951;
  border-radius: 9px;
  background: transparent;
  color: #aeb9c1;
  cursor: pointer;
  font: 500 11px/1 Inter, "Helvetica Neue", Arial, sans-serif;
}
.widget-back-button:hover { border-color: #579ba5; background: rgba(77,176,190,.07); color: #a5e6ec; }
.widget-create-heading { margin-bottom: 18px; }
.widget-create-heading h2 { font-size: 20px; }
.widget-create-heading p { margin: 7px 0 0; color: #9da8b0; font: 400 12px/1.5 Inter, "Helvetica Neue", Arial, sans-serif; }

.widget-type-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.widget-type-option {
  box-sizing: border-box;
  display: flex;
  min-width: 0;
  min-height: 78px;
  align-items: flex-start;
  gap: 11px;
  padding: 13px;
  border: 1px solid #383f46;
  border-radius: 12px;
  background: #22262b;
  color: #72c4d0;
  cursor: pointer;
  text-align: left;
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}
.widget-type-option:hover { transform: translateY(-1px); border-color: #59666e; background: #272d32; }
.widget-type-option.is-selected { border-color: #58b9c8; background: linear-gradient(135deg, rgba(47,151,165,.16), rgba(46,146,160,.06)); box-shadow: inset 0 0 0 1px rgba(91,199,213,.08); }
.widget-type-option > i { flex: none; margin-top: 2px; font-size: 14px; }
.widget-type-option > span { display: grid; min-width: 0; gap: 5px; }
.widget-type-option strong { color: #e9eef1; font: 600 11px/1.25 Inter, "Helvetica Neue", Arial, sans-serif; }
.widget-type-option small { color: #9aa5ae; font: 400 10px/1.4 Inter, "Helvetica Neue", Arial, sans-serif; }

body[data-theme="light"] .widgets-section-heading h2,
body[data-theme="light"] .widget-create-heading h2 { color: #263e4a; }
body[data-theme="light"] .widgets-empty { border-color: #d7e1e5; background: rgba(42,156,179,.018); color: #75858e; }
body[data-theme="light"] .widgets-empty-icon { border-color: rgba(42,156,179,.16); background: rgba(42,156,179,.07); color: #25899a; }
body[data-theme="light"] .widgets-empty strong { color: #405763; }
body[data-theme="light"] .widgets-empty p,
body[data-theme="light"] .widget-create-heading p { color: #788992; }
body[data-theme="light"] .widget-header-button { border-color: #d5e0e4; background: #fff; color: #526874; }
body[data-theme="light"] .widget-create-button { border-color: #278b9b; background: linear-gradient(135deg, #279aaa, #197889); color: #fff; }
body[data-theme="light"] .widget-templates-button:disabled { color: #91a0a8; }
body[data-theme="light"] .widget-back-button { border-color: #d9e2e6; color: #657781; }
body[data-theme="light"] .widget-back-button:hover { border-color: #83c9d3; background: #f1fbfc; color: #287f8d; }
body[data-theme="light"] .widget-type-option { border-color: #e1e7eb; background: #fff; color: #25899a; }
body[data-theme="light"] .widget-type-option:hover { border-color: #b9cbd0; background: #fbfdfd; }
body[data-theme="light"] .widget-type-option.is-selected { border-color: #7ac5d0; background: linear-gradient(135deg, #f0fafb, #f8fcfc); }
body[data-theme="light"] .widget-type-option strong { color: #334b57; }
body[data-theme="light"] .widget-type-option small { color: #788992; }
body[data-theme="light"] .widget-type-option:focus-visible,
body[data-theme="light"] .widget-header-button:focus-visible,
body[data-theme="light"] .widget-back-button:focus-visible { outline-color: #25899a; }

@media (max-width: 980px) { .widget-type-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .widgets-content { min-height: 0; padding: 4px 13px 24px; }
  .side-navigation #nav-widgets,
  .shortcut[data-route-to="nav-widgets"] { display: none; }
  .widgets-toolbar-row { align-items: stretch; flex-direction: column; gap: 13px; margin: 4px 0 16px; }
  .widgets-header-actions { justify-content: flex-start; }
  .widget-type-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
}
@media (max-width: 420px) {
  .widget-type-grid { grid-template-columns: minmax(0, 1fr); }
  .widget-type-option { min-height: 68px; }
  .widget-header-button { min-height: 34px; padding: 0 9px; font-size: 10px; }
  .widgets-grid { grid-template-columns: minmax(0, 1fr); }
}


/* Widget setup and live QR preview */
.widget-config-view[hidden],
.qrcode-settings[hidden],
.widget-pending-config[hidden],
.widget-advance-button[hidden],
.qrcode-position-field[hidden],
.qrcode-preview-title[hidden],
.qrcode-preview-description[hidden] { display: none; }

.widget-type-footer { display: flex; justify-content: flex-end; margin-top: 18px; }
.widget-advance-button,
.qrcode-save-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 17px;
  border: 1px solid #3197a6;
  border-radius: 10px;
  background: linear-gradient(135deg, #198b9c, #147383);
  color: #f2feff;
  cursor: pointer;
  font: 600 12px/1 Inter, "Helvetica Neue", Arial, sans-serif;
  box-shadow: 0 7px 18px rgba(7,107,122,.17);
  transition: transform .15s ease, filter .15s ease;
}
.widget-advance-button:hover,
.qrcode-save-button:hover { transform: translateY(-1px); filter: brightness(1.1); }
.widget-advance-button:focus-visible,
.qrcode-save-button:focus-visible { outline: 2px solid #72d3df; outline-offset: 3px; }
.widget-config-toolbar { width: min(1280px, 100%); margin: 0 auto 8px; }

.qrcode-settings { width: min(1280px, 100%); margin: 0 auto; }
.qrcode-config-layout { --qrcode-settings-panel-height: max(360px, calc(100vh - 150px)); display: grid; grid-template-columns: minmax(0, .9fr) minmax(360px, 1.1fr); align-items: start; gap: 18px; }
.qrcode-settings-form,
.qrcode-preview-panel { box-sizing: border-box; min-width: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.qrcode-settings-form { display: grid; height: var(--qrcode-settings-panel-height); min-height: 0; gap: 18px; padding: 4px 8px 4px 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.qrcode-settings-form::-webkit-scrollbar { width: 8px; }
.qrcode-settings-form::-webkit-scrollbar-thumb { border: 2px solid transparent; border-radius: 8px; background: #4a555d; background-clip: padding-box; }
.qrcode-settings-form::-webkit-scrollbar-track { background: transparent; }
.qrcode-field[hidden] { display: none; }
.qrcode-classic-controls[hidden] { display: none; }
.qrcode-classic-controls { display: grid; gap: 12px; padding: 14px; border: 1px solid #343d44; border-radius: 11px; background: rgba(255,255,255,.015); }
.qrcode-control-heading { display: grid; gap: 4px; }
.qrcode-control-heading strong { color: #e0e6eb; font: 600 11px/1.3 Inter,"Helvetica Neue",Arial,sans-serif; }
.qrcode-control-heading small { color: #929da7; font: 400 9px/1.4 Inter,"Helvetica Neue",Arial,sans-serif; }
.qrcode-order-fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.qrcode-order-fieldset legend { margin-bottom: 6px; color: #cbd4d9; font: 550 10px/1.3 Inter,"Helvetica Neue",Arial,sans-serif; }
.qrcode-order-list { display: grid; gap: 5px; margin: 0; padding: 0; list-style: none; }
.qrcode-order-item { display: grid; grid-template-columns: minmax(0,1fr) 25px auto; align-items: center; gap: 8px; min-height: 34px; padding: 4px 6px 4px 10px; border: 1px solid #39424a; border-radius: 8px; background: #1c2024; color: #dbe3e8; font: 500 10px/1.3 Inter,"Helvetica Neue",Arial,sans-serif; }
.qrcode-order-item > small { color: #87949d; font-size: 9px; }
.qrcode-order-actions { display: flex; gap: 4px; }
.qrcode-order-button { display: grid; width: 25px; height: 25px; padding: 0; border: 1px solid #414b53; border-radius: 6px; background: #272d32; color: #afc0c8; place-items: center; cursor: pointer; }
.qrcode-order-button:hover:not(:disabled) { border-color: #55b9c8; color: #80d5df; }
.qrcode-order-button:disabled { opacity: .35; cursor: default; }
.qrcode-typography-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.qrcode-range-field input[type="range"] { height: 20px; padding: 0; accent-color: #42aebd; cursor: pointer; }
.qrcode-range-field > span:first-child { display: flex; align-items: center; justify-content: space-between; gap: 5px; }
.qrcode-range-field output { color: #8fd8df; font: 600 9px/1 Inter,"Helvetica Neue",Arial,sans-serif; }
.qrcode-card-style-field { display: grid; min-width: 0; gap: 8px; margin: 0; padding: 0 0 18px; border: 0; border-bottom: 1px solid rgba(255,255,255,.075); }
.qrcode-card-style-field legend { padding: 0; color: #e0e6eb; font: 600 12px/1.35 Inter, "Helvetica Neue", Arial, sans-serif; }
.qrcode-card-style-field > p { margin: -3px 0 2px; color: #929da7; font: 400 10px/1.4 Inter, "Helvetica Neue", Arial, sans-serif; }
.qrcode-card-style-options { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; }
.qrcode-style-option { position: relative; display: grid; min-width: 0; gap: 9px; padding: 9px; border: 1px solid #3b444b; border-radius: 11px; background: #1d2125; color: inherit; text-align: left; cursor: pointer; transition: border-color .16s ease, background .16s ease; }
.qrcode-style-option:hover { border-color: #65757e; }
.qrcode-style-option.is-selected { border-color: #55b9c8; background: rgba(46,166,183,.08); box-shadow: inset 0 0 0 1px rgba(91,199,213,.08); }
.qrcode-style-option:focus-visible { outline: 2px solid #72d3df; outline-offset: 2px; }
.qrcode-style-option > .fa-circle-check { position: absolute; top: 13px; right: 13px; color: #64c6d3; font-size: 13px; opacity: 0; }
.qrcode-style-option.is-selected > .fa-circle-check { opacity: 1; }
.qrcode-style-preview { box-sizing: border-box; display: flex; min-height: 92px; align-items: center; justify-content: center; gap: 5px; padding: 7px; overflow: hidden; border-radius: 7px; background: #fff; color: #112629; }
.qrcode-style-preview strong { color: #111; font: 700 7px/1.2 Arial,sans-serif; }
.qrcode-style-preview small { color: #354149; font: 400 6px/1.3 Arial,sans-serif; }
.qrcode-style-preview em { color: #00bac8; font: 700 5px/1.2 Arial,sans-serif; font-style: normal; }
.classic-style-preview { flex-direction: column; }
.informative-style-preview { justify-content: flex-start; gap: 8px; }
.informative-style-preview > span:last-child { display: grid; gap: 5px; }
.style-qr { position: relative; display: block; width: 42px; height: 42px; flex: none; background-color: #fff; background-image: repeating-conic-gradient(#102629 0 25%, #fff 0 50%); background-size: 8px 8px; }
.style-qr::before,.style-qr::after { position: absolute; width: 9px; height: 9px; border: 3px solid #102629; background: #fff; content: ""; }
.style-qr::before { top: 2px; left: 2px; box-shadow: 25px 0 #fff,25px 0 0 3px #102629,0 25px #fff,0 25px 0 3px #102629; }
.style-qr::after { top: 5px; left: 5px; width: 3px; height: 3px; background: #102629; box-shadow: 25px 0 #102629,0 25px #102629; }
.qrcode-style-copy { display: grid; gap: 3px; padding: 0 3px; }
.qrcode-style-copy strong { color: #e7edf0; font: 600 10px/1.2 Inter,"Helvetica Neue",Arial,sans-serif; }
.qrcode-style-copy small { color: #929da7; font: 400 9px/1.35 Inter,"Helvetica Neue",Arial,sans-serif; }
.qrcode-field { display: grid; min-width: 0; gap: 7px; color: #dce4e9; font: 600 12px/1.35 Inter, "Helvetica Neue", Arial, sans-serif; }
.qrcode-field > span:first-child { color: #e0e6eb; }
.qrcode-field > span:first-child small { color: #8c98a2; font: 450 10px/1.2 Inter, "Helvetica Neue", Arial, sans-serif; }
.qrcode-field > small { color: #929da7; font: 400 10px/1.4 Inter, "Helvetica Neue", Arial, sans-serif; }
.qrcode-field input,
.qrcode-field textarea,
.qrcode-field select { box-sizing: border-box; width: 100%; min-width: 0; border: 1px solid #424a53; border-radius: 9px; outline: 0; background: #1c2024; color: #f1f4f6; font: 450 12px/1.5 Inter, "Helvetica Neue", Arial, sans-serif; transition: border-color .16s ease, box-shadow .16s ease, background .16s ease; }
.qrcode-field input,
.qrcode-field select { height: 42px; padding: 0 12px; }
.qrcode-field textarea { min-height: 82px; padding: 10px 12px; resize: vertical; }
.qrcode-field input::placeholder,
.qrcode-field textarea::placeholder { color: #77838d; }
.qrcode-field input:focus,
.qrcode-field textarea:focus,
.qrcode-field select:focus { border-color: #54b9c8; background: #20262a; box-shadow: 0 0 0 3px rgba(77,189,205,.13); }
.qrcode-select-wrap { position: relative; display: block; }
.qrcode-select-wrap select { padding-right: 34px; appearance: none; cursor: pointer; }
.qrcode-select-wrap > i { position: absolute; top: 50%; right: 13px; transform: translateY(-50%); color: #a2b0b8; font-size: 9px; pointer-events: none; }
.qrcode-save-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 1px; padding-top: 16px; border-top: 1px solid rgba(255,255,255,.075); }
.qrcode-save-row p { min-height: 1em; margin: 0; color: #8fd8df; font: 450 10px/1.4 Inter, "Helvetica Neue", Arial, sans-serif; }
.qrcode-save-button { flex: none; }

.qrcode-preview-panel { position: sticky; top: 92px; display: flex; height: var(--qrcode-settings-panel-height); flex-direction: column; justify-content: center; padding: 0; }
.qrcode-preview-stage { box-sizing: border-box; container-type: size; display: grid; flex: 1; min-height: 250px; min-width: 0; margin: 0; padding: 18px; overflow: hidden; border: 1px solid #353b42; border-radius: 12px; background-color: #1b1f23; background-image: linear-gradient(45deg,#24292e 25%,transparent 25%),linear-gradient(-45deg,#24292e 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#24292e 75%),linear-gradient(-45deg,transparent 75%,#24292e 75%); background-position: 0 0,0 8px,8px -8px,-8px 0; background-size: 16px 16px; place-items: center; }
.qrcode-preview-card { box-sizing: border-box; display: flex; width: min(240px, calc(100cqi - 40px), calc((100cqh - 40px) * .75)); max-width: 100%; max-height: calc(100cqh - 36px); aspect-ratio: 3 / 4; flex-direction: column; align-items: center; justify-content: center; gap: clamp(4px, 2cqh, 9px); padding: clamp(8px, 3cqh, 15px); overflow: auto; border: 1px solid #e1e7eb; border-radius: 13px; background: #fff; color: #263b45; box-shadow: 0 15px 32px rgba(0,0,0,.22); text-align: center; scrollbar-width: none; }
.qrcode-preview-card::-webkit-scrollbar { display: none; }
.qrcode-preview-card.is-informative { display: grid; width: min(460px, calc(100cqi - 40px)); min-height: 196px; max-height: calc(100cqh - 36px); aspect-ratio: 2.1 / 1; grid-template-columns: minmax(112px, .78fr) minmax(0, 1.5fr); align-items: center; justify-items: stretch; gap: clamp(24px, 4cqi, 32px); padding: clamp(18px, 4cqi, 28px); border-color: #d7e5e8; border-radius: 20px; background: linear-gradient(135deg, #fff 0%, #f5fbfb 100%); box-shadow: 0 18px 38px rgba(0,0,0,.25), 0 2px 8px rgba(31,92,103,.08); text-align: left; }
.qrcode-preview-card.is-informative .qrcode-image-wrap { order: 0 !important; width: min(100%, 140px); padding: 9px; border: 1px solid #dfebed; border-radius: 15px; background: #fff; box-shadow: 0 8px 20px rgba(27, 61, 72, .1); }
.qrcode-card-copy { order: 1; display: flex; min-width: 0; flex-direction: column; align-items: flex-start; justify-content: center; gap: 10px; }
.qrcode-preview-card.is-informative .qrcode-card-copy > * { order: initial; }
.qrcode-preview-card:not(.is-informative) .qrcode-card-copy { display: contents; }
.qrcode-preview-card:not(.is-informative) .qrcode-card-copy { align-items: center; }
.qrcode-preview-title { max-width: 100%; margin: 0; color: #102b32; font: 750 12px/1.25 Inter, "Helvetica Neue", Arial, sans-serif; letter-spacing: .015em; overflow-wrap: anywhere; }
.qrcode-preview-description { max-width: 100%; margin: 0; color: #526a73; font: 450 10px/1.55 Inter, "Helvetica Neue", Arial, sans-serif; overflow-wrap: anywhere; }
.qrcode-preview-card.description-above .qrcode-preview-description { order: -1; }
.qrcode-preview-url { display: inline-flex; max-width: 100%; box-sizing: border-box; padding: 6px 9px; border: 1px solid #d8eff0; border-radius: 999px; background: #edf8f8; color: #007f8c; font: 700 9px/1.25 Inter, "Helvetica Neue", Arial, sans-serif; overflow-wrap: anywhere; }
.qrcode-image-wrap { position: relative; display: grid; width: min(190px, 74cqi, calc((100cqh - 140px) * .8)); max-width: 100%; aspect-ratio: 1; padding: 3px; border-radius: 8px; background: #fff; place-items: center; }
.qrcode-preview-card [hidden], .qrcode-image-wrap [hidden] { display: none !important; }
.qrcode-preview-card.is-informative .qrcode-image-wrap { width: min(100%, 132px); }
.qrcode-preview-note { color: #87969d; font: 700 7px/1.3 Inter, "Helvetica Neue", Arial, sans-serif; letter-spacing: .1em; }

.widget-pending-config { display: flex; min-height: 300px; flex-direction: column; align-items: center; justify-content: center; padding: 25px; border: 1px dashed #414951; border-radius: 15px; color: #96a2ab; text-align: center; }
.widget-pending-icon { display: grid; width: 48px; height: 48px; margin-bottom: 12px; border: 1px solid rgba(93,204,219,.2); border-radius: 15px; background: rgba(46,166,183,.08); color: #79ced9; place-items: center; }
.widget-pending-config h2 { margin: 0; color: #e9eef1; font: 650 17px/1.3 Inter, "Helvetica Neue", Arial, sans-serif; }
.widget-pending-config p { margin: 7px 0 0; font: 400 11px/1.5 Inter, "Helvetica Neue", Arial, sans-serif; }

.widget-saved-card { min-width: 0; padding: 16px; border: 1px solid #383f46; border-radius: 13px; background: #22262b; }
.widget-saved-top { display: flex; align-items: center; gap: 9px; color: #9ba7af; font: 500 10px/1.3 Inter, "Helvetica Neue", Arial, sans-serif; }
.widget-saved-icon { display: grid; width: 28px; height: 28px; border-radius: 8px; background: rgba(46,166,183,.1); color: #79ced9; place-items: center; }
.widget-saved-card h3 { margin: 13px 0 5px; color: #edf2f5; font: 650 13px/1.35 Inter, "Helvetica Neue", Arial, sans-serif; overflow-wrap: anywhere; }
.widget-saved-card p { margin: 0; color: #99a5ae; font: 400 10px/1.45 Inter, "Helvetica Neue", Arial, sans-serif; overflow-wrap: anywhere; }

body[data-theme="light"] .widget-pending-config h2,
body[data-theme="light"] .widget-saved-card h3 { color: #263e4a; }
body[data-theme="light"] .widget-saved-card { border-color: #e1e7eb; background: #fff; box-shadow: 0 8px 24px rgba(20,42,54,.04); }
body[data-theme="light"] .qrcode-field,
body[data-theme="light"] .qrcode-field > span:first-child,
body[data-theme="light"] .qrcode-card-style-field legend { color: #344b57; }
body[data-theme="light"] .qrcode-field > span:first-child small,
body[data-theme="light"] .qrcode-field > small { color: #83929a; }
body[data-theme="light"] .qrcode-field input,
body[data-theme="light"] .qrcode-field textarea,
body[data-theme="light"] .qrcode-field select { border-color: #dce4e8; background: #fbfcfd; color: #233b48; }
body[data-theme="light"] .qrcode-field input:focus,
body[data-theme="light"] .qrcode-field textarea:focus,
body[data-theme="light"] .qrcode-field select:focus { border-color: #53b4c3; background: #fff; }
body[data-theme="light"] .qrcode-save-row { border-color: #e8edef; }
body[data-theme="light"] .qrcode-card-style-field { border-color: #e8edef; }
body[data-theme="light"] .qrcode-card-style-field > p { color: #83929a; }
body[data-theme="light"] .qrcode-classic-controls { border-color: #dce4e8; background: #fbfcfd; }
body[data-theme="light"] .qrcode-control-heading strong,
body[data-theme="light"] .qrcode-order-fieldset legend { color: #344b57; }
body[data-theme="light"] .qrcode-control-heading small { color: #83929a; }
body[data-theme="light"] .qrcode-order-item { border-color: #dce4e8; background: #fff; color: #344b57; }
body[data-theme="light"] .qrcode-order-button { border-color: #dce4e8; background: #f5f8f9; color: #61737d; }
body[data-theme="light"] .qrcode-style-option { border-color: #dce4e8; background: #fbfcfd; }
body[data-theme="light"] .qrcode-style-option.is-selected { border-color: #7ac5d0; background: #f0fafb; }
body[data-theme="light"] .qrcode-style-copy strong { color: #334b57; }
body[data-theme="light"] .qrcode-style-copy small { color: #788992; }
body[data-theme="light"] .qrcode-preview-stage { border-color: #e3e9ec; background-color: #f0f3f4; background-image: linear-gradient(45deg,#e5e9ea 25%,transparent 25%),linear-gradient(-45deg,#e5e9ea 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#e5e9ea 75%),linear-gradient(-45deg,transparent 75%,#e5e9ea 75%); }
body[data-theme="light"] .widget-pending-config { border-color: #d7e1e5; color: #788992; }
body[data-theme="light"] .widget-saved-top,
body[data-theme="light"] .widget-saved-card p { color: #71818a; }
body[data-theme="light"] .qrcode-save-button:focus-visible,
body[data-theme="light"] .widget-advance-button:focus-visible { outline-color: #25899a; }

@media (max-width: 900px) {
  .qrcode-config-layout { grid-template-columns: minmax(0,1fr); }
  .qrcode-preview-panel { position: static; height: auto; order: -1; }
  .qrcode-settings-form { height: auto; overflow: visible; scrollbar-gutter: auto; }
  .qrcode-preview-stage { min-height: 300px; }
}
@media (max-width: 560px) {
  .qrcode-config-layout { gap: 12px; }
  .qrcode-preview-panel { padding: 13px; }
  .qrcode-preview-stage { min-height: 300px; padding: 10px; }
  .qrcode-preview-card.is-informative { min-height: 0; grid-template-columns: minmax(76px, .7fr) minmax(0, 1.5fr); gap: 18px; padding: 12px; border-radius: 15px; }
  .qrcode-preview-card.is-informative .qrcode-image-wrap { width: min(100%, 84px); padding: 5px; border-radius: 10px; }
  .qrcode-preview-card.is-informative .qrcode-card-copy { gap: 7px; }
  .qrcode-settings-form { gap: 15px; padding: 16px; }
  .qrcode-save-row { align-items: stretch; flex-direction: column; }
  .qrcode-save-button { width: 100%; }
  .widget-type-footer { margin-top: 14px; }
  .widget-advance-button { width: 100%; }
}

/* Smooth unified scrolling on Widgets workspace (never trap scroll on .main-panel or .widgets-content) */
body.widgets-active .main-panel {
  overflow-x: hidden;
  overflow-y: auto;
}

body.widgets-active .widgets-content {
  height: auto;
  min-height: calc(100dvh - 84px);
  overflow: visible;
  padding-bottom: 56px;
}

body.widgets-active .widgets-home,
body.widgets-active .widget-create-view,
body.widgets-active .widget-config-view {
  height: auto;
  min-height: 0;
  overflow: visible;
}

.widgets-section-heading {
  margin: 0;
}

.widgets-empty {
  min-height: min(360px, calc(100dvh - 220px));
  border-color: rgba(115, 132, 146, .35);
  background: radial-gradient(ellipse at 50% 15%, rgba(50, 170, 187, .08), transparent 58%), rgba(255,255,255,.012);
}

.widget-config-view {
  height: auto;
  min-height: 0;
  overflow: visible;
}

.widget-config-toolbar { margin-bottom: 12px; }

.qrcode-settings {
  height: auto;
  min-height: 0;
  overflow: visible;
}

.qrcode-config-layout {
  height: auto;
  min-height: 0;
  align-items: start;
}

.qrcode-preview-panel {
  position: sticky;
  top: 84px;
  height: auto;
  min-height: 0;
  align-self: start;
}

.qrcode-preview-stage {
  container-type: inline-size;
  min-height: 360px;
  height: auto;
  padding: 28px 20px;
}

.qrcode-preview-card { overflow: visible; }

.qrcode-settings-form {
  height: auto;
  min-height: 0;
  overflow: visible;
  scrollbar-gutter: auto;
}

@media (max-width: 900px) {
  body.widgets-active .widgets-content {
    height: auto;
    padding: 4px 13px 40px;
  }

  body.widgets-active .qrcode-settings { height: auto; }

  body.widgets-active .qrcode-config-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto;
    gap: 16px;
  }

  body.widgets-active .qrcode-preview-panel {
    position: static;
    height: auto;
    min-height: 0;
    order: -1;
  }

  body.widgets-active .qrcode-preview-stage { min-height: 300px; }

  body.widgets-active .qrcode-settings-form {
    height: auto;
    overflow: visible;
    scrollbar-gutter: auto;
  }
}

@media (max-width: 560px) {
  body.widgets-active .widgets-content { padding-right: 13px; padding-left: 13px; }
  body.widgets-active .qrcode-preview-stage { padding: 18px 12px; min-height: 280px; }
  body.widgets-active .qrcode-preview-card.is-informative { min-height: 0; grid-template-columns: minmax(76px, .7fr) minmax(0, 1.5fr); gap: 18px; padding: 12px; }
  body.widgets-active .qrcode-preview-card.is-informative .qrcode-image-wrap { width: min(100%, 84px); padding: 5px; }
  body.widgets-active .qrcode-settings-form { padding: 0 0 24px; }
}
