.dw-converters {
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100%;
  min-height: 0;
  color: var(--text);
  font-size: 12px;
}

.dw-converters-tabs {
  display: flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-muted);
  align-self: flex-start;
}

.dw-converters-tabs button {
  padding: 3px 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease;
}

.dw-converters-tabs button.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px color-mix(in srgb, var(--text) 12%, transparent);
}

.dw-unit-category-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-muted);
}

.dw-unit-category-tabs button {
  min-width: 0;
  padding: 5px 6px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease;
}

.dw-unit-category-tabs button.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px color-mix(in srgb, var(--text) 12%, transparent);
}

.dw-converter-panel {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}

.dw-image-tab-panel {
  flex: 1 1 auto;
  min-height: 0;
}

.dw-image-tab-panel[hidden] {
  display: none;
}

.dw-image-converter {
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100%;
  min-height: 0;
  overflow: auto;
}

.dw-image-empty,
.dw-image-choose {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 62px;
  color: var(--text-muted);
}

.dw-image-choose {
  width: 100%;
  border: 1px dashed var(--border-strong);
  background: var(--surface-muted);
}

.dw-image-source {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-muted);
}

.dw-image-source img {
  width: 42px;
  height: 34px;
  border-radius: 4px;
  object-fit: cover;
  background: var(--surface);
}

.dw-image-source div {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.dw-image-source strong,
.dw-image-source span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dw-image-source strong {
  font-size: 11px;
}

.dw-image-source span,
.dw-image-lossless {
  color: var(--text-muted);
  font-size: 10px;
}

.dw-image-options {
  display: grid;
  grid-template-columns: minmax(100px, 0.7fr) minmax(0, 1.3fr);
  gap: 8px;
  align-items: end;
}

.dw-image-options label,
.dw-image-dimensions label,
.dw-image-percentage label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  color: var(--text-muted);
  font-size: 10px;
}

.dw-image-options select,
.dw-image-dimensions input,
.dw-image-percentage input {
  min-width: 0;
  width: 100%;
  padding: 5px 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.dw-image-quality input {
  width: 100%;
  accent-color: var(--accent);
}

.dw-image-lossless {
  align-self: center;
}

.dw-image-resize-modes,
.dw-image-presets {
  display: flex;
  gap: 2px;
}

.dw-image-resize-modes {
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-muted);
}

.dw-image-resize-modes button,
.dw-image-presets button {
  flex: 1 1 0;
  min-width: 0;
  padding: 4px 6px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  cursor: pointer;
}

.dw-image-resize-modes button.is-active,
.dw-image-presets button.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px color-mix(in srgb, var(--text) 12%, transparent);
}

.dw-image-dimensions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px minmax(0, 1fr);
  gap: 5px;
  align-items: end;
}

.dw-image-dimensions > button {
  margin-bottom: 2px;
}

.dw-image-percentage {
  display: grid;
  grid-template-columns: minmax(72px, 0.45fr) minmax(0, 1.55fr);
  gap: 7px;
  align-items: end;
}

.dw-image-percentage label > div {
  display: flex;
  align-items: center;
  gap: 4px;
}

.dw-image-percentage label > div span {
  color: var(--text-muted);
}

.dw-image-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  color: var(--text-muted);
  font-size: 10px;
}

.dw-image-footer > span {
  min-width: 0;
}

.dw-image-footer > span.is-error {
  color: var(--red);
}

.dw-image-footer button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
  white-space: nowrap;
}

.dw-converter-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dw-converter-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(88px, auto);
  gap: 6px;
  align-items: stretch;
}

.dw-converter-panel input,
.dw-converter-panel select {
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.dw-converter-panel input {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
}

.dw-currency-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  color: var(--text-muted);
  font-size: 10px;
}

.dw-currency-footer button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.dw-currency-spin {
  animation: dw-currency-spin 720ms linear infinite;
}

@keyframes dw-currency-spin {
  to {
    transform: rotate(360deg);
  }
}
