:root {
  color-scheme: light;
  accent-color: #f5a524;
  --bg: #fdf9f0;
  --surface: #ffffff;
  --surface-alt: #fdf6e8;
  --ink: #1a1a1a;
  --ink-soft: #6b6b6b;
  --brand: #f5a524;
  --brand-dark: #d68910;
  --brand-soft: #fef3d4;
  --brand-ink: #1a1a1a;
  --accent: #7ed957;
  --accent-soft: #d9f5c5;
  --success: #2e7d4f;
  --success-soft: #e7f3eb;
  --danger: #c0392b;
  --danger-soft: #fbeae7;
  --border: #f0e8d4;
  --shadow: 0 2px 12px rgba(40, 30, 0, 0.06);
  --radius: 16px;
  --radius-sm: 10px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  accent-color: #f5a524;
  --bg: #161210;
  --surface: #1f1a14;
  --surface-alt: #28211a;
  --ink: #f5efe4;
  --ink-soft: #b8a999;
  --brand: #f5a524;
  --brand-dark: #f9bb50;
  --brand-soft: #3d2a10;
  --brand-ink: #1a1a1a;
  --accent: #7ed957;
  --accent-soft: #1f3819;
  --success: #4ade80;
  --success-soft: #1a3a26;
  --danger: #ef6055;
  --danger-soft: #3a1a17;
  --border: #38302a;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--brand);
  text-decoration: none;
}
a:hover { color: var(--brand-dark); text-decoration: underline; }

/* ==== Layout ==== */

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

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

.topbar .brand img {
  height: 36px;
  width: 36px;
  object-fit: contain;
  display: block;
}

.topbar .brand .brand-name {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.2px;
  color: var(--ink);
}

@media (max-width: 600px) {
  .topbar .brand .brand-name { display: none; }
}

.theme-toggle {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  cursor: pointer;
  display: grid;
  place-items: center;
  color: var(--ink);
  transition: background 0.15s;
  padding: 0;
  font-family: inherit;
  line-height: 1;
}
.theme-toggle:hover { background: var(--brand-soft); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .ic-sun { display: none; }
.theme-toggle .ic-moon { display: block; }
:root[data-theme="dark"] .theme-toggle .ic-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .ic-moon { display: none; }

.theme-toggle-floating {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10;
}

.topbar nav {
  display: flex;
  gap: 4px;
}

.topbar nav a {
  color: var(--ink-soft);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
}
.topbar nav a:hover { background: var(--brand-soft); color: var(--ink); text-decoration: none; }
.topbar nav a.active { background: var(--brand); color: var(--brand-ink); }

.topbar .user-area {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--ink-soft);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px;
}

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

.page-header h1 {
  font-size: 24px;
  font-weight: 600;
}

.page-header .subtitle {
  color: var(--ink-soft);
  font-size: 14px;
  margin-top: 4px;
}

/* ==== Cards ==== */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.grid {
  display: grid;
  gap: 16px;
}
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols-5 { grid-template-columns: repeat(5, 1fr); }

