/* ============================================================
   PORTAL DO CLIENTE — JS DIGITAL BUSINESS
   CSS Principal
   ============================================================ */

:root {
  --primary: #624895;
  --primary-light: #f3eff9;
  --primary-hover: #513c7d;
  --sidebar-width: 252px;
  --sidebar-collapsed: 64px;
  --text: #1a1a2e;
  --muted: #8b8fa8;
  --border: #e8e8f0;
  --bg: #f7f7fb;
  --white: #ffffff;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ===== PORTAL ===== */
.portal { display: flex; min-height: 100vh; }

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  z-index: 100;
  transition: width 0.25s ease;
  overflow: hidden;
}

.sidebar.collapsed { width: var(--sidebar-collapsed); }

/* Estado inicial do menu recolhido (classes no <html> aplicadas no <head>, antes da primeira pintura) */
html.menu-recolhido .sidebar { width: var(--sidebar-collapsed); }
html.menu-recolhido .main { margin-left: var(--sidebar-collapsed); }
html.sem-transicao .sidebar, html.sem-transicao .sidebar *, html.sem-transicao .main { transition: none !important; }

.sidebar-header {
  display: flex;
  align-items: center;
  padding: 0 14px;
  height: 68px;
  border-bottom: 1px solid var(--border);
  gap: 8px;
  flex-shrink: 0;
}

.logo-wrap { flex: 1; overflow: hidden; display: flex; align-items: center; min-width: 0; }
.logo-full { height: 34px; width: auto; display: block; object-fit: contain; object-position: left center; max-width: 160px; }
.logo-icon { height: 34px; width: 34px; display: none; object-fit: contain; flex-shrink: 0; }

.sidebar.collapsed .sidebar-header { justify-content: center; padding: 0; }
.sidebar.collapsed .logo-wrap { display: flex; justify-content: center; }
.sidebar.collapsed .logo-full { display: none; }
.sidebar.collapsed .logo-icon { display: block; cursor: pointer; }
.sidebar.collapsed .toggle-btn { display: none; }

.toggle-btn {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 7px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.15s;
  flex-shrink: 0;
}
.toggle-btn:hover { background: var(--primary-light); color: var(--primary); }

.sidebar-nav { flex: 1; padding: 12px 10px; overflow-y: auto; overflow-x: hidden; }

.nav-section {
  font-size: 10px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted);
  padding: 0 8px; margin: 12px 0 4px;
  white-space: nowrap; transition: opacity 0.2s;
}
.sidebar.collapsed .nav-section { opacity: 0; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 8px;
  font-size: 13.5px; font-weight: 400;
  color: var(--muted); cursor: pointer;
  text-decoration: none;
  transition: all 0.15s; white-space: nowrap;
  margin-bottom: 2px; position: relative;
}
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active { background: var(--primary-light); color: var(--primary); font-weight: 500; }
.nav-item svg { flex-shrink: 0; }

.nav-label { transition: opacity 0.15s; }
.sidebar.collapsed .nav-label { opacity: 0; width: 0; overflow: hidden; }

.nav-tooltip {
  position: fixed;
  left: calc(var(--sidebar-collapsed) + 10px);
  background: var(--text); color: #fff;
  font-size: 12px; padding: 5px 10px;
  border-radius: 6px; white-space: nowrap;
  pointer-events: none; opacity: 0; z-index: 999;
  transition: opacity 0.15s;
}
.sidebar.collapsed .nav-item:hover .nav-tooltip { opacity: 1; }

/* Grupos em dropdown */
.nav-group-toggle {
  width: 100%; border: none; background: none;
  font-family: inherit; text-align: left;
}
.nav-group.has-active > .nav-group-toggle { color: var(--text); font-weight: 500; }
.nav-chevron { margin-left: auto; transition: transform 0.2s; }
.nav-group.open .nav-chevron { transform: rotate(90deg); }
.sidebar.collapsed .nav-chevron { display: none; }

.nav-sub { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.2s ease; }
.nav-group.open .nav-sub { grid-template-rows: 1fr; }
.nav-sub-inner { overflow: hidden; margin-left: 19px; padding-left: 8px; border-left: 1px solid var(--border); }
.nav-sub .nav-item { padding: 7px 10px; font-size: 13px; }
.nav-sub .nav-item:last-child { margin-bottom: 6px; }
.nav-sub-section {
  font-size: 10px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted);
  padding: 10px 10px 4px; white-space: nowrap;
}
.sidebar.collapsed .nav-sub { display: none; }

