:root {
  --azul: #1A3E6E;
  --vermelho: #CC4331;
  --bg: #F5F6FA;
  --txt: #2a2a2a;
  --muted: #667085;
  --line: #E5E7EB;
}

* {
  box-sizing: border-box
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--txt);
  font-family: Poppins, Arial, sans-serif;
}

/* ================= HERO ================= */
.hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #0a192f 0%, #003366 100%);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  min-height: 0;
  display: block;
  color: #fff;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 90% 10%, rgba(255, 255, 255, 0.05) 0%, transparent 20%);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 28px;
  min-height: 138px;
}

.logo {
  height: 150px;
  width: auto;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.2));
}

.hero-title {
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
  margin: 0;
  font-size: clamp(18px, 2vw, 24px);
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  width: calc(100% - 220px);
  pointer-events: none;
}

.ghost {
  display: block;
  margin-left: auto;
  width: 1px;
  height: 1px;
  visibility: hidden;
}

.hamburger-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 10px;
  color: #fff;
  cursor: pointer;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.hamburger-btn:hover { background: rgba(255, 255, 255, 0.22); }
.hamburger-btn:active { background: rgba(255, 255, 255, 0.30); }

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 25, 47, 0.55);
  backdrop-filter: blur(4px);
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.28s ease, visibility 0.28s ease;
}

.sidebar-backdrop.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.mobile-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(300px, 88vw);
  background: #fff;
  z-index: 10001;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  transform: translateX(100%);
  visibility: hidden;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear 0.3s;
  box-shadow: -8px 0 32px rgba(10, 25, 47, 0.18);
}

.mobile-sidebar.is-open {
  transform: translateX(0);
  visibility: visible;
  pointer-events: auto;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s;
}

.sidebar-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 16px 14px;
  background: linear-gradient(135deg, #0a192f 0%, #003366 100%);
  flex-shrink: 0;
}

