:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #241b35;
  background: #faf8ff;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --purple: #7c3aed;
  --purple-dark: #5b21b6;
  --ink: #241b35;
  --muted: #766d83;
  --line: #e9e2f2;
  --surface: #fff;
  --soft: #f2ebff;
  --green: #16794b;
  --red: #b42318;
  --shadow: 0 8px 24px rgba(49, 24, 80, .06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
}

.topbar {
  min-height: 76px;
  padding: 14px clamp(16px, 4vw, 56px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand {
  display: flex;
  gap: 11px;
  align-items: center;
  text-decoration: none;
  color: var(--ink);
}

.brand-mark {
  width: 43px;
  height: 43px;
  flex-shrink: 0;
  border-radius: 15px;
  background: linear-gradient(135deg, #a78bfa, #7c3aed);
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 900;
  font-size: 22px;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 17px;
}

.brand small {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.top-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.button {
  border: 0;
  border-radius: 11px;
  padding: 11px 16px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .15s, background .15s;
}

.button:hover {
  transform: translateY(-1px);
}

.button-primary {
  background: var(--purple);
  color: #fff;
}

.button-primary:hover {
  background: var(--purple-dark);
}

.button-light {
  background: #f2edf8;
  color: #4e3866;
}

.view {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px clamp(16px, 3vw, 36px) 48px;
}

.hidden {
  display: none !important;
}

/* Apresentação da loja */

.hero {
  padding: clamp(28px, 5vw, 60px);
  border-radius: 24px;
  background:
    radial-gradient(circle at 85% 20%, rgba(255, 255, 255, .35), transparent 28%),
    linear-gradient(125deg, #5b21b6, #8b5cf6 55%, #c084fc);
  color: white;
  overflow: hidden;
}

.eyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .15em;
  margin: 0 0 9px;
  color: #a78bfa;
}

.hero .eyebrow {
  color: #f0e7ff;
}

.hero h1 {
  font-size: clamp(30px, 5vw, 52px);
  line-height: 1.08;
  letter-spacing: -.04em;
  margin: 0 0 12px;
}

.hero > p:not(.eyebrow) {
  margin: 0;
  color: #f3eaff;
  font-size: 16px;
}

.catalog-search {
  max-width: 520px;
  margin-top: 24px;
}

.catalog-search input {
  width: 100%;
  padding: 14px 17px;
  border: 0;
  border-radius: 12px;
  font: inherit;
  box-shadow: 0 8px 22px #3b07641c;
}

.section-heading,
.panel-heading,
.admin-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.section-heading {
  margin: 30px 0 16px;
}

.section-heading h2,
.panel h2 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -.025em;
}

.section-heading .eyebrow {
  margin-bottom: 6px;
}

.muted {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.notice {
  padding: 14px 16px;
  background: #f0eaff;
  border: 1px solid #e2d4ff;
  border-radius: 12px;
  color: #55358a;
  font-size: 14px;
  margin: 16px 0;
}

/* CATÁLOGO: cartões mais compactos */

.product-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
}

.product-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition: transform .18s ease, box-shadow .18s ease;
}

.product-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(49, 24, 80, .10);
}

.product-image {
  aspect-ratio: 4 / 3;
  max-height: 190px;
  background: #f5f1fa;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.image-placeholder {
  color: #a59aad;
  font-size: 13px;
}

.product-info {
  padding: 12px;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.product-category {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--purple);
  font-weight: 800;
  margin: 0 0 5px;
  overflow-wrap: anywhere;
}

.product-info h3 {
  font-size: 15px;
  line-height: 1.35;
  margin: 0 0 6px;
  overflow-wrap: anywhere;
}

.product-description {
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
  margin: 0 0 10px;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.product-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
}

.price {
  font-size: 19px;
  font-weight: 850;
  letter-spacing: -.03em;
  overflow-wrap: anywhere;
}

.stock-label {
  font-size: 11px;
  color: var(--green);
  font-weight: 700;
  margin-top: 4px;
}

.whatsapp-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 10px;
  text-decoration: none;
  border-radius: 9px;
  padding: 10px 8px;
  background: #168c54;
  color: #fff;
  font-weight: 800;
  font-size: 12px;
  text-align: center;
  line-height: 1.3;
}

