/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:              #1a2a4a;
  --bg2:             #1e3258;
  --bg3:             #243b6a;
  --bg4:             #2a4478;
  --azul:            #4a90d9;
  --azul-claro:      #6aaff0;
  --azul-glow:       rgba(74,144,217,0.18);
  --azul-borda:      rgba(74,144,217,0.4);
  --texto:           #e8f0ff;
  --texto-dim:       #7a9abb;
  --borda:           #2e4a7a;
  --borda-clara:     #3a5a90;
  --danger:          #e05252;
  --tag-massiva:     #ff6000;
  --tag-massiva-glow:rgba(255,96,0,0.4);
  --tag-pendencia:   #7b52c0;
  --th-bg:           #12192e;
  --hover-linha:     rgba(74,144,217,0.06);
  --zebra:           rgba(255,255,255,0.018);
  --sla-verde:       #2ecc71;
  --sla-amarelo:     #f39c12;
  --sla-vermelho:    #e74c3c;
  --row-height:      52px;
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--texto);
  min-height: 100vh;
  font-size: 14px;
}

/* ===== HEADER ===== */
header {
  background: var(--bg2);
  padding: 13px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--borda);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 20px rgba(0,0,0,0.4);
}
header h1 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
nav {
  display: flex;
  gap: 5px;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}
.nav-btn {
  padding: 6px 16px;
  border-radius: 6px;
  text-decoration: none;
  color: var(--texto-dim);
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.2s;
  border: 1px solid transparent;
  white-space: nowrap;
}
.nav-btn:hover  { color: white; border-color: var(--azul-borda); background: var(--azul-glow); }
.nav-btn.active { color: white; background: var(--azul); border-color: var(--azul); box-shadow: 0 0 12px rgba(74,144,217,0.35); }

/* ===== CONTAINERS ===== */
.container       { max-width: 760px; margin: 28px auto; padding: 0 20px; }
.container-wide  { max-width: 1860px; margin: 20px auto; padding: 0 20px; }
.container-form  { display: flex; gap: 24px; max-width: 1440px; margin: 24px auto; padding: 0 24px; align-items: flex-start; }
.form-wrapper    { flex: 1; min-width: 0; }

/* ===== MÁSCARA ===== */
.mascara-wrapper {
  flex: 1; min-width: 0; display: flex; flex-direction: column;
  background: var(--bg2); border: 1px solid var(--borda);
  border-radius: 10px; overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  position: sticky; top: 80px;
}
.mascara-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 11px 16px; background: var(--bg3);
  border-bottom: 1px solid var(--borda);
  font-size: 0.88rem; font-weight: 600; color: var(--texto-dim);
}
.btn-copiar {
  background: var(--azul); color: white; border: none;
  border-radius: 6px; padding: 6px 16px; font-size: 0.84rem;
  font-weight: 700; cursor: pointer; transition: all 0.2s; font-family: inherit;
}
.btn-copiar:hover { background: var(--azul-claro); box-shadow: 0 0 10px var(--azul-glow); }
#mascara-texto {
  flex: 1; width: 100%; min-height: 540px;
  background: var(--bg2); border: none; color: var(--texto);
  padding: 16px; font-family: 'Consolas','Courier New',monospace;
  font-size: 0.88rem; line-height: 1.75; resize: none; outline: none;
}
#mascara-texto::placeholder { color: var(--texto-dim); font-style: italic; font-family: 'Segoe UI',sans-serif; }

/* ===== FORMULÁRIO ===== */
form {
  background: var(--bg2); border: 1px solid var(--borda);
  border-radius: 10px; padding: 22px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
}
.form-row     { display: flex; gap: 14px; margin-bottom: 15px; flex-wrap: wrap; }
.field        { display: flex; flex-direction: column; flex: 1; min-width: 140px; }
.field-wide   { flex: 2.5; }
.field-sm     { flex: 0.6; min-width: 80px; }

