/* ========================================
   INVENTÁRIO SABESP v2
   Design system: corporativo, sóbrio, moderno
======================================== */

:root {
  --sabesp-azul: #009EDB;
  --sabesp-azul-escuro: #0077A8;
  --sabesp-azul-mais-escuro: #005A82;
  --sabesp-azul-claro: #E8F6FC;
  --sabesp-amarelo: #F5C518;
  --sabesp-laranja: #FF8C42;
  --sabesp-verde: #16A34A;
  --sabesp-vermelho: #DC2626;

  --bg: #F8FAFC;
  --bg-card: #FFFFFF;
  --border: #E2E8F0;
  --border-strong: #CBD5E1;
  --text: #0F172A;
  --text-muted: #64748B;
  --text-light: #94A3B8;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.12);

  --transition: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

html, body {
  height: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

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

/* ============ HEADER ============ */
.header {
  background: linear-gradient(180deg, var(--sabesp-azul) 0%, var(--sabesp-azul-escuro) 100%);
  color: white;
  padding: 14px 20px;
  box-shadow: 0 2px 12px rgba(0, 158, 219, 0.25);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  max-width: 1680px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-logo {
  height: 32px;
  width: auto;
  display: block;
}

.header-divider {
  width: 1px;
  height: 28px;
  background: rgba(255, 255, 255, 0.3);
}

.header-title-group {
  line-height: 1.2;
}

.header h1 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.2px;
}

.header-subtitle {
  font-size: 12px;
  opacity: 0.85;
  margin-top: 2px;
}

.header-info {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.12);
  padding: 6px 12px;
  border-radius: 20px;
  font-weight: 500;
}

.header-user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: white;
  color: var(--sabesp-azul);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 11px;
}

.btn-sair {
  background: rgba(255, 255, 255, 0.15);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-sair:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* ============ CONTAINER ============ */
.container {
  max-width: 1680px;
  margin: 0 auto;
  padding: 20px;
}

.container-narrow {
  max-width: 600px;
}

/* ============ LOGIN ============ */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(circle at 20% 0%, rgba(0, 158, 219, 0.18) 0%, transparent 50%),
    radial-gradient(circle at 80% 100%, rgba(0, 119, 168, 0.22) 0%, transparent 50%),
    linear-gradient(180deg, #F0F9FD 0%, #DCEFF8 100%);
}

.login-card {
  background: white;
  border-radius: var(--radius-xl);
  padding: 40px 32px 32px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.8);
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo img {
  height: 44px;
  width: auto;
  display: inline-block;
}

.login-titulo {
  text-align: center;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.login-titulo h1 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
  letter-spacing: -0.3px;
}

.login-titulo p {
  font-size: 13px;
  color: var(--text-muted);
}

.login-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--sabesp-azul-claro);
  color: var(--sabesp-azul-escuro);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 8px;
}

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 7px;
  color: var(--text);
}

.form-group input {
  width: 100%;
  padding: 13px 15px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 15px;
  background: white;
  color: var(--text);
  transition: all var(--transition);
}

.form-group input:focus {
  outline: none;
  border-color: var(--sabesp-azul);
  box-shadow: 0 0 0 4px rgba(0, 158, 219, 0.12);
}

.form-group input.codigo {
  text-transform: uppercase;
  letter-spacing: 3px;
  font-weight: 700;
  font-size: 18px;
  text-align: center;
}

.form-help {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 6px;
}

.btn-primario {
  width: 100%;
  padding: 14px;
  background: var(--sabesp-azul);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
}

.btn-primario:hover {
  background: var(--sabesp-azul-escuro);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 158, 219, 0.35);
}

.btn-primario:active {
  transform: translateY(0);
}

