#tab-numberplate-creator {
  height: 100%;
}

.numberplate-studio-panel {
  gap: 16px;
  height: 100%;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
  --studio-content-height: calc(100dvh - 190px);
}

.numberplate-studio {
  display: grid;
  grid-template-columns: minmax(320px, 380px) minmax(360px, 1fr) minmax(320px, 420px);
  gap: 14px;
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
  overflow: hidden;
}

.numberplate-template-rail,
.numberplate-studio-preview,
.numberplate-studio-editor {
  min-width: 0;
  border: var(--border-width) solid var(--line-soft);
  background: rgba(255, 255, 255, 0.025);
}

.numberplate-template-rail,
.numberplate-studio-editor {
  padding: 12px;
  overflow: auto;
}

.numberplate-studio-preview {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
  padding: 12px;
}

.numberplate-studio-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.numberplate-template-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  max-height: calc(var(--studio-content-height) - 122px);
  overflow: auto;
}

.numberplate-template-item {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 10px;
  border: var(--border-width) solid var(--line-soft);
  background: rgba(255, 255, 255, 0.025);
  text-align: left;
}

.numberplate-template-thumb {
  width: 82px;
  aspect-ratio: 1 / 1;
  border: var(--border-width) solid var(--line-soft);
  background: #0c0f14;
  object-fit: contain;
}

.numberplate-template-copy {
  display: grid;
  gap: 4px;
  min-width: 0;

  strong,
  span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  strong {
    color: var(--accent-3);
    font-size: 17px;
  }
}

.numberplate-template-item.active {
  border-color: var(--accent);
  background: rgba(23, 195, 178, 0.08);
}

.numberplate-template-item span,
.numberplate-template-empty,
.numberplate-studio-status {
  color: var(--muted);
  font-size: 13px;
}

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

.numberplate-template-actions button:first-child {
  grid-column: 1 / -1;
}

.numberplate-template-download {
  grid-column: 1 / -1;
}

.numberplate-studio-actions .primary {
  grid-column: 1 / -1;
}

.numberplate-studio-actions button {
  grid-column: 1 / -1;
}

.numberplate-template-save-pulse {
  animation: numberplate-template-save-pulse 1.25s ease-in-out infinite;
}

@keyframes numberplate-template-save-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(255, 202, 82, 0.5);
  }

  50% {
    box-shadow: 0 0 0 4px rgba(255, 202, 82, 0.16);
  }
}

.numberplate-preview-stage {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  align-content: start;
  gap: 12px;
  min-height: 0;
  overflow: auto;
  padding: 12px;
}

.numberplate-preview-card {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.numberplate-preview-card h2 {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.numberplate-studio-canvas {
  width: min(100%, 230px);
  justify-self: center;
  aspect-ratio: 1 / 1;
  border: var(--border-width) solid var(--line);
  background: #0c0f14;
}

.numberplate-editor-grid,
.numberplate-text-controls,
.numberplate-color-controls {
  display: grid;
  gap: 10px;
}

.numberplate-editor-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.numberplate-editor-grid label,
.numberplate-text-controls label,
.numberplate-color-controls label {
  min-width: 0;
}

.numberplate-editor-grid select,
.numberplate-editor-grid input,
.numberplate-text-controls input,
.numberplate-color-controls input {
  width: 100%;
}

.numberplate-editor-grid label button {
  width: 100%;
  margin-top: 6px;
}

.numberplate-field-status {
  display: block;
  min-height: 18px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.numberplate-field-status.is-ok {
  color: #92e5bb;
}

.numberplate-field-status.is-warning {
  color: #ffe7a3;
}

.numberplate-field-status.is-error {
  color: #ff9da3;
}

.numberplate-font-source {
  gap: 6px;
}

.numberplate-editor-grid label select[data-numberplate-base-source] {
  margin-top: 8px;
}

.numberplate-editor-grid label:nth-child(n + 3),
.numberplate-editor-grid label:nth-child(6) {
  grid-column: 1 / -1;
}

.numberplate-workflow-note,
.numberplate-advanced-bases {
  grid-column: 1 / -1;
}

.numberplate-workflow-note {
  padding: 10px;
  border: var(--border-width) solid var(--line-soft);
  color: var(--muted);
  font-size: 13px;
  background: rgba(255, 255, 255, 0.025);
}

.numberplate-advanced-bases {
  border: var(--border-width) solid var(--line-soft);
  background: rgba(255, 255, 255, 0.018);
}

.numberplate-advanced-bases summary {
  cursor: pointer;
  padding: 10px;
  color: var(--muted);
  font-size: 13px;
}

.numberplate-advanced-base-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 0 10px 10px;
}

.numberplate-advanced-base-grid label {
  grid-column: auto;
}

.numberplate-text-controls {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 14px;
}

.numberplate-color-controls {
  grid-template-columns: minmax(0, 1fr) 120px;
  margin-top: 10px;
}

.numberplate-color-controls input[type="color"] {
  min-height: 36px;
  padding: 2px;
}

#numberplateTemplateSummary {
  margin-top: 12px;
  min-height: 150px;
  max-height: min(26dvh, 240px);
}

@media (max-width: 1280px) {
  .numberplate-studio {
    grid-template-columns: 320px minmax(0, 1fr);
    align-content: start;
    overflow: auto;
  }

  .numberplate-studio-editor {
    grid-column: 1 / -1;
    overflow: visible;
  }
}
