:root {
  --header-height: 60px;

  --subnav-height: 52px;
  --subnav-bg: #f8f9fa;
  --subnav-border: #e0e0e0;
  --subnav-text: #495057;
  --subnav-hover-bg: #e9ecef;
  --subnav-active-border: #53da00;
  --transition-speed: 0.3s;

  --bg-aside: #000;
  --bg-header: #fff;
  --color-text: #c9d1d9;
  --color-hover: rgba(16, 185, 129, 0.1);
  --color-active-bg: #161b22;
  --color-accent: #000000;
  --transition-speed: 0.2s;
}

body {
  margin: 0;
  padding: 0;
  font-family: "League Spartan", sans-serif;
}

header {
  position: sticky;
  top: 0; left: 0; right: 0;
  height: var(--header-height);
  background: var(--bg-header);
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
  z-index: 100;
}

main {
  padding: 1rem;
  padding-top: calc(var(--header-height) + 20px);
}

.hidden {
  display: none !important;
}

.main-nav {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: .75rem;
  padding: 0 1rem;
  height: var(--header-height);
  background: var(--bg-header);
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

/* centraliza e distribui o menu */
.nav-list {
  display: flex;
  flex-direction: row!important;
  list-style: none!important;
  margin: 0;
  padding: 0;
  gap: 1.5rem;
}

.nav-list a {
  text-decoration: none;
  color: #333;
  padding: 0.5rem 0;
  font-weight: 500;
}

.nav-list li {
  display: flex;
  flex-direction: row;
}

.has-dropdown {
  position: relative;
}

.user-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  background: white;
  border: 1px solid #ddd;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  min-width: 220px;
  z-index: 200;
  border-radius: 6px;
  padding: 0.5rem 0;
}

.user-dropdown.show {
  display: block;
}

#userToggle {
  border: none;
  background-color: transparent;
}

.user-dropdown li + li { margin-top: 0.25rem; list-style: none!important;}

.user-dropdown a {
  display: block;
  padding: 0.5rem 1rem;
  color: #333;
  white-space: nowrap;
}

.has-dropdown:hover > .dropdown,
.has-dropdown:focus-within > .dropdown {
  display: block;
}

.nav-list a:hover,
.has-dropdown:hover > a {
  color: var(--color-accent);
}

/* esconda por padrão em desktop */
.mobile-toggle { display: none; }

/* em telas até 768px, mostre o botão e esconda o menu */
@media (max-width: 768px) {
  .mobile-toggle { display: block; background: none; border: none; }
  .nav-list {
    display: none;
    flex-direction: column;
    position: absolute;
    top: var(--header-height);
    left: 0; right: 0;
    background: var(--bg-header);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  }
  .nav-list.show {
    display: flex;
  }
}

/* logo e usuário mantêm o estilo atual, só garantem flex */
.header-left .logo { height: 40px; }

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  position: relative;
  border: none;
}

.menuclass {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
}


/* botão de ícone genérico */
.header-icon-btn {
  position: relative!important;
  background: none!important;
  border: none!important;
  cursor: pointer!important;
  padding: 0.5rem!important;
  display: flex!important;
  align-items: center!important;
  gap: 0.25rem!important;
}

/* badge de notificação */
.header-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: #dc3545;
  color: #fff;
  font-size: 0.6rem;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 10px;
}

/* chevron giratório (opcional JS para aria-expanded) */
.chevron {
  stroke-width: 2;
  width: 14px;
  height: 14px;
  transition: transform var(--transition-speed);
}

.has-dropdown[aria-expanded="true"] .chevron {
  transform: rotate(180deg);
}


/* ─── Cabeçalho do Dropdown ───────────────────────────────────────────────── */

.user-dropdown__header {
  padding: 0.75rem 1rem;
}
.user-dropdown__header div {
  margin: 0;
}
.user-dropdown__header div:first-child {
  font-weight: bold;
  font-size: 1rem;
}
.user-dropdown__header div:last-child {
  font-size: 0.8rem;
  color: #4a5568;
}

/* ─── Títulos de Seção ────────────────────────────────────────────────────── */

.user-dropdown .section-title {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  color: #4a5568;
}

.user-dropdown__info {
  padding: 0.5rem 1rem;
  font-size: 1rem;
  color: #4a5568;
  display: flex;
  flex-direction: column;
}

