/* ========================================
   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;
}

/* ============================================================
   MELHORIAS DO MRO TRAZIDAS PARA O EPT (v9)
   Polimento visual + modo escuro
   ============================================================ */
:root{--text:#1E293B;--text-muted:#64748B;--text-light:#94A3B8;--border:#E2E8F0;--border-strong:#CBD5E1;--bg:#F1F5F9;}

/* botoes com profundidade */
.btn-primary,.btn-confirmar,button[type="submit"]{transition:all .18s cubic-bezier(.4,0,.2,1) !important;}
.btn-primary:hover,.btn-confirmar:hover,button[type="submit"]:hover{transform:translateY(-1px);filter:brightness(1.05);}
.btn-primary:active,.btn-confirmar:active,button[type="submit"]:active{transform:translateY(0) scale(.98);}

/* inputs com foco azul */
input:focus,select:focus,textarea:focus{outline:none !important;border-color:var(--sabesp-azul) !important;box-shadow:0 0 0 3px rgba(0,158,219,.14) !important;}

/* cards hover */
.card,.canteiro-card,.stat-card,.item-row{transition:all .18s ease;}
.stat-card:hover{transform:translateY(-2px);box-shadow:0 6px 16px rgba(0,0,0,.09);}

/* scrollbar */
::-webkit-scrollbar{width:9px;height:9px;}
::-webkit-scrollbar-track{background:transparent;}
::-webkit-scrollbar-thumb{background:#C3CDD8;border-radius:5px;}
::-webkit-scrollbar-thumb:hover{background:var(--sabesp-azul);}

/* modais com animacao */
.modal,.modal-content{animation:eptModalIn .22s cubic-bezier(.34,1.3,.64,1);}
@keyframes eptModalIn{from{opacity:0;transform:translateY(20px) scale(.97);}to{opacity:1;transform:translateY(0) scale(1);}}

/* ===== MODO ESCURO ===== */
body.tema-escuro{background:#0F172A;color:#E2E8F0;}
body.tema-escuro .card,body.tema-escuro .stat-card,body.tema-escuro .canteiro-card,body.tema-escuro .item-row,body.tema-escuro .modal,body.tema-escuro .modal-content,body.tema-escuro table{background:#1E293B !important;color:#E2E8F0 !important;border-color:#334155 !important;}
body.tema-escuro .header,body.tema-escuro header{background:linear-gradient(180deg,#124867,#0C3350) !important;}
body.tema-escuro input,body.tema-escuro select,body.tema-escuro textarea{background:#0F172A !important;color:#E2E8F0 !important;border-color:#334155 !important;}
body.tema-escuro th{background:#0C2A3A !important;color:#7DD3FC !important;}
body.tema-escuro tr:hover td{background:#263449 !important;}
body.tema-escuro .text-muted,body.tema-escuro .sub,body.tema-escuro label{color:#94A3B8 !important;}
body.tema-escuro a{color:#7DD3FC;}

/* botao de tema */
.btn-tema-ept{background:rgba(255,255,255,.18);border:none;color:white;width:38px;height:38px;border-radius:9px;cursor:pointer;font-size:17px;}
.btn-tema-ept:hover{background:rgba(255,255,255,.3);}

/* status offline banner */
.ept-offline{display:flex;align-items:center;gap:8px;background:#FEF3C7;border:1px solid #FCD34D;color:#92400E;padding:9px 14px;border-radius:12px;font-size:12px;font-weight:500;margin:8px 0;}
body.tema-escuro .ept-offline{background:#3A2E12;border-color:#78591A;color:#FCD34D;}

/* botao instalar */
.ept-btn-instalar{position:fixed;bottom:20px;right:20px;z-index:900;background:var(--sabesp-azul);color:white;border:none;padding:12px 20px;border-radius:30px;font-size:14px;font-weight:600;box-shadow:0 4px 16px rgba(0,158,219,.4);cursor:pointer;display:flex;align-items:center;gap:8px;font-family:inherit;}

/* ===== CARTA DE CIRCULARIZAÇÃO ===== */
.carta-card{background:white;border:2px dashed var(--sabesp-laranja);border-radius:16px;padding:18px;margin-bottom:16px;transition:all .2s ease;}
.carta-card.carta-ok{border-style:solid;border-color:var(--sabesp-verde);background:#F0FDF4;}
.carta-header{display:flex;gap:12px;align-items:flex-start;margin-bottom:12px;}
.carta-header svg{color:var(--sabesp-laranja);flex-shrink:0;margin-top:2px;}
.carta-card.carta-ok .carta-header svg{color:var(--sabesp-verde);}
.carta-titulo{font-size:15px;font-weight:700;color:var(--text);display:flex;align-items:center;gap:8px;flex-wrap:wrap;}
.carta-obrig{font-size:10px;font-weight:700;background:var(--sabesp-laranja);color:white;padding:2px 8px;border-radius:20px;text-transform:uppercase;letter-spacing:.5px;}
.carta-sub{font-size:12.5px;color:var(--text-muted);margin-top:3px;line-height:1.4;}
.carta-btn{display:flex;align-items:center;justify-content:center;gap:8px;width:100%;padding:13px;background:var(--sabesp-azul);color:white;border-radius:11px;font-size:14px;font-weight:600;cursor:pointer;transition:all .16s ease;}
.carta-btn:hover{background:var(--sabesp-azul-escuro);transform:translateY(-1px);}
.carta-pendente{color:#92400E;background:#FEF3C7;border-radius:8px;padding:8px 12px;font-size:13px;font-weight:600;margin-bottom:12px;}
.carta-enviada{color:#166534;background:#DCFCE7;border-radius:8px;padding:8px 12px;font-size:13px;font-weight:500;margin-bottom:12px;}
.carta-enviada a{color:var(--sabesp-azul-escuro);font-weight:700;}
body.tema-escuro .carta-card{background:#1E293B;}
body.tema-escuro .carta-card.carta-ok{background:#14351F;}
body.tema-escuro .carta-titulo{color:#E2E8F0;}
body.tema-escuro .carta-pendente{background:#3A2E12;color:#FCD34D;}
body.tema-escuro .carta-enviada{background:#14351F;color:#86EFAC;}

/* tags da carta na tabela admin */
.carta-tag-ok{display:inline-block;background:#DCFCE7;color:#166534;font-size:12px;font-weight:700;padding:4px 10px;border-radius:8px;text-decoration:none;}
.carta-tag-ok:hover{background:#16A34A;color:white;}
.carta-tag-falta{display:inline-block;background:#FEF3C7;color:#92400E;font-size:12px;font-weight:600;padding:4px 10px;border-radius:8px;}
body.tema-escuro .carta-tag-ok{background:#14351F;color:#86EFAC;}
body.tema-escuro .carta-tag-falta{background:#3A2E12;color:#FCD34D;}
