:root {
  --navy: #101d40;
  --navy2: #1c2b52;
  --blue: #3483fa;
  --blue-dark: #2968c8;
  --blue50: #edf5ff;
  --bg: #f5f7fb;
  --surface: #fff;
  --text: #17203a;
  --muted: #697386;
  --line: #e2e7f0;
  --green: #0a9b68;
  --orange: #c97909;
  --red: #dc3c43;
  --red50: #fdecec;
  --text-danger: #dc3c43;
  --bg-danger: #fdecec;
  --purple: #7447c6;
  --tabbar-height: 58px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text);
  background: var(--bg);
}

button, input, textarea, select { font: inherit; color: inherit; }

/* ---------- App shell ---------- */
.app {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 30px 18px 20px;
  display: flex;
  flex-direction: column;
  color: #fff;
  background: var(--navy);
  z-index: 10;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 10px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  background: linear-gradient(145deg, #4d98ff, #2878eb);
  box-shadow: 0 8px 20px rgba(52, 131, 250, 0.28);
  font-weight: 780;
  font-size: 15px;
}

.brand-name {
  font-size: 19px;
  font-weight: 750;
  letter-spacing: -0.2px;
}

/* Active store identity — logo + nickname, sits under the LojaSync brand
   and above the store switcher. Server-rendered from the cached ML profile,
   so it refreshes on the full-page reload that a store switch triggers. */
.store-identity {
  margin-top: 26px;
  padding: 0 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.store-identity-logo {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: 50%;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.store-identity-logo--fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: linear-gradient(145deg, #4d98ff, #2878eb);
  box-shadow: 0 8px 20px rgba(52, 131, 250, 0.28);
  font-weight: 780;
  font-size: 16px;
}

.store-identity-name {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.1px;
  color: #e8edf6;
  word-break: break-word;
}

.store-switcher {
  margin-top: 24px;
  padding: 0 8px 24px;
}

.store-switcher-label {
  display: block;
  margin-bottom: 9px;
  color: #93a0bb;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.store-select {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid #425070;
  border-radius: 11px;
  color: #fff;
  background: rgba(255, 255, 255, 0.055);
  font-weight: 650;
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2393a0bb' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

.store-select:disabled { opacity: 0.6; cursor: not-allowed; }
.store-select option { color: var(--text); background: #fff; }

.sidebar-nav {
  margin: 16px -18px 0;
  padding: 16px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  display: grid;
  gap: 6px;
}

.nav-item {
  height: 46px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 13px;
  border: 0;
  border-radius: 10px;
  color: #adb7cb;
  background: transparent;
  font-weight: 650;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
}

.nav-item svg { flex-shrink: 0; opacity: 0.85; }

.nav-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.nav-item.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.095);
  box-shadow: inset 3px 0 0 var(--blue);
}

.nav-item.active svg { opacity: 1; }

.sidebar-footer {
  margin-top: auto;
  padding: 16px 8px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.seller-id {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 12px;
}

.seller-id .label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #8997b3;
}

.seller-id .value {
  font-size: 13px;
  font-weight: 650;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-top: 14px;
  padding: 9px 10px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: #9aa7c0;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.logout-btn:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }

/* ---------- Mobile tab bar (< 768px only; see .mobile-tabbar { display: flex }
   in the responsive section) ---------- */
.mobile-tabbar {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  min-height: var(--tabbar-height);
  padding-bottom: env(safe-area-inset-bottom, 0);
  background: var(--surface);
  border-top: 1px solid var(--line);
  z-index: 20;
}

.mobile-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  text-decoration: none;
}

.mobile-tab-icon { font-size: 20px; line-height: 1; }

.mobile-tab.active { color: var(--blue); }

/* ---------- Mobile store header + switcher sheet (< 768px only) ----------
   The sidebar (store logo / name / switcher) is hidden on mobile, so this
   fixed header at the top gives the same store identity + a tap target that
   opens the store switcher as a bottom sheet. Hidden on desktop. */
.mobile-store-header { display: none; }
.store-sheet,
.store-sheet-backdrop { display: none; }

/* ---------- Content ---------- */
.content {
  min-width: 0;
  padding: 40px clamp(28px, 4vw, 64px) 40px;
}

.content-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
  flex-wrap: wrap;
}

.content-header h1 {
  margin: 0;
  font-size: 30px;
  font-weight: 750;
  line-height: 1.1;
  letter-spacing: -0.6px;
}

.subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 46px;
  min-width: 340px;
  padding: 0 14px;
  border: 1px solid #dce2ec;
  border-radius: 12px;
  background: #fff;
  color: #7c8798;
}

.search-box:focus-within {
  border-color: #7db0fc;
  box-shadow: 0 0 0 3px rgba(52, 131, 250, 0.11);
}

.search-box input {
  min-width: 0;
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 14px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 46px;
  padding: 0 18px;
  border: 1px solid #dce2ec;
  border-radius: 11px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.btn-ghost { background: #fff; border-color: #dce2ec; color: var(--text); }
.btn-ghost:hover { border-color: #aab8cc; }

.btn-secondary { background: #fff; border-color: #dce2ec; color: var(--text); }
.btn-secondary:hover { border-color: #aab8cc; }

.btn-primary {
  border-color: var(--blue);
  color: #fff;
  background: var(--blue);
  box-shadow: 0 7px 16px rgba(52, 131, 250, 0.18);
}

.btn-primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); }

.btn-primary:disabled { background: #a9c8f5; border-color: #a9c8f5; box-shadow: none; }

.btn-success {
  border-color: var(--green);
  color: #fff;
  background: var(--green);
}

.btn-success:hover { background: #087d54; border-color: #087d54; }

.btn-success:disabled { background: #92cdb8; border-color: #92cdb8; box-shadow: none; }

.btn-add-store,
.btn-new-user {
  width: 100%;
  height: auto;
  padding: 13px 20px;
  border: none;
  outline: none;
  border-radius: 10px;
  color: #fff;
  font-weight: 600;
}

.btn-add-store { background: #16a34a; }
.btn-add-store:hover { background: #15803d; }
.btn-add-store:disabled { background: #7cc79a; box-shadow: none; }

.btn-new-user { background: #2563eb; }
.btn-new-user:hover { background: #1d4ed8; }
.btn-new-user:disabled { background: #9db8f2; box-shadow: none; }

.btn-cta-icon {
  display: inline-flex;
  align-items: center;
  font-size: 17px;
  font-weight: 700;
  line-height: 1;
}

.btn-cta-icon svg { display: block; }

.btn-warning {
  border-color: var(--orange);
  color: #fff;
  background: var(--orange);
}

.btn-warning:hover { background: #a86408; border-color: #a86408; }

.btn-danger { border-color: #f4cccc; color: var(--red); background: #fff; }
.btn-danger:hover { border-color: #ecb0b0; background: #fef4f4; }

.btn-danger-outline {
  background: transparent;
  border: 1px solid var(--text-danger);
  color: var(--text-danger);
}
.btn-danger-outline:hover { background: var(--bg-danger); border-color: var(--text-danger); }

.btn-danger-solid {
  border-color: var(--red);
  color: #fff;
  background: var(--red);
}
.btn-danger-solid:hover { background: #c22e35; border-color: #c22e35; }
.btn-danger-solid:disabled { background: #eaa0a3; border-color: #eaa0a3; box-shadow: none; }
.btn-danger-solid.is-loading::after {
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
}

.btn:disabled { opacity: 0.55; cursor: not-allowed; pointer-events: none; }

.btn.is-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.btn.is-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid rgba(0, 0, 0, 0.18);
  border-top-color: var(--muted);
  border-radius: 50%;
  animation: btn-spin 0.6s linear infinite;
}

.btn-primary.is-loading::after,
.btn-success.is-loading::after,
.btn-warning.is-loading::after,
.btn-add-store.is-loading::after,
.btn-new-user.is-loading::after {
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
}

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

.btn-sm { height: 36px; padding: 0 13px; font-size: 13px; }

.icon-btn {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.icon-btn:hover { background: #f1f3f8; color: var(--text); }

/* ---------- Status tabs ---------- */
.status-tabs {
  height: 54px;
  display: flex;
  align-items: flex-end;
  gap: 26px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
}

.status-tab {
  position: relative;
  height: 46px;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  color: #687182;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.status-tab-count {
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #ebeff5;
  color: #778092;
  font-size: 11px;
  font-weight: 750;
}

.status-tab.active { color: var(--blue); }

.status-tab.active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--blue);
}

.status-tab.active .status-tab-count { color: #fff; background: var(--blue); }

/* ---------- Sync status ---------- */
.sync-meta {
  height: 22px;
  margin: -4px 0 18px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 7px;
  color: #8b94a5;
  font-size: 12px;
}

.sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #a7b0c0;
  transition: background 0.2s ease;
}

.sync-dot.live {
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.11);
}

/* ---------- Table ---------- */
.table-wrap {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 8px 28px rgba(27, 42, 82, 0.035);
  overflow: hidden;
  overflow-x: auto;
}

.table-head,
.table-row {
  display: grid;
  grid-template-columns: minmax(410px, 1.75fr) minmax(160px, 0.75fr) 160px 100px 130px 28px;
  align-items: center;
  gap: 18px;
  min-width: 760px;
}

.table-head {
  height: 54px;
  padding: 0 24px;
  color: #737c8d;
  background: #fbfcfe;
  font-size: 12px;
  font-weight: 780;
  letter-spacing: 0.045em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
}

.table-head > :nth-child(3) { text-align: right; }
.table-head > :nth-child(4),
.table-head > :nth-child(5) { text-align: center; }

.table-row {
  width: 100%;
  min-height: 78px;
  margin: 0;
  padding: 10px 24px;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
  text-align: left;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: background 0.1s ease;
}

.table-row:hover {
  position: relative;
  z-index: 1;
  background: #f6faff;
  box-shadow: inset 3px 0 0 var(--blue);
}

.table-row.selected { background: #edf5ff; }

.item-cell {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
}

.item-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.row-thumb {
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  border-radius: 10px;
  object-fit: cover;
  background: linear-gradient(135deg, #eef1f6, #fff);
  border: 1px solid #e1e6ef;
}

.item-title {
  font-weight: 700;
  font-size: 14.5px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-mlb {
  display: block;
  margin-top: 3px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
  color: #7a8496;
}

.sku-cell {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.sku-empty {
  display: inline-block;
  width: fit-content;
  padding: 5px 9px;
  border-radius: 7px;
  background: #f1f3f6;
  color: #8b94a4;
  font-size: 12px;
}

.price-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.stock-col { text-align: center; }

.stock-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 14px;
  white-space: nowrap;
}

.stock-low {
  padding: 3px 6px;
  border-radius: 6px;
  color: #b46604;
  background: #fff5dc;
  font-size: 10px;
  font-weight: 780;
  text-transform: uppercase;
  white-space: nowrap;
}

.status-col { text-align: center; }

.row-arrow {
  text-align: right;
  color: transparent;
  font-size: 20px;
  line-height: 1;
}

.table-row:hover .row-arrow { color: var(--blue); }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}

.status-active { color: #0b8d5a; background: #def8ed; }
.status-paused { color: #bd6a00; background: #fff3d8; }
.status-under_review { color: var(--purple); background: #f1eafd; }
.status-closed,
.status-inactive { color: #7b8494; background: #eceff4; }

.empty-row {
  text-align: center;
  color: var(--muted);
  padding: 48px 16px;
}

/* ---------- Table footer / pagination ---------- */
.table-foot {
  min-height: 64px;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  color: #747e8f;
  font-size: 13px;
}

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

.pager button {
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
  font-weight: 680;
  cursor: pointer;
}

.pager button:hover:not(:disabled) { border-color: #aab8cc; }

.pager button.current {
  border-color: var(--blue);
  color: #fff;
  background: var(--blue);
  cursor: default;
}

.pager button:disabled { opacity: 0.45; cursor: not-allowed; }

.pager-ellipsis {
  min-width: 20px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 680;
  user-select: none;
}

/* ---------- Drawer ---------- */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(14, 25, 51, 0.42);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 40;
}

.drawer-backdrop.visible { opacity: 1; pointer-events: auto; }

.edit-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(640px, 96vw);
  background: #fff;
  box-shadow: -18px 0 50px rgba(10, 20, 45, 0.18);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.22s ease;
  z-index: 50;
}

.edit-drawer.open { transform: translateX(0); }

.drawer-header {
  padding: 20px 28px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.drawer-header h2 { margin: 0 0 6px; font-size: 22px; }

.drawer-permalink { color: var(--blue); font-size: 13px; text-decoration: none; }
.drawer-permalink:hover { text-decoration: underline; }

.drawer-body { flex: 1; overflow-y: auto; padding: 26px 28px; }

.drawer-msg {
  padding: 12px 14px;
  border-radius: 11px;
  font-size: 13px;
  margin-bottom: 18px;
}

.drawer-msg.error { background: #fdeaea; color: #b91c1c; }
.drawer-msg.success { background: #def8ed; color: #0b7a4f; }
.drawer-msg.info { background: #edf5ff; color: var(--blue-dark); }

.drawer-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.drawer-footer .btn { justify-content: center; }

/* "Excluir" sits on the left; the Cancelar / Salvar pair is pushed to
   the opposite edge and keeps the original 1fr / 1.3fr proportion. */
.drawer-footer-main {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 12px;
  margin-left: auto;
  flex: 1 1 auto;
  max-width: 420px;
}

#deleteItemBtn { flex: 0 0 auto; }

/* ---------- Fields ---------- */
.field { margin-bottom: 18px; }

.field label {
  display: block;
  margin-bottom: 8px;
  color: #687284;
  font-size: 11.5px;
  font-weight: 760;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid #dce2ec;
  border-radius: 10px;
  outline: none;
  color: var(--text);
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input,
.field select { height: 46px; padding: 0 14px; font-size: 14px; }

.field textarea {
  min-height: 130px;
  padding: 12px 14px;
  resize: vertical;
  line-height: 1.5;
  font-size: 14px;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: #7db0fc;
  box-shadow: 0 0 0 3px rgba(52, 131, 250, 0.11);
}

.field input[readonly] { background: #f7f9fc; color: var(--muted); }

.field-row { display: flex; gap: 14px; }
.field-row .field { flex: 1; }

.required-attributes-grid { display: flex; flex-direction: column; gap: 14px; }
.required-attributes-grid .field { margin-bottom: 0; }
.required-attributes-grid label {
  display: block;
  margin-bottom: 6px;
  color: #687284;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.field-note { margin: -4px 0 10px; font-size: 12px; color: var(--muted); }

.gtin-no-code-label {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 9px;
  font-size: 13px;
  color: #687284;
  cursor: pointer;
}
.gtin-no-code-label input { width: auto; margin: 0; }
#fieldGtin.input-error { border-color: #d9534f; }

.hint {
  display: block;
  margin-top: 7px;
  font-size: 12px;
  color: #8b94a4;
  min-height: 15px;
}

/* ---------- Image grid ---------- */
.image-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.image-grid-compact { max-width: 300px; }

.image-grid-drawer {
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.image-grid-photoslots {
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.image-tile {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  overflow: hidden;
  background: #fbfcfe;
  border: 1.5px solid #d4dbe7;
}

.image-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.image-tile[draggable="true"] { cursor: grab; }
.image-tile.dragging { opacity: 0.4; }

.image-tile.drag-over {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(52, 131, 250, 0.3) inset;
}

.image-tile-badge {
  position: absolute;
  left: 6px;
  bottom: 6px;
  background: rgba(16, 29, 64, 0.78);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2px;
  padding: 3px 7px;
  border-radius: 999px;
  pointer-events: none;
}

.image-tile-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(16, 29, 64, 0.78);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.image-tile-remove:hover { background: var(--red); }

.image-tile-spinner { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }

.image-tile-spinner::after {
  content: '';
  width: 22px;
  height: 22px;
  border: 2px solid rgba(16, 29, 64, 0.15);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: btn-spin 0.6s linear infinite;
}

.image-tile-add {
  border: 1.5px dashed #d4dbe7;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #7a8497;
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  background: #fbfcfe;
}

.image-tile-add:hover { border-color: var(--blue); color: var(--blue); }

.mobile-photo-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.mobile-photo-actions[hidden] { display: none; }

.mobile-photo-btn { flex: 1; }

/* ---------- Camera-capture photo queue (mobile) ---------- */
.photo-queue {
  margin-top: 12px;
  padding: 12px;
  border: 1.5px solid #d4dbe7;
  border-radius: 12px;
  background: #fbfcfe;
}

.photo-queue[hidden] { display: none; }

.photo-queue .field-note { margin: 0 0 10px; }

.photo-queue-previews {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.photo-queue-tile.has-error {
  border-color: var(--red);
  box-shadow: 0 0 0 2px rgba(224, 49, 49, 0.25) inset;
}

.photo-queue-tile-error {
  position: absolute;
  left: 6px;
  bottom: 6px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2px;
  padding: 3px 7px;
  border-radius: 999px;
  pointer-events: none;
}

.photo-queue-status { display: block; margin-bottom: 10px; }
.photo-queue-status.is-error { color: var(--red); }

.photo-queue-actions {
  display: flex;
  gap: 10px;
}

.photo-queue-actions .btn { flex: 1; }

/* ---------- In-app camera overlay (getUserMedia capture) ---------- */
body.cam-open { overflow: hidden; }

.cam-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #000;
  display: flex;
  flex-direction: column;
  overscroll-behavior: contain;
}

.cam-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

.cam-top {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 16px 0;
}

.cam-counter {
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
}
.cam-counter[hidden] { display: none; }

.cam-close {
  margin-left: auto;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

.cam-bottom {
  position: relative;
  z-index: 2;
  margin-top: auto;
  padding: 12px 16px calc(env(safe-area-inset-bottom, 0px) + 20px);
  background: linear-gradient(to top, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0));
}

.cam-thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 10px;
  scrollbar-width: none;
}
.cam-thumbs::-webkit-scrollbar { display: none; }

.cam-thumb {
  width: 54px;
  height: 54px;
  flex: 0 0 auto;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.85);
}

.cam-limit {
  text-align: center;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
}
.cam-limit[hidden] { display: none; }

.cam-controls {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 76px;
}

.cam-shutter {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 4px solid #fff;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  transition: transform 0.08s ease;
}
.cam-shutter:active { transform: scale(0.92); }
.cam-shutter:disabled { opacity: 0.4; cursor: default; }

.cam-done {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  padding: 12px 20px;
  cursor: pointer;
}
.cam-done[hidden] { display: none; }

/* ---------- Notice (e.g. paused-item banner) ---------- */
.notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 15px;
  border-radius: 12px;
  background: #fff7e7;
}

.notice-copy { display: grid; gap: 2px; }
.notice-copy strong { font-size: 13px; color: var(--text); }
.notice-copy span { color: #7d6b48; font-size: 12px; }

.notice .btn { flex-shrink: 0; min-width: 140px; }

.notice-success { background: #def8ed; }
.notice-success .notice-copy span { color: #0b6b45; }

/* ---------- Confirm modals ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(14, 25, 51, 0.42);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 60;
}

.modal-backdrop.visible { opacity: 1; pointer-events: auto; }

.confirm-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 400px;
  max-width: 92vw;
  background: #fff;
  border-radius: 16px;
  padding: 30px 28px 26px;
  box-shadow: 0 24px 60px rgba(10, 20, 45, 0.28);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.96);
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 70;
}

.confirm-modal.open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.confirm-modal-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: #fff3d8;
  color: var(--orange);
  display: flex;
  align-items: center;
  justify-content: center;
}

.confirm-modal-icon-danger { background: var(--bg-danger); color: var(--text-danger); }

.confirm-modal h3 { margin: 0 0 14px; font-size: 17px; color: var(--text); }

.confirm-modal-price { margin: 0 0 4px; font-size: 14px; color: var(--text); }

.confirm-modal-pct { margin: 0 0 22px; font-size: 13px; font-weight: 700; color: var(--orange); }

.confirm-modal-message { margin: 0 0 22px; font-size: 14px; line-height: 1.55; color: var(--text); }

.confirm-modal-footer { display: flex; gap: 10px; }
.confirm-modal-footer .btn { flex: 1; justify-content: center; }

/* ---------- Duplicate warning ---------- */
.duplicate-warning {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 15px 16px;
  border-radius: 12px;
  background: #fff7e7;
  border: 1px solid #f5d99b;
  margin-bottom: 22px;
}

.duplicate-warning[hidden] { display: none; }

.duplicate-warning-header { display: flex; align-items: center; gap: 9px; color: #8a6a1e; font-size: 14px; }
.duplicate-warning-header svg { flex-shrink: 0; }

.duplicate-warning-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border-radius: 10px;
  padding: 10px;
}

.duplicate-warning-thumb {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  object-fit: cover;
  background: #f1f3f8;
  border: 1px solid var(--line);
  flex-shrink: 0;
}

.duplicate-warning-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }

.duplicate-warning-title {
  font-weight: 700;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.duplicate-warning-meta { font-size: 12px; color: var(--muted); }

.duplicate-warning-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  z-index: 100;
  right: 28px;
  bottom: 28px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 9px;
  border-radius: 11px;
  color: #fff;
  background: var(--navy);
  box-shadow: 0 14px 35px rgba(15, 28, 58, 0.25);
  font-size: 13px;
  font-weight: 650;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.toast.visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
.toast.error { background: var(--red); }
.toast.success { background: var(--green); }

/* ---------- Criar Anuncio: wizard ---------- */
.wizard-steps {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}

.wizard-step {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #8b93a2;
  font-weight: 700;
  font-size: 14px;
}

.wizard-step-num {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #e9edf3;
  font-size: 13px;
  transition: background 0.15s ease, color 0.15s ease;
}

.wizard-step-label { font-size: 14px; font-weight: 700; }

.wizard-step.active { color: var(--text); }
.wizard-step.active .wizard-step-num { color: #fff; background: var(--blue); }
.wizard-step.done .wizard-step-num { color: #fff; background: var(--green); }

.wizard-step-divider { width: 60px; height: 2px; background: #e0e5ed; }

.wizard-panel { max-width: 900px; }

/* ---------- Publish success banner ---------- */
.publish-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
  padding: 48px 32px;
  border-radius: 12px;
  background: #def8ed;
  border: 1px solid #a9e8cb;
}

.publish-success[hidden] { display: none; }

.publish-success-icon {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
}

.publish-success-title { font-size: 20px; color: #0b7a4f; }

.publish-success-actions { display: flex; gap: 10px; margin-top: 6px; }

.create-search-row { display: flex; gap: 12px; margin-bottom: 22px; }

.create-search-box { flex: 1; min-width: 0; max-width: 460px; }
.create-search-box input { height: 100%; }

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

.search-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 56px 24px;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--line);
}

.search-empty-state[hidden] { display: none; }

.product-grid > .search-empty-state { grid-column: 1 / -1; }

.search-empty-state-icon {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--blue50);
  color: var(--blue);
}

.search-empty-state-icon.tone-error {
  background: var(--red50);
  color: var(--red);
}

.search-empty-state-title { font-size: 18px; color: var(--text); }

.search-empty-state-subtitle {
  max-width: 420px;
  color: var(--muted);
  font-size: 13.5px;
}

.load-more-btn { display: block; margin: 18px auto 0; }
.load-more-btn[hidden] { display: none; }

.search-progress-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
  padding: 56px 24px;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--line);
}

.product-grid > .search-progress-state { grid-column: 1 / -1; }

.search-progress-message {
  max-width: 420px;
  color: var(--muted);
  font-size: 13.5px;
}

.search-progress-track {
  width: 100%;
  max-width: 320px;
  height: 6px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.search-progress-fill {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: var(--blue);
  transition: width 2s ease;
}

.manual-create-btn {
  display: inline-flex;
  margin: 14px 0 0;
  color: var(--blue);
  background: transparent;
  border: none;
  padding: 0;
  height: auto;
  font-weight: 700;
  text-decoration: none;
}

.manual-create-btn:hover { text-decoration: underline; }

.category-search { position: relative; }

.category-search input {
  width: 100%;
  height: 46px;
  border: 1px solid #dce2ec;
  border-radius: 10px;
  padding: 0 14px;
  font-size: 14px;
  color: var(--text);
}

.category-search input:focus {
  outline: none;
  border-color: #7db0fc;
  box-shadow: 0 0 0 3px rgba(52, 131, 250, 0.11);
}

.category-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(15, 28, 63, 0.14);
  max-height: 240px;
  overflow-y: auto;
  z-index: 20;
}

.category-dropdown-item { padding: 11px 13px; font-size: 13px; cursor: pointer; border-bottom: 1px solid var(--line); }
.category-dropdown-item:last-child { border-bottom: none; }
.category-dropdown-item:hover { background: #f6faff; }
.category-dropdown-empty { cursor: default; color: var(--muted); }
.category-dropdown-empty:hover { background: none; }

.product-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.product-card:hover {
  border-color: #82b0f8;
  box-shadow: 0 10px 24px rgba(52, 131, 250, 0.08);
  transform: translateY(-1px);
}

.product-card-thumb {
  width: 84px;
  height: 84px;
  border-radius: 10px;
  background: linear-gradient(135deg, #eef1f6, #fff);
  border: 1px solid #e1e6ef;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: 14px;
}

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

.product-card-name {
  font-weight: 700;
  font-size: 14px;
  line-height: 1.35;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-card-meta { font-size: 12px; color: var(--muted); }

/* ---------- Criar Anuncio: form ---------- */
.selected-product-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 22px;
}

.selected-product-thumb-sm {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  border-radius: 10px;
  object-fit: contain;
  background: linear-gradient(135deg, #eef1f6, #fff);
  border: 1px solid #e1e6ef;
}

.selected-product-info { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.selected-product-info strong { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.selected-product-info .hint { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 0; }

.create-form-section { max-width: 940px; }

.create-form-columns {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 34px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 8px 28px rgba(27, 42, 82, 0.035);
}

.create-form-col-left .field,
.create-form-col-right .field { margin-bottom: 20px; }

.create-form-footer {
  margin-top: 20px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
}

.publish-bar-info { display: grid; gap: 3px; }
.publish-bar-info strong { font-size: 14px; }
.publish-bar-info span { color: var(--muted); font-size: 12px; }

.create-form-footer .btn { min-width: 260px; justify-content: center; }

@media (max-width: 900px) {
  .create-form-columns { grid-template-columns: 1fr; }
  .create-form-footer { flex-direction: column; align-items: flex-start; }
  .create-form-footer .btn { width: 100%; }
}

/* ---------- Login page ---------- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(120% 120% at 15% 10%, var(--navy2) 0%, var(--navy) 55%, #0b1330 100%);
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: 18px;
  padding: 40px 36px 34px;
  box-shadow: 0 30px 70px rgba(8, 16, 38, 0.45);
}

.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.login-brand .brand-name { font-size: 19px; font-weight: 750; color: var(--text); }

.login-subtitle { margin: 0 0 26px; color: var(--muted); font-size: 13.5px; }

.login-submit { width: 100%; justify-content: center; margin-top: 6px; }

.login-card .drawer-msg { margin-bottom: 16px; }

/* ---------- Settings page ---------- */
.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(310px, 0.8fr);
  gap: 20px;
  align-items: start;
}

#integrationCard { grid-column: 1 / -1; }

.settings-divider { border-top: 1px solid var(--line); margin: 22px 0 18px; }

.settings-section-label {
  display: block;
  margin: 0 0 8px;
  color: #687284;
  font-size: 11.5px;
  font-weight: 760;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.settings-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 26px 28px;
  box-shadow: 0 8px 28px rgba(27, 42, 82, 0.035);
}

.settings-card h2 { margin: 0 0 6px; font-size: 18px; }

.settings-hint { margin: 0 0 22px; color: var(--muted); font-size: 13px; }

.settings-card .drawer-msg { margin-bottom: 16px; }

.settings-card .btn { width: 100%; justify-content: center; margin-top: 4px; }
.settings-card .btn-danger { width: auto; justify-content: center; margin-top: 20px; }
.settings-card .btn-sm { width: auto; margin-top: 0; }
#addStoreBtn { margin-top: 16px; }

.settings-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.settings-card-head h2 { margin-bottom: 6px; }
.settings-card-head .settings-hint { margin: 0; }

.connected-badge {
  flex-shrink: 0;
  padding: 6px 10px;
  border-radius: 999px;
  color: #087b51;
  background: #def8ed;
  font-size: 11px;
  font-weight: 760;
  white-space: nowrap;
}

.connected-badge.is-off { color: #7b8494; background: #eceff4; }

.stores-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }

.store-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 15px;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.store-row.is-active { border-color: var(--blue); background: var(--blue50); }

.ml-logo {
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 13px;
  background: #ffe600;
  color: #213056;
  font-size: 18px;
  font-weight: 850;
}

.store-row-info { display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 0; }

.store-name-input {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 9px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  outline: none;
  max-width: 260px;
}

.store-name-input:focus { border-color: #7db0fc; }

.store-row-uid { font-size: 12px; color: var(--muted); }

.store-row-actions { display: flex; flex-wrap: wrap; gap: 8px; flex-shrink: 0; }
.store-row-actions .btn { width: auto; margin-top: 0; }

.detail-list { margin-top: 4px; display: grid; }

.detail-row {
  padding: 13px 0;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.detail-row span { color: var(--muted); }

/* ---------- Users / team management ---------- */
.users-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }

.user-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 15px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.user-row-info { display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 0; }
.user-row-name { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.user-row-meta { font-size: 12px; color: var(--muted); }
.user-row-actions { display: flex; flex-wrap: wrap; gap: 8px; flex-shrink: 0; }
.user-row-actions .btn { width: auto; margin-top: 0; }

.role-badge {
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 760;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #7b8494;
  background: #eceff4;
}
.role-badge.role-superadmin { color: #7c3aed; background: #f1e9fe; }
.role-badge.role-admin { color: #b45309; background: #fdf0d9; }
.role-badge.role-user { color: #0b7a4f; background: #def8ed; }

.user-form-panel { margin-top: 4px; }
.user-form-actions { display: flex; gap: 10px; margin-top: 8px; }
.user-form-actions .btn { width: auto; margin-top: 0; }

.check-list { display: flex; flex-direction: column; gap: 8px; }
.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13.5px;
  color: var(--text);
  cursor: pointer;
}
.check-row input { width: 16px; height: 16px; flex-shrink: 0; }

/* ---------- Toggles ---------- */
.toggle-list { margin: 4px 0 22px; display: grid; }

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  cursor: pointer;
}

.toggle-row:first-child { border-top: none; padding-top: 4px; }

.toggle-row-text { display: flex; flex-direction: column; gap: 3px; }
.toggle-row-text strong { font-size: 14px; }
.toggle-row-hint { font-size: 12px; color: var(--muted); }

.toggle { position: relative; flex-shrink: 0; width: 45px; height: 25px; }

.toggle input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: #dce2ec;
  border-radius: 999px;
  transition: background 0.15s ease;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 19px;
  height: 19px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease;
}

.toggle input:checked + .toggle-slider { background: var(--blue); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }
.toggle input:focus-visible + .toggle-slider { box-shadow: 0 0 0 3px rgba(52, 131, 250, 0.25); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .app { grid-template-columns: 220px minmax(0, 1fr); }
  .content { padding-inline: 28px; }
  .content-header { flex-direction: column; align-items: stretch; }
  .header-actions { width: 100%; }
  .search-box { min-width: 0; flex: 1; }
  .product-grid { grid-template-columns: repeat(2, 1fr); }
  .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 767px) {
  .app { display: block; }
  .sidebar { display: none; }
  .mobile-tabbar { display: flex; }
  /* Bottom padding clears the fixed tab bar (--tabbar-height) plus its
     safe-area inset, with extra breathing room so the last element in a
     panel — e.g. the "criar manualmente" link — never sits under the bar. */
  .content {
    padding: 22px 16px calc(var(--tabbar-height) + env(safe-area-inset-bottom, 0px) + 40px);
  }
  .content-header h1 { font-size: 25px; }

  /* Last item in the search panel: give it its own clearance above the tab
     bar on top of the .content padding, since it's the final scroll target. */
  .manual-create-btn {
    margin-bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom, 0px) + 16px);
  }

  .mobile-store-header {
    display: flex;
    position: sticky;
    top: 0;
    z-index: 19;
    padding: 10px 16px;
    padding-top: calc(10px + env(safe-area-inset-top, 0));
    background: var(--navy);
  }

  .mobile-store-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 7px 10px;
    border: 0;
    border-radius: 10px;
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
    font: inherit;
    cursor: pointer;
  }

  .mobile-store-logo {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    border-radius: 50%;
    object-fit: cover;
    background: rgba(255, 255, 255, 0.1);
  }

  .mobile-store-logo--fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 780;
    background: linear-gradient(145deg, #4d98ff, #2878eb);
  }

  .mobile-store-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
    font-size: 14px;
    font-weight: 700;
  }

  .mobile-store-caret { flex-shrink: 0; opacity: 0.7; }

  /* JS toggles the [hidden] attribute; author display rules would otherwise
     win over the UA [hidden] rule, so restore it explicitly on mobile. */
  .store-sheet[hidden],
  .store-sheet-backdrop[hidden] { display: none; }

  .store-sheet-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgba(9, 15, 32, 0.5);
    opacity: 0;
    transition: opacity 0.2s ease;
  }
  .store-sheet-backdrop.is-open { opacity: 1; }

  .store-sheet {
    display: block;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 41;
    max-height: 70vh;
    overflow-y: auto;
    padding: 10px 16px calc(20px + env(safe-area-inset-bottom, 0));
    background: #fff;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -12px 40px rgba(9, 15, 32, 0.25);
    transform: translateY(100%);
    transition: transform 0.24s ease;
  }
  .store-sheet.is-open { transform: translateY(0); }

  .store-sheet-handle {
    width: 40px;
    height: 4px;
    margin: 4px auto 14px;
    border-radius: 999px;
    background: #d5dae5;
  }

  .store-sheet-title {
    margin: 0 0 12px;
    font-size: 15px;
    font-weight: 750;
    color: var(--text);
  }

  .store-sheet-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 6px;
  }

  .store-sheet-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 14px;
    border: 1px solid #e2e6ef;
    border-radius: 12px;
    color: var(--text);
    background: #fff;
    font: inherit;
    font-weight: 650;
    text-align: left;
    cursor: pointer;
  }
  .store-sheet-item.is-active {
    border-color: var(--blue);
    background: var(--blue50);
    color: var(--blue-dark);
  }
  .store-sheet-item:disabled { opacity: 0.6; cursor: progress; }

  .store-sheet-check { margin-left: auto; font-weight: 800; color: var(--blue); }

  .store-sheet-loading {
    padding: 14px;
    color: var(--muted);
    font-size: 14px;
  }

  .mobile-photo-btn {
    font-size: 13px;
    white-space: nowrap;
  }

  /* Filter tabs scroll horizontally instead of wrapping/squeezing. */
  .status-tabs {
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    gap: 18px;
    scrollbar-width: none;
  }
  .status-tabs::-webkit-scrollbar { display: none; }
  .status-tab { flex-shrink: 0; }

  .product-grid { grid-template-columns: 1fr; }
  .field-row { flex-direction: column; gap: 0; }
  .edit-drawer { width: 100vw; }
  .drawer-footer { flex-direction: column; align-items: stretch; }
  .drawer-footer-main { max-width: none; margin-left: 0; }

  /* Announcements list: card layout instead of the full table. Only the
     thumbnail + title + MLB code stay in place; SKU/Preço/Estoque/Status
     columns are hidden (nth-child matches .table-row's/.table-head's grid
     children) and the status pill is repositioned under the title instead
     of being dropped, since it's the same cell/content, just relocated. */
  .table-wrap { overflow-x: hidden; }
  .table-head { display: none; }

  .table-row {
    grid-template-columns: 52px 1fr;
    grid-template-rows: auto auto;
    align-items: start;
    gap: 6px 14px;
    min-width: 0;
    min-height: 0;
    padding: 18px 16px;
  }

  .table-row > :nth-child(2),
  .table-row > :nth-child(3),
  .table-row > :nth-child(4),
  .row-arrow { display: none; }

  .item-cell { display: contents; }
  .row-thumb { grid-column: 1; grid-row: 1 / 3; align-self: center; }
  .item-copy { grid-column: 2; grid-row: 1; }

  .item-title {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .status-col {
    grid-column: 2;
    grid-row: 2;
    text-align: left;
  }
}
