/* ===== DistriSupri — identidade Loop (LoopChat/LoopDesk/LoopPonto/LoopBank) ===== */

:root {
  --brand: #155dfc;
  --brand-dark: #0a3acc;
  --brand-grad: linear-gradient(135deg, #155dfc, #0a3acc);
  --accent: #10b981;
  --faixa: linear-gradient(90deg, #155dfc, #10b981 55%, #6366f1);
  --zap: #22c55e;
  --zap-dark: #16a34a;

  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-muted: #64748b;
  --warn-bg: #fef3c7;
  --warn-text: #92400e;
  --info-bg: #eff6ff;
  --perigo: #dc2626;
  --sucesso: #16a34a;
  --overlay: rgba(15, 23, 42, .45);

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .07);
  --shadow-lg: 0 10px 40px rgba(15, 23, 42, .18);
}

[data-theme="dark"] {
  --bg: #020618;
  --surface: #0f172a;
  --surface-2: #1e293b;
  --border: #26334d;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --warn-bg: #451a03;
  --warn-text: #fbbf24;
  --info-bg: #172554;
  --perigo: #f87171;
  --sucesso: #4ade80;
  --overlay: rgba(0, 0, 0, .6);
  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 8px 24px rgba(0, 0, 0, .4);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, .55);
}

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

body {
  font-family: "Outfit", "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: 96px;
  transition: background .2s ease, color .2s ease;
}

button, input, select { font-family: inherit; }

/* ===== Topo (padrão LoopBank + faixa gradiente LoopPonto) ===== */
.topo {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}
.topo::before {
  content: "";
  display: block;
  height: 4px;
  background: var(--faixa);
}
.topo-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 20px 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.marca { display: flex; align-items: center; gap: 12px; }
.marca-logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--accent) 100%);
  color: #fff;
  font-weight: 800;
  font-size: .9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: .02em;
  box-shadow: 0 4px 14px rgba(21, 93, 252, .3);
  flex-shrink: 0;
}
.marca h1 { font-size: 1.35rem; font-weight: 800; letter-spacing: -0.02em; }
.marca h1 span {
  background: var(--brand-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.marca p { font-size: .75rem; color: var(--text-muted); }
.contato { font-size: .8rem; color: var(--text-muted); }
.link-admin { color: var(--brand); }

.topo-acoes {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.btn-admin {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: .85rem;
  font-weight: 600;
  text-decoration: none;
  transition: color .15s, border-color .15s, background .15s;
}
.btn-admin svg { width: 16px; height: 16px; }
.btn-admin:hover {
  color: var(--brand);
  border-color: var(--brand);
  background: var(--info-bg);
}

.theme-toggle {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 38px;
  height: 38px;
  padding: 8px;
  cursor: pointer;
  color: var(--text-muted);
  transition: color .15s, border-color .15s;
}
.theme-toggle:hover { color: var(--brand); border-color: var(--brand); }
.theme-toggle svg { width: 100%; height: 100%; display: block; }
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

.filtros {
  max-width: 1200px;
  margin: 0 auto;
  padding: 6px 20px 14px;
  display: flex;
  gap: 10px;
}
.filtros input, .filtros select {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  outline: none;
  background: var(--surface-2);
  color: var(--text);
  height: 40px;
  transition: border-color .15s, box-shadow .15s;
}
.filtros input:focus, .filtros select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(21, 93, 252, .15);
}
.filtros input { flex: 1; min-width: 0; }
.filtros select { max-width: 230px; }

/* ===== Grade de produtos ===== */
#catalogo { max-width: 1200px; margin: 0 auto; padding: 8px 20px 20px; }

.secao-titulo {
  margin: 28px 0 12px;
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--brand);
  display: flex;
  align-items: center;
  gap: 10px;
}
.secao-titulo::before {
  content: "";
  width: 22px;
  height: 4px;
  border-radius: 2px;
  background: var(--faixa);
}

.grade {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  box-shadow: var(--shadow);
  transition: box-shadow .15s, border-color .15s, transform .15s;
}
.card:hover { transform: translateY(-2px); }
.card.sel { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand), var(--shadow); }