/* Menu recolhido: mini-menu flutuante ao lado do ícone.
   O painel #nav-flyout fica no <body> (fora da sidebar) e recebe os links do grupo via JS. */
.nav-flyout-titulo { display: none; }
.sidebar.collapsed .nav-group-toggle .nav-tooltip { display: none; }
.sidebar.collapsed .nav-group.flyout > .nav-group-toggle { background: var(--bg); color: var(--text); }
.nav-flyout {
  display: none; position: fixed; left: calc(var(--sidebar-collapsed) + 8px); z-index: 999;
  min-width: 200px; max-height: calc(100vh - 16px); overflow-y: auto;
  background: var(--white); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(26, 26, 46, 0.12); padding: 6px;
}
.nav-flyout.aberto { display: block; }
.nav-flyout .nav-item { padding: 7px 10px; font-size: 13px; }
.nav-flyout .nav-item:last-child { margin-bottom: 0; }
.nav-flyout .nav-flyout-titulo {
  display: block; padding: 6px 10px; white-space: nowrap;
  font-size: 10px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
}

.sidebar-footer { padding: 10px 10px 14px; border-top: 1px solid var(--border); flex-shrink: 0; }

.user-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px;
  margin-bottom: 4px; overflow: hidden;
  text-decoration: none; transition: background 0.15s;
}
.user-row:hover { background: var(--bg); }

.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary); color: #fff;
  font-size: 12px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.user-details { overflow: hidden; transition: opacity 0.15s; }
.user-name { font-size: 13px; font-weight: 500; color: var(--text); white-space: nowrap; }
.user-role { font-size: 11px; color: var(--muted); }
.sidebar.collapsed .user-details { opacity: 0; width: 0; }

