* { box-sizing: border-box; }

:root {
  --bg: #f6f2ec;
  --card: #ffffff;
  --text: #171717;
  --muted: #6c6864;
  --line: #e4ddd4;
  --red: #a71922;
  --red-dark: #7f1118;
  --red-soft: #f9ecec;
  --gold: #c6a348;
  --gold-soft: #f7f0df;
  --black: #151515;
  --shadow: 0 10px 32px rgba(37, 29, 24, .08);
}

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(circle at 8% 0%, rgba(167,25,34,.055), transparent 28rem),
    radial-gradient(circle at 100% 10%, rgba(198,163,72,.07), transparent 24rem),
    var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
}

body { min-height: 100vh; }
button, input, select { font: inherit; }
button { cursor: pointer; }

.app-shell {
  width: min(900px, calc(100% - 24px));
  margin: 0 auto;
  padding: 18px 0 42px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
}

.brand-topbar {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #121212 0%, #1c1717 58%, #271719 100%);
  color: #fff;
  border: 1px solid rgba(255,255,255,.055);
  border-radius: 24px;
  padding: 15px 17px;
  box-shadow: 0 18px 44px rgba(17,17,17,.16);
}

.brand-topbar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--red) 0 72%, var(--gold) 72% 100%);
}

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

.brand-logo-box {
  width: 118px;
  height: 58px;
  border-radius: 14px;
  background: linear-gradient(145deg, #b61f29, #8f1119);
  border: 1px solid rgba(219,186,94,.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 11px;
  flex: 0 0 auto;
}

.brand-logo-box img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: invert(1);
}

.brand-copy { min-width: 0; }
.eyebrow {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .12em;
  color: #e9cf87;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin: 2px 0 1px; font-size: 30px; line-height: 1; }
h2 { margin-bottom: 8px; }
.brand-subtitle { color: #cfcfcf; font-size: 12px; }

.topbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  position: relative;
  z-index: 1;
}

.header-btn {
  border-color: #4b4b4b !important;
  color: #fff !important;
  background: #232323 !important;
}
.header-btn:hover { border-color: var(--gold) !important; }

.card {
  background: rgba(255,255,255,.96);
  border: 1px solid rgba(221,212,202,.86);
  border-radius: 20px;
  padding: 22px;
  box-shadow: 0 10px 30px rgba(37,29,24,.065);
}

.card + .card { margin-top: 14px; }

.step, .section-kicker {
  display: inline-block;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .09em;
  text-transform: uppercase;
  margin-bottom: 10px;
  color: var(--red);
}

.section-kicker { color: #8b6b23; margin-bottom: 7px; }
.muted { color: var(--muted); }

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.choice-btn,
.product-btn {
  border: 1px solid #ddd4c9;
  background: linear-gradient(180deg, #fff 0%, #fefcf9 100%);
  color: var(--text);
  border-radius: 15px;
  padding: 17px 15px;
  font-weight: 900;
  min-height: 62px;
  box-shadow: 0 4px 14px rgba(24,24,24,.04);
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}

.choice-btn:hover,
.product-btn:hover {
  border-color: var(--red);
  box-shadow: 0 6px 18px rgba(167,25,34,.08);
}
.choice-btn:active, .product-btn:active { transform: scale(.99); }

.category-btn {
  min-height: 88px;
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.category-btn::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--red);
}
.category-btn strong { display: block; font-size: 17px; }
.category-btn small { display: block; margin-top: 5px; color: var(--muted); font-weight: 500; line-height: 1.35; }

.product-list { display: grid; gap: 10px; margin-top: 12px; }
.product-btn { text-align: left; }
.product-btn small { display: block; font-weight: 500; color: var(--muted); margin-top: 5px; }
.product-btn .product-subcategory-tag {
  display: inline-flex;
  margin-top: 7px;
  font-size: 10px;
  font-weight: 900;
  color: var(--red-dark);
  background: var(--red-soft);
  border-radius: 999px;
  padding: 4px 7px;
}

.subcategory-filter-bar {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  scrollbar-width: thin;
  padding: 4px 1px 7px;
  margin-top: 12px;
  margin-bottom: 2px;
  -webkit-overflow-scrolling: touch;
}
.subcategory-filter-bar:empty { display: none; }
.subcategory-chip {
  flex: 0 0 auto;
  border: 1px solid #d7cfc5;
  background: #fff;
  color: #4a4642;
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.subcategory-chip.active {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
  box-shadow: 0 4px 10px rgba(167,25,34,.18);
}
.subcategory-chip .chip-count { opacity: .74; margin-left: 4px; }

.other-box { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 18px; }
label { font-weight: 800; display: block; margin-bottom: 7px; color: #302d2a; }
.inline { display: flex; gap: 10px; }

input, select {
  width: 100%;
  border: 1px solid #cfc5ba;
  border-radius: 11px;
  padding: 13px 12px;
  background: white;
  color: var(--text);
  outline: none;
}
input:focus, select:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(167,25,34,.09);
}

.primary-btn,
.secondary-btn,
.ghost-btn {
  border-radius: 10px;
  padding: 12px 16px;
  font-weight: 900;
  border: 0;
}
.primary-btn { background: var(--red); color: #fff; }
.primary-btn:hover { background: linear-gradient(180deg, #a81721 0%, var(--red-dark) 100%); transform: translateY(-1px); }
.primary-btn:active { transform: translateY(0); }
.secondary-btn { background: #eee8e2; color: #292623; }
.ghost-btn { background: transparent; color: var(--text); border: 1px solid #c8beb3; }
.full { width: 100%; margin-top: 14px; }
.hidden { display: none !important; }

.preview-wrap { margin-top: 18px; }
.preview-actions { display: flex; justify-content: space-between; align-items: end; gap: 14px; margin-bottom: 16px; }
.preview-actions h2 { margin-bottom: 0; }
.label-stage { background: #dfd9d1; border-radius: 18px; padding: 26px; display: flex; justify-content: center; overflow: auto; }
.footer-actions { display: flex; justify-content: center; margin-top: 16px; }

/* Etiqueta térmica aprovada: não alterar sem nova validação física. */
.thermal-label {
  width: 50mm;
  height: 40mm;
  background: white;
  color: black;
  border: 1px solid #111;
  padding: 1.9mm 2.6mm 1.8mm;
  display: flex;
  flex-direction: column;
  font-family: Arial, Helvetica, sans-serif;
  overflow: hidden;
}
.label-header { display: flex; align-items: center; justify-content: space-between; gap: 1.3mm; min-height: 10.2mm; }
.label-product {
  flex: 0 0 60%; font-size: 10.4pt; line-height: .98; font-weight: 900; text-align: left; text-transform: uppercase;
  max-height: 10.0mm; overflow: hidden; letter-spacing: .01em; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
}
.label-product.long-name { font-size: 9.2pt; }
.label-product.very-long-name { font-size: 8.3pt; }
.label-logo { flex: 0 0 40%; display: flex; justify-content: flex-end; align-items: center; min-height: 7.3mm; }
.label-logo img { display: block; max-width: 100%; max-height: 6.7mm; object-fit: contain; }
.label-divider { border-top: .48mm solid #000; margin: .85mm 0 1.45mm; }
.label-divider.thin { border-top-width: .26mm; margin: 1.0mm 0 .8mm; }
.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 2mm; font-size: 8.7pt; margin-bottom: 1.8mm; }
.label-row span, .label-responsible span { font-weight: 700; }
.label-row strong { font-size: 10.7pt; }
.label-responsible { display: flex; flex-direction: column; align-items: flex-start; gap: .45mm; font-size: 8.2pt; line-height: 1; white-space: nowrap; overflow: hidden; }
.label-responsible span { font-weight: 800; }
.label-responsible strong { font-size: 8.7pt; font-weight: 700; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.label-note { font-size: 5.7pt; line-height: 1.05; font-weight: 800; text-align: center; text-transform: uppercase; margin: .15mm 0 .45mm; max-height: 4.2mm; overflow: hidden; }
.thermal-label.has-note .label-row { margin-bottom: 1.15mm; }
.thermal-label.has-note .label-divider { margin-bottom: 1.15mm; }
.thermal-label.has-note .label-divider.thin { margin-top: .45mm; }

/* Administração */
.admin-area { display: block; }
.admin-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 16px; }
.admin-header > div:first-child { max-width: 620px; }
.admin-grid { display: grid; grid-template-columns: minmax(280px, .9fr) minmax(320px, 1.1fr); gap: 16px; align-items: start; }
.categories-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.admin-form-card h3, .admin-list-head h3 { margin-top: 0; margin-bottom: 12px; }
.admin-form-card label:not(.check-row) { margin-top: 14px; }
.field-help { color: var(--muted); font-size: 12px; margin: 6px 0 0; line-height: 1.4; }
.check-row { display: flex; align-items: center; gap: 9px; margin-top: 16px; cursor: pointer; }
.check-row input { width: 18px; height: 18px; margin: 0; }
.form-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.admin-list-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.compact { margin-bottom: 0; font-size: 13px; }
.count-badge, .module-count {
  min-width: 34px; height: 34px; padding: 0 10px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 900; background: var(--black); color: white;
}
.admin-product-list { display: grid; gap: 10px; }
.admin-product-item { border: 1px solid #ddd4ca; border-radius: 13px; padding: 13px; background: #fff; }
.admin-product-item.inactive { opacity: .62; background: #f5f2ef; }
.admin-product-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.admin-product-name { font-weight: 900; font-size: 15px; }
.status-pill { display: inline-flex; align-items: center; min-height: 24px; padding: 3px 8px; border: 1px solid #d4c8bb; border-radius: 999px; font-size: 10px; font-weight: 900; white-space: nowrap; background: var(--gold-soft); }
.admin-product-meta { margin-top: 7px; color: #5c5752; font-size: 13px; line-height: 1.45; }
.admin-product-actions { display: flex; gap: 8px; margin-top: 11px; flex-wrap: wrap; }
.mini-btn, .danger-btn { border: 1px solid #cfc5ba; background: #fff; color: #2d2926; border-radius: 8px; padding: 8px 10px; font-weight: 900; font-size: 12px; }
.mini-btn:hover { border-color: var(--red); color: var(--red); }
.danger-btn { color: #8d171e; border-color: #e2c2c4; background: #fffafa; }
.danger-btn:hover { background: #faeeee; }
.empty-state { border: 1px dashed #c8beb3; border-radius: 12px; padding: 20px; text-align: center; color: var(--muted); background: #fdfbf9; }
.responsible-admin-card { grid-column: 1 / -1; }
.admin-responsible-list { display: grid; gap: 9px; margin-top: 16px; }
.admin-responsible-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid #ddd4ca; border-radius: 12px; padding: 11px 12px; background: #fff; }
.admin-responsible-name { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.admin-home { margin-top: 4px; }
.admin-menu-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.admin-module-btn {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; min-height: 178px; padding: 20px;
  border: 1px solid #ddd3c7; border-radius: 19px; background: linear-gradient(145deg, #fff 0%, #fcfaf7 100%); color: var(--text); text-align: left; box-shadow: 0 9px 27px rgba(37,29,24,.06); transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.admin-module-btn::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; border-radius: 0 0 18px 18px; background: var(--red); opacity: .92; }
.admin-module-btn:hover { border-color: #d2b25b; transform: translateY(-2px); box-shadow: 0 14px 34px rgba(37,29,24,.095); }
.admin-module-btn:active { transform: translateY(0) scale(.995); }
.admin-module-icon { display: flex; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: 14px; background: linear-gradient(145deg, var(--red-soft), #fff7f4); border: 1px solid #eed6d4; font-size: 22px; }
.admin-module-copy { display: flex; flex-direction: column; gap: 6px; padding-right: 28px; }
.admin-module-copy strong { font-size: 17px; }
.admin-module-copy small { color: var(--muted); font-weight: 500; line-height: 1.35; }
.module-count { position: absolute; top: 16px; right: 16px; min-width: 30px; height: 30px; font-size: 12px; background: #211e1b; border: 1px solid rgba(198,163,72,.55); }
.admin-module { margin-top: 4px; }
.module-header { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.module-header h3 { margin: 0 0 5px; font-size: 22px; }
.back-admin-btn { flex: 0 0 auto; border: 1px solid #d7cdc2; background: rgba(255,255,255,.86); color: var(--text); border-radius: 11px; padding: 10px 13px; font-weight: 900; box-shadow: 0 4px 12px rgba(37,29,24,.035); }
.back-admin-btn:hover { border-color: var(--gold); }
.category-empty { grid-column: 1 / -1; }

.subcategory-admin-group { border-top: 1px solid var(--line); padding-top: 11px; margin-top: 11px; }
.subcategory-admin-group:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.subcategory-group-title { display: flex; justify-content: space-between; gap: 10px; align-items: center; font-weight: 900; margin-bottom: 8px; }
.subcategory-row { display: flex; align-items: center; justify-content: space-between; gap: 9px; padding: 9px 0; border-top: 1px solid #f0ebe5; }
.subcategory-row:first-of-type { border-top: 0; }
.subcategory-name { min-width: 0; font-weight: 800; }
.subcategory-meta { font-size: 11px; color: var(--muted); display: block; margin-top: 2px; }
.subcategory-actions { display: flex; gap: 6px; flex: 0 0 auto; }

/* Modal de movimentação */
.modal-backdrop { position: fixed; inset: 0; z-index: 1000; background: rgba(15,15,15,.58); display: flex; align-items: center; justify-content: center; padding: 18px; }
.modal-card { width: min(520px, 100%); background: #fff; border-radius: 20px; overflow: hidden; box-shadow: 0 24px 70px rgba(0,0,0,.28); }
.modal-accent { height: 6px; background: linear-gradient(90deg, var(--red) 0 72%, var(--gold) 72% 100%); }
.modal-content { padding: 22px; }
.modal-content label { margin-top: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }


/* Refinamento visual clean/premium — V0.16 */
.admin-header {
  padding: 4px 2px 2px;
}
.admin-header h2 {
  font-size: clamp(25px, 4vw, 34px);
  letter-spacing: -.025em;
  margin-bottom: 6px;
}
.admin-module-copy strong { letter-spacing: -.01em; }
.module-header {
  padding: 3px 2px 0;
}
.module-header > div { min-width: 0; }
.module-header .section-kicker { margin-bottom: 4px; }
.admin-product-item, .admin-responsible-item {
  box-shadow: 0 3px 12px rgba(37,29,24,.025);
}
.choice-btn.category-btn {
  box-shadow: 0 7px 20px rgba(37,29,24,.045);
}
.choice-btn.category-btn:hover {
  transform: translateY(-1px);
}
.subcategory-chip { transition: background .14s ease, color .14s ease, border-color .14s ease, transform .14s ease; }
.subcategory-chip:active { transform: scale(.97); }
input, select { min-height: 46px; }
.primary-btn, .secondary-btn, .ghost-btn, .back-admin-btn { transition: transform .14s ease, background .14s ease, border-color .14s ease, box-shadow .14s ease; }

@page { size: 50mm 40mm; margin: 0; }
@media print {
  html, body { width: 50mm; height: 40mm; margin: 0 !important; padding: 0 !important; background: #fff !important; }
  body * { visibility: hidden !important; }
  #printLabel, #printLabel * { visibility: visible !important; }
  #printLabel { position: fixed; left: 0; top: 0; width: 50mm !important; height: 40mm !important; border: 0 !important; margin: 0 !important; }
  .no-print { display: none !important; }
}

@media (max-width: 760px) {
  .admin-grid, .categories-grid { grid-template-columns: 1fr; }
  .admin-header { flex-direction: column; }
  .admin-menu-grid { grid-template-columns: 1fr; }
  .admin-module-btn { min-height: 132px; }
  .module-header { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 620px) {
  .brand-topbar { align-items: stretch; flex-direction: column; }
  .topbar-actions { justify-content: stretch; }
  .header-btn { flex: 1 1 auto; }
  .brand-logo-box { width: 102px; height: 52px; }
  h1 { font-size: 27px; }
}

@media (max-width: 520px) {
  .app-shell { width: min(100% - 18px, 900px); padding-top: 9px; }
  .choice-grid { grid-template-columns: 1fr; }
  .preview-actions { align-items: stretch; flex-direction: column; }
  .preview-actions .primary-btn { width: 100%; }
  .inline { flex-direction: column; }
  .brand-lockup { gap: 10px; }
  .brand-logo-box { width: 88px; height: 48px; padding: 9px; }
  .brand-subtitle { display: none; }
  .topbar-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .card { padding: 18px; border-radius: 17px; }
  .subcategory-filter-bar { margin-right: -8px; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions button { width: 100%; }
  .subcategory-row { align-items: flex-start; }
  .subcategory-actions { flex-direction: column; }
}

/* Experiência mobile/tablet — V0.17
   Ajustes somente na interface. A etiqueta 50x40 acima permanece inalterada. */

/* Alvos de toque confortáveis e formulários sem zoom inesperado em celulares. */
button,
input,
select {
  touch-action: manipulation;
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.back-admin-btn,
.choice-btn,
.product-btn,
.subcategory-chip,
.mini-btn,
.danger-btn {
  -webkit-tap-highlight-color: transparent;
}

/* Lista de produtos aproveita melhor tablets sem prejudicar celulares. */
@media (min-width: 680px) {
  #stepProduct .product-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Tablets: mantém módulos administrativos em 2 colunas por mais tempo. */
@media (min-width: 600px) and (max-width: 760px) {
  .admin-menu-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-module-btn {
    min-height: 150px;
  }
}

@media (max-width: 620px) {
  html,
  body {
    width: 100%;
    overflow-x: hidden;
  }

  body {
    padding-bottom: env(safe-area-inset-bottom);
  }

  .app-shell {
    width: min(100% - 16px, 900px);
    padding-top: max(8px, env(safe-area-inset-top));
    padding-bottom: calc(28px + env(safe-area-inset-bottom));
  }

  .brand-topbar {
    border-radius: 19px;
    padding: 13px 13px 14px;
    gap: 13px;
  }

  .brand-lockup {
    width: 100%;
  }

  .brand-copy h1 {
    font-size: 25px;
  }

  .eyebrow {
    font-size: 10px;
  }

  .topbar-actions {
    width: 100%;
  }

  .header-btn {
    min-height: 44px;
    padding: 10px 11px;
    font-size: 13px;
  }

  .card {
    padding: 18px;
  }

  .card h2 {
    font-size: 24px;
    line-height: 1.08;
  }

  .choice-btn,
  .product-btn {
    min-height: 58px;
    padding: 14px 13px;
  }

  /* Responsáveis são nomes curtos: 2 colunas economizam rolagem. */
  #stepResponsible .choice-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  #stepResponsible .choice-btn {
    min-height: 52px;
    padding: 11px 9px;
    font-size: 14px;
  }

  /* Categorias têm descrição: continuam em uma coluna para leitura confortável. */
  #stepCategory .choice-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .category-btn {
    min-height: 76px;
    padding-left: 15px;
  }

  .category-btn strong {
    font-size: 16px;
  }

  .category-btn small {
    font-size: 12px;
  }

  /* Filtros compactos em uma única faixa horizontal, sem poluir a tela. */
  .subcategory-filter-bar {
    gap: 6px;
    margin-top: 10px;
    margin-right: -18px;
    padding: 3px 18px 8px 0;
    scrollbar-width: none;
    overscroll-behavior-x: contain;
  }

  .subcategory-filter-bar::-webkit-scrollbar {
    display: none;
  }

  .subcategory-chip {
    min-height: 34px;
    padding: 7px 10px;
    font-size: 11px;
  }

  .product-list {
    margin-top: 8px;
    gap: 8px;
  }

  .product-btn {
    border-radius: 13px;
  }

  .product-btn small {
    font-size: 12px;
  }

  .product-btn .product-subcategory-tag {
    font-size: 9px;
    margin-top: 5px;
  }

  .other-box {
    margin-top: 16px;
    padding-top: 15px;
  }

  input,
  select {
    min-height: 48px;
    font-size: 16px;
  }

  .primary-btn,
  .secondary-btn,
  .ghost-btn,
  .back-admin-btn {
    min-height: 46px;
  }

  .inline {
    gap: 8px;
  }

  .inline .primary-btn,
  .inline .secondary-btn {
    width: 100%;
  }

  .admin-header {
    gap: 12px;
    margin-bottom: 13px;
  }

  .admin-header h2 {
    font-size: 27px;
  }

  #closeAdminBtn {
    width: 100%;
  }

  .admin-menu-grid {
    gap: 10px;
  }

  .admin-module-btn {
    min-height: 118px;
    padding: 16px;
    gap: 9px;
    border-radius: 16px;
  }

  .admin-module-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    font-size: 20px;
  }

  .admin-module-copy {
    gap: 4px;
  }

  .admin-module-copy strong {
    font-size: 16px;
  }

  .admin-module-copy small {
    font-size: 12px;
  }

  .module-count {
    top: 13px;
    right: 13px;
    min-width: 28px;
    height: 28px;
  }

  .module-header {
    gap: 10px;
    margin-bottom: 13px;
  }

  .module-header h3 {
    font-size: 21px;
  }

  .back-admin-btn {
    width: 100%;
  }

  .admin-grid {
    gap: 12px;
  }

  .admin-product-item,
  .admin-responsible-item {
    padding: 12px;
  }

  .admin-product-top {
    gap: 8px;
  }

  .admin-product-actions {
    gap: 6px;
  }

  .mini-btn,
  .danger-btn {
    min-height: 40px;
    padding: 8px 10px;
  }

  .label-stage {
    padding: 18px 10px;
  }

  .preview-wrap {
    margin-top: 13px;
  }

  .footer-actions .secondary-btn {
    width: 100%;
  }

  .modal-backdrop {
    padding: 10px;
    align-items: flex-end;
  }

  .modal-card {
    border-radius: 20px 20px 14px 14px;
    max-height: calc(100vh - 20px);
    overflow-y: auto;
  }

  .modal-content {
    padding: 19px 16px calc(16px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 380px) {
  .brand-logo-box {
    width: 78px;
    height: 45px;
  }

  .brand-copy h1 {
    font-size: 23px;
  }

  .topbar-actions {
    grid-template-columns: 1fr;
  }

  #stepResponsible .choice-grid {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   V0.20 — acesso, sincronização e administração online
   A etiqueta térmica 50x40 permanece inalterada.
   ========================================================= */

.connection-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 5px;
  font-size: 10px;
  font-weight: 800;
  color: #cfcfcf;
  letter-spacing: .02em;
}
.connection-status .status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #8c8c8c;
  box-shadow: 0 0 0 3px rgba(255,255,255,.05);
}
.connection-status.online .status-dot { background: #55c977; }
.connection-status.syncing .status-dot { background: var(--gold); animation: nevesPulse 1.1s infinite; }
.connection-status.offline .status-dot { background: #b8b8b8; }
.connection-status.warning .status-dot,
.connection-status.pending .status-dot { background: #e9b949; }
.connection-status.blocked .status-dot { background: #e45b63; }
@keyframes nevesPulse { 50% { opacity: .4; transform: scale(.8); } }

.access-request-box,
.access-pending-box,
.access-master-box {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  background: #fdfbf8;
}
.access-pending-box { text-align: center; }
.access-pending-box .access-icon { font-size: 28px; margin-bottom: 7px; }
.access-master-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: linear-gradient(135deg, #171515, #261719);
  color: #fff;
  border-color: #332526;
}
.access-master-box strong,
.access-master-box small { display: block; }
.access-master-box small { color: #cfc6c4; margin-top: 4px; line-height: 1.35; }
.google-btn {
  border: 1px solid #d7c9bd;
  background: #fff;
  color: #222;
  border-radius: 11px;
  padding: 12px 15px;
  font-weight: 900;
  white-space: nowrap;
}

.admin-advanced-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}
.subtle-link-btn {
  border: 0;
  background: transparent;
  color: #77706a;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-size: 12px;
  padding: 7px 2px;
}
.subtle-link-btn:hover { color: var(--red); }

.device-card {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid #e0d7cd;
  border-radius: 14px;
  background: #fffdfa;
}
.device-card + .device-card { margin-top: 9px; }
.device-card.inactive { opacity: .68; background: #f4f1ed; }
.device-card strong { font-size: 15px; }
.device-card small { display: block; color: var(--muted); margin-top: 5px; line-height: 1.45; }
.device-main { min-width: 0; }
.device-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }

.history-tabs {
  display: inline-flex;
  gap: 5px;
  padding: 4px;
  background: #eae4dd;
  border-radius: 12px;
  margin-bottom: 12px;
}
.history-tab {
  border: 0;
  background: transparent;
  color: #625d58;
  border-radius: 9px;
  padding: 9px 13px;
  font-weight: 900;
}
.history-tab.active { background: #fff; color: var(--red-dark); box-shadow: 0 2px 8px rgba(0,0,0,.07); }
.history-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}
.history-toolbar input { flex: 1 1 300px; }
.history-list { display: grid; gap: 9px; }
.history-item {
  border: 1px solid #e2d9cf;
  background: #fffdfa;
  border-radius: 13px;
  padding: 13px;
}
.history-item-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}
.history-item-head strong { font-size: 15px; }
.history-item-head span { color: var(--muted); font-size: 11px; white-space: nowrap; }
.history-item-body { display: grid; gap: 3px; margin-top: 7px; font-size: 12px; color: #59534e; }

.system-details { display: grid; gap: 1px; margin: 12px 0 4px; border: 1px solid #e3dbd2; border-radius: 13px; overflow: hidden; }
.system-details > div { display: flex; justify-content: space-between; gap: 14px; padding: 10px 12px; background: #fffdfa; border-bottom: 1px solid #eee7df; }
.system-details > div:last-child { border-bottom: 0; }
.system-details span { color: var(--muted); font-size: 12px; }
.system-details strong { text-align: right; font-size: 12px; }

.security-details { margin-top: 14px; }
.security-details summary { cursor: pointer; font-weight: 900; color: #6d6660; }
.security-content { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 18px; }

.pin-modal-card { max-width: 390px; }
.pin-dots { display: flex; justify-content: center; gap: 13px; margin: 18px 0; }
.pin-dots span { width: 15px; height: 15px; border: 2px solid #b8afa5; border-radius: 50%; background: transparent; }
.pin-dots span.filled { background: var(--red); border-color: var(--red); box-shadow: 0 0 0 4px rgba(167,25,34,.08); }
.pin-keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.pin-keypad button {
  min-height: 54px;
  border: 1px solid #d8cec3;
  background: #fff;
  color: #222;
  border-radius: 12px;
  font-size: 19px;
  font-weight: 900;
}
.pin-keypad button:active { transform: scale(.97); }
.pin-keypad .pin-ok { background: var(--red); color: #fff; border-color: var(--red); }

.app-toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 1000;
  max-width: min(520px, calc(100% - 28px));
  padding: 12px 16px;
  border-radius: 12px;
  background: #1d1b1a;
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  box-shadow: 0 12px 32px rgba(0,0,0,.22);
}
.app-toast.success { background: #1d5f38; }
.app-toast.warning { background: #765717; }
.app-toast.error { background: #8d1a22; }

@media (max-width: 620px) {
  .connection-status { margin-top: 4px; }
  .access-master-box { flex-direction: column; align-items: stretch; }
  .google-btn { width: 100%; }
  .device-card { flex-direction: column; align-items: stretch; }
  .device-actions { justify-content: stretch; }
  .device-actions button { flex: 1 1 135px; }
  .history-tabs { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .history-tab { font-size: 12px; padding: 9px 8px; }
  .history-toolbar { align-items: stretch; }
  .history-toolbar button { width: 100%; }
  .history-item-head { flex-direction: column; gap: 3px; }
  .history-item-head span { white-space: normal; }
  .system-details > div { align-items: flex-start; }
  .admin-advanced-row { justify-content: center; }
  .pin-modal-card { width: 100%; }
}