label {
  font-size: 0.71rem; color: var(--texto-dim); text-transform: uppercase;
  letter-spacing: 0.08em; margin-bottom: 5px; font-weight: 700;
}
input[type="text"], input[type="number"], input[type="datetime-local"], select, textarea {
  background: var(--bg3); border: 1px solid var(--borda); border-radius: 7px;
  color: var(--texto); padding: 8px 11px; font-size: 0.9rem;
  outline: none; transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%; font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--azul-claro); box-shadow: 0 0 0 2px var(--azul-glow);
}
select option { background: var(--bg3); }

.tags-group { display: flex; gap: 22px; flex-wrap: wrap; margin-top: 6px; }
.tag-option {
  display: flex; align-items: center; gap: 7px;
  font-size: 0.92rem; color: var(--texto); cursor: pointer;
  font-weight: 500; text-transform: none; letter-spacing: 0;
}
.tag-option input { width: auto; cursor: pointer; accent-color: var(--azul-claro); }
.form-actions { display: flex; gap: 10px; margin-top: 8px; }

/* ===== BOTÕES ===== */
.btn-primary, .btn-secondary, .btn-danger {
  padding: 9px 20px; border-radius: 7px; border: none;
  font-size: 0.9rem; font-weight: 700; cursor: pointer;
  transition: all 0.2s; font-family: inherit;
}
.btn-primary   { background: var(--azul); color: white; }
.btn-primary:hover   { background: var(--azul-claro); box-shadow: 0 0 14px var(--azul-glow); }
.btn-secondary { background: var(--bg4); color: var(--texto); border: 1px solid var(--borda-clara); }
.btn-secondary:hover { background: var(--bg3); }
.btn-danger    { background: var(--danger); color: white; }
.btn-danger:hover    { opacity: 0.85; }
.btn-primary:active, .btn-secondary:active { transform: scale(0.98); }

/* ===== ALERTA ===== */
.alerta {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  z-index: 300; padding: 12px 28px; border-radius: 8px;
  background: rgba(74,144,217,0.14); border: 1px solid var(--azul);
  font-size: 0.9rem; white-space: nowrap;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4); color: #b0d4ff;
}
.alerta.erro { background: rgba(224,82,82,0.14); border-color: var(--danger); color: #ffb0b0; }
.hidden { display: none; }

/* ===== PAINEL HEADER ===== */
.painel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  min-height: 62px;
}
.painel-acoes { display: flex; align-items: center; gap: 12px; }
.info-text    { font-size: 0.82rem; color: var(--texto-dim); }