.foto {
  aspect-ratio: 4/3;
  background: #fff;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.foto img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
[data-theme="dark"] .foto img.ph { filter: invert(.92) brightness(.85); }

.nome {
  font-size: .88rem;
  font-weight: 600;
  line-height: 1.35;
  min-height: 2.7em;
}
.codigo {
  font-size: .72rem;
  color: var(--text-muted);
  font-family: "JetBrains Mono", monospace;
  letter-spacing: .02em;
}

/* ===== Quantidade ===== */
.qtd {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.qtd button {
  width: 44px;
  border: none;
  background: var(--surface-2);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.qtd button:hover { background: var(--brand-grad); color: #fff; }
.qtd button:active { transform: scale(.94); }
.qtd .num {
  flex: 1;
  text-align: center;
  font-size: 1.05rem;
  font-weight: 700;
  font-family: "JetBrains Mono", monospace;
  padding: 9px 0;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  min-width: 48px;
}
.card.sel .qtd .num { color: var(--brand); }

.vazio {
  grid-column: 1/-1;
  text-align: center;
  color: var(--text-muted);
  padding: 40px 0;
}

/* ===== Barra flutuante ===== */
.barra {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 16px;
  z-index: 50;
  display: flex;
  gap: 10px;
  width: min(680px, calc(100% - 24px));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 10px;
  box-shadow: var(--shadow-lg);
  animation: sobe .25s ease;
}
@keyframes sobe { from { transform: translate(-50%, 24px); opacity: 0; } }

.barra-info {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: .95rem;
  cursor: pointer;
  color: var(--text);
}
.barra-info .ver { margin-left: auto; color: var(--brand); font-weight: 700; font-size: .85rem; }
.ico { font-size: 1.2rem; }

.btn-whatsapp {
  display: flex;
  align-items: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  background: var(--zap);
  color: #fff;
  font-size: .95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, transform .1s;
  white-space: nowrap;
}
.btn-whatsapp:hover { background: var(--zap-dark); }
.btn-whatsapp:active { transform: scale(.97); }
.ico-zap { font-size: 1.1rem; }

.hidden { display: none !important; }

/* ===== Painel do pedido ===== */
.overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 60;
}
.painel {
  position: fixed;
  top: 0;
  right: -420px;
  width: min(400px, 100%);
  height: 100%;
  background: var(--surface);
  z-index: 70;
  display: flex;
  flex-direction: column;
  transition: right .25s ease;
  box-shadow: var(--shadow-lg);
}
.painel.aberto { right: 0; }
.painel header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.painel h2 { font-size: 1.05rem; font-weight: 800; letter-spacing: -.01em; }
.fechar {
  border: none;
  background: none;
  font-size: 1.6rem;
  cursor: pointer;
  color: var(--text-muted);
}
.fechar:hover { color: var(--text); }
.lista { flex: 1; overflow-y: auto; padding: 10px 18px; }
.item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.item .nome { font-size: .85rem; min-height: 0; }
.item-linha { display: flex; align-items: center; gap: 8px; }
.item .qtd { width: 140px; }
.item .qtd button { width: 34px; font-size: 1.05rem; }
.item .qtd .num { padding: 5px 0; font-size: .95rem; }
.remover {
  margin-left: auto;
  border: none;
  background: none;
  color: var(--perigo);
  font-size: .8rem;
  cursor: pointer;
}
.painel footer {
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.doc-cliente-wrap {
  padding: 14px 18px 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.doc-cliente-wrap label {
  font-size: .75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.doc-cliente-wrap label span {
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
}
.doc-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .95rem;
  background: var(--surface);
  color: var(--text);
}
.doc-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(21, 93, 252, .15);
}
.limpar {
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: .85rem;
  cursor: pointer;
  text-decoration: underline;
}
.limpar:hover { color: var(--perigo); }

@media (max-width: 560px) {
  .barra { flex-direction: column; }
  .btn-whatsapp { justify-content: center; }
  .topo-acoes .contato { display: none; }
}

/* ===== Admin ===== */
.admin-body { padding-bottom: 40px; }

.login {
  display: flex;
  justify-content: center;
  padding: 60px 16px;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: min(360px, 100%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow);
}
.login-card h2 { color: var(--text); font-size: 1.15rem; font-weight: 800; }
.login-card p { font-size: .85rem; color: var(--text-muted); }
.login-card input {
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  background: var(--surface-2);
  color: var(--text);
}
.login-card input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(21, 93, 252, .15);
}
.erro { color: var(--perigo); font-size: .85rem; }

.admin { max-width: 1100px; margin: 0 auto; padding: 20px; }
.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 10px;
}
.toolbar input[type="search"] {
  flex: 1;
  min-width: 200px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  background: var(--surface);
  color: var(--text);
}
.toolbar input[type="search"]:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(21, 93, 252, .15);
}
.toolbar select {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  background: var(--surface);
  color: var(--text);
}
.aviso {
  font-size: .8rem;
  color: var(--warn-text);
  background: var(--warn-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 14px;
}
.status-fotos {
  color: var(--text-muted);
  font-size: .85rem;
  margin: 0 0 10px;
}
.importar-fotos {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 0 0 14px;
  padding: 12px;
}
.importar-fotos summary {
  color: var(--brand);
  cursor: pointer;
  font-size: .9rem;
  font-weight: 700;
}
.importar-fotos p, .importar-fotos span {
  color: var(--text-muted);
  font-size: .8rem;
  margin: 9px 0;
}
.importar-fotos textarea {
  display: block;
  width: 100%;
  resize: vertical;
  margin: 10px 0;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font: .82rem "JetBrains Mono", monospace;
}
.importar-fotos textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(21, 93, 252, .15);
}

.btn-acao {
  border: none;
  border-radius: var(--radius-sm);
  background: var(--brand-grad);
  color: #fff;
  font-weight: 700;
  padding: 10px 16px;
  font-size: .9rem;
  cursor: pointer;
  transition: opacity .15s;
}
.btn-acao:hover { opacity: .88; }
.btn-sec {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  padding: 9px 14px;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn-sec:hover { background: var(--surface-2); border-color: var(--brand); }
.perigo { color: var(--perigo) !important; }

.tabela {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.tabela th, .tabela td {
  text-align: left;
  padding: 9px 12px;
  font-size: .85rem;
  border-bottom: 1px solid var(--border);
}
.tabela th {
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.tabela tbody tr:hover { background: var(--surface-2); }
.c-thumb { width: 56px; }
.thumb {
  width: 46px;
  height: 46px;
  object-fit: contain;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 7px;
}
[data-theme="dark"] .thumb.ph { filter: invert(.92) brightness(.85); }
.c-cod { width: 130px; white-space: nowrap; font-family: "JetBrains Mono", monospace; font-size: .8rem; }
.c-sec { width: 190px; }
.c-acoes { width: 235px; white-space: nowrap; }
.tabela tr.inativo td { opacity: .5; }
.tabela tr.inativo .c-acoes { opacity: 1; }
.mini.toggle { min-width: 62px; }
.mini.toggle.on { color: var(--sucesso); border-color: var(--sucesso); }
.mini.toggle.on:hover { border-color: var(--sucesso); background: var(--surface-2); }
.mini.toggle.off { color: var(--text-muted); border-style: dashed; }
.mini.toggle.off:hover { border-color: var(--text-muted); }
.mini {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 6px;
  padding: 4px 9px;
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  margin-right: 4px;
}
.mini:hover { background: var(--surface-2); border-color: var(--brand); }
.mini.perigo:hover { border-color: var(--perigo); }

/* ===== Modais ===== */
.modal-card {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 80;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: min(420px, calc(100% - 32px));
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-lg);
}
.modal-card h3 { font-weight: 800; letter-spacing: -.01em; }
.modal-card label { font-size: .85rem; color: var(--text-muted); display: flex; flex-direction: column; gap: 5px; }
.modal-card input {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .95rem;
  background: var(--surface-2);
  color: var(--text);
}
.modal-card input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(21, 93, 252, .15);
}
.modal-botoes { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

/* ===== Editor de foto (admin) ===== */
.foto-editor {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-top: 2px;
}
.preview-foto {
  width: 96px;
  height: 96px;
  object-fit: contain;
  background-color: var(--surface);
  background-image: linear-gradient(45deg, var(--surface-2) 25%, transparent 25%),
    linear-gradient(-45deg, var(--surface-2) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--surface-2) 75%),
    linear-gradient(-45deg, transparent 75%, var(--surface-2) 75%);
  background-size: 14px 14px;
  background-position: 0 0, 0 7px, 7px -7px, -7px 0;
  border: 1px solid var(--border);
  border-radius: 10px;
}
[data-theme="dark"] .preview-foto.ph { filter: invert(.92) brightness(.85); }
.foto-botoes { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.foto-url { font-size: .85rem; }
.dica-foto { color: var(--text-muted); font-size: .72rem; line-height: 1.35; }