.btn-primario:disabled {
  background: var(--text-light);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.erro-msg {
  background: #FEF2F2;
  color: var(--sabesp-vermelho);
  padding: 11px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
  border: 1px solid #FECACA;
  align-items: center;
  gap: 8px;
}

.erro-msg.show {
  display: flex;
}

.login-footer {
  text-align: center;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.login-footer a {
  color: var(--sabesp-azul);
  text-decoration: none;
  font-weight: 500;
  font-size: 13px;
  transition: color var(--transition);
}

.login-footer a:hover {
  color: var(--sabesp-azul-escuro);
}

.login-rodape {
  text-align: center;
  margin-top: 20px;
  font-size: 11px;
  color: var(--text-light);
  letter-spacing: 0.3px;
}

/* ============ INFO EMPREITEIRA ============ */
.empreiteira-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
}

.empreiteira-icon {
  width: 44px;
  height: 44px;
  background: var(--sabesp-azul-claro);
  color: var(--sabesp-azul);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.empreiteira-info {
  flex: 1;
  min-width: 0;
}

.empreiteira-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  margin-bottom: 2px;
}

.empreiteira-nome {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============ PROGRESSO ============ */
.progresso-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.progresso-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
}

.progresso-titulo {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.progresso-percent {
  font-size: 28px;
  font-weight: 700;
  color: var(--sabesp-azul);
  letter-spacing: -1px;
}

.progresso-bar {
  height: 10px;
  background: var(--bg);
  border-radius: 5px;
  overflow: hidden;
  position: relative;
}

.progresso-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--sabesp-azul) 0%, #00C7B7 50%, var(--sabesp-verde) 100%);
  transition: width 0.5s ease;
  border-radius: 5px;
  position: relative;
}

.progresso-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.3) 50%, transparent 100%);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.progresso-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 16px;
}

.stat {
  text-align: center;
  padding: 12px 8px;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.stat::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: currentColor;
  opacity: 0.6;
}

.stat-valor {
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.5px;
}

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 6px;
  font-weight: 600;
}

.stat-pendente { color: var(--sabesp-laranja); }
.stat-contado { color: var(--sabesp-verde); }
.stat-total { color: var(--sabesp-azul); }
.stat-pendente .stat-label, .stat-contado .stat-label, .stat-total .stat-label {
  color: var(--text-muted);
}

/* ============ FILTROS ============ */
.filtros {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 14px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.busca {
  position: relative;
  margin-bottom: 12px;
}

.busca input {
  width: 100%;
  padding: 12px 14px 12px 42px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 15px;
  background: var(--bg);
  transition: all var(--transition);
}

.busca input:focus {
  outline: none;
  border-color: var(--sabesp-azul);
  background: white;
  box-shadow: 0 0 0 4px rgba(0, 158, 219, 0.1);
}

.busca-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.filtro-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  background: var(--bg);
  padding: 4px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.tab {
  padding: 9px 8px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--transition);
}

.tab:hover:not(.active) {
  background: white;
  color: var(--text);
}

.tab.active {
  background: white;
  color: var(--sabesp-azul);
  box-shadow: var(--shadow-sm);
}

.tab-pendentes.active { color: var(--sabesp-laranja); }
.tab-contados.active { color: var(--sabesp-verde); }

/* ============ LISTA ============ */
.lista-itens {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.item-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  border-left: 3px solid var(--sabesp-laranja);
  cursor: pointer;
  transition: all var(--transition);
}

.item-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  border-color: var(--sabesp-azul);
}

.item-card:active {
  transform: translateY(0) scale(0.99);
}

.item-card.contado {
  border-left-color: var(--sabesp-verde);
  background: linear-gradient(180deg, #F0FDF4 0%, white 80%);
}

.item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
}

.item-codigo {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 700;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  letter-spacing: 0.3px;
}

.item-status {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

.item-status.pendente {
  background: #FFF4E5;
  color: #B45309;
}

.item-status.contado {
  background: #DCFCE7;
  color: #15803D;
}

.item-descricao {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 10px;
  line-height: 1.35;
}

.item-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
}

.item-info-umb {
  display: inline-block;
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
}

