.sqrg-shell {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
}

.sqrg-main {
  display: grid;
  grid-template-columns: minmax(300px, 420px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.sqrg-builder {
  background: #f4f8ff;
  border: 1px solid rgba(17, 68, 146, 0.14);
  border-radius: 16px;
  padding: 16px;
  box-sizing: border-box;
}

.sqrg-builder-title {
  margin: 0 0 12px;
  font-size: 18px;
  line-height: 1.2;
}

.sqrg-field {
  display: block;
  margin-bottom: 10px;
}

.sqrg-field-label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
}

.sqrg-field input {
  width: 100%;
  border: 1px solid rgba(17, 68, 146, 0.24);
  border-radius: 10px;
  background: #ffffff;
  padding: 10px 12px;
  font-size: 14px;
  box-sizing: border-box;
}

.sqrg-logo-choice {
  width: 100%;
  border: 1px solid rgba(17, 68, 146, 0.24);
  border-radius: 10px;
  background: #ffffff;
  padding: 10px 12px;
  font-size: 14px;
  box-sizing: border-box;
}

.sqrg-builder-actions {
  margin-top: 6px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.sqrg-btn-primary,
.sqrg-btn-secondary {
  border: 1px solid rgba(17, 68, 146, 0.2);
  border-radius: 10px;
  padding: 10px 12px;
  line-height: 1;
  font-weight: 600;
  cursor: pointer;
}

.sqrg-btn-primary {
  color: #ffffff;
  background: #114492;
  border-color: #114492;
}

.sqrg-btn-secondary {
  color: #114492;
  background: #ffffff;
}

.sqrg-status {
  min-height: 18px;
  margin: 10px 0 0;
  font-size: 12px;
}

.sqrg-status.is-loading {
  color: #4f5f72;
}

.sqrg-status.is-ok {
  color: #0b7a4a;
}

.sqrg-status.is-error {
  color: #b42318;
}

.sqrg-preview {
  min-width: 0;
}

.sqrg-card {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  background: transparent;
  border-radius: 0;
  padding: 0;
  box-sizing: border-box;
}

.sqrg-export {
  width: 100%;
}

.sqrg-qr-shell {
  background: #ffffff;
  border-radius: 18px;
  padding: 10px;
  box-sizing: border-box;
}

.sqrg-qr-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
}

.sqrg-canvas {
  width: 100%;
  height: 100%;
}

.sqrg-canvas canvas,
.sqrg-canvas svg,
.sqrg-canvas img {
  display: block;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
}

.sqrg-center-stack {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: var(--sqrg-center-size, 21%);
  aspect-ratio: 1 / 1;
  border: var(--sqrg-center-ring-width, 4px) solid var(--sqrg-center-ring-color, #114492);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  overflow: hidden;
}

.sqrg-center-stack.is-clear {
  background: var(--sqrg-center-bg, #fff);
}

.sqrg-center-stack.is-hidden {
  display: none;
}

.sqrg-center-stack.is-no-ring {
  border-width: 0;
}

.sqrg-center-logo {
  width: calc(100% - (var(--sqrg-logo-inset, 9%) * 2));
  height: calc(100% - (var(--sqrg-logo-inset, 9%) * 2));
  object-fit: var(--sqrg-logo-fit, cover);
  border-radius: inherit;
  z-index: 1;
}

.sqrg-center-logo.is-empty {
  display: none;
}

.sqrg-center-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  z-index: 2;
  pointer-events: none;
}

.sqrg-center-stack.has-frame .sqrg-center-logo {
  width: calc(100% - (var(--sqrg-logo-inset, 0%) * 2));
  height: calc(100% - (var(--sqrg-logo-inset, 0%) * 2));
  border-radius: inherit;
}

.sqrg-center-frame-tint {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: var(--sqrg-frame-tint, transparent);
  opacity: var(--sqrg-frame-tint-opacity, 0);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

.sqrg-footer {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  background: #114492;
  color: #fff;
  padding: 14px;
  border-radius: 0 0 18px 18px;
}

.sqrg-footer-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  line-height: 1;
}

.sqrg-footer-text {
  min-width: 0;
  word-break: break-word;
  font-size: clamp(18px, 2.4vw, 36px);
  font-weight: 600;
  line-height: 1.15;
}

.sqrg-download {
  margin: 12px auto 0;
  width: 100%;
  max-width: 100%;
  border: 0;
  border-radius: 12px;
  background: #114492;
  color: #ffffff;
  padding: 11px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform .16s ease, opacity .16s ease;
}

.sqrg-download.is-loading {
  opacity: .7;
  cursor: progress;
}

.sqrg-download:hover {
  opacity: .92;
}

.sqrg-download:active {
  transform: translateY(1px) scale(.995);
}

.sqrg-download-icon,
.sqrg-download-icon i,
.sqrg-download-icon svg {
  width: 1em;
  height: 1em;
  line-height: 1;
}

.sqrg-history {
  margin-top: 18px;
  background: #eef3fa;
  border: 1px solid rgba(17, 68, 146, 0.14);
  border-radius: 16px;
  padding: 14px;
  box-sizing: border-box;
}

.sqrg-history-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 360px);
  align-items: center;
  gap: 10px;
}