/* ─── Separadores ────────────────────────────────────────────────────────── */

.user-dropdown hr {
  margin: 0;
  border: none;
  border-top: 1px solid #e2e8f0;
}

/* ─── Links e Botões no Dropdown ───────────────────────────────────────────── */

.user-dropdown a,
.user-dropdown button.logout-btn,
.user-dropdown button#closeUserMenu {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.75rem 1rem;
  text-align: left;
  text-decoration: none;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 200;
}
.user-dropdown a:hover,
.user-dropdown button.logout-btn:hover,
.user-dropdown button#closeUserMenu:hover {
  background-color: #f1f5f9;
}


/* garante ícones alinhados e com stroke mais grosso */

.user-dropdown i {
  stroke-width: 2;
}

/* ─── CONTAINER DO HEADER ─────────────────────────────────────────────────── */

.user-dropdown__header {
  padding: 0.75rem 1rem;      /* mesmo padding dos outros itens */
}

/* ─── NOME DO USUÁRIO ────────────────────────────────────────────────────── */

.user-dropdown__header .user-name {
  font-size: 1rem;
  font-weight: 600;
  color: #2d3748;             /* Cinza-escuro */
  margin-bottom: 0.125rem;
}

/* ─── EMPRESA ─────────────────────────────────────────────────────────────── */

.user-dropdown__header .user-company {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: #718096;             /* Cinza-médio */
  margin-bottom: 0.5rem;
}

/* ─── LINK “TROCAR DE EMPRESA” ───────────────────────────────────────────── */

.user-dropdown__header .user-switch-company {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.875rem;
  text-decoration: none;
  color: var(--color-accent); /* usa seu verde de destaque */
  padding: 0;                 /* já está dentro do header */
  cursor: pointer;
  margin-top: 15px;
}

.user-dropdown__header .user-switch-company i {
  stroke-width: 2;
}

.user-dropdown__footer {
  display: flex;
  justify-content: space-between; /* Sair à esquerda, Fechar à direita */
}

.user-dropdown__footer .logout-btn {
  width: auto;     /* não força 100% de largura */
}

.action-nav {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 1.5rem;
  height: 100%;
  align-items: center;
}

.action-nav li { position: relative; }

.action-nav a {
  display: flex;
  align-items: center;
  gap: .4rem;
  text-decoration: none;
  color: var(--subnav-text);
  padding: .5rem .75rem;
  font-size: .95rem;
  font-weight: 500;
  transition: background var(--transition-speed), color var(--transition-speed);
  border-bottom: 2px solid transparent;
  border-radius: 7px;
}

.action-nav a:hover {
  background: var(--subnav-hover-bg);
  color: var(--subnav-active-border);
  border-bottom-color: var(--subnav-active-border);
  border-radius: 7px;
}

.action-nav a.active {
  color: var(--subnav-active-border);
  border-bottom-color: var(--subnav-active-border);
}

.action-nav .chevron {
  stroke-width: 2;
  width: 14px;
  height: 14px;
  transition: transform var(--transition-speed);
}

.has-dropdown[aria-expanded="true"] > a .chevron { transform: rotate(180deg); }

/* dropdown dos ícones (continua igual) */
.sub-dropdown {
  display: none;
  list-style: none;
  position: absolute;
  background: #fff;
  border: 1px solid var(--subnav-border);
  box-shadow: 0 4px 10px rgba(0,0,0,0.05);
  border-radius: 6px;
  width: 100%;
  padding: .2rem 0;
  z-index: 200; /* acima do header */
}

.sub-dropdown a {
  list-style: none;
  display: block;
  padding: .4rem 1rem;
  font-size: .9rem;
  color: var(--subnav-text);
  white-space: nowrap;
  transition: background var(--transition-speed), color var(--transition-speed);
}

.sub-dropdown a:hover {
  background: var(--subnav-hover-bg);
  color: var(--subnav-active-border);
}

.has-dropdown:hover > .sub-dropdown,
.has-dropdown:focus-within > .sub-dropdown {
  display: block;
}


/* Drawer */
.notif-overlay {
  position: fixed; inset: 0;
  z-index: 130; /* abaixo do drawer */
}

