/* Select Tool modal — NIIMBOT label designer / print */

.nw-st-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-page, #f2f5f7);
}

.nw-st-page__topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--header-height, 56px);
  padding: 0 1rem;
  background: var(--bg-header, #fff);
  border-bottom: 1px solid var(--border, #d9dee3);
  box-shadow: var(--shadow, 0 1px 3px rgba(0, 0, 0, 0.08));
}

.nw-st-page__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text, #1a1a1a);
}

.nw-st-page__topbar a {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.85rem;
}

.nw-st-page__topbar a:hover {
  text-decoration: underline;
}

.nw-st-page__main {
  flex: 1;
  padding: 1rem 1.25rem 2rem;
  max-width: 40rem;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.nw-st-page__lead {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  color: var(--text-muted, #5c5c5c);
  line-height: 1.45;
}

.nw-st-page__status {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-muted, #5c5c5c);
}

.nw-st-page__denied {
  margin: 0;
  padding: 0.85rem 1rem;
  border-radius: var(--radius, 8px);
  border: 1px solid var(--border, #d9dee3);
  background: var(--bg-card, #fff);
  color: var(--text, #1a1a1a);
  font-size: 0.88rem;
  line-height: 1.45;
}

html[data-nw-select-tool-page="1"] .nw-st-overlay {
  /* Vollseite: Modal ohne zusätzlichen Seitenhintergrund */
  background: rgba(0, 0, 0, 0.45);
}

.nw-st-scanner-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.nw-st-scanner-link:hover {
  text-decoration: underline;
}

.nw-st-overlay {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 1.5rem 1rem 2rem;
  overflow: auto;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
}

.nw-st-overlay[hidden] {
  display: none !important;
}

.nw-st-dialog {
  width: min(920px, 100%);
  max-height: min(92vh, 900px);
  display: flex;
  flex-direction: column;
  margin-top: 0.5rem;
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.nw-st-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.nw-st-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.nw-st-close {
  flex-shrink: 0;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  cursor: pointer;
  font-size: 0.85rem;
}

.nw-st-close:hover {
  border-color: var(--accent);
}

.nw-st-tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.5rem 1rem 0;
  border-bottom: 1px solid var(--border);
}

.nw-st-tab {
  padding: 0.45rem 0.85rem;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
}

.nw-st-tab:hover {
  color: var(--text);
}

.nw-st-tab.is-active {
  color: var(--text);
  background: var(--bg-card);
  border-color: var(--border);
  border-bottom-color: var(--bg-card);
  margin-bottom: -1px;
}

.nw-st-body {
  padding: 1rem;
  overflow: auto;
  flex: 1;
  min-height: 0;
}

.nw-st-panel[hidden] {
  display: none !important;
}

.nw-st-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.nw-st-field--inline-btn {
  display: flex;
  align-items: flex-end;
  padding-bottom: 0.15rem;
}

.nw-st-field--full {
  grid-column: 1 / -1;
}

.nw-st-field__sub {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.7rem;
  line-height: 1.35;
  color: var(--text-muted);
}

.nw-st-field label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.nw-st-field input,
.nw-st-field select,
.nw-st-field textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 0.4rem 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--input-text);
  font-size: 0.85rem;
}

.nw-st-field textarea {
  min-height: 4.5rem;
  font-family: ui-monospace, monospace;
  resize: vertical;
}

.nw-st-preview-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-start;
}

.nw-st-preview-box {
  flex: 0 0 auto;
  padding: 0.5rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg-page);
}

.nw-st-preview-box canvas {
  display: block;
  max-width: 100%;
  height: auto;
  image-rendering: pixelated;
}

.nw-st-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.nw-st-btn {
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
}

.nw-st-btn:hover {
  border-color: var(--accent);
}

.nw-st-btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.nw-st-btn--primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.nw-st-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.nw-st-hw-hint {
  margin-top: -0.35rem;
  margin-bottom: 0.75rem;
}

.nw-st-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0 0 0.75rem;
  line-height: 1.45;
}

.nw-st-layout-hint.nw-st-layout-hint--warn {
  color: var(--danger);
  border-left: 3px solid var(--danger);
  padding-left: 0.65rem;
}

.nw-st-table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
}

.nw-st-table-wrap--wide {
  max-width: 100%;
}

.nw-st-table--elements th,
.nw-st-table--elements td {
  white-space: nowrap;
}

.nw-st-table--elements select {
  min-width: 3.5rem;
  max-width: 5.5rem;
  padding: 0.2rem 0.25rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--input-bg);
  color: var(--input-text);
  font-size: 0.75rem;
}

.nw-st-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.nw-st-table th,
.nw-st-table td {
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.nw-st-table th {
  background: var(--bg-page);
  color: var(--text-muted);
  font-weight: 600;
}

.nw-st-table input {
  width: 100%;
  min-width: 4rem;
  box-sizing: border-box;
  padding: 0.25rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--input-bg);
  color: var(--input-text);
  font-size: 0.8rem;
}

.nw-st-dialog--visual {
  width: min(1080px, 100%);
}

.nw-st-ed-mode {
  display: inline-flex;
  gap: 0.35rem;
  margin-bottom: 0.65rem;
  padding: 0.2rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-page);
}

.nw-st-ed-mode-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  cursor: pointer;
}

.nw-st-ed-mode-btn.is-active {
  background: var(--accent);
  color: #fff;
}

.nw-st-visual-layout {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.nw-st-visual-stage {
  position: relative;
  flex: 1 1 320px;
  max-width: 100%;
  padding: 0.5rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg-page);
  touch-action: none;
  user-select: none;
}

.nw-st-visual-stage canvas {
  display: block;
  max-width: 100%;
  height: auto;
  image-rendering: pixelated;
}

.nw-st-visual-overlay {
  position: absolute;
  left: 0.5rem;
  top: 0.5rem;
  pointer-events: none;
}

.nw-st-visual-el {
  position: absolute;
  box-sizing: border-box;
  border: 2px solid rgba(0, 120, 215, 0.75);
  background: rgba(0, 120, 215, 0.08);
  pointer-events: auto;
  cursor: move;
}

.nw-st-visual-el.is-selected {
  border-color: var(--accent);
  background: rgba(0, 120, 215, 0.14);
  box-shadow: 0 0 0 1px var(--accent);
}

.nw-st-visual-el__label {
  position: absolute;
  left: 2px;
  top: 1px;
  font-size: 9px;
  line-height: 1.2;
  color: var(--accent);
  background: rgba(255, 255, 255, 0.85);
  padding: 0 2px;
  border-radius: 2px;
  max-width: calc(100% - 4px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}

.nw-st-visual-resize {
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 12px;
  height: 12px;
  border-radius: 2px;
  background: var(--accent);
  border: 1px solid #fff;
  cursor: nwse-resize;
  pointer-events: auto;
}

.nw-st-visual-side {
  flex: 0 1 220px;
  min-width: 180px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.nw-st-visual-props {
  padding: 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
}

.nw-st-table .nw-st-btn {
  padding: 0.2rem 0.45rem;
  font-size: 0.75rem;
}

.nw-st-status {
  font-size: 0.8rem;
  color: var(--text-muted);
  min-height: 1.2em;
  margin-top: 0.35rem;
}

.nw-st-status--err {
  color: var(--danger);
}

.nw-st-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 720px) {
  .nw-st-split {
    grid-template-columns: 1fr;
  }
}