.logout-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px;
  border: none; background: none; cursor: pointer;
  color: var(--muted); font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  width: 100%; text-align: left;
  transition: all 0.15s; white-space: nowrap;
  text-decoration: none;
}
.logout-btn:hover { background: #fff0f0; color: #e53e3e; }
.sidebar.collapsed .logout-label { opacity: 0; width: 0; overflow: hidden; }

/* Sininho do admin (rodapé do menu) */
.user-avatar { position: relative; }
.avatar-ponto { position: absolute; top: -1px; right: -1px; width: 10px; height: 10px; border-radius: 50%; background: #e53e3e; border: 2px solid #fff; }
.sino-btn { position: relative; margin-left: auto; flex-shrink: 0; width: 32px; height: 32px; border: none; background: none; border-radius: 8px; color: var(--muted); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.sino-btn:hover { background: var(--primary-light); color: var(--primary); }
.sino-badge { position: absolute; top: 1px; right: 0; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: #e53e3e; color: #fff; font-size: 10px; font-weight: 600; line-height: 16px; text-align: center; }
.user-row:has(.sino-btn) .avatar-ponto { display: none; }
.sidebar.collapsed .user-row .avatar-ponto { display: block; }
.sidebar.collapsed .sino-btn { display: none; }
.sino-painel { display: none; position: fixed; bottom: 12px; width: 340px; max-width: calc(100vw - 24px); max-height: 70vh; background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 8px 32px rgba(0,0,0,.14); z-index: 300; flex-direction: column; overflow: hidden; }
.sino-painel.aberto { display: flex; }
.sino-topo { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.sino-topo button { border: none; background: none; color: var(--primary); font-size: 12px; font-family: inherit; cursor: pointer; padding: 0; }
.sino-lista { overflow-y: auto; }
.sino-item { display: block; padding: 11px 16px; border-bottom: 1px solid var(--border); text-decoration: none; color: var(--muted); font-size: 13px; line-height: 1.4; }
.sino-item:hover { background: var(--bg); }
.sino-item.nao-lida { color: var(--text); background: var(--primary-light); }
.sino-item.nao-lida .sino-texto { font-weight: 500; }
.sino-quando { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.sino-vazio { padding: 20px 16px; font-size: 13px; color: var(--muted); }

/* ===== MAIN ===== */
.main { flex: 1; min-width: 0; margin-left: var(--sidebar-width); transition: margin-left 0.25s ease; min-height: 100vh; display: flex; flex-direction: column; } /* min-width: tabela larga rola dentro do card, não empurra a página */
.main.collapsed { margin-left: var(--sidebar-collapsed); }

.topbar {
  height: 68px; background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 28px; position: sticky; top: 0; z-index: 50;
}
.topbar-info { flex: 1; }
.topbar-title { font-size: 16px; font-weight: 600; }
.topbar-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }

.page { padding: 28px; flex: 1; }

/* ===== CARDS ===== */
.card { background: var(--white); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; margin-bottom: 18px; }
.card-head { padding: 16px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-title { font-size: 14px; font-weight: 600; }
.card-body { padding: 22px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card { background: var(--white); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; }
.stat-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 8px; }
.stat-value { font-size: 26px; font-weight: 600; }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ===== BADGES ===== */
.badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 500; white-space: nowrap; }
.badge-success { background: #edfaf3; color: #2fb36e; }
.badge-warning { background: #fff8eb; color: #c27e0a; }
.badge-neutral { background: var(--bg); color: var(--muted); }
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-blue { background: #eff6ff; color: #2563eb; }

/* ===== PROGRESS ===== */
.progress-wrap { background: var(--border); border-radius: 999px; height: 5px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; background: var(--primary); }

/* ===== TIMELINE ===== */
.timeline { list-style: none; position: relative; padding-left: 22px; }
.timeline::before { content: ''; position: absolute; left: 6px; top: 6px; bottom: 0; width: 2px; background: var(--border); }
.tl-item { position: relative; margin-bottom: 24px; }
.tl-dot { position: absolute; left: -22px; top: 4px; width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--border); background: var(--white); z-index: 1; }
.tl-dot.done { background: var(--primary); border-color: var(--primary); }
.tl-dot.progress { background: var(--white); border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.tl-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.tl-title { font-size: 13.5px; font-weight: 500; flex: 1; }

.tl-messages { margin-top: 8px; }
.msg-row { display: grid; grid-template-columns: 130px 1fr; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); align-items: start; }
.msg-row:first-child { border-top: none; padding-top: 0; }
.msg-date { font-size: 11.5px; color: var(--muted); padding-top: 1px; white-space: nowrap; }
.msg-text { font-size: 13px; color: var(--text); line-height: 1.55; }
.msg-text a { color: var(--primary); text-decoration: none; }
.msg-text a:hover { text-decoration: underline; }

/* ===== PROJETOS ===== */
.proj-card { background: var(--white); border: 1px solid var(--border); border-radius: 12px; padding: 18px 22px; cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s; display: flex; align-items: center; gap: 16px; margin-bottom: 12px; text-decoration: none; }
.proj-card:hover { border-color: var(--primary); box-shadow: 0 2px 12px rgba(98,72,149,0.08); }
.proj-icon { width: 42px; height: 42px; border-radius: 10px; background: var(--primary-light); color: var(--primary); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.proj-info { flex: 1; min-width: 0; }
.proj-name { font-size: 14px; font-weight: 500; margin-bottom: 4px; color: var(--text); }
.proj-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.proj-type { font-size: 12px; color: var(--muted); }
.proj-progress { text-align: right; flex-shrink: 0; min-width: 80px; }
.proj-pct { font-size: 18px; font-weight: 600; color: var(--primary); }
.proj-pct-label { font-size: 11px; color: var(--muted); }

.section-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); margin-bottom: 12px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }

.back-btn { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); cursor: pointer; border: none; background: none; font-family: 'DM Sans', sans-serif; padding: 0; margin-bottom: 20px; transition: color 0.15s; text-decoration: none; }
.back-btn:hover { color: var(--primary); }

/* ===== ARQUIVOS ===== */
.doc-tabs { display: flex; gap: 3px; margin-bottom: 18px; background: var(--bg); padding: 4px; border-radius: 10px; width: fit-content; flex-wrap: wrap; }
.doc-tab { padding: 7px 15px; border-radius: 7px; font-size: 13px; color: var(--muted); cursor: pointer; border: none; background: none; transition: all 0.15s; font-family: 'DM Sans', sans-serif; text-decoration: none; }
.doc-tab.active { background: var(--white); color: var(--text); font-weight: 500; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }

.file-item { display: flex; align-items: center; gap: 14px; padding: 14px 18px; background: var(--white); border: 1px solid var(--border); border-radius: 10px; transition: border-color 0.15s; margin-bottom: 10px; }
.file-item:hover { border-color: var(--primary); }
.file-icon { width: 38px; height: 38px; border-radius: 8px; background: var(--primary-light); color: var(--primary); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.file-name { font-size: 13.5px; font-weight: 500; flex: 1; }
.file-date { font-size: 12px; color: var(--muted); margin-top: 2px; }

.btn-dl { display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 7px; border: 1.5px solid var(--border); background: var(--white); color: var(--text); font-size: 12px; font-weight: 500; font-family: 'DM Sans', sans-serif; cursor: pointer; transition: all 0.15s; white-space: nowrap; text-decoration: none; }
.btn-dl:hover { border-color: var(--primary); color: var(--primary); }

/* ===== INFORMAÇÕES ===== */
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.info-item { padding: 16px 18px; background: var(--bg); border-radius: 10px; }
.info-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 5px; }
.info-value { font-size: 14px; font-weight: 500; }
.info-value a { color: var(--primary); text-decoration: none; }
.info-value a:hover { text-decoration: underline; }
.info-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* ===== ALERTAS ===== */
.alert-warn { background: #fff8eb; border: 1px solid #fde68a; border-radius: 10px; padding: 12px 16px; font-size: 13px; color: #92400e; margin-bottom: 16px; display: flex; align-items: center; gap: 10px; }
.alert-success { background: #edfaf3; border: 1px solid #9ae6b4; border-radius: 8px; padding: 10px 14px; font-size: 13px; color: #2f855a; margin-bottom: 16px; }
.alert-error { background: #fff0f0; border: 1px solid #feb2b2; border-radius: 8px; padding: 10px 14px; font-size: 13px; color: #c53030; margin-bottom: 16px; }

/* ===== FORMULÁRIOS ===== */
.field-label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.field-input { width: 100%; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: 8px; font-family: 'DM Sans', sans-serif; font-size: 14px; color: var(--text); background: #fff; outline: none; transition: border-color 0.2s; margin-bottom: 16px; }
.field-input:focus { border-color: var(--primary); }

/* Seta dos selects desenhada pelo portal (a do navegador fica colada na borda e muda de um navegador para outro).
   !important só na seta e no espaço da direita: vários selects têm background/padding escritos no próprio HTML. */
select:not([multiple]):not([size]) {
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b8fa8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 14px center !important;
  background-size: 12px 12px !important;
  padding-right: 36px !important;
}
select::-ms-expand { display: none; }
/* Campos de uma linha com a mesma altura (data/hora do navegador e select sem a seta nativa mediam diferente) */
input.field-input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select.field-input { height: 42px; }
.field-hint { font-size: 12px; color: var(--muted); margin-top: -10px; margin-bottom: 14px; }

.btn-primary { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 20px; background: var(--primary); color: #fff; border: none; border-radius: 8px; font-family: 'DM Sans', sans-serif; font-size: 14px; font-weight: 500; cursor: pointer; transition: background 0.2s; text-decoration: none; }
.btn-primary:hover { background: var(--primary-hover); }

.btn-whatsapp { background: #25d366; }
.btn-whatsapp:hover { background: #1da851; }

/* ===== COMPONENTES BASE =====
   Use estas classes nas telas novas em vez de style="" inline.
   Os valores são os mesmos que as telas antigas usam inline, então trocar não muda o visual.
   Telas antigas migram aos poucos, quando forem editadas. */

/* Tabela padrão dentro de card (Clientes, Projetos, Usuários) */
.tabela { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tabela tr { border-bottom: 1px solid var(--border); }
.tabela th { padding: 12px 22px; text-align: left; font-weight: 600; color: var(--muted); font-size: 11px; text-transform: uppercase; }
.tabela td { padding: 12px 22px; }

/* Tabela compacta (Tickets, Pendências) */
.tabela-compacta { width: 100%; border-collapse: collapse; }
.tabela-compacta tr { border-bottom: 1px solid var(--border); }
.tabela-compacta th { padding: 9px 14px; font-size: 11px; font-weight: 600; color: var(--muted); text-align: left; text-transform: uppercase; letter-spacing: .05em; }
.tabela-compacta td { padding: 11px 14px; font-size: 13px; }

.td-acoes { text-align: right; }
.td-acoes-flex { display: flex; gap: 8px; justify-content: flex-end; }
.td-acoes-flex .btn-sm { white-space: nowrap; }
.texto-muted { color: var(--muted); }
.texto-vazio { color: var(--border); }
.opcional { font-weight: 400; color: var(--muted); }
.vazio-msg { color: var(--muted); font-size: 13px; padding: 20px 22px; }

/* Botão pequeno de ação em linha (Apagar, Editar…) */
.btn-sm { padding: 3px 9px; font-size: 11px; border-radius: 6px; border: 1.5px solid var(--border); background: #fff; cursor: pointer; font-family: inherit; transition: all .15s; color: var(--text); text-decoration: none; display: inline-flex; align-items: center; }
.btn-sm:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm-danger:hover { border-color: #e53e3e !important; color: #e53e3e !important; }

/* Modal: abrir com elemento.style.display = 'flex' */
.modal-fundo { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 999; align-items: center; justify-content: center; }
.modal-caixa { background: #fff; border-radius: 14px; padding: 32px; width: 100%; max-width: 440px; position: relative; max-height: 90vh; overflow-y: auto; }
.modal-titulo { font-size: 16px; font-weight: 600; margin-bottom: 20px; }
.modal-botoes { display: flex; gap: 10px; margin-top: 4px; }

/* Caixa de aviso amarela dentro de formulário */
.aviso-form { background: #fef9ef; color: #c27e0a; border-radius: 8px; padding: 10px 12px; font-size: 12.5px; margin-bottom: 14px; }

.badge-danger { background: #fff0f0; color: #e53e3e; }

/* Tabela larga: rola de lado no celular em vez de estourar a página */
.tabela-rolagem { overflow-x: auto; }

/* Pills de período (mesmo visual do CRM) */
.pills { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pills-rotulo { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.pill { padding: 6px 16px; border-radius: 999px; font-size: 13px; font-weight: 500; border: 1.5px solid var(--border); background: #fff; color: var(--muted); text-decoration: none; white-space: nowrap; cursor: pointer; font-family: inherit; }
/* Financeiro: etiqueta do marcador (a cor vem do cadastro, só na etiqueta) */
.fin-marcador { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 500; color: #fff; line-height: 1.6; }
.pill.ativo { border-color: var(--primary); background: var(--primary); color: #fff; }
.pill-data { padding: 6px 14px; border-radius: 999px; border: 1.5px solid var(--border); font-family: inherit; font-size: 13px; color: var(--text); background: #fff; outline: none; }

/* Linha de filtros: busca com lupa + selects + botão */
.filtros-linha { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.filtro-busca { position: relative; flex: 1; min-width: 200px; }
.filtro-busca svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.filtro-busca input { width: 100%; padding: 9px 14px 9px 36px; border: 1.5px solid var(--border); border-radius: 8px; font-family: inherit; font-size: 13px; color: var(--text); background: #fff; outline: none; }
.filtro-select { padding: 9px 14px; border: 1.5px solid var(--border); border-radius: 8px; font-family: inherit; font-size: 13px; color: var(--text); background: #fff; outline: none; min-width: 150px; }
.filtro-limpar { font-size: 13px; color: var(--muted); text-decoration: none; white-space: nowrap; }

/* Grade de quadros, 2 por linha (Categorias); no celular vira 1 */
.cards-grade { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.cards-grade > .card { margin-bottom: 0; }

/* Paginação */
.paginacao { display: flex; justify-content: center; gap: 6px; margin-top: 18px; flex-wrap: wrap; }
.paginacao .atual { background: var(--primary); color: #fff; border-color: var(--primary); }
.paginacao-info { text-align: center; margin-top: 10px; font-size: 12px; color: var(--muted); }

/* ===== AGENDA (admin/agenda.php e widget do dashboard) =====
   Cada item recebe a cor da fonte em --ag-cor */
.ag-barra .card-body { padding: 16px 20px; display: flex; flex-direction: column; gap: 14px; }
.ag-barra-linha { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ag-nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ag-nav .btn-sm { padding: 6px 12px; font-size: 13px; }
.ag-periodo { font-size: 14px; font-weight: 600; margin-left: 6px; }
.ag-fontes { display: flex; gap: 16px; flex-wrap: wrap; flex: 1; min-width: 200px; }
.ag-fonte { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; white-space: nowrap; }
.ag-fonte input { accent-color: var(--primary); }
.ag-ponto { width: 8px; height: 8px; border-radius: 50%; background: var(--ag-cor, var(--muted)); display: inline-block; flex-shrink: 0; }
.ag-btn-filtrar { padding: 9px 18px; font-size: 13px; }

.ag-dia-bloco + .ag-dia-bloco { border-top: 1px solid var(--border); }
.ag-dia-titulo { padding: 10px 22px; background: var(--bg); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.ag-dia-titulo.hoje { color: var(--primary); background: var(--primary-light); }
.ag-vazio { padding: 12px 22px; font-size: 13px; color: var(--muted); }

.ag-item { display: flex; align-items: center; gap: 14px; padding: 12px 22px; border-top: 1px solid var(--border); }
.ag-dia-titulo + .ag-item, .card-head + .ag-item { border-top: none; }
.ag-hora { width: 52px; flex-shrink: 0; font-size: 13px; font-weight: 600; line-height: 1.3; }
.ag-hora small { display: block; font-size: 11.5px; font-weight: 400; color: var(--muted); }
.ag-icone { width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: var(--ag-cor); background: var(--bg); background: color-mix(in srgb, var(--ag-cor) 12%, #fff); }
.ag-info { flex: 1; min-width: 0; }
.ag-titulo { font-size: 13.5px; font-weight: 500; color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
a.ag-titulo:hover { color: var(--primary); }
.ag-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.ag-acoes { display: flex; gap: 6px; flex-shrink: 0; }
.ag-acoes .btn-sm { padding: 5px 11px; font-size: 12px; }
.ag-btn-wpp { color: #1a7a4a; border-color: #b8ecd1; }
.ag-concluido .ag-titulo { color: var(--muted); text-decoration: line-through; }
.ag-concluido .ag-icone { opacity: .55; }
.ag-mais { display: block; width: 100%; padding: 10px; border: none; border-top: 1px solid var(--border); background: #fff; color: var(--primary); font-family: inherit; font-size: 13px; font-weight: 500; cursor: pointer; }
.ag-mais:hover { background: var(--bg); }
.ag-atrasados .card-head { background: #fff8f8; }
/* Lista do dia clicado no mês: a página desce até ela (âncora #ag-lista) sem ficar colada no topo */
.ag-lista { scroll-margin-top: 84px; }

.ag-mes-cab, .ag-mes-grade { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.ag-mes-cab div { padding: 9px 4px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); text-align: center; border-bottom: 1px solid var(--border); }
.ag-dia { min-height: 96px; padding: 6px; display: flex; flex-direction: column; gap: 3px; min-width: 0; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); color: var(--text); text-decoration: none; transition: background .15s; }
.ag-dia:nth-child(7n) { border-right: none; }
.ag-dia:nth-last-child(-n+7) { border-bottom: none; }
.ag-dia:hover { background: var(--bg); }
.ag-dia.fora { color: var(--muted); background: #fcfcfe; }
.ag-dia.sel { box-shadow: inset 0 0 0 2px var(--primary); }
.ag-dia-num { width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12.5px; font-weight: 600; }
.ag-dia.hoje .ag-dia-num { background: var(--primary); color: #fff; }
.ag-dia-cont { display: none; align-self: flex-start; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--primary-light); color: var(--primary); }
.ag-dia-cont.feito { background: var(--bg); color: var(--muted); }
.ag-dia-cont.atrasado { background: #fff0f0; color: #e53e3e; }
.ag-dia-ev { display: block; padding: 2px 6px; border-left: 3px solid var(--ag-cor); border-radius: 3px; background: var(--bg); font-size: 11.5px; line-height: 1.35; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-dia-ev b { font-weight: 600; }
.ag-dia-ev.atrasado { background: #fff0f0; color: #c53030; }
.ag-dia-ev.feito { color: var(--muted); text-decoration: line-through; }
.ag-dia-mais { font-size: 11px; font-weight: 500; color: var(--primary); padding-left: 6px; }

/* Modal de compromisso */
.ag-btn-concluir { color: #2fb36e; border-color: #b8ecd1; }
.ag-rotulo-linha { display: flex; align-items: baseline; justify-content: space-between; }
.ag-link-pequeno { font-size: 12px; color: var(--primary); text-decoration: none; background: none; border: none; padding: 0; cursor: pointer; font-family: inherit; }
.ag-link-pequeno:hover { text-decoration: underline; }
.ag-cats { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.ag-cat { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1.5px solid var(--border); border-radius: 999px; font-size: 13px; cursor: pointer; }
.ag-cat input { position: absolute; opacity: 0; pointer-events: none; }
.ag-cat:has(input:checked) { border-color: var(--ag-cor); background: color-mix(in srgb, var(--ag-cor) 10%, #fff); font-weight: 500; }
.ag-form-linha { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: center; }
.ag-check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; padding-top: 6px; }
.ag-check input { accent-color: var(--primary); width: 16px; height: 16px; }
.ag-oportunidade { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.ag-btn-apagar { margin-left: auto; }
.ag-btn-apagar:hover { border-color: #e53e3e; color: #e53e3e; }
.ag-btn-apagar[hidden], .ag-oportunidade[hidden] { display: none; }

/* ===== DASHBOARD =====
   Cor com um sentido só (tom-*): perigo = resolver agora · atencao = atenção · ok = em dia · neutro = informação (roxo) */
.tom-perigo  { --tom: #e53e3e; --tom-bg: #fff0f0; }
.tom-atencao { --tom: #c27e0a; --tom-bg: #fff8eb; }
.tom-ok      { --tom: #2fb36e; --tom-bg: #edfaf3; }
.tom-neutro  { --tom: var(--primary); --tom-bg: var(--primary-light); }
.dash-txt-perigo { color: #e53e3e !important; }
.dash-txt-atencao { color: #c27e0a !important; }
.dash-txt-ok { color: #2fb36e !important; }
.dash-txt-neutro { color: var(--muted) !important; }

.dash-alertas { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.dash-alerta { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: var(--tom-bg); color: var(--tom); border: 1px solid color-mix(in srgb, var(--tom) 25%, #fff); font-size: 12.5px; font-weight: 500; text-decoration: none; transition: border-color .15s; }
.dash-alerta:hover { border-color: var(--tom); }
.dash-alerta i { width: 8px; height: 8px; border-radius: 50%; background: var(--tom); flex-shrink: 0; }

.dash-linha { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.dash-card { display: block; position: relative; overflow: hidden; color: var(--text); text-decoration: none; transition: border-color .15s, box-shadow .15s; }
a.dash-card:hover { border-color: var(--primary); box-shadow: 0 4px 16px rgba(26,26,46,.06); }
.dash-card .stat-value { color: var(--text); }
.dash-card.tom-perigo .stat-value, .dash-card.tom-atencao .stat-value { color: var(--tom); }
.dash-card .stat-sub b { font-weight: 600; color: var(--text); }
.dash-de { font-size: 14px; font-weight: 500; color: var(--muted); }
.dash-card-lado { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dash-card-lado canvas { flex-shrink: 0; }

.dash-barra { display: flex; gap: 2px; height: 8px; margin-top: 12px; border-radius: 999px; overflow: hidden; background: var(--bg); }
.dash-barra span { display: block; height: 100%; }
.dash-legenda { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 8px; font-size: 11.5px; color: var(--muted); }
.dash-legenda span { display: inline-flex; align-items: center; white-space: nowrap; }
.dash-legenda i { width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.dash-legenda b { font-weight: 600; color: var(--text); margin-left: 4px; }

.dash-colunas { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.dash-coluna { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.dash-coluna .card { margin-bottom: 0; }
.card-title .badge { margin-left: 6px; vertical-align: 1px; }

.dash-item { display: flex; align-items: center; gap: 12px; padding: 11px 22px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text); text-decoration: none; transition: background .15s; }
.card-head + .dash-item, .ag-dia-titulo + .dash-item, .dash-duas-topo + .dash-item { border-top: none; }
a.dash-item:hover { background: var(--bg); }
.dash-item-data { width: 40px; flex-shrink: 0; font-size: 12px; font-weight: 600; color: var(--muted); }
.dash-item-nome { flex: 1; min-width: 0; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-item-nome small { display: block; font-size: 12px; font-weight: 400; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; }
.dash-item-valor { flex-shrink: 0; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.dash-item-progresso { display: flex; align-items: center; gap: 8px; width: 110px; flex-shrink: 0; }
.dash-item-progresso .progress-wrap { flex: 1; display: block; }
.dash-item-progresso b { font-size: 12px; font-weight: 600; color: var(--primary); }
.dash-bolinha { width: 9px; height: 9px; border-radius: 50%; background: var(--tom); flex-shrink: 0; box-shadow: 0 0 0 3px var(--tom-bg); }
.dash-vazio { padding: 20px 22px; text-align: center; font-size: 13px; color: var(--muted); }
.dash-mais { display: block; padding: 10px 22px; border-top: 1px solid var(--border); font-size: 12.5px; font-weight: 500; color: var(--primary); text-decoration: none; }

.dash-duas { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dash-duas > div + div { border-left: 1px solid var(--border); }
.dash-duas .dash-item { padding: 10px 16px; gap: 8px; }
.dash-duas-topo { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 12px 16px; background: var(--bg); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); text-decoration: none; }
.dash-duas-topo b { font-size: 13.5px; letter-spacing: 0; text-transform: none; }

.dash-grafico { position: relative; height: 220px; }
.dash-hbarras { display: flex; flex-direction: column; gap: 14px; }
.dash-hbarra { display: block; color: var(--text); text-decoration: none; }
.dash-hbarra-topo { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; margin-bottom: 6px; }
.dash-hbarra-topo span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.dash-hbarra-topo b { font-weight: 600; white-space: nowrap; }
.dash-hbarra-trilho { height: 8px; border-radius: 999px; background: var(--bg); overflow: hidden; }
.dash-hbarra-trilho span { display: block; height: 100%; border-radius: 999px; background: var(--tom); }
.dash-hbarra small { display: block; font-size: 11.5px; color: var(--muted); margin-top: 5px; }
a.dash-hbarra:hover .dash-hbarra-topo span { color: var(--primary); }
.dash-recorrencia { padding-bottom: 16px; }
.dash-recorrencia small { font-size: 13px; font-weight: 400; color: var(--muted); }

@media (max-width: 1200px) {
  .dash-linha { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-colunas { grid-template-columns: minmax(0, 1fr); }
}

/* ===== CELULAR (admin) =====
   O menu começa recolhido (header.php); aberto, fica por cima da página */
@media (max-width: 768px) {
  .main, .main.collapsed { margin-left: var(--sidebar-collapsed); min-width: 0; }
  .sidebar:not(.collapsed) { box-shadow: 0 0 32px rgba(0,0,0,.18); }
  .topbar { padding: 0 16px; }
  .page { padding: 16px; }
  .modal-fundo { padding: 16px; }
  .cards-grade { grid-template-columns: 1fr; }
  .modal-caixa { padding: 24px 20px; }

  .ag-barra .card-body { padding: 14px 16px; }
  .ag-barra .filtro-select { flex: 1; min-width: 0; }
  .ag-fontes { flex-basis: 100%; gap: 10px 16px; }
  .ag-dia-titulo, .ag-vazio { padding-left: 16px; padding-right: 16px; }
  .ag-item { flex-wrap: wrap; gap: 10px; padding: 12px 16px; }
  .ag-icone { display: none; }
  .ag-hora { width: 44px; }
  .ag-acoes { width: 100%; padding-left: 54px; }
  .ag-dia { min-height: 58px; padding: 5px 2px; align-items: center; gap: 4px; }
  .ag-dia-cont { display: block; align-self: center; padding: 1px 6px; }
  .ag-dia-ev, .ag-dia-mais { display: none; }

  .dash-linha { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .dash-item, .dash-mais { padding-left: 16px; padding-right: 16px; }
  .dash-duas { grid-template-columns: minmax(0, 1fr); }
  .dash-duas > div + div { border-left: none; border-top: 1px solid var(--border); }
  .dash-item-progresso { width: 80px; }
}

/* ===== LOGIN ===== */
.login-page { display: flex; min-height: 100vh; }
.login-left { flex: 1; background: var(--primary); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px 48px; position: relative; overflow: hidden; }
.login-left::before { content: ''; position: absolute; width: 420px; height: 420px; border-radius: 50%; border: 64px solid rgba(255,255,255,0.06); top: -120px; left: -120px; }
.login-left::after { content: ''; position: absolute; width: 320px; height: 320px; border-radius: 50%; border: 48px solid rgba(255,255,255,0.05); bottom: -80px; right: -80px; }
.login-left-content { position: relative; z-index: 1; text-align: center; color: #fff; }
.login-left-content img { width: 72px; margin-bottom: 28px; filter: brightness(0) invert(1); }
.login-left-content h2 { font-size: 24px; font-weight: 600; margin-bottom: 10px; }
.login-left-content p { font-size: 14px; opacity: 0.72; line-height: 1.65; }
.login-right { flex: 1; display: flex; align-items: center; justify-content: center; background: #fff; padding: 60px; }
.login-box { width: 100%; max-width: 360px; }
.login-box h1 { font-size: 24px; font-weight: 600; margin-bottom: 4px; }
.login-subtitle { color: var(--muted); font-size: 14px; margin-bottom: 32px; }
.login-footer { text-align: center; margin-top: 32px; font-size: 12px; color: var(--muted); }

@media (max-width: 768px) {
  .login-left { display: none; }
  .info-grid { grid-template-columns: 1fr; }
  .msg-row { grid-template-columns: 1fr; gap: 4px; }
}