.whatsapp-button:hover {
  background: #117342;
}

/* LOGIN */

.login-card {
  max-width: 440px;
  margin: 45px auto;
  background: #fff;
  border: 1px solid var(--line);
  padding: clamp(22px, 4vw, 36px);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.login-card h1,
.admin-heading h1 {
  margin: 0 0 8px;
  letter-spacing: -.035em;
}

.stack {
  display: grid;
  gap: 15px;
  margin-top: 22px;
}

.stack label,
.form-grid label {
  display: grid;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
}

.input,
.stack input,
.form-grid input,
.form-grid select,
.form-grid textarea,
.compact-input {
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #dcd2e8;
  border-radius: 10px;
  padding: 11px 12px;
  width: 100%;
  min-width: 0;
  outline: none;
}

.stack input:focus,
.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus,
.compact-input:focus {
  border-color: #a78bfa;
  box-shadow: 0 0 0 3px #a78bfa33;
}

.form-message {
  font-size: 13px;
  color: var(--red);
  line-height: 1.4;
}

/* PAINEL ADMINISTRATIVO */

.admin-heading {
  margin-bottom: 24px;
  align-items: flex-start;
}

.admin-heading .eyebrow {
  margin-bottom: 8px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 20px 0 28px;
}

.stat-card {
  background: #fff;
  border: 1px solid var(--line);
  padding: 19px;
  border-radius: 16px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 12px;
}

.stat-card strong {
  font-size: 27px;
  letter-spacing: -.04em;
  overflow-wrap: anywhere;
}

.admin-tabs {
  display: flex;
  gap: 8px;
  overflow: auto;
  padding: 4px 0 14px;
  margin-bottom: 8px;
}

.tab {
  white-space: nowrap;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 11px 15px;
  font: inherit;
  font-size: 13px;
  font-weight: 750;
  color: #655773;
  cursor: pointer;
}

.tab.active {
  background: var(--soft);
  border-color: #c4b5fd;
  color: var(--purple-dark);
}

.admin-tab {
  display: grid;
  gap: 20px;
}

.panel {
  background: #fff;
  border: 1px solid var(--line);
  padding: clamp(16px, 3vw, 26px);
  border-radius: 18px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.panel-heading {
  margin-bottom: 20px;
}

.panel-heading h2 {
  margin-bottom: 5px;
}

.panel-heading .muted {
  margin: 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.full {
  grid-column: 1 / -1;
}

.form-grid textarea {
  resize: vertical;
}

.form-grid small {
  font-weight: 400;
}

.checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 10px !important;
}

.checkbox-label input {
  width: auto;
  accent-color: var(--purple);
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

/* TABELAS */

.table-wrap {
  overflow: auto;
  width: 100%;
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 720px;
  font-size: 13px;
}

th,
td {
  text-align: left;
  padding: 13px 12px;
  border-bottom: 1px solid #f0eaf5;
  vertical-align: middle;
}

th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  background: #fcfaff;
}

td strong {
  display: block;
}

td small {
  display: block;
  color: var(--muted);
  margin-top: 3px;
}

.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.small-button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 7px 9px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  color: #51376b;
}

.small-button.danger {
  color: var(--red);
}

.status-pill {
  display: inline-block;
  border-radius: 99px;
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 800;
  background: #e8f7ee;
  color: #16794b;
}

.status-pill.off {
  background: #f2edf8;
  color: #776987;
}

.photo-preview {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
}

.photo-preview img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
}

/* RODAPÉ E AVISOS */