@media (max-width: 1100px) {
  .grid.cols-5 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
  .grid.cols-3, .grid.cols-4, .grid.cols-5 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .grid.cols-2, .grid.cols-3, .grid.cols-4, .grid.cols-5 { grid-template-columns: 1fr; }
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.stat-card .label {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-card .value {
  font-size: 28px;
  font-weight: 700;
  margin-top: 6px;
  color: var(--ink);
}

.stat-card.success .value { color: var(--success); }
.stat-card.brand .value { color: var(--brand-dark); }
.stat-card.accent .value { color: #2d6e1f; }
.stat-card .sub {
  color: var(--ink-soft);
  font-size: 12px;
  margin-top: 6px;
}

/* ==== Forms ==== */

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

@media (max-width: 600px) {
  .form-row { grid-template-columns: 1fr; }
}

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

.field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
}

.field input,
.field select,
.field textarea {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14px;
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
}

.field select,
.toolbar select {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  padding-right: 34px;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.field textarea { resize: vertical; min-height: 80px; }

.field .hint {
  font-size: 12px;
  color: var(--ink-soft);
}

/* ==== Buttons ==== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  background: var(--surface);
  color: var(--ink);
  border-color: var(--border);
}
.btn:hover { background: var(--surface-alt); }

.btn.primary {
  background: var(--brand);
  color: var(--brand-ink);
  border-color: var(--brand);
  font-weight: 600;
}
.btn.primary:hover { background: var(--brand-dark); color: var(--brand-ink); border-color: var(--brand-dark); }

.btn.success {
  background: var(--success);
  color: white;
  border-color: var(--success);
}
.btn.success:hover { filter: brightness(0.92); }

.btn.danger {
  background: var(--surface);
  color: var(--danger);
  border-color: var(--danger-soft);
}
.btn.danger:hover { background: var(--danger-soft); }

.btn.small { padding: 6px 12px; font-size: 13px; }

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ==== Tables ==== */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

table th, table td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

table th {
  background: var(--surface-alt);
  font-weight: 600;
  font-size: 13px;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

table tr:last-child td { border-bottom: none; }
table tr:hover td { background: var(--surface-alt); }

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

/* ==== Badge ==== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge.success { background: var(--success-soft); color: var(--success); }
.badge.brand { background: var(--brand-soft); color: var(--brand-dark); }
.badge.accent { background: var(--accent-soft); color: #2d6e1f; }
.badge.muted { background: var(--surface-alt); color: var(--ink-soft); }

/* ==== Modal ==== */

.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-bg.open { display: flex; }
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal h2 {
  font-size: 18px;
  margin-bottom: 16px;
}
.modal .actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 18px;
}

/* ==== Peca cards ==== */

.peca-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.peca-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.peca-card .img {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--brand-soft);
  display: grid;
  place-items: center;
  color: var(--brand-dark);
  overflow: hidden;
  position: relative;
}
.peca-card .img > svg { width: 48px; height: 48px; }
.peca-card .img img { width: 100%; height: 100%; object-fit: cover; }

.peca-card .sold-overlay {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--success);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.peca-card .body { padding: 14px; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.peca-card .nome { font-weight: 600; font-size: 15px; color: var(--ink); }
.peca-card .meta { font-size: 13px; color: var(--ink-soft); }
.peca-card .precos { margin-top: 6px; display: flex; align-items: baseline; gap: 8px; }
.peca-card .preco-de { font-size: 12px; color: var(--ink-soft); text-decoration: line-through; }
.peca-card .preco-por { font-size: 18px; font-weight: 700; color: var(--brand-dark); }
.peca-card .actions { padding: 0 14px 14px; display: flex; gap: 8px; flex-wrap: wrap; }

/* ==== Login page ==== */

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(circle at 15% 20%, var(--brand-soft) 0%, transparent 45%),
    radial-gradient(circle at 85% 80%, var(--accent-soft) 0%, transparent 50%),
    var(--bg);
}

.auth-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 36px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 8px 32px rgba(60, 40, 20, 0.12);
}

.auth-card .logo-block {
  text-align: center;
  margin-bottom: 24px;
}
.auth-card .logo-block img {
  width: auto;
  max-width: 240px;
  height: auto;
  object-fit: contain;
}
.auth-card .logo-block h2 {
  font-size: 16px;
  font-weight: 600;
  margin-top: 10px;
  color: var(--ink);
}
.auth-card .logo-block p { font-size: 13px; color: var(--ink-soft); margin-top: 4px; }

.auth-card .switch {
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
  color: var(--ink-soft);
}

.alert {
  background: var(--danger-soft);
  color: var(--danger);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 14px;
  display: none;
}
.alert.visible { display: block; }

/* ==== Helpers ==== */
.row { display: flex; gap: 10px; align-items: center; }
.row.gap-lg { gap: 18px; }
.spacer { flex: 1; }
.muted { color: var(--ink-soft); }
.mt-lg { margin-top: 24px; }
.mb-lg { margin-bottom: 24px; }

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--ink-soft);
}
.empty-state .icon {
  margin: 0 auto 12px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-dark);
  display: grid;
  place-items: center;
}
.empty-state .icon svg { width: 30px; height: 30px; }
.empty-state h3 { font-size: 16px; font-weight: 600; margin-bottom: 6px; color: var(--ink); }
.empty-state p { font-size: 14px; }