/* ===== CONTADORES ===== */
.contadores {
  display: flex;
  align-items: center;
  background: var(--bg2);
  border: 1px solid var(--borda);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.2);
}
.contador-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 26px;
  gap: 2px;
}
.contador-valor {
  font-size: 1.55rem;
  font-weight: 900;
  line-height: 1;
  color: var(--texto);
}
.contador-valor.massiva  { color: var(--tag-massiva); text-shadow: 0 0 12px var(--tag-massiva-glow); }
.contador-valor.pendencia{ color: #a07ee0; }
.contador-label {
  font-size: 0.66rem;
  color: var(--texto-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
}
.contador-sep { width: 1px; height: 38px; background: var(--borda); }

/* ===== TABELA ===== */
.loading { text-align: center; padding: 40px; color: var(--texto-dim); }
.grupo-regiao { margin-bottom: 4px; }

/* Região: centralizada, cor = mesma do th */
.grupo-titulo {
  background: var(--th-bg);
  color: var(--texto-dim);
  text-align: center;
  font-weight: 900;
  font-size: 0.82rem;
  letter-spacing: 0.22em;
  padding: 8px 18px;
  text-transform: uppercase;
  border-top: 1px solid var(--borda);
  border-bottom: 1px solid var(--borda);
  border-left: 3px solid var(--azul-claro);
  border-right: 3px solid var(--azul-claro);
}

.tickets-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }

.tickets-table th {
  background: var(--th-bg);
  padding: 10px 12px;
  text-align: center;
  color: var(--texto-dim);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.09em;
  white-space: nowrap;
  border-bottom: 1px solid var(--borda);
}

/* Altura uniforme FIXA em todas as linhas */
.tickets-table tbody tr {
  height: 52px;
  max-height: 52px;
}
.tickets-table td {
  height: 52px;
  max-height: 52px;
  padding: 0 12px;
  border-bottom: 1px solid rgba(46,74,122,0.7);
  vertical-align: middle;
  text-align: center;
  overflow: hidden;
}

.tickets-table tbody tr:nth-child(even) td { background: var(--zebra); }
.tickets-table tr:hover td { background: var(--hover-linha); }

.cell-mono  { font-family: 'Consolas','Courier New',monospace; font-size: 0.86rem; white-space: nowrap; color: #b0d0f0; }
.cell-center{ text-align: center; }
.cell-sp    { text-align: left; white-space: nowrap; font-size: 0.9rem; }
.cell-sp-wrap { white-space: normal; word-break: break-word; text-align: left; }

/* ===== COLUNA DESCRIÇÃO ===== */
.col-descricao {
  padding: 0 !important;
}
.desc-inner {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  height: 52px;
  padding: 0 12px;
  box-sizing: border-box;
  gap: 3px;
}

/* texto: UMA linha só, corte garantido com overflow hidden */
.descricao-texto {
  width: 100%;
  height: 1.35em;
  line-height: 1.35em;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  text-align: left;
  font-size: 0.9rem;
  display: block;
}

/* rodapé: atualizado + editar lado a lado, centralizado na célula */
.desc-footer {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.atualizado-label {
  font-size: 0.66rem;
  color: var(--texto-dim);
  font-style: italic;
  opacity: 0.65;
  white-space: nowrap;
}
.btn-edit-desc {
  background: none;
  border: 1px solid var(--borda-clara);
  color: var(--azul);
  border-radius: 4px;
  padding: 1px 8px;
  font-size: 0.71rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  flex-shrink: 0;
}
.btn-edit-desc:hover { background: var(--azul-glow); border-color: var(--azul-claro); }

/* ===== SLA BAR ===== */
.sla-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 2px;
}
.sla-bar-bg {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,0.07);
  border-radius: 10px;
  overflow: hidden;
}
.sla-bar-fill {
  height: 100%;
  border-radius: 10px;
  transition: width 0.6s ease;
}
.sla-pct {
  font-size: 0.76rem;
  font-weight: 700;
  min-width: 33px;
  text-align: right;
}

/* ===== TAGS ===== */
.tag-badge {
  display: inline-block; padding: 4px 12px; border-radius: 20px;
  font-size: 0.74rem; font-weight: 800; color: white;
  white-space: nowrap; letter-spacing: 0.05em;
}
.tag-Massiva {
  background: var(--tag-massiva);
  box-shadow: 0 0 10px var(--tag-massiva-glow), 0 0 22px var(--tag-massiva-glow);
}
.tag-pendencia { background: var(--tag-pendencia); }

.btn-delete {
  background: none;
  border: none;
  color: rgba(224,82,82,0.5);
  padding: 4px 6px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.15s;
  border-radius: 4px;
  line-height: 1;
}
.btn-delete:hover { color: var(--danger); background: rgba(224,82,82,0.1); }

.cell-acoes { text-align: center; padding: 0 8px !important; }

/* Modal delete — dois botões grandes */
.delete-opcoes {
  display: flex;
  gap: 12px;
}
.btn-finalizar, .btn-deletar {
  flex: 1;
  padding: 14px 16px;
  border-radius: 8px;
  border: none;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  line-height: 1.5;
  text-align: center;
}
.btn-finalizar {
  background: rgba(46,204,113,0.15);
  color: #2ecc71;
  border: 1px solid rgba(46,204,113,0.4);
}
.btn-finalizar:hover { background: rgba(46,204,113,0.25); box-shadow: 0 0 12px rgba(46,204,113,0.2); }
.btn-deletar {
  background: rgba(224,82,82,0.12);
  color: var(--danger);
  border: 1px solid rgba(224,82,82,0.35);
}
.btn-deletar:hover { background: rgba(224,82,82,0.22); }
.btn-finalizar small, .btn-deletar small {
  display: block;
  font-size: 0.75rem;
  font-weight: 400;
  opacity: 0.75;
  margin-top: 2px;
}

.sem-tickets { text-align: center; padding: 14px; color: var(--texto-dim); font-size: 0.85rem; font-style: italic; }

/* ===== MODAL ===== */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.8);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; backdrop-filter: blur(4px);
}
.modal.hidden { display: none; }
.modal-content {
  background: var(--bg2); border: 1px solid var(--azul-borda);
  border-radius: 12px; padding: 28px; width: 90%; max-width: 500px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}
