* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(135deg, #f5f7fa 0%, #e4ecf7 100%);
  min-height: 100vh;
  padding: 40px 20px;
  color: #1a202c;
}
.container { max-width: 1100px; margin: 0 auto; }
[hidden] { display: none !important; }
.auth-shell {
  min-height: calc(100vh - 80px); display: grid; place-items: center;
}
.login-panel {
  width: min(100%, 400px); background: white; border: 1px solid #dbe3ee;
  border-radius: 8px; padding: 32px; box-shadow: 0 12px 36px rgba(15, 23, 42, 0.12);
}
.login-brand {
  width: 48px; height: 48px; display: grid; place-items: center; margin-bottom: 20px;
  border-radius: 8px; background: #1e40af; color: white; font-size: 15px; font-weight: 800;
}
.login-panel h1 { font-size: 24px; margin-bottom: 8px; }
.login-subtitle { color: #64748b; font-size: 14px; line-height: 1.5; margin-bottom: 24px; }
.login-input { height: 44px; margin-bottom: 14px; }
.login-remember {
  display: inline-flex; align-items: center; gap: 8px; color: #475569;
  font-size: 13px; cursor: pointer; user-select: none;
}
.login-remember input { width: 16px; height: 16px; accent-color: #1e40af; }
.login-error { min-height: 20px; margin-top: 12px; color: #b91c1c; font-size: 13px; }
.login-submit {
  width: 100%; height: 44px; margin-top: 8px; border: 0; border-radius: 8px;
  background: #1e40af; color: white; font-family: inherit; font-size: 15px;
  font-weight: 600; cursor: pointer;
}
.login-submit:hover:not(:disabled) { background: #1e3a8a; }
.login-submit:disabled { opacity: 0.55; cursor: wait; }
.login-status { margin-top: 16px; color: #64748b; font-size: 13px; text-align: center; }
header { text-align: center; margin-bottom: 40px; }
h1 { font-size: 32px; font-weight: 700; color: #1a202c; margin-bottom: 8px; }
.subtitle { font-size: 16px; color: #64748b; font-weight: 400; }
.date-pill {
  display: inline-block; margin-top: 12px; background: white;
  padding: 6px 16px; border-radius: 999px; font-size: 13px;
  color: #475569; box-shadow: 0 1px 3px rgba(0,0,0,0.05); font-weight: 500;
}
.summary {
  background: white; border-radius: 16px; padding: 24px;
  margin-bottom: 32px; box-shadow: 0 4px 20px rgba(0,0,0,0.06);
  display: flex; justify-content: space-around; align-items: center;
  flex-wrap: wrap; gap: 20px;
}
.summary-item { text-align: center; }
.summary-label {
  font-size: 13px; color: #64748b; text-transform: uppercase;
  letter-spacing: 0.5px; margin-bottom: 6px; font-weight: 600;
}
.summary-value { font-size: 36px; font-weight: 700; color: #0f172a; }
.summary-value .unit { font-size: 16px; color: #64748b; font-weight: 500; }
#acimaLimiteHoje { color: #be123c; }
.grid {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 20px;
}
.grid > .card { flex: 0 1 calc((100% - 40px) / 3); min-width: min(260px, 100%); }
.card {
  background: white; border-radius: 16px; padding: 24px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
  border-top: 4px solid transparent;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex; flex-direction: column;
}
.card.ml { border-top-color: #fff159; }
.card.shopee { border-top-color: #ee4d2d; }
.card.magalu { border-top-color: #0086ff; }
.card.amazon { border-top-color: #ff9900; }
.card.tiktok { border-top-color: #fe2c55; }
.card.esgotado { background: #fef2f2; border-top-color: #dc2626 !important; }
.card.acima { background: #fff1f2; border-top-color: #be123c !important; box-shadow: 0 4px 20px rgba(190, 18, 60, 0.18); }
.over-tag {
  display: inline-block; background: #be123c; color: white;
  font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px;
  margin-left: 6px; text-transform: uppercase; letter-spacing: 0.5px;
}
.platform-name { font-size: 18px; font-weight: 700; color: #1a202c; margin-bottom: 4px; }
.platform-tag {
  font-size: 12px; color: #64748b; text-transform: uppercase;
  letter-spacing: 0.5px; font-weight: 600; margin-bottom: 16px;
}
.counter-display {
  display: flex; align-items: baseline; justify-content: center;
  gap: 6px; margin: 8px 0 4px;
}
.counter-current { font-size: 56px; font-weight: 800; line-height: 1; color: #0f172a; }
.counter-sep { font-size: 28px; color: #94a3b8; font-weight: 400; }
.counter-total { font-size: 28px; color: #64748b; font-weight: 600; }
.remaining {
  text-align: center; font-size: 13px; color: #64748b;
  margin-bottom: 16px; font-weight: 500;
}
.remaining strong { color: #16a34a; font-size: 15px; }
.card.esgotado .remaining strong { color: #dc2626; }
.bar-track {
  background: #f1f5f9; height: 10px; border-radius: 999px;
  overflow: hidden; margin-bottom: 16px;
}
.bar-fill { height: 100%; border-radius: 999px; transition: width 0.4s ease, background 0.3s ease; }
.card.ml .bar-fill { background: #fbc02d; }
.card.shopee .bar-fill { background: #ee4d2d; }
.card.magalu .bar-fill { background: #0086ff; }
.card.amazon .bar-fill { background: #ff9900; }
.card.tiktok .bar-fill { background: #fe2c55; }
.card.esgotado .bar-fill { background: #dc2626 !important; }
.actions { display: flex; gap: 8px; margin-top: auto; }
.btn {
  flex: 1; padding: 12px; border: none; border-radius: 10px;
  font-size: 15px; font-weight: 600; cursor: pointer;
  transition: all 0.15s ease; font-family: inherit;
}
.btn-add { background: #16a34a; color: white; font-size: 16px; }
.btn-add:hover:not(:disabled) { background: #15803d; transform: translateY(-1px); }
.btn-add:disabled { background: #cbd5e1; cursor: not-allowed; }
.btn-add.over { background: #be123c; }
.btn-add.over:hover:not(:disabled) { background: #9f1239; }
.btn-sub {
  flex: 0 0 auto; background: #f1f5f9; color: #475569; padding: 12px 16px;
}
.btn-sub:hover:not(:disabled) { background: #e2e8f0; }
.btn-sub:disabled { opacity: 0.4; cursor: not-allowed; }
.footer-actions {
  margin-top: 32px; display: flex; justify-content: center;
  gap: 12px; flex-wrap: wrap;
}
.btn-footer {
  background: white; color: #475569; border: 1px solid #e2e8f0;
  padding: 10px 20px; border-radius: 10px; font-size: 14px;
  font-weight: 600; cursor: pointer; font-family: inherit;
  transition: all 0.15s ease;
}
.btn-footer:hover { background: #f8fafc; border-color: #cbd5e1; }
.btn-footer.primary { background: #1e40af; color: white; border-color: #1e40af; }
.btn-footer.primary:hover { background: #1e3a8a; }
.btn-footer.danger { color: #b91c1c; }
.btn-footer.danger:hover { background: #fef2f2; border-color: #fecaca; }
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.5);
  display: none; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px; backdrop-filter: blur(4px);
}
.modal-overlay.show { display: flex; }
.modal {
  background: white; border-radius: 16px; width: 100%; max-width: 520px;
  padding: 28px; box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  max-height: 90vh; overflow-y: auto;
}
.modal-header { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.modal-platform-dot {
  width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0;
}
.modal h2 { font-size: 20px; font-weight: 700; color: #0f172a; }
.modal-subtitle { font-size: 14px; color: #64748b; margin-bottom: 20px; }
.form-group { margin-bottom: 16px; }
.form-label {
  display: block; font-size: 13px; font-weight: 600; color: #334155;
  margin-bottom: 6px;
}
.form-label .req { color: #dc2626; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #cbd5e1;
  border-radius: 8px; font-size: 14px; font-family: inherit;
  color: #0f172a; transition: border 0.15s ease;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: #1e40af; box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}
.form-textarea { resize: vertical; min-height: 80px; }
.modal-actions {
  display: flex; gap: 10px; margin-top: 24px; justify-content: flex-end;
}
.btn-modal {
  padding: 10px 20px; border-radius: 8px; font-size: 14px;
  font-weight: 600; cursor: pointer; font-family: inherit;
  border: 1px solid transparent; transition: all 0.15s ease;
}
.btn-modal-cancel { background: white; color: #475569; border-color: #e2e8f0; }
.btn-modal-cancel:hover { background: #f8fafc; }
.btn-modal-confirm { background: #16a34a; color: white; }
.btn-modal-confirm:hover { background: #15803d; }
.btn-modal-confirm:disabled { background: #cbd5e1; cursor: not-allowed; }
.btn-modal-confirm.over { background: #be123c; }
.btn-modal-confirm.over:hover:not(:disabled) { background: #9f1239; }
.warning-banner {
  background: #fff1f2; border: 1px solid #fecdd3; border-left: 4px solid #be123c;
  border-radius: 8px; padding: 12px 14px; margin-bottom: 16px;
  color: #881337; font-size: 13px; line-height: 1.5;
  display: none;
}
.warning-banner.show { display: block; }
.warning-banner strong { color: #881337; }
tr.row-over { background: #fff1f2 !important; }
tr.row-over td:first-child { border-left: 3px solid #be123c; }
.historico-modal { max-width: 900px; }
.historico-stats {
  display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap;
}
.historico-stat {
  flex: 1; min-width: 120px; background: #f8fafc; border-radius: 8px;
  padding: 12px; text-align: center;
}
.historico-stat-label { font-size: 11px; color: #64748b; text-transform: uppercase; font-weight: 600; }
.historico-stat-value { font-size: 22px; font-weight: 700; color: #0f172a; margin-top: 4px; }
.historico-filtros {
  display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap;
}
.historico-filtros label {
  display: flex; flex: 1; min-width: 130px;
}
.historico-filtros input, .historico-filtros select {
  padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 6px;
  font-size: 13px; font-family: inherit; flex: 1; min-width: 130px;
}
table.historico-tabela {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
table.historico-tabela th {
  text-align: left; padding: 10px 8px; background: #f8fafc;
  font-weight: 600; color: #475569; font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.3px;
  border-bottom: 1px solid #e2e8f0;
}
table.historico-tabela td {
  padding: 10px 8px; border-bottom: 1px solid #f1f5f9; color: #1a202c;
  vertical-align: top;
}
table.historico-tabela tr:hover { background: #fafbfc; }
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
}
.badge-ml { background: #fff8e1; color: #8a6d00; }
.badge-shopee { background: #ffe5dd; color: #b3361a; }
.badge-magalu { background: #e1f0ff; color: #0058a8; }
.badge-amazon { background: #ffe9c9; color: #8a4a00; }
.badge-tiktok { background: #ffe4ea; color: #a3112f; }
.btn-excluir {
  background: none; border: none; color: #dc2626; cursor: pointer;
  font-size: 13px; font-weight: 600; padding: 4px 8px; border-radius: 4px;
}
.btn-excluir:hover { background: #fef2f2; }
.historico-vazio {
  text-align: center; padding: 40px 20px; color: #94a3b8; font-size: 14px;
}
.toggle-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.toggle-btn {
  min-height: 42px; padding: 10px 16px; border: 1px solid #cbd5e1; border-radius: 8px;
  background: white; font-size: 14px; font-weight: 600; color: #475569;
  cursor: pointer; font-family: inherit; transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.toggle-btn:hover { background: #f1f5f9; border-color: #94a3b8; }
.toggle-btn:focus {
  outline: none; border-color: #1e40af; box-shadow: 0 0 0 3px rgba(30,64,175,0.1);
}
.toggle-btn.active {
  background: #1e40af; color: white; border-color: #1e40af;
  box-shadow: 0 6px 14px rgba(30, 64, 175, 0.18);
}
.sku-tag-container {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  width: 100%; padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 8px;
  cursor: text; min-height: 42px; transition: border 0.15s ease, box-shadow 0.15s ease;
  background: white;
}
.sku-tag-container:focus-within {
  border-color: #1e40af; box-shadow: 0 0 0 3px rgba(30,64,175,0.1);
}
.sku-tag {
  display: inline-flex; align-items: center; gap: 4px;
  background: #e0e7ff; color: #1e40af; font-size: 12px; font-weight: 700;
  padding: 4px 8px; border-radius: 999px; white-space: nowrap;
}
.sku-remove {
  background: none; border: none; color: #1e40af; cursor: pointer;
  font-size: 14px; line-height: 1; padding: 0 2px; font-weight: 700;
}
.sku-remove:hover { color: #be123c; }
.sku-tag-input {
  border: none; outline: none; font-size: 14px; font-family: inherit;
  color: #0f172a; flex: 1; min-width: 180px; padding: 2px 4px;
  background: transparent;
}
.sku-tag-input::placeholder { color: #7c8798; }