.foto-thumbs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.foto-thumb {
  position: relative;
  width: 70px;
  height: 70px;
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
  overflow: hidden;
  border: 1px solid var(--border);
}
.foto-thumb img { width: 100%; height: 100%; object-fit: cover; }
.foto-thumb button {
  position: absolute;
  top: 2px;
  right: 2px;
  background: rgba(192, 57, 43, 0.92);
  color: white;
  border: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 12px;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.toolbar input[type="search"],
.toolbar select {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
}
.toolbar input[type="search"] { min-width: 240px; }

input::placeholder,
textarea::placeholder {
  color: var(--ink-soft) !important;
  opacity: 0.7;
}
input::-webkit-input-placeholder,
textarea::-webkit-input-placeholder {
  color: var(--ink-soft) !important;
  opacity: 0.7;
}

/* ==== Bottom nav mobile (PWA) ==== */

.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 6px 4px;
  padding-bottom: calc(6px + env(safe-area-inset-bottom));
  z-index: 50;
  justify-content: space-around;
  align-items: center;
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.04);
}

.bottom-nav a,
.bottom-nav button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 11px;
  font-weight: 500;
  border: none;
  background: none;
  font-family: inherit;
  cursor: pointer;
  min-width: 0;
  flex: 1;
  border-radius: 10px;
  transition: color 0.15s;
}

.bottom-nav a:hover,
.bottom-nav button:hover {
  text-decoration: none;
  color: var(--ink);
}

.bottom-nav a.active {
  color: var(--brand-dark);
}

.bottom-nav .icon {
  display: grid;
  place-items: center;
  line-height: 1;
}
.bottom-nav .icon svg { width: 22px; height: 22px; }

@media (max-width: 768px) {
  .bottom-nav { display: flex; }
  body { padding-bottom: 70px; }
  .topbar nav { display: none; }
  .topbar .user-area #user-label { display: none; }
  .topbar { padding: 10px 16px; }
  .container { padding: 18px 16px; }
}

/* ==== Catalogo publico ==== */

.catalogo-page { background: var(--bg); }

.cat-header {
  position: sticky;
  top: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 20;
  backdrop-filter: blur(8px);
}
.cat-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  padding-bottom: 14px;
}
.cat-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  flex-shrink: 0;
}
.cat-brand:hover { text-decoration: none; }
.cat-brand img {
  height: 54px;
  width: auto;
  display: block;
}
.cat-brand span {
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.2px;
}
.cat-header-actions { display: flex; align-items: center; gap: 8px; }

/* Nav horizontal de categorias no header */
.cat-header-nav {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 4px 0;
  margin: 0 16px;
  min-width: 0;
  justify-content: center;
}
.cat-header-nav::-webkit-scrollbar { display: none; }

.cat-nav-item {
  flex-shrink: 0;
  padding: 7px 14px;
  background: none;
  border: none;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  transition: all 0.15s;
}
.cat-nav-item:hover {
  color: var(--ink);
  background: var(--surface-alt);
}
.cat-nav-item.is-active {
  color: var(--ink);
  background: var(--brand-soft);
  font-weight: 600;
}

@media (max-width: 768px) {
  .cat-header-nav {
    justify-content: flex-start;
    margin: 0 8px;
  }
  .cat-nav-item {
    font-size: 13px;
    padding: 6px 11px;
  }
  .cat-brand span { display: none; }
  .cat-brand img { height: 42px; }
}

.cat-hero {
  padding: 40px 0 28px;
  text-align: center;
}
.cat-hero h1 {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.6px;
  color: var(--ink);
}
.cat-hero p {
  font-size: 15px;
  color: var(--ink-soft);
  margin-top: 6px;
}

.cat-search {
  margin: 22px auto 0;
  max-width: 520px;
  position: relative;
}
.cat-search input[type="search"] {
  width: 100%;
  padding: 14px 18px 14px 46px;
  font-size: 15px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}