footer {
  border-top: 1px solid var(--line);
  padding: 22px clamp(16px, 4vw, 56px);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  background: #fff;
}

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - 28px);
  background: #241b35;
  color: #fff;
  padding: 13px 18px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  z-index: 10;
  font-size: 14px;
}

.toast.error {
  background: #9f1d1d;
}

/* TELAS MÉDIAS */

@media (max-width: 1100px) {
  .product-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 13px;
  }

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

/* CELULARES E TABLETS PEQUENOS */

@media (max-width: 650px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions {
    width: 100%;
  }

  .top-actions .button {
    flex: 1;
  }

  .view {
    padding: 18px 12px 36px;
  }

  .hero {
    padding: 26px 20px;
    border-radius: 18px;
  }

  .hero > p:not(.eyebrow) {
    font-size: 14px;
  }

  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .product-card {
    border-radius: 12px;
  }

  .product-image {
    aspect-ratio: 4 / 3;
    max-height: 145px;
  }

  .product-info {
    padding: 10px;
  }

  .product-info h3 {
    font-size: 14px;
  }

  .product-category {
    font-size: 9px;
  }

  .product-description {
    font-size: 11px;
    line-height: 1.4;
    margin-bottom: 9px;
  }

  .price {
    font-size: 17px;
  }

  .stock-label {
    font-size: 10px;
  }

  .whatsapp-button {
    font-size: 11px;
    padding: 9px 5px;
    margin-top: 9px;
  }

  .section-heading {
    align-items: flex-end;
    gap: 10px;
    margin-top: 25px;
  }

  .section-heading h2,
  .panel h2 {
    font-size: 20px;
  }

  .stats-grid {
    gap: 9px;
  }

  .stat-card {
    padding: 14px;
  }

  .stat-card strong {
    font-size: 22px;
  }

  .admin-heading {
    align-items: flex-start;
  }

  .admin-heading .button {
    flex-shrink: 0;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .full {
    grid-column: auto;
  }

  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .compact-input {
    max-width: 100%;
  }

  footer {
    flex-direction: column;
  }

  .product-bottom {
    align-items: flex-start;
  }

  #sales-tab .panel {
    padding: 14px;
  }

  #sales-tab .table-wrap table {
    min-width: 760px;
  }
}

/* CELULARES MUITO ESTREITOS */

@media (max-width: 380px) {
  .product-grid {
    grid-template-columns: 1fr;
  }

  .product-image {
    aspect-ratio: 4 / 3;
    max-height: 220px;
  }

  .product-info {
    padding: 13px;
  }

  .product-info h3 {
    font-size: 16px;
  }

  .product-description {
    font-size: 12px;
  }

  .price {
    font-size: 19px;
  }
}

/* MÓDULO DE VENDAS */

#sale-items-body td {
  vertical-align: middle;
}

.status-pill.pending {
  background: #fff4d6;
  color: #8a5a00;
}

.sales-summary {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.admin-tabs .tab {
  flex-shrink: 0;
}

/* AJUSTE FINAL: FOTO AO LADO DAS INFORMAÇÕES */
.product-card {
  display: grid !important;
  grid-template-columns: 100px minmax(0, 1fr);
  grid-template-rows: 1fr;
  align-items: stretch;
}

.product-card > .product-image {
  grid-column: 1;
  grid-row: 1;
  width: 100px;
  height: 100%;
  min-height: 150px;
  max-height: none;
  aspect-ratio: auto;
}

.product-card > .product-info {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  padding: 12px;
}

.product-card .product-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

@media (max-width: 650px) {
  .product-card {
    grid-template-columns: 90px minmax(0, 1fr);
  }

  .product-card > .product-image {
    width: 90px;
    min-height: 135px;
  }

  .product-card > .product-info {
    padding: 10px;
  }
}

@media (max-width: 380px) {
  .product-card {
    grid-template-columns: 80px minmax(0, 1fr);
  }

  .product-card > .product-image {
    width: 80px;
    min-height: 120px;
  }
}

