.product-page-head,
.product-list-toolbar,
.product-list-toolbar-left,
.product-list-toolbar-right,
.product-table-summary,
.product-row-actions,
.product-image-actions,
.product-form-actions,
.switch-row {
  display: flex;
  align-items: center;
}

.product-page-head {
  justify-content: space-between;
  gap: 16px;
}

.product-page-head h2 {
  margin: 0;
  color: #6a6f78;
  font-size: 1.15rem;
  letter-spacing: 0.08em;
}

.product-primary-button {
  min-width: 220px;
  background: var(--purple);
}

.product-primary-button:hover {
  background: #4c125e;
}

.product-search-shell {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 18px;
  border: 1px solid rgba(93, 22, 116, 0.08);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.product-search-prefix {
  color: var(--purple);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.product-search-shell input {
  min-height: 54px;
  padding: 0;
  color: #5a5f67;
  background: transparent;
  box-shadow: none;
  font-size: 1rem;
}

.product-search-shell input::placeholder {
  color: #777d87;
  font-style: italic;
}

.product-list-card,
.product-form-card {
  padding: 18px;
}

.product-list-toolbar {
  justify-content: space-between;
  gap: 18px;
}

.product-list-toolbar-left,
.product-list-toolbar-right {
  gap: 12px;
  flex-wrap: wrap;
}

.product-filter-button {
  background: var(--orange);
}

.product-filter-button:hover {
  background: var(--orange-dark);
}

.product-inline-message {
  min-height: 0;
  margin: 0;
}

.product-filters {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.product-filter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 240px));
  gap: 16px;
}

.product-table-summary {
  justify-content: space-between;
  margin: 18px 0 12px;
}

.product-count {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.product-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
}

.product-table {
  width: 100%;
  min-width: 1080px;
  border-collapse: collapse;
}

.product-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  background: #fbfbfd;
  color: #686f78;
  text-align: left;
  white-space: nowrap;
}

.product-table tbody td {
  padding: 14px 12px;
  border-bottom: 1px solid #eef1f5;
  color: #616771;
  vertical-align: middle;
}

.product-table tbody tr:last-child td {
  border-bottom: 0;
}

.product-title-cell strong,
.product-title-cell span {
  display: block;
}

.product-title-cell strong {
  color: #4d5560;
}

.product-title-cell span {
  margin-top: 4px;
  color: #8a919b;
  font-size: 0.84rem;
}

.product-row-inactive td {
  opacity: 0.58;
}

.product-table-empty {
  padding: 26px 16px;
  color: var(--muted);
  text-align: center;
}

.product-row-actions,
.product-form-actions {
  gap: 10px;
  flex-wrap: wrap;
}

/* ── Product editor ─────────────────────────────────── */

.product-editor {
  display: grid;
}

.product-editor-grid {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 24px;
}

.product-image-panel {
  display: grid;
  align-content: start;
  gap: 14px;
}

.product-image-dropzone {
  justify-items: center;
  padding: 8px;
  color: var(--muted);
  text-align: center;
  cursor: pointer;
}

.product-image-preview {
  width: 240px;
  height: 240px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  border: 1px solid rgba(93, 22, 116, 0.08);
  background: #f9f8fb;
}

.product-image-empty {
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.92) 32%, rgba(93, 22, 116, 0.05) 33%),
    linear-gradient(135deg, rgba(93, 22, 116, 0.06), rgba(255, 61, 16, 0.08));
}

.product-image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-image-placeholder-text {
  color: rgba(93, 22, 116, 0.22);
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.product-image-name {
  color: #545a64;
  font-size: 1.02rem;
}

.product-image-note {
  line-height: 1.5;
  color: #7d838d;
  font-weight: 500;
}

.product-image-actions {
  justify-content: center;
}

.product-fields-stack {
  display: grid;
  gap: 18px;
}

.product-top-grid {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr) 360px;
  gap: 16px;
  align-items: start;
}

.product-form-grid {
  display: grid;
  gap: 16px;
}

.product-form-grid-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.product-form-grid-four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

/* ── Input shell / adornments ───────────────────────── */