.cat-search input[type="search"]:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-soft);
}
.cat-search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--ink-soft);
  pointer-events: none;
  display: grid;
  place-items: center;
}
.cat-search-icon svg { width: 18px; height: 18px; }

.cat-chips-wrap {
  padding: 0 0 8px;
  overflow: hidden;
}
.cat-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 4px 0 12px;
  margin: 0 -4px;
}
.cat-chips::-webkit-scrollbar { display: none; }
.cat-chip {
  flex-shrink: 0;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.cat-chip:hover { background: var(--surface-alt); }
.cat-chip.is-active {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

/* Banners carousel */
.cat-banner-wrap {
  padding: 20px 0 0;
}
.cat-banners {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  aspect-ratio: 3 / 1;
  background: var(--surface-alt);
}
.cat-banner-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.6s ease;
  display: block;
}
.cat-banner-slide.is-active { opacity: 1; z-index: 1; }
.cat-banner-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cat-banner-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 12px;
}
.cat-banner-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--border);
  border: none;
  padding: 0;
  cursor: pointer;
  transition: all 0.3s;
}
.cat-banner-dot.is-active {
  background: var(--ink);
  width: 24px;
}

/* Categorias grid */
.cat-categorias-section { padding: 32px 0 8px; }
.cat-section-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.2px;
  margin-bottom: 14px;
  color: var(--ink);
}
.cat-categorias-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 14px;
}
.cat-cat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  color: var(--ink);
  transition: transform 0.15s;
}
.cat-cat-card:hover { transform: translateY(-3px); }
.cat-cat-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: var(--surface);
  overflow: hidden;
  border: 2px solid var(--border);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.cat-cat-card.is-active .cat-cat-img {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-soft);
}
.cat-cat-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cat-cat-img-fallback,
.cat-cat-img-todos {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  color: var(--brand-dark);
}
.cat-cat-img-fallback svg,
.cat-cat-img-todos svg { width: 28px; height: 28px; }
.cat-cat-card span {
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  line-height: 1.2;
}

.cat-section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
  gap: 14px;
  flex-wrap: wrap;
}
.cat-section-header .cat-section-title { margin-bottom: 0; }

.cat-main { padding-top: 32px; }

.cat-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.cat-count {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-soft);
}
.cat-toolbar-right {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.cat-toolbar select {
  padding: 8px 30px 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background-color: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
}

.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 22px;
  padding-bottom: 40px;
}

.cat-card {
  background: var(--surface);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, box-shadow 0.2s;
  border: 1px solid var(--border);
}
.cat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.07);
}
.cat-card-img {
  position: relative;
  aspect-ratio: 3 / 4;
  background: var(--surface-alt);
  overflow: hidden;
}
.cat-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}
.cat-card:hover .cat-card-img img { transform: scale(1.03); }
.cat-card-img-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--brand-dark);
}
.cat-card-img-fallback svg { width: 48px; height: 48px; }
.cat-card-fotos {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.65);
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  letter-spacing: 0.2px;
}
.cat-card-body {
  padding: 12px 14px 6px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cat-card-nome {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
}
.cat-card-meta {
  font-size: 12px;
  color: var(--ink-soft);
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.cat-card-meta-sep { opacity: 0.5; }
.cat-card-precos {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 6px;
}
.cat-preco-de {
  font-size: 12px;
  color: var(--ink-soft);
  text-decoration: line-through;
}
.cat-preco-por {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.3px;
}
.cat-card-actions {
  padding: 0 14px 14px;
}
.cat-btn-whatsapp {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 10px;
  background: var(--surface);
  color: #1c8a4e;
  border: 1.5px solid #1c8a4e;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
}
.cat-btn-whatsapp:hover {
  background: #1c8a4e;
  color: white;
  text-decoration: none;
}
.cat-btn-whatsapp svg { width: 15px; height: 15px; }
.cat-btn-whatsapp.disabled {
  background: var(--surface-alt);
  color: var(--ink-soft);
  border-color: var(--border);
  cursor: not-allowed;
  pointer-events: none;
}

:root[data-theme="dark"] .cat-btn-whatsapp {
  color: #4ade80;
  border-color: #4ade80;
}
:root[data-theme="dark"] .cat-btn-whatsapp:hover {
  background: #4ade80;
  color: #0c1f12;
}

.cat-footer {
  margin-top: 60px;
  padding-top: 40px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.cat-footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 32px;
}
.cat-footer-brand img {
  height: 60px;
  width: auto;
  display: block;
  margin-bottom: 14px;
}
.cat-footer-brand p {
  font-size: 13.5px;
  color: var(--ink-soft);
  line-height: 1.55;
  max-width: 380px;
}
.cat-footer-col h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 14px;
  letter-spacing: -0.1px;
}
.cat-footer-col ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cat-footer-col li {
  font-size: 13.5px;
  color: var(--ink-soft);
}
.cat-footer-col li a {
  color: var(--ink-soft);
  text-decoration: none;
  transition: color 0.15s;
}
.cat-footer-col li a:hover {
  color: var(--brand-dark);
  text-decoration: none;
}
.cat-footer-bottom {
  padding: 18px 0;
  border-top: 1px solid var(--border);
  text-align: center;
}
.cat-footer-bottom p {
  font-size: 13px;
  color: var(--ink-soft);
}

@media (max-width: 768px) {
  .cat-footer-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }
  .cat-footer-brand p { max-width: none; }
}