.notif-drawer {
  position: fixed;
  top: var(--header-height);
  right: 0;
  height: calc(100dvh - var(--header-height));
  width: min(420px, 92vw);
  background: #fff;
  box-shadow: 2px 0 16px rgba(0,0,0,.12);
  border-right: 1px solid #eee;
  border-radius: 10px;
  transform: translateX(110%);
  transition: transform .22s ease;
  z-index: 140;
  display: flex; flex-direction: column;
}

.notif-drawer.is-open { transform: translateX(0); }
.notif-overlay.hidden { display: none !important; }

.notif-drawer__header,
.notif-drawer__footer {
  padding: .75rem 1rem;
  border-bottom: 1px solid #eee;
}
.notif-drawer__footer { border-top: 1px solid #eee; border-bottom: none; margin-top: auto; }

.notif-list {
  overflow: auto;
  padding: .5rem;
}
.notif-empty {
  padding: 1rem;
  color: #666;
  text-align: center;
}

/* Item compacto */
.notif-item {
  border: 1px solid #eee;
  border-radius: 10px;
  padding: .75rem .75rem;
  margin: .5rem 0;
  cursor: pointer;
  background: #fff;
  transition: background .15s ease, border-color .15s ease;
}
.notif-item:hover { background: #fafafa; }
.notif-item.is-unread { border-color: #e3e8ff; background: #f6f8ff; }
.notif-item .notif-top {
  display: flex; align-items: center; gap: .5rem; justify-content: space-between;
}
.notif-title { font-weight: 600; color: #111; line-height: 1.2; }
.notif-meta {
  display: flex; align-items: center; gap: .5rem; color: #666; font-size: .85rem;
}
.notif-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #3b82f6;
  display: inline-block;
}

/* Conteúdo expandido (modal inline) */
.notif-body {
  display: none;
  margin-top: .5rem;
  padding-top: .5rem;
  border-top: 1px dashed #e5e7eb;
  color: #333;
}
.notif-item.is-open .notif-body { display: block; }

.notif-actions {
  display: flex; gap: .5rem; margin-top: .75rem;
}

.icon-btn {
  border: none; background: none; font-size: 1.25rem; line-height: 1; cursor: pointer;
}

.btn-ghost {
  background: transparent; border: 1px solid #ddd; padding: .5rem .75rem; border-radius: 8px; cursor: pointer;
}
.btn-ghost:hover { background: #f7f7f7; }

/* ====== Enviados: cabeçalho e estado ====== */
.enviado-item{
  position: relative;
  border: 1px solid #e9ecef;
  border-radius: 12px;
  background: #fff;
  margin: .5rem 0;
  overflow: hidden;
  transition: box-shadow .18s ease, border-color .18s ease, background .18s ease;
}
.enviado-item:hover{
  box-shadow: 0 2px 14px rgba(0,0,0,.06);
  border-color: #e3e8ef;
}
.enviado-item[aria-expanded="true"]{
  background: #fcfcff;
  border-color: #dfe7ff;
}

/* ações “flutuando” no topo, sempre acessíveis */
.enviado-actions{
  position:absolute;
  right:.5rem; top:.5rem;
  display:flex; gap:.25rem;
  z-index: 2;
}
.enviado-actions .icon-btn{
  width: 28px; height: 28px; border-radius: 8px;
}
.enviado-actions .icon-btn.danger:hover{ background:#fff1f2; }

/* Cabeçalho clicável */
.enviado-head{
  all:unset;
  display:flex; align-items:center; justify-content:space-between;
  width:100%;
  padding: .8rem 3rem .8rem .9rem; /* espaço pro botão de deletar à direita */
  cursor:pointer;
}
.enviado-head:focus-visible{ outline: 2px solid #b7ceff; outline-offset: 2px; }

.eh-left{
  display:flex; align-items:center; gap:.65rem; flex-wrap:wrap; min-width:0;
}
.eh-title{
  margin-right:.25rem; font-weight:600; color:#111;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width: 42ch;
}

/* chips meta (destinatários, leitura, data) */
.mini-badge{
  display:inline-flex; align-items:center; gap:.35rem;
  padding:.2rem .5rem; border-radius:999px;
  font-size:.78rem; line-height:1; color:#334155; background:#f1f5f9;
  border:1px solid #e2e8f0;
}
.mini-badge + .mini-badge{ margin-left:.25rem; }
.mini-badge .dot{ margin-right:.15rem; }

/* seta animada */
.eh-right .caret{ transition: transform .18s ease, opacity .18s ease; opacity:.7; }
.enviado-item[aria-expanded="true"] .caret{ transform: rotate(180deg); opacity:1; }

/* indicador ativo/inativo */
.dot{ width:10px; height:10px; border-radius:50%; background:#16a34a; }
.dot.gray{ background:#cbd5e1; }

/* ====== Área expandida ====== */
.enviado-details{
  overflow:hidden;
  transition: grid-template-rows .22s ease, padding .22s ease, opacity .22s ease;
  padding:0 .9rem 0 .9rem;
  opacity: 1;
}
.enviado-details[hidden]{ display:block; grid-template-rows:0fr; padding:0 .9rem; opacity:0; }
.enviado-details:not([hidden]){ display:block; grid-template-rows:1fr; padding:.4rem .9rem .9rem .9rem; }

/* grid interno */
.ed-grid{
  display:grid; gap:1rem;
  grid-template-columns: 1.1fr .9fr;
  border-top:1px dashed #e5e7eb; padding-top:.8rem;
}
@media (max-width: 880px){ .ed-grid{ grid-template-columns:1fr; } }

/* mensagem */
.ed-subject{ margin:0 0 .25rem 0; font-size:1rem; font-weight:600; color:#0f172a; }
.ed-body{ margin:0; white-space:pre-wrap; color:#1f2937; }

/* ====== Destinatários (tabela) ====== */
.ed-dest h5{
  margin:.15rem 0 .4rem 0; font-size:.92rem; color:#334155; font-weight:700;
}

.dest-table{
  list-style:none; margin:0; padding:0;
  border:1px solid #eef2f7; border-radius:10px; overflow:hidden;
}
.dest-row{
  display:grid; grid-template-columns: 16px 1fr auto;
  align-items:center; gap:.6rem;
  padding:.5rem .75rem;
  background:#fff;
  border-bottom:1px solid #f3f4f6;
}
.dest-row:last-child{ border-bottom:none; }
.dest-name{ color:#0f172a; }
.dest-when{ font-size:.84rem; color:#64748b; white-space:nowrap; }
.muted{ color:#94a3b8; }

.mini-dot{ width:8px; height:8px; border-radius:50%; display:inline-block; background:#cbd5e1; }
.mini-dot.green{ background:#22c55e; }

/* limite de altura com scroll suave para listas longas */
.ed-dest .dest-table{
  max-height: 280px;
  overflow:auto;
}

/* ====== Form/Aside títulos ====== */
.side-title{
  margin:0 0 .5rem 0; font-size:1rem; font-weight:700; color:#0f172a;
}

/* ====== Pequenos ajustes utilitários ====== */
.btn-primary{ border-radius:10px; }
.btn-ghost{ border-radius:10px; }

/* ===== MODAL TROCA DE EMPRESA ===== */
.modal-troca-empresa {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  animation: fadeIn 0.25s ease;
}

.modal-troca-empresa__content {
  background: #fff;
  border-radius: 12px;
  padding: 2rem 2.5rem;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
  position: relative;
  animation: slideUp 0.3s ease;
}

.modal-troca-empresa__title {
  font-size: 1.4rem;
  font-weight: 700;
  color: #111;
  margin-bottom: 1.5rem;
  text-align: center;
}

.modal-troca-empresa__form-group {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
}

.modal-troca-empresa__select {
  padding: 0.6rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: .95rem;
  min-width: 200px;
  color: #111;
  background-color: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.modal-troca-empresa__select:focus {
  outline: none;
  border-color: #63ed0f;
  box-shadow: 0 0 0 3px rgba(99, 237, 15, 0.25);
}

.modal-troca-empresa__button {
  padding: 0.6rem 1.25rem;
  background-color: #63ed0f;
  color: #fff;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
}
.modal-troca-empresa__button:hover {
  background-color: #54c80c;
  transform: translateY(-1px);
}

.modal-troca-empresa__close {
  position: absolute;
  top: 0.75rem;
  right: 0.9rem;
  background: transparent;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: #888;
  transition: color 0.2s ease, transform 0.1s ease;
}
.modal-troca-empresa__close:hover {
  color: #000;
  transform: scale(1.1);
}

/* ===== Animações ===== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