.sqrg-history-title {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
}

.sqrg-history-search {
  width: 100%;
  border: 1px solid rgba(17, 68, 146, 0.24);
  border-radius: 10px;
  background: #ffffff;
  padding: 9px 11px;
  font-size: 14px;
  box-sizing: border-box;
}

.sqrg-history-grid {
  --sqrg-history-item-width: 260px;
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--sqrg-history-item-width), var(--sqrg-history-item-width)));
  gap: 10px;
  justify-content: start;
}

.sqrg-history-empty {
  margin: 12px 0 0;
  font-size: 13px;
  color: rgba(36, 44, 56, .8);
}

.sqrg-history-item {
  min-height: 400px;
  border: 1px solid rgba(17, 68, 146, 0.12);
  border-radius: 12px;
  background: #ffffff;
  padding: 10px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

.sqrg-history-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  object-fit: contain;
  background: #eff4fb;
  border: 1px solid rgba(17, 68, 146, 0.1);
}

.sqrg-history-item-title {
  margin: 8px 0 0;
  font-size: 14px;
  line-height: 1.25;
}

.sqrg-history-item-date,
.sqrg-history-item-url {
  margin: 5px 0 0;
  font-size: 12px;
  color: rgba(39, 46, 59, .8);
  word-break: break-word;
}

.sqrg-history-item-actions {
  margin-top: auto;
  padding-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sqrg-mini-btn {
  border: 1px solid rgba(17, 68, 146, 0.2);
  border-radius: 8px;
  background: #ffffff;
  color: #114492;
  padding: 8px 10px;
  line-height: 1;
  font-size: 12px;
  cursor: pointer;
  text-decoration: none;
}

.sqrg-mini-btn.is-link {
  background: #114492;
  border-color: #114492;
  color: #ffffff;
}

@media (max-width: 1024px) {
  .sqrg-main {
    grid-template-columns: 1fr;
  }

  .sqrg-builder {
    order: 1;
  }

  .sqrg-preview {
    order: 2;
  }
}

@media (max-width: 767px) {
  .sqrg-builder-actions {
    grid-template-columns: 1fr;
  }

  .sqrg-history-head {
    grid-template-columns: 1fr;
  }

  .sqrg-history-grid {
    --sqrg-history-item-width: 100%;
    grid-template-columns: 1fr;
  }

  .sqrg-card {
    border-radius: 16px;
    padding: 8px;
  }

  .sqrg-qr-shell {
    border-radius: 12px;
    padding: 7px;
  }

  .sqrg-footer {
    margin-top: 8px;
    gap: 8px;
    padding: 10px;
  }
}