.item-info-contado {
  color: var(--sabesp-verde);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.lista-vazia {
  text-align: center;
  padding: 60px 20px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px dashed var(--border-strong);
  color: var(--text-muted);
}

.lista-vazia-icon {
  font-size: 48px;
  margin-bottom: 12px;
  display: block;
}

.lista-vazia-titulo {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.lista-vazia-desc {
  font-size: 13px;
}

/* ============ MODAL ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 200;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-overlay.show {
  display: flex;
}

.modal {
  background: white;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  width: 100%;
  max-width: 500px;
  padding: 24px 24px 28px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.25s cubic-bezier(0.2, 0.9, 0.4, 1);
}

@media (min-width: 640px) {
  .modal-overlay {
    align-items: center;
    padding: 20px;
  }
  .modal {
    border-radius: var(--radius-xl);
    max-height: 80vh;
  }
}

@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0.5; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-handle {
  width: 40px;
  height: 4px;
  background: var(--border-strong);
  border-radius: 2px;
  margin: -12px auto 16px;
}

.modal-codigo-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.modal-codigo-label {
  font-size: 10px;
  background: var(--sabesp-azul-claro);
  color: var(--sabesp-azul-escuro);
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.modal-codigo {
  font-size: 13px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-weight: 600;
}

.modal-descricao {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 20px;
  line-height: 1.35;
}

.modal-input-wrapper {
  margin-bottom: 18px;
}

.modal-input-wrapper label {
  font-size: 12px;
  font-weight: 600;
  display: block;
  margin-bottom: 8px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.modal-input {
  width: 100%;
  padding: 18px;
  font-size: 32px;
  font-weight: 700;
  text-align: center;
  border: 2px solid var(--border-strong);
  border-radius: var(--radius);
  letter-spacing: -1px;
  transition: all var(--transition);
}

.modal-input:focus {
  outline: none;
  border-color: var(--sabesp-azul);
  box-shadow: 0 0 0 4px rgba(0, 158, 219, 0.12);
}

.modal-umb {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 8px;
  font-weight: 500;
}

.modal-umb strong {
  color: var(--text);
  font-weight: 700;
}

.modal-acoes {
  display: flex;
  gap: 10px;
}

.modal-acoes button {
  flex: 1;
  padding: 14px;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-cancelar {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border-strong) !important;
}

.btn-cancelar:hover {
  background: var(--border);
}

.btn-confirmar {
  background: var(--sabesp-verde);
  color: white;
}

.btn-confirmar:hover {
  background: #15803D;
}

.btn-confirmar:disabled {
  background: var(--text-light);
}

.aviso-ja-contado {
  background: #FFF8E1;
  color: #92400E;
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 16px;
  border: 1px solid #FDE68A;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

/* ============ ADMIN ============ */
.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.admin-stat {
  background: var(--bg-card);
  padding: 18px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.admin-stat::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--sabesp-azul);
}

.admin-stat.laranja::before { background: var(--sabesp-laranja); }
.admin-stat.verde::before { background: var(--sabesp-verde); }
.admin-stat.amarelo::before { background: var(--sabesp-amarelo); }

.admin-stat-valor {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
  letter-spacing: -0.5px;
  white-space: nowrap;
  overflow: visible;
}
/* numeros compostos (X/Y) menores pra caber */
.admin-stat-valor.duplo { font-size: 22px; }

.admin-stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 8px;
  font-weight: 600;
}

.admin-tabela-wrapper {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}

.admin-tabela-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 12px;
}