.sidebar-user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  border: 2px solid rgba(255, 255, 255, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.sidebar-avatar svg { width: 22px; height: 22px; color: #fff; opacity: 0.85; }
.sidebar-avatar img { width: 100%; height: 100%; object-fit: cover; }

.sidebar-user-name {
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-close-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-close-btn:hover { background: rgba(255, 255, 255, 0.2); }

.sidebar-section-label {
  padding: 14px 16px 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  font-size: 15px;
  font-weight: 600;
  color: #1e293b;
  cursor: pointer;
  font-family: "Poppins", Arial, sans-serif;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-item:hover { background: #f1f5f9; }
.sidebar-item:active { background: #e2e8f0; }
.sidebar-item svg { color: #64748b; flex-shrink: 0; }
.sidebar-item:hover svg { color: #1d4ed8; }
.sidebar-item.danger { color: #dc2626; }
.sidebar-item.danger svg { color: #dc2626; }
.sidebar-item.danger:hover { background: #fef2f2; }

.sidebar-divider {
  height: 1px;
  background: #e2e8f0;
  margin: 6px 0;
}

@media (max-width:900px) {
  .hero-inner {
    flex-direction: column;
    align-items: flex-start;
    padding: 14px 18px;
    padding-right: 76px;
  }

  .logo {
    height: 42px
  }

  .hero-title {
    position: static;
    left: auto;
    transform: none;
    width: 100%;
    text-align: left;
    pointer-events: auto;
  }

  .ghost {
    display: none
  }

  .hamburger-btn {
    display: flex;
    position: absolute;
    top: 10px;
    right: 14px;
  }
}

/* =============== LAYOUT BASE =============== */
.container {
  max-width: 1200px;
  margin: 28px auto 60px;
  padding: 0 20px
}

.backlink {
  display: inline-block;
  color: #0f2c54;
  text-decoration: none;
  margin-bottom: 14px
}

.backlink:hover {
  text-decoration: underline
}

.card {
  background: #fff;
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .08);
}

.filters.card {
  margin-bottom: 16px
}

/* =============== FILTROS =============== */
.filters-row {
  display: flex;
  gap: clamp(8px, 2vw, 16px);
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.search {
  flex: 1 1 360px;
  min-width: 260px
}

.search input {
  width: 100%;
  border: 1px solid #dcdcdc;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 15px;
  background: #fff;
  transition: box-shadow .15s, border-color .15s;
}

.search input:focus {
  outline: none;
  border-color: var(--azul);
  box-shadow: 0 0 0 3px rgba(26, 62, 110, .12)
}

.controls {
  display: flex;
  gap: clamp(8px, 1.5vw, 12px);
  flex-wrap: wrap;
  align-items: center;
}

.select {
  display: flex;
  align-items: center;
  gap: 8px
}

.select span {
  color: #555;
  font-size: 14px
}

.select select {
  border: 1px solid #dcdcdc;
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
  font-size: 14px;
}

/* chips de status */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  justify-content: center;
  margin-top: 10px;
}

.chip {
  display: inline-flex
}

.chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none
}

.chip span {
  display: inline-block;
  padding: 8px 14px;
  min-height: 36px;
  border: 1px solid #cfd6e1;
  border-radius: 999px;
  background: #f7f9fc;
  color: #1f3353;
  cursor: pointer;
  user-select: none;
  font-weight: 600;
  font-size: 14px;
}

.chip input:checked+span {
  background: var(--azul);
  color: #fff;
  border-color: var(--azul)
}

/* Legenda de prioridades */
.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding: 0 6px;
}

.list-head h2 {
  margin: 0;
  font-size: 20px;
  color: var(--azul);
  font-weight: 700
}

.legend {
  display: flex;
  align-items: center;
  gap: 14px;
  color: #555;
  font-size: 14px
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
  vertical-align: middle
}

.dot-alta {
  background: #dc2626
}

.dot-media {
  background: #f59e0b
}

.dot-baixa {
  background: #16a34a
}

/* =============== TABELA (GRID) =============== */
.table-wrapper {
  width: 100%;
  overflow-x: auto;
  /* rolagem só se necessário */
  margin-bottom: 10px;
  /* separa da paginação */
}

.table {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  /* mantém cantos arredondados */
  min-width: 720px;
  /* evita quebra em tablet/desktop */
}

.thead,
.trow {
  display: grid;
  grid-template-columns: 180px 1.2fr 0.9fr 0.9fr 110px 150px 120px 190px;
  /* aumentamos a última coluna */
  align-items: center;
}

.thead {
  background: #f8fafc;
  color: #1f3353;
  font-weight: 700;
  font-size: 12.5px;
  border-bottom: 1px solid var(--line);
}

.thead>div,
.trow>div {
  padding: 12px 12px;
  /* mais altura */
  font-size: 13px;
  line-height: 1.7;
  /* melhor respirado */
  vertical-align: middle;
}

.thead>div {
  border-bottom: 1px solid var(--line)
}

.trow>div {
  border-bottom: 0
}

.trow {
  background: #fff
}

.trow:nth-child(even) {
  background: #eef1f5
}

.th-actions {
  text-align: center
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 11.5px;
  color: #374151;
}

/* título: corta em 2 linhas */
.trow>div:nth-child(2) {
  line-height: 1.25;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.trow>div:nth-child(2) b {
  font-weight: 700
}

/* PRIORIDADE (Alta/Média/Baixa) */
.prio {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;

  font-size: 11.5px;
  font-weight: 700;
  color: #fff;
  text-align: center;
  ;
}

.prio.alta {
  background: #dc2626
}

.prio.media {
  background: #f59e0b
}

.prio.baixa {
  background: #16a34a
}

/* espaçamento entre prioridade e status */
/* STATUS (badges) */
.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12px;
  border: 1px solid transparent;
}

.aberto {
  background: #e8f0ff;
  color: #193b7a;
  border-color: #cfe0ff
}

.andando {
  background: #fff6e5;
  color: #7a4a19;
  border-color: #ffe1b3
}

.aguardando {
  background: #eef4f7;
  color: #214a63;
  border-color: #d9e7f0
}

.resolvido {
  background: #eaf8ef;
  color: #1a7f49;
  border-color: #bfe8cf
}

.pendente {
  background: #fff7ed;
  color: #c2410c;
  border-color: #fed7aa
}

/* =============== CHAT — ARQUIVO =============== */
.chat-file-card {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  text-decoration: none;
  color: #1e3a5f;
  font-size: 13px;
  max-width: 300px;
  transition: background 0.15s;
}
.chat-file-card:hover { background: #e2e8f0; }
.chat-file-icon { font-size: 22px; flex-shrink: 0; }
.chat-file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
  font-weight: 500;
}
.chat-file-dl { font-size: 14px; flex-shrink: 0; opacity: 0.6; }

/* ── Botão de clipe ── */
.chat-clip-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  background: #f8fafc;
  color: #64748b;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.chat-clip-btn:hover { background: #e0e7ff; color: #3b4fd8; border-color: #a5b4fc; }

/* ── Preview de documento no compose ── */
.chat-doc-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  font-size: 12px;
  color: #1e3a5f;
  max-width: 220px;
  position: relative;
}
.chat-doc-item .doc-icon { font-size: 20px; flex-shrink: 0; }
.chat-doc-item .doc-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

/* ── Linha inferior do compose (clipe + dica) ── */
.chat-bottom-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

/* =============== AÇÕES =============== */
.actions {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center
}

/* Se os links não tiverem classe, ainda viram “botões” */
.trow .actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 12.5px;
  text-decoration: none;
  border: 1px solid #dfe7f3;
  background: #f3f6fb;
  color: #1a2e4d;
  transition: transform .05s ease, filter .15s ease;
  box-shadow: 0 4px 10px rgba(31, 51, 83, .06);
  margin: 0 4px;
}

.trow .actions a:hover {
  filter: brightness(0.98)
}

.trow .actions a:active {
  transform: translateY(1px)
}

/* Primeiro link (Responder) como primário */
.trow .actions a:first-child {
  background: var(--vermelho);
  color: #fff;
  border-color: var(--vermelho);
  box-shadow: 0 6px 12px rgba(204, 67, 49, .16);
}

/* Segundo link (Detalhes) como “ghost” */
.trow .actions a:last-child {
  background: #f3f6fb;
  color: #1a2e4d;
  border: 1px solid #dfe7f3;
}

/* =============== PAGINAÇÃO =============== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 6px 0;
  flex-wrap: wrap;
}

.pag-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: 10px;
  font-weight: 700;
  text-decoration: none;
  color: #fff;
  background: var(--vermelho);
  box-shadow: 0 6px 12px rgba(204, 67, 49, .16);
}

.pag-btn.ghost {
  background: #f3f6fb;
  color: #1a2e4d;
  border: 1px solid #dfe7f3;
  padding: 20px;
  width: 120px;
}

.pages {
  display: flex;
  align-items: center;
  gap: 8px
}

.page {
  display: inline-flex;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  text-decoration: none;
  color: #1a2e4d;
  background: #f3f6fb;
  border: 1px solid #dfe7f3;
  font-weight: 700;
}

.page.is-active {
  background: var(--azul);
  color: #fff;
  border-color: var(--azul)
}

.ellipsis {
  color: #94a3b8
}

.backlink {
  display: inline-flex;
  /* Permite padding e alinhamento */
  align-items: center;
  /* Centraliza o texto verticalmente */
  gap: 8px;
  /* Espaçamento entre o ícone e o texto */
  color: var(--azul);
  text-decoration: none;
  margin-bottom: 24px;
  /* Aumentado para melhor separação visual */
  padding: 8px 14px;
  border: 1px solid #dfe7f3;
  /* Borda sutil */
  border-radius: 8px;
  background: #f7f9fc;
  font-weight: 600;
  transition: all 0.15s ease;
  box-shadow: 0 4px 8px rgba(26, 62, 110, 0.04);
}

.unread-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background-color: #ef4444;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

.backlink:hover {
  background: var(--azul);
  color: #fff;
  border-color: var(--azul);
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 6px 12px rgba(26, 62, 110, 0.1);
}

.backlink:active {
  transform: translateY(0);
  box-shadow: 0 4px 8px rgba(26, 62, 110, 0.04);
}

/* =============== RESPONSIVIDADE MOBILE =============== */
@media (max-width: 900px) {
  .hero-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    min-height: 0;
    gap: 10px;
  }

  .logo {
    height: 40px;
  }

  /* Título fica entre logo e hamburguer */
  .hero-title {
    position: static;
    left: auto;
    transform: none;
    width: auto;
    text-align: center;
    pointer-events: auto;
    font-size: 14px;
    font-weight: 700;
    flex: 1;
    line-height: 1.2;
  }

  .ghost {
    display: none;
  }

  .hamburger-btn {
    position: static;
    top: auto;
    right: auto;
    transform: none;
    display: flex;
    flex-shrink: 0;
  }

  .container {
    padding: 0 12px;
    margin-top: 18px;
  }
}

@media (max-width: 768px) {
  .search {
    flex: 1 1 100%;
    min-width: 0;
  }

  .controls {
    width: 100%;
    justify-content: flex-start;
  }

  .select select {
    font-size: 13px;
    padding: 8px 10px;
  }

  .list-head {
    flex-wrap: wrap;
    gap: 8px;
  }

  .legend {
    font-size: 12px;
    gap: 10px;
    flex-wrap: wrap;
  }

  .pagination {
    justify-content: center;
    padding: 12px 0 0;
  }

  .pag-btn {
    padding: 10px 16px;
    font-size: 13px;
  }

  .pag-btn.ghost {
    width: auto;
    padding: 10px 16px;
  }

  .page {
    width: 36px;
    height: 36px;
  }

  /* Tabela: scroll horizontal suave com indicador de gradiente */
  .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    /* Sombra nos lados para indicar que há mais conteúdo */
    background:
      linear-gradient(to right, #fff 20px, transparent) left,
      linear-gradient(to left,  #fff 20px, transparent) right;
    background-size: 40px 100%;
    background-attachment: local;
    background-repeat: no-repeat;
  }

  /* Reduzir colunas para caber melhor */
  .thead,
  .trow {
    grid-template-columns: 140px 1.1fr 0.8fr 0.8fr 90px 130px 100px 160px;
    font-size: 12px;
  }

  .thead > div,
  .trow > div {
    padding: 10px 8px;
    font-size: 12px;
    line-height: 1.4;
  }

  .badge {
    font-size: 11px;
    padding: 3px 7px;
  }

  .prio {
    font-size: 10.5px;
    padding: 2px 6px;
  }

  /* Ações: ícones menores */
  .trow .actions a {
    padding: 5px 8px;
    font-size: 11.5px;
  }
}

@media (max-width: 600px) {
  /* Ocultar colunas menos críticas: Área, Unidade, Responsável */
  .thead > div:nth-child(3),
  .trow > div:nth-child(3),
  .thead > div:nth-child(4),
  .trow > div:nth-child(4),
  .thead > div:nth-child(7),
  .trow > div:nth-child(7) {
    display: none;
  }

  /* Ajustar grid sem essas colunas */
  .thead,
  .trow {
    grid-template-columns: 130px 1.4fr 90px 130px 160px;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 8px;
  }

  .card {
    padding: 14px 12px;
    border-radius: 14px;
  }

  .filters.card {
    margin-bottom: 12px;
  }

  .search input {
    font-size: 16px; /* iOS zoom prevention */
    padding: 10px 12px;
  }

  .chips {
    gap: 8px;
  }

  .chip span {
    font-size: 12px;
    padding: 6px 12px;
  }

  .list-head h2 {
    font-size: 17px;
  }

  /* Ocultar também coluna de Prioridade em telas muito pequenas */
  .thead > div:nth-child(5),
  .trow > div:nth-child(5) {
    display: none;
  }

  .thead,
  .trow {
    grid-template-columns: 110px 1.4fr 120px 150px;
  }
}
