/* Controle Lavanderia — mobile-first */
:root {
  --bg: #0f1115;
  --card: #171b22;
  --card2: #1e242e;
  --text: #f2f4f8;
  --muted: #9aa3b2;
  --accent: #2f9e5f;
  --accent-soft: rgba(47, 158, 95, .15);
  --warn: #e8b33c;
  --danger: #e05c5c;
  --border: #2a313d;
  --radius: 14px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  padding-bottom: 40px;
}

/* Aviso de configuração */
.cfg-warning {
  background: #3a2f12;
  color: #ffd97a;
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.4;
  border-bottom: 1px solid #5a4a1e;
}
.hidden { display: none !important; }

/* Cabeçalho */
header {
  padding: 18px 16px 14px;
  background: linear-gradient(180deg, #141821, #0f1115);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
header h1 { margin: 0 0 12px; font-size: 22px; letter-spacing: .5px; }
.lav-toggle {
  display: flex;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
  gap: 4px;
  margin-bottom: 12px;
}
.lav-toggle button {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 17px;
  font-weight: 700;
  padding: 12px 0;
  border-radius: 10px;
  cursor: pointer;
}
.lav-toggle button.active { background: var(--accent); color: #fff; }
.date-row { display: flex; align-items: center; gap: 10px; }
.date-row label { color: var(--muted); font-size: 14px; }
#datePicker {
  flex: 1;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 17px;
  padding: 12px;
  color-scheme: dark;
}

/* Renomear lavanderias */
.edit-names {
  background: transparent;
  border: 0;
  font-size: 18px;
  cursor: pointer;
  vertical-align: middle;
  padding: 4px 8px;
}
.name-panel {
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 12px;
}
.name-panel .field { margin-bottom: 10px; }
.name-save {
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 800;
  padding: 13px 0;
  cursor: pointer;
}
.name-hint { color: var(--muted); font-size: 13px; text-align: center; margin-top: 8px; }

/* Subseções do stain */
.stain-sub { margin-bottom: 20px; }
.stain-sub:last-child { margin-bottom: 0; }
.stain-sub-head {
  font-size: 17px;
  font-weight: 800;
  margin-bottom: 10px;
}
.stain-sub-head span {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

/* Foto do bin */
.bin-photo { margin-top: 10px; }
.photo-btn {
  width: 100%;
  background: transparent;
  border: 2px dashed var(--border);
  border-radius: 10px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
  padding: 12px 0;
  cursor: pointer;
}
.photo-btn:active { border-color: var(--accent); color: var(--accent); }
.bin-photo { position: relative; }
.bin-photo img {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: 10px;
  display: block;
}
.photo-del {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 0;
  background: rgba(0,0,0,.65);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

/* Abas */
.tabs {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 15;
}
.tabs button {
  flex: 1;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .5px;
  padding: 14px 0;
  border-radius: var(--radius);
  cursor: pointer;
}
.tabs button.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: #fff;
}

/* Painéis */
main { padding: 4px 16px 0; }
.panel { animation: fade .15s ease-in; }
@keyframes fade { from { opacity: .4; } to { opacity: 1; } }

/* Linha da quantidade (a mágica) */
.qtd-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 14px;
}
.qtd-row label { font-size: 17px; font-weight: 700; }
.qtd-row input {
  width: 96px;
  font-size: 22px;
  font-weight: 800;
  text-align: center;
  background: var(--card2);
  color: #fff;
  border: 2px solid var(--accent);
  border-radius: 10px;
  padding: 10px 0;
}

/* Linhas de bin */
.bin {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}
.bin-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.bin-head .n { font-weight: 800; font-size: 16px; color: var(--accent); }
.bin-head .subtotal { font-weight: 800; font-size: 16px; }
.bin-grid { display: grid; gap: 10px; }
.field label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 5px;
  font-weight: 600;
}
.field input, .field select {
  width: 100%;
  font-size: 18px;
  background: var(--card2);
  color: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 13px 12px;
  min-height: 52px;
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--accent);
}
.two-col { grid-template-columns: 1fr 1fr; }
.empty-note {
  text-align: center;
  color: var(--muted);
  padding: 26px 10px;
  font-size: 15px;
}

/* Totais */
.totals {
  position: sticky;
  bottom: 12px;
  background: #12241a;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-top: 16px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.7;
  box-shadow: 0 6px 24px rgba(0,0,0,.5);
}
.totals .big { font-size: 20px; color: #7fe0a8; }

/* Relatório semanal */
.rep-controls {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 14px;
}
.rep-lavs {
  display: flex;
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
  gap: 4px;
  margin-bottom: 12px;
}
.rep-lavs button {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
  padding: 10px 0;
  border-radius: 8px;
  cursor: pointer;
}
.rep-lavs button.active { background: var(--accent); color: #fff; }
.rep-controls .date-row { margin-bottom: 8px; }
#weekPicker {
  flex: 1;
  background: var(--card2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 17px;
  padding: 12px;
  color-scheme: dark;
}
.rep-range { color: var(--muted); font-size: 14px; text-align: center; }
.rep-day {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}
.rep-day-head {
  font-weight: 800;
  font-size: 16px;
  color: var(--accent);
  text-transform: capitalize;
  margin-bottom: 8px;
}
.rep-lav-name {
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin: 8px 0 4px;
}
.rep-line { font-size: 15px; line-height: 1.8; }
.rep-line .lbl { color: var(--muted); }
.rep-total {
  background: #12241a;
  border: 1px solid var(--accent);
}
.rep-total .rep-day-head { color: #7fe0a8; }
.rep-loading, .rep-empty {
  text-align: center;
  color: var(--muted);
  padding: 30px 10px;
  font-size: 15px;
}

/* Status de sincronização */
.sync {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  padding: 14px 0 4px;
}
.sync .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.sync .dot.on { background: var(--accent); }
.sync .dot.off { background: var(--warn); }
