:root {
  /* Paleta Lightwall (alinhada ao lw-panel) */
  --bg: #0e1e38;
  --chip: #1b2d52;
  --strip: #16284a;
  --line: #24406e;
  --text: #ffffff;
  --muted: #9fb3c8;

  --card-bg: #ffffff;
  --card-title: #0e1e38;
  --card-muted: #7c8aa0;
  --card-line: #e8edf3;
  --field-line: #d7dfe9;

  --blue: #378add;
  --blue-soft: #e6f1fb;
  --green: #2e9e78;
  --green-light: #5dcaa5;
  --orange: #d85a30;
  --orange-mid: #f0997b;
  --gold: #f2b705;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

/* ---------- Header ---------- */
.topo {
  max-width: 900px;
  margin: 0 auto;
  padding: 26px 24px 8px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.topo .logo { width: 42px; height: 42px; flex-shrink: 0; }
.topo .marca { flex: 1; }
.topo h1 { font-size: 26px; font-weight: bold; }
.topo .subtitle { color: var(--muted); font-size: 14px; margin-top: 4px; }
.chip {
  background: var(--chip);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: bold;
  color: var(--gold);
  white-space: nowrap;
}
.link {
  background: none; border: none; color: var(--muted);
  text-decoration: underline; font-size: 13px; padding: 0;
}

/* ---------- Layout ---------- */
main { max-width: 900px; margin: 0 auto; padding: 12px 24px 60px; }
.card {
  background: var(--card-bg);
  color: var(--card-title);
  border-radius: 16px;
  padding: 22px 24px;
  margin-bottom: 18px;
}
.card > h2 { font-size: 18px; margin-bottom: 4px; }
.card > h2 .contador { color: var(--card-muted); font-weight: normal; font-size: 14px; }
.ajuda { color: var(--card-muted); font-size: 13px; margin-bottom: 12px; }

/* ---------- Campos ---------- */
label { display: block; font-size: 13px; color: var(--card-muted); margin-bottom: 4px; }
input, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--field-line);
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  background: #fff;
  color: var(--card-title);
}
input:focus, select:focus { outline: 2px solid var(--blue); border-color: var(--blue); }
.campo { margin-bottom: 12px; }
.linha { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
.linha .campo { flex: 1; min-width: 130px; margin-bottom: 0; }

/* ---------- Botões ---------- */
.btn {
  background: var(--blue); color: #fff; border: none; border-radius: 8px;
  padding: 12px 22px; font-size: 15px; font-weight: bold;
}
.btn:hover { filter: brightness(1.06); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-lg { width: 100%; padding: 15px; font-size: 16px; }
.btn-ghost {
  background: transparent; color: var(--blue); border: 1px solid var(--blue);
  border-radius: 8px; padding: 9px 16px; font-size: 14px; font-weight: bold;
}
.btn-ghost:hover { background: var(--blue-soft); }
.remover {
  background: none; border: none; color: var(--orange); font-size: 13px;
  text-decoration: underline; padding: 0;
}
.remover.x { font-size: 20px; text-decoration: none; line-height: 1; }

/* ---------- Parede / abertura / laje ---------- */
.parede {
  border: 1px solid var(--card-line); border-radius: 12px;
  padding: 14px 16px; margin-bottom: 14px;
}
.parede legend, .parede .cab {
  display: flex; align-items: center; gap: 10px; width: 100%;
  font-weight: bold; margin-bottom: 10px;
}
.parede .cab { cursor: pointer; user-select: none; margin-bottom: 0; }
.parede:not(.recolhida) .cab { margin-bottom: 10px; }
.parede .cab .chevron { color: var(--card-muted); font-size: 11px; transition: transform .15s; }
.parede:not(.recolhida) .cab .chevron { transform: rotate(90deg); }
.parede .cab .resumo-parede { flex: 1; font-weight: normal; font-size: 12px; color: var(--card-muted); }
.parede.recolhida .corpo { display: none; }
.titulo-linha { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.aberturas { margin: 10px 0; display: flex; flex-direction: column; gap: 8px; }
.abertura, .laje-row {
  display: flex; gap: 10px; align-items: end;
  background: #f5f8fc; border-radius: 8px; padding: 8px 10px;
}
.abertura .campo, .laje-row .campo { flex: 1; min-width: 90px; margin: 0; }
.toggle-classe { display: flex; align-items: center; gap: 8px; margin: 10px 0 4px; }
.toggle-classe input { width: auto; }
.toggle-classe label { margin: 0; }

/* ---------- Upload ---------- */
.upload {
  border: 2px dashed var(--field-line); border-radius: 12px;
  padding: 20px; text-align: center; transition: border-color .15s;
}
.upload.drag { border-color: var(--blue); background: var(--blue-soft); }
.upload .arquivo { font-size: 14px; margin: 8px 0; color: var(--card-title); }
.upload input[type=file] { display: none; }
.upload .escolher { display: inline-block; }
.status-planta { font-size: 13px; margin-top: 12px; }
.status-planta.ok { color: var(--green); }
.status-planta.erro { color: var(--orange); }
.spinner {
  display: inline-block; width: 14px; height: 14px; vertical-align: middle;
  border: 2px solid var(--field-line); border-top-color: var(--blue);
  border-radius: 50%; animation: girar .8s linear infinite; margin-right: 6px;
}
@keyframes girar { to { transform: rotate(360deg); } }

/* ---------- Resultado ---------- */
#resultado .selo {
  display: inline-block; background: rgba(242,183,5,.15); color: var(--gold);
  border: 1px solid var(--gold); border-radius: 999px; padding: 3px 12px;
  font-size: 12px; font-weight: bold; margin-bottom: 12px;
}
.hero { text-align: center; padding: 8px 0 4px; }
.hero .num { font-size: 44px; font-weight: bold; color: var(--blue); line-height: 1; }
.hero .rot { color: var(--card-muted); font-size: 14px; margin-top: 6px; }
.sku-grid { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin: 16px 0; }
.sku-pill {
  background: var(--blue-soft); border-radius: 12px; padding: 10px 18px; text-align: center; min-width: 120px;
}
.sku-pill .v { font-size: 22px; font-weight: bold; color: var(--card-title); }
.sku-pill .k { font-size: 12px; color: var(--card-muted); }
#resultado h3 { font-size: 14px; margin: 18px 0 6px; color: var(--card-title); }
.preco { font-size: 22px; font-weight: bold; color: var(--card-title); }
.preco .ate { font-size: 14px; color: var(--card-muted); font-weight: normal; }

table.mem { width: 100%; border-collapse: collapse; font-size: 13px; }
table.mem td { padding: 6px 4px; border-bottom: 1px solid var(--card-line); }
table.mem td:last-child { text-align: right; }

details summary { cursor: pointer; font-weight: bold; font-size: 14px; margin-top: 8px; }

/* ---------- Caixas de aviso ---------- */
.warn {
  background: rgba(242,183,5,.12); border: 1px solid var(--gold); color: #a67c00;
  border-radius: 10px; padding: 10px 14px; font-size: 13px; margin: 10px 0;
}
.erro-box { color: var(--orange); font-size: 14px; white-space: pre-line; margin-top: 8px; }
.alertas { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.alertas li {
  font-size: 13px; padding: 8px 12px; border-radius: 8px;
  background: rgba(216,90,48,.08); border-left: 3px solid var(--orange);
}
.alertas .nivel { font-weight: bold; text-transform: uppercase; font-size: 11px; margin-right: 6px; color: var(--orange); }
.ressalva { color: var(--card-muted); font-size: 12px; margin-top: 14px; border-top: 1px solid var(--card-line); padding-top: 10px; }

/* ---------- Login ---------- */
.login-wrap { min-height: 70vh; display: grid; place-items: center; }
.login-card {
  background: var(--strip); border-radius: 18px; padding: 40px 36px;
  max-width: 400px; width: 100%; color: var(--text);
}
.login-card .logo-login { width: 64px; height: 64px; display: block; margin: 0 auto 10px; }
.login-card h2 { font-size: 22px; margin-bottom: 6px; text-align: center; }
.login-card > .ajuda { text-align: center; }
.login-card .ajuda { color: var(--muted); }
.login-card label { color: var(--muted); }
.login-card input {
  background: var(--chip); border: 1px solid var(--line); color: var(--text);
}
.login-card .btn { width: 100%; margin-top: 6px; }

/* ---------- Admin (KPIs) ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.kpi { background: var(--blue-soft); border-radius: 12px; padding: 14px 16px; }
.kpi .v { font-size: 24px; font-weight: bold; color: var(--card-title); }
.kpi .k { font-size: 12px; color: var(--card-muted); margin-top: 2px; }
.barra-serie { display: flex; align-items: flex-end; gap: 4px; height: 90px; margin-top: 8px; }
.barra-serie .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.barra-serie .b { width: 100%; background: var(--blue); border-radius: 3px 3px 0 0; min-height: 2px; }
.barra-serie .d { font-size: 9px; color: var(--card-muted); }
.aguardando { color: var(--card-muted); font-size: 13px; font-style: italic; }

/* ---------- Responsivo ---------- */
@media (max-width: 560px) {
  .topo, main { padding-left: 14px; padding-right: 14px; }
  .hero .num { font-size: 36px; }
}