.admin-tabela-titulo {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.btn-acao {
  border: none;
  padding: 9px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-atualizar {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border-strong) !important;
}

.btn-atualizar:hover {
  background: var(--border);
}

.btn-exportar {
  background: var(--sabesp-verde);
  color: white;
}

.btn-exportar:hover {
  background: #15803D;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
}

.admin-busca {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.admin-busca input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 14px;
  background: white;
}

.admin-busca input:focus {
  outline: none;
  border-color: var(--sabesp-azul);
}

.admin-tabela {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.admin-tabela th {
  background: var(--bg);
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.admin-tabela td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.admin-tabela tr:last-child td {
  border-bottom: none;
}

.admin-tabela tbody tr:hover {
  background: var(--bg);
}

.empresa-nome {
  font-weight: 600;
  color: var(--text);
}

.empresa-codigo {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
  font-weight: 600;
}

.progresso-mini {
  display: flex;
  align-items: center;
  gap: 10px;
}

.progresso-mini-bar {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  min-width: 60px;
}

.progresso-mini-fill {
  height: 100%;
  background: var(--sabesp-azul);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.progresso-mini-fill.completo {
  background: var(--sabesp-verde);
}

.progresso-mini-valor {
  font-size: 12px;
  font-weight: 600;
  min-width: 80px;
  text-align: right;
  color: var(--text);
}

.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge-nao-iniciado {
  background: #F1F5F9;
  color: var(--text-muted);
}

.badge-andamento {
  background: #FFF4E5;
  color: #B45309;
}

.badge-concluido {
  background: #DCFCE7;
  color: #15803D;
}

/* ============ LOADING ============ */
.loading {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.spinner {
  display: inline-block;
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--sabesp-azul);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 14px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============ TOAST ============ */
.toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: var(--text);
  color: white;
  padding: 12px 22px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  transition: transform 0.3s ease;
  z-index: 300;
  max-width: 90%;
  text-align: center;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

.toast.success { background: var(--sabesp-verde); }
.toast.error { background: var(--sabesp-vermelho); }

/* ============ FOOTER ============ */
.footer {
  text-align: center;
  padding: 24px 20px;
  font-size: 11px;
  color: var(--text-light);
  letter-spacing: 0.3px;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 640px) {
  .header h1 {
    font-size: 14px;
  }
  .header-subtitle {
    font-size: 11px;
  }
  .header-user span {
    display: none;
  }
  .admin-tabela {
    font-size: 12px;
  }
  .admin-tabela th, .admin-tabela td {
    padding: 10px 10px;
  }
  .admin-tabela-mobile-hide {
    display: none;
  }
  .login-card {
    padding: 32px 24px 24px;
  }
}

/* Esconder elementos via JS */
.hidden {
  display: none !important;
}

/* ===== MELHORIAS ADMIN V2 ===== */
.admin-filtros {
  display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap;
}
.admin-filtro-busca {
  flex: 2; min-width: 200px; padding: 11px 14px;
  border: 1.5px solid var(--border-strong); border-radius: var(--radius); font-size: 14px;
}
.admin-filtro-select { flex: 1; min-width: 150px; }

.diretoria-tag {
  display: inline-block; padding: 3px 10px; border-radius: 12px;
  background: var(--sabesp-azul-claro); color: var(--sabesp-azul-escuro);
  font-size: 12px; font-weight: 700; letter-spacing: 0.3px;
}

.btn-gerenciar {
  padding: 7px 14px; border: 1.5px solid var(--sabesp-azul); background: white;
  color: var(--sabesp-azul); border-radius: var(--radius); font-size: 13px;
  font-weight: 600; cursor: pointer; transition: all .15s; white-space: nowrap;
}
.btn-gerenciar:hover { background: var(--sabesp-azul); color: white; }

.acao-box {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
}
.acao-titulo { font-weight: 600; font-size: 15px; margin-bottom: 6px; color: var(--text); }
.acao-desc { font-size: 13px; color: var(--text-muted); line-height: 1.5; margin-bottom: 12px; }
.btn-acao-perigo {
  width: 100%; padding: 11px; border: 1.5px solid var(--sabesp-vermelho);
  background: #FEF2F2; color: var(--sabesp-vermelho); border-radius: var(--radius);
  font-size: 14px; font-weight: 600; cursor: pointer; transition: all .15s;
}
.btn-acao-perigo:hover { background: var(--sabesp-vermelho); color: white; }

.form-input {
  width: 100%; padding: 11px 14px; border: 1.5px solid var(--border-strong);
  border-radius: var(--radius); font-size: 14px; font-family: inherit;
}
.form-input:focus { outline: none; border-color: var(--sabesp-azul); box-shadow: 0 0 0 3px rgba(0,158,219,0.12); }

/* ===== FILTROS MULTI-SELECAO ===== */
.multi-filtro { position: relative; flex: 1 1 200px; min-width: 180px; max-width: 320px; }
.multi-filtro-btn {
  width: 100%; padding: 11px 14px; border: 1.5px solid var(--border-strong);
  border-radius: var(--radius); background: white; font-size: 14px; color: var(--text);
  cursor: pointer; display: flex; align-items: center; justify-content: space-between;
  gap: 8px; font-family: inherit; transition: border-color .15s;
}
.multi-filtro-btn:hover { border-color: var(--sabesp-azul); }
.multi-filtro-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.multi-filtro-menu {
  min-width: 100%; width: max-content; max-width: 340px;
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 50;
  background: white; border: 1.5px solid var(--border-strong); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12); max-height: 280px; overflow-y: auto;
  padding: 6px; display: none;
}
.multi-filtro-menu.aberto { display: block; }
.multi-opt {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px;
  border-radius: 8px; cursor: pointer; font-size: 14px; color: var(--text);
  transition: background .12s;
}
.multi-opt:hover { background: var(--bg); }
.multi-opt input[type="checkbox"] {
  width: 17px; height: 17px; accent-color: var(--sabesp-azul); cursor: pointer;
}

/* ===== OVERLAY DE PROGRESSO DO EXPORT ===== */
.export-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,0.55);
  display: none; align-items: center; justify-content: center; z-index: 9999;
  backdrop-filter: blur(2px);
}
.export-overlay.show { display: flex; }
.export-box {
  background: white; border-radius: 16px; padding: 32px 40px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3); text-align: center;
  min-width: 320px; max-width: 90%;
}
.export-spinner {
  width: 48px; height: 48px; margin: 0 auto 18px;
  border: 4px solid var(--sabesp-azul-claro); border-top-color: var(--sabesp-azul);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.export-titulo { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.export-etapa { font-size: 14px; color: var(--text-muted); margin-bottom: 16px; min-height: 20px; }
.export-barra { height: 8px; background: var(--bg); border-radius: 10px; overflow: hidden; }
.export-barra-fill {
  height: 100%; background: linear-gradient(90deg, var(--sabesp-azul), var(--sabesp-verde));
  width: 5%; transition: width 0.4s ease; border-radius: 10px;
}

/* ===== TAG DE CANCELAMENTO/ZERAMENTO na linha ===== */
.cancel-tag {
  display: inline-flex; align-items: center; gap: 5px;
  margin-top: 6px; padding: 3px 9px; border-radius: 10px;
  background: #FEF2F2; color: #B91C1C; font-size: 11px; font-weight: 600;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  border: 1px solid #FECACA;
}
.cancel-tag svg { flex-shrink: 0; }

/* busca interna dos filtros multi */
.multi-filtro-busca-interna {
  width: 100%; padding: 8px 10px; margin-bottom: 6px;
  border: 1.5px solid var(--border-strong); border-radius: 8px; font-size: 13px;
  position: sticky; top: 0; background: white;
}

/* ===== INVENTARIO GERAL ===== */
.btn-trocar {
  padding: 7px 14px; border: 1.5px solid var(--sabesp-azul); background: white;
  color: var(--sabesp-azul); border-radius: var(--radius); font-size: 13px;
  font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn-trocar:hover { background: var(--sabesp-azul); color: white; }

.progresso-topo { margin: 16px 0; }
.progresso-topo-info { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text); }

.btn-add-material {
  width: 100%; padding: 12px; margin: 12px 0; border: 1.5px dashed var(--sabesp-azul);
  background: var(--sabesp-azul-claro); color: var(--sabesp-azul-escuro);
  border-radius: var(--radius); font-size: 14px; font-weight: 600; cursor: pointer;
}
.btn-add-material:hover { background: var(--sabesp-azul); color: white; }

.rodada-aviso {
  background: #FFF8E1; border: 1px solid #FDE68A; color: #92400E;
  padding: 10px 12px; border-radius: var(--radius); font-size: 13px; margin-bottom: 14px;
}

.item-contado { opacity: 0.85; }
.check-verde { color: var(--sabesp-verde); font-weight: 700; font-size: 16px; }

/* ===== INVENTARIO GERAL v2 ===== */
.btn-trocar { padding:7px 14px;border:1.5px solid var(--sabesp-azul);background:white;color:var(--sabesp-azul);border-radius:var(--radius);font-size:13px;font-weight:600;cursor:pointer;white-space:nowrap; }
.btn-trocar:hover { background:var(--sabesp-azul);color:white; }
.progresso-topo { margin:16px 0; }
.progresso-topo-info { display:flex;justify-content:space-between;font-size:13px;font-weight:600;margin-bottom:6px;color:var(--text); }
.btn-add-material { width:100%;padding:12px;margin:12px 0;border:1.5px dashed var(--sabesp-azul);background:var(--sabesp-azul-claro);color:var(--sabesp-azul-escuro);border-radius:var(--radius);font-size:14px;font-weight:600;cursor:pointer; }
.btn-add-material:hover { background:var(--sabesp-azul);color:white; }
.rodada-aviso { background:#FFF8E1;border:1px solid #FDE68A;color:#92400E;padding:10px 12px;border-radius:var(--radius);font-size:13px;margin-bottom:14px; }
.item-contado { opacity:.85; }
.check-verde { color:var(--sabesp-verde);font-weight:700;font-size:16px; }

/* enderecamento */
.ender-box { display:flex;align-items:center;justify-content:space-between;gap:10px;background:var(--sabesp-azul-claro);border-radius:var(--radius);padding:10px 14px;margin-bottom:14px; }
.ender-label { font-size:11px;text-transform:uppercase;letter-spacing:.5px;color:var(--sabesp-azul-escuro);font-weight:600; }
.ender-valor { font-family:'JetBrains Mono',monospace;font-weight:600;color:var(--text);font-size:14px; }
.item-ender { font-family:'JetBrains Mono',monospace;font-size:11px;background:var(--bg);padding:2px 7px;border-radius:6px;color:var(--text-muted);font-weight:600; }
.item-ender-sap { background:#FEF3C7;color:#92400E; }

/* sucata */
.check-sucata { display:flex;align-items:center;gap:8px;font-size:14px;color:var(--text);margin:4px 0 14px;cursor:pointer; }
.check-sucata input { width:18px;height:18px;accent-color:var(--sabesp-laranja); }

/* selecao almox (contagem) */
.almox-select-card { display:flex;align-items:center;justify-content:space-between;padding:16px;border:1.5px solid var(--border-strong);border-radius:var(--radius);margin-bottom:10px;cursor:pointer;transition:all .15s;color:var(--text-muted); }
.almox-select-card:hover { border-color:var(--sabesp-azul);background:var(--sabesp-azul-claro);color:var(--sabesp-azul); }
.almox-select-nome { font-weight:600;color:var(--text);font-size:15px; }
.almox-select-info { font-size:12px;color:var(--text-muted);margin-top:2px; }

/* abas admin */
.admin-abas { display:flex;gap:4px;margin-bottom:20px;background:white;padding:6px;border-radius:var(--radius);box-shadow:var(--shadow-sm);width:fit-content;flex-wrap:wrap; }
.admin-aba { padding:10px 20px;border:none;background:transparent;border-radius:8px;font-size:14px;font-weight:600;color:var(--text-muted);cursor:pointer;font-family:inherit;transition:all .15s; }
.admin-aba:hover { background:var(--bg); }
.admin-aba.active { background:var(--sabesp-azul);color:white; }

/* relatorios */
.relat-grid { display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:18px; }
.relat-card { background:white;border-radius:var(--radius);padding:24px;box-shadow:var(--shadow-sm);border:1px solid var(--border);display:flex;flex-direction:column; }
.relat-card-titulo { font-size:17px;font-weight:700;color:var(--sabesp-azul);margin-bottom:10px; }
.relat-card-desc { font-size:13px;color:var(--text-muted);line-height:1.5;margin-bottom:18px;flex:1; }

/* gestao acessos - checkboxes */
.check-linha { display:flex;gap:16px;flex-wrap:wrap; }
.check-inline { display:flex;align-items:center;gap:7px;font-size:14px;cursor:pointer; }
.check-inline input { width:17px;height:17px;accent-color:var(--sabesp-azul); }
.lista-almox-check { max-height:200px;overflow-y:auto;border:1px solid var(--border);border-radius:var(--radius);padding:6px; }

/* multi-filtro (reuso) */
.multi-filtro { position:relative;flex:1 1 200px;min-width:180px;max-width:320px; }
.multi-filtro-btn { width:100%;padding:11px 14px;border:1.5px solid var(--border-strong);border-radius:var(--radius);background:white;font-size:14px;color:var(--text);cursor:pointer;display:flex;align-items:center;justify-content:space-between;gap:8px;font-family:inherit; }
.multi-filtro-btn:hover { border-color:var(--sabesp-azul); }
.multi-filtro-btn span { overflow:hidden;text-overflow:ellipsis;white-space:nowrap; }
.multi-filtro-menu { min-width:100%;width:max-content;max-width:340px;position:absolute;top:calc(100% + 4px);left:0;z-index:50;background:white;border:1.5px solid var(--border-strong);border-radius:var(--radius);box-shadow:0 8px 24px rgba(0,0,0,.12);max-height:280px;overflow-y:auto;padding:6px;display:none; }
.multi-filtro-menu.aberto { display:block; }
.multi-opt { display:flex;align-items:center;gap:10px;padding:9px 10px;border-radius:8px;cursor:pointer;font-size:14px;color:var(--text); }
.multi-opt:hover { background:var(--bg); }
.multi-opt input[type=checkbox] { width:17px;height:17px;accent-color:var(--sabesp-azul);cursor:pointer; }
.multi-filtro-busca-interna { width:100%;padding:8px 10px;margin-bottom:6px;border:1.5px solid var(--border-strong);border-radius:8px;font-size:13px;position:sticky;top:0;background:white; }

/* barra de progresso do topo da contagem - com degrade */
.progresso-topo .progresso-mini-bar { height: 12px; border-radius: 6px; }
.progresso-topo #progFill {
  height: 100%; border-radius: 6px;
  background: linear-gradient(90deg, #009EDB 0%, #00C2A8 50%, #16A34A 100%);
  background-size: 200% 100%;
  transition: width 0.4s ease;
  box-shadow: 0 1px 3px rgba(0,158,219,0.3);
}

/* progresso por rodada (4 barras) */
.progresso-rodadas { display:grid;grid-template-columns:repeat(4,1fr);gap:12px;margin:16px 0; }
.prog-rodada { background:white;border-radius:var(--radius);padding:12px;box-shadow:var(--shadow-sm);border:1px solid var(--border); }
.prog-rodada-top { display:flex;justify-content:space-between;align-items:baseline;margin-bottom:6px; }
.prog-rodada-label { font-size:12px;font-weight:600;color:var(--text-muted); }
.prog-rodada-pct { font-size:15px;font-weight:700;color:var(--sabesp-azul); }
.prog-fill { height:100%;border-radius:6px;transition:width .4s ease;background:linear-gradient(90deg,#009EDB,#00C2A8,#16A34A);background-size:200% 100%; }
.prog-fill-geral { background:linear-gradient(90deg,#009EDB,#00C2A8,#16A34A); }
.prog-fill-2 { background:linear-gradient(90deg,#F59E0B,#FBBF24); }
.prog-fill-3 { background:linear-gradient(90deg,#EF4444,#F87171); }
.prog-rodada .progresso-mini-bar { height:10px;border-radius:5px; }
.prog-rodada-txt { font-size:11px;color:var(--text-light);margin-top:5px;text-align:right;font-weight:600; }
@media(max-width:640px){ .progresso-rodadas{grid-template-columns:repeat(2,1fr);} }

/* gestao de itens no admin */
.item-admin-row { display:flex;justify-content:space-between;align-items:center;gap:10px;padding:10px;border-bottom:1px solid var(--border); }
.btn-rodada-zerar { padding:5px 10px;border:1px solid #FCA5A5;background:#FEF2F2;color:#B91C1C;border-radius:6px;font-size:11px;font-weight:600;cursor:pointer;white-space:nowrap;font-family:inherit; }
.btn-rodada-zerar:hover { background:var(--sabesp-vermelho);color:white; }

.btn-mini { padding:6px 12px;border:1.5px solid var(--sabesp-azul);background:white;color:var(--sabesp-azul);border-radius:8px;font-size:12px;font-weight:600;cursor:pointer;font-family:inherit; }
.btn-mini:hover { background:var(--sabesp-azul);color:white; }