@media (max-width: 600px) {
  .cat-hero { padding: 28px 0 20px; }
  .cat-hero h1 { font-size: 24px; }
  .cat-hero p { font-size: 14px; }
  .cat-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .cat-card-body { padding: 10px 10px 4px; }
  .cat-card-nome { font-size: 13px; }
  .cat-card-actions { padding: 0 10px 10px; }
  .cat-preco-por { font-size: 15px; }
  .cat-categorias-grid {
    grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
    gap: 10px;
  }
  .cat-cat-card span { font-size: 12px; }
  .cat-banners { aspect-ratio: 16 / 9; border-radius: 14px; }
}

/* ==== Admin: banners + categoria thumbs ==== */

.banners-admin-list { display: flex; flex-direction: column; gap: 10px; }
.banner-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px;
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.banner-row-img {
  width: 96px;
  height: 32px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}
.banner-row-info { flex: 1; min-width: 0; }
.banner-row-info strong { font-size: 14px; }
.banner-row-info .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.banner-row-status { margin-top: 4px; }
.banner-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  cursor: pointer;
  color: var(--ink-soft);
}
.banner-toggle input { accent-color: var(--brand); }
.banner-row-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

@media (max-width: 600px) {
  .banner-row { flex-wrap: wrap; }
  .banner-row-img { width: 100%; height: 80px; }
}

.cat-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 8px;
  display: block;
}
.cat-thumb-empty {
  background: var(--surface-alt);
  border: 1px dashed var(--border);
}

.cat-img-preview { margin-bottom: 8px; }
.cat-img-preview-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}
.cat-img-preview-wrap img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 8px;
}

.peca-card .preco-block {
  padding: 0 14px 12px;
}

.btn-whatsapp {
  background: #25d366;
  color: white;
  border: none;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  font-family: inherit;
  text-decoration: none;
  transition: background 0.15s;
}
.btn-whatsapp:hover { background: #1ebd5a; text-decoration: none; color: white; }
.btn-whatsapp:disabled, .btn-whatsapp.disabled {
  background: var(--surface-alt);
  color: var(--ink-soft);
  cursor: not-allowed;
  pointer-events: none;
}
.btn-whatsapp svg { width: 18px; height: 18px; }

.info-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.info-row .info-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  color: var(--brand-dark);
}
.info-row .info-icon svg { width: 20px; height: 20px; }
.info-row.warn .info-icon { background: var(--danger-soft); color: var(--danger); }

/* Lightbox de fotos */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}
.lightbox.open { display: flex; }
.lightbox img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 8px;
}
.lightbox .lb-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255,255,255,0.15);
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
}
.lightbox .lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.15);
  color: white;
  border: none;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  font-size: 24px;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.lightbox .lb-prev { left: 20px; }
.lightbox .lb-next { right: 20px; }