.modal-content h3   { margin-bottom: 14px; font-size: 1.05rem; color: var(--azul-claro); }
.modal-info         { font-size: 0.85rem; color: var(--texto-dim); margin-bottom: 12px; }
.modal-content textarea { margin-bottom: 16px; min-height: 100px; }
.modal-actions      { display: flex; gap: 10px; }

/* ===== PÁGINA EM CONSTRUÇÃO ===== */
.pagina-construcao {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; min-height: 60vh; gap: 16px;
  color: var(--texto-dim); text-align: center;
}
.pagina-construcao h2 { font-size: 1.5rem; color: var(--texto); }
.pagina-construcao p  { font-size: 0.95rem; max-width: 360px; line-height: 1.6; }

/* ===== CONTATOS ===== */
.contatos-page {
  display: flex;
  gap: 32px;
  align-items: flex-start;
  padding: 8px 0;
}
.contatos-col { flex: 1; min-width: 0; }
.contatos-titulo {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--texto-dim);
  margin-bottom: 14px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--borda);
}

/* cards de região */
.regioes-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.regiao-card-serra { grid-column: 1 / -1; }
.regiao-card-serra .regiao-table { columns: 3; column-gap: 24px; }

.regiao-card {
  background: var(--bg2);
  border: 1px solid var(--borda);
  border-radius: 8px;
  overflow: hidden;
}
.regiao-card-header {
  padding: 7px 12px;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  text-align: center;
}
.regiao-card-header.norte   { background: #1a3a2a; color: #4dcc88; border-bottom: 1px solid #2a5a3a; }
.regiao-card-header.sul     { background: #1a2a4a; color: var(--azul-claro); border-bottom: 1px solid var(--borda); }
.regiao-card-header.serra   { background: #2a1a3a; color: #b07af0; border-bottom: 1px solid #3a2a5a; }
.regiao-card-header.taquari { background: #3a2a1a; color: #f0a04a; border-bottom: 1px solid #5a3a1a; }

.regiao-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
}
.regiao-table td {
  padding: 5px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.regiao-table td:last-child {
  text-align: right;
  font-family: 'Consolas', monospace;
  color: var(--texto-dim);
  font-size: 0.78rem;
}
.regiao-table tr:last-child td { border-bottom: none; }

/* cards de escalation */
.escalation-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.esc-card {
  background: var(--bg2);
  border: 1px solid var(--borda);
  border-radius: 8px;
  overflow: hidden;
}
.esc-header {
  padding: 8px 14px;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}
.esc-header.sul     { background: #1a2a4a; color: var(--azul-claro); border-bottom: 1px solid var(--borda); }
.esc-header.norte   { background: #1a3a2a; color: #4dcc88; border-bottom: 1px solid #2a5a3a; }
.esc-header.serra   { background: #2a1a3a; color: #b07af0; border-bottom: 1px solid #3a2a5a; }
.esc-header.taquari { background: #3a2a1a; color: #f0a04a; border-bottom: 1px solid #5a3a1a; }

.esc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}
.esc-table th {
  padding: 6px 12px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--texto-dim);
  background: var(--th-bg);
  border-bottom: 1px solid var(--borda);
}
.esc-table td {
  padding: 6px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--texto);
}
.esc-table td:nth-child(2) { text-align: center; color: var(--texto-dim); font-size:0.82rem; }
.esc-table td:nth-child(3) { text-align: right; font-family: 'Consolas',monospace; color: var(--azul-claro); }
.esc-table tr:last-child td { border-bottom: none; }
.esc-plantao {
  font-size: 0.76rem !important;
  color: var(--texto-dim) !important;
  font-style: italic;
  padding: 5px 12px !important;
  background: rgba(255,255,255,0.02);
}

/* ===== LOGIN ===== */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: radial-gradient(ellipse at 70% 20%, #1a3a6a 0%, #0e1a3a 50%, #0a0f1e 100%);
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: rgba(30,50,88,0.85);
  border: 1px solid var(--azul-borda);
  border-radius: 16px;
  padding: 32px 28px;
  box-shadow: 0 8px 48px rgba(0,0,0,0.6), 0 0 0 1px rgba(74,144,217,0.1);
  backdrop-filter: blur(8px);
}
.login-logo { font-size: 2rem; text-align: center; margin-bottom: 6px; }
.login-title {
  text-align: center;
  font-size: 1.4rem;
  font-weight: 800;
  color: white;
  margin-bottom: 4px;
}
.login-sub {
  text-align: center;
  font-size: 0.85rem;
  color: var(--texto-dim);
  margin-bottom: 22px;
}
.login-field {
  margin-bottom: 14px;
}
.login-field label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--texto-dim);
  margin-bottom: 6px;
}
.login-field input {
  width: 100%;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--borda);
  border-radius: 8px;
  color: white;
  padding: 10px 14px;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: inherit;
}
.login-field input:focus {
  border-color: var(--azul-claro);
  box-shadow: 0 0 0 3px rgba(74,144,217,0.2);
}
.input-eye { position: relative; }
.input-eye input { padding-right: 44px; }
.eye-btn {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; font-size: 1rem; opacity: 0.5;
  transition: opacity 0.2s;
}
.eye-btn:hover { opacity: 1; }
.btn-login {
  width: 100%;
  padding: 11px;
  background: var(--azul);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  margin-top: 4px;
  letter-spacing: 0.02em;
}
.btn-login:hover {
  background: var(--azul-claro);
  box-shadow: 0 0 20px rgba(74,144,217,0.5);
}
.btn-login:disabled { opacity: 0.6; cursor: default; }
.login-links {
  text-align: center;
  margin-top: 12px;
}
.login-links a {
  color: var(--texto-dim);
  font-size: 0.84rem;
  text-decoration: none;
  transition: color 0.2s;
}
.login-links a:hover { color: var(--azul-claro); }
.login-divider {
  text-align: center;
  font-size: 0.75rem;
  color: var(--texto-dim);
  margin: 14px 0;
  position: relative;
}
.login-divider::before, .login-divider::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 42%;
  height: 1px;
  background: var(--borda);
}
.login-divider::before { left: 0; }
.login-divider::after  { right: 0; }
.btn-visualizar {
  display: block;
  width: 100%;
  padding: 10px;
  background: transparent;
  color: var(--texto-dim);
  border: 1px solid var(--borda-clara);
  border-radius: 8px;
  text-align: center;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.2s;
}
.btn-visualizar:hover {
  border-color: var(--azul-borda);
  color: var(--azul-claro);
  background: var(--azul-glow);
}
.login-msg {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.86rem;
  margin-bottom: 14px;
}
.login-msg.erro { background: rgba(224,82,82,0.14); border: 1px solid var(--danger); color: #ffb0b0; }
.login-msg.ok   { background: rgba(74,144,217,0.12); border: 1px solid var(--azul); color: #b0d4ff; }