.input-shell {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 40px;
  border-radius: 5px;
  background: #ffffff;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.12);
  overflow: hidden;
}

.input-shell input {
  min-height: 40px;
  padding: 10px 12px;
  color: var(--purple);
  background: transparent;
  box-shadow: none;
}

.input-adornment {
  padding: 0 12px;
  color: var(--purple);
  font-weight: 700;
}

.currency-shell input,
.percent-shell input {
  text-align: right;
}

.auto-code-shell {
  background: #f4f3f8;
}

.auto-code-shell input {
  color: var(--purple);
  font-weight: 700;
  background: transparent;
}

.auto-badge {
  padding: 0 10px;
  background: var(--purple);
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  border-radius: 0 4px 4px 0;
  align-self: stretch;
  display: flex;
  align-items: center;
}

/* ── Toggle / Switch ────────────────────────────────── */

.toggle-grid {
  display: grid;
  gap: 12px;
}

.switch-field {
  gap: 10px;
  color: var(--purple);
}

.switch-row {
  gap: 10px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.switch {
  position: relative;
  width: 54px;
  height: 30px;
  display: inline-flex;
}

.switch input {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  min-height: 0;
  opacity: 0;
  cursor: pointer;
  box-shadow: none;
}

.switch-control {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #d4d7de;
  transition: background 0.2s ease;
}

.switch-control::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.18);
  transition: transform 0.2s ease;
}

.switch input:checked + .switch-control {
  background: var(--purple);
}

.switch input:checked + .switch-control::after {
  transform: translateX(24px);
}

/* ── Form section grouping ──────────────────────────── */

.field-stack {
  display: grid;
  gap: 8px;
  align-content: start;
}

.text-link-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: #2852df;
  font-size: 0.82rem;
  font-weight: 500;
  text-align: left;
}

.text-link-button:hover {
  background: transparent;
  color: #173cb5;
  text-decoration: underline;
}

.product-form-card {
  border-top: 3px solid var(--orange);
}

.form-section {
  display: grid;
  gap: 14px;
  padding: 16px 18px 18px;
  border: 1px solid #eaecf1;
  border-radius: 10px;
  background: #fafbfd;
}

.form-section-highlight {
  background: linear-gradient(135deg, rgba(93, 22, 116, 0.03) 0%, rgba(255, 61, 16, 0.04) 100%);
  border-color: rgba(93, 22, 116, 0.15);
}

.form-section-title {
  margin: 0;
  padding-left: 8px;
  color: var(--purple);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-left: 3px solid var(--orange);
}

.form-section-highlight .form-section-title {
  border-left-color: var(--magenta);
}

.product-image-preview.product-image-empty {
  border: 2px dashed rgba(93, 22, 116, 0.22);
  transition: border-color 0.2s ease;
}

.product-image-dropzone:hover .product-image-preview.product-image-empty {
  border-color: rgba(93, 22, 116, 0.42);
}

/* ── Grupos e Unidades ──────────────────────────────── */

.gu-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.gu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 12px;
  font-size: 0.88rem;
}

.gu-item-badge {
  background: var(--purple);
  color: #fff;
  border-radius: 5px;
  padding: 2px 9px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.gu-item-name {
  flex: 1;
  color: var(--text);
  font-weight: 500;
}

.gu-del-btn {
  margin-left: auto;
  flex-shrink: 0;
}

/* ── Responsive ─────────────────────────────────────── */

@media (max-width: 1120px) {
  .product-editor-grid,
  .product-top-grid {
    grid-template-columns: 1fr;
  }

  .product-form-grid-four {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .product-page-head,
  .product-list-toolbar,
  .product-list-toolbar-left,
  .product-list-toolbar-right,
  .product-table-summary,
  .product-form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .product-search-shell {
    padding: 12px 14px;
  }

  .product-search-prefix {
    width: auto;
  }

  .product-filter-grid,
  .product-form-grid-three,
  .product-form-grid-four {
    grid-template-columns: 1fr;
  }

  .product-image-preview {
    width: 200px;
    height: 200px;
  }
}
