/* =============================================
   V2 MÍDIA — dashboard.css
   Estilos do dashboard unificado + sino de
   notificações. Carregar no index.html após
   os outros CSS do hub.
   ============================================= */

/* ════════════════════════════════════════════
   SINO DE NOTIFICAÇÕES
════════════════════════════════════════════ */

.notif-bell-wrap {
  position: relative;
}

.notif-bell-btn {
  position: relative;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  flex-shrink: 0;
}

.notif-bell-btn svg {
  width: 16px;
  height: 16px;
  display: block;
}

.notif-bell-btn:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

/* Badge vermelho com contagem */
.notif-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  background: var(--accent-red, #f87171);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-mono);
  border-radius: 99px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-surface);
  line-height: 1;
  animation: badgePop .3s cubic-bezier(.34,1.56,.64,1) both;
}

@keyframes badgePop {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

/* Dropdown de notificações */
.notif-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 320px;
  background: var(--bg-card);
  border: 1px solid var(--border-md);
  border-radius: var(--radius);
  box-shadow: 0 16px 40px rgba(0,0,0,0.5);
  z-index: 250;
  opacity: 0;
  transform: translateY(-8px) scale(0.98);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  overflow: hidden;
}

.notif-dropdown.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

.notif-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border);
}

.notif-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  flex: 1;
}

.notif-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Lista de itens */
.notif-list {
  max-height: 300px;
  overflow-y: auto;
}

.notif-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: default;
  transition: background .12s;
}

.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: rgba(128,128,128,.04); }

.notif-item--vencido {
  border-left: 3px solid var(--accent-red, #f87171);
}

.notif-item--hoje {
  border-left: 3px solid var(--accent-amber, #facc15);
}

.notif-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.notif-item-nome {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notif-item-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.notif-item--vencido .notif-item-badge {
  background: rgba(248,113,113,.15);
  color: var(--accent-red, #f87171);
}

.notif-item--hoje .notif-item-badge {
  background: rgba(250,204,21,.15);
  color: var(--accent-amber, #facc15);
}

.notif-item-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  gap: 8px;
}

.notif-item-nota {
  font-size: 11.5px;
  color: var(--text-secondary);
  margin-top: 5px;
  padding: 6px 10px;
  background: rgba(128,128,128,.06);
  border-radius: var(--radius-sm);
  line-height: 1.4;
}

/* Vazia */
.notif-vazia {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 28px 16px;
  color: var(--text-muted);
  font-size: 13px;
}

.notif-vazia-icon { font-size: 28px; line-height: 1; }

/* Footer do dropdown */
.notif-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--border);
}

.notif-ir-crm {
  width: 100%;
  background: none;
  border: 1px solid var(--border-md);
  color: var(--text-secondary);
  padding: 8px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background .14s, color .14s, border-color .14s;
}

.notif-ir-crm:hover {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: rgba(167,139,250,.3);
}

/* ════════════════════════════════════════════
   DASHBOARD UNIFICADO — CONTAINER
════════════════════════════════════════════ */

#dashboardUnificado {
  margin-bottom: 24px;
}

.dash-unificado {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── KPIs — mesmo estilo dos app-card ── */
.dash-kpis {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 4px;
}

.dash-kpi {
  /* Layout vertical idêntico ao .app-card */
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  cursor: pointer;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: border-color .22s, transform .22s, background .22s;
}

.dash-kpi:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  transform: translateY(-3px);
}

/* Glow colorido no hover — igual ao .card-glow */
.dash-kpi::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s;
}
.dash-kpi:hover::after           { opacity: 1; }
.dash-kpi--financeiro::after     { box-shadow: inset 0 0 60px rgba(34, 197, 94, 0.06); }
.dash-kpi--tarefas::after        { box-shadow: inset 0 0 60px rgba(56, 189, 248, 0.06); }
.dash-kpi--crm::after            { box-shadow: inset 0 0 60px rgba(249,115, 22, 0.08); }
.dash-kpi--okr::after            { box-shadow: inset 0 0 60px rgba(167,139,250, 0.06); }

/* Ícone — igual ao .card-icon-wrap */
.dash-kpi-icon {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.dash-kpi-icon svg { width: 24px; height: 24px; }

.dash-kpi--financeiro .dash-kpi-icon { background: rgba(34, 197, 94, 0.12);  color: var(--accent-green,  #22c55e); }
.dash-kpi--tarefas    .dash-kpi-icon { background: rgba(56, 189, 248, 0.12); color: var(--accent-blue,   #38bdf8); }
.dash-kpi--crm        .dash-kpi-icon { background: var(--accent-dim); color: var(--accent); }
.dash-kpi--okr        .dash-kpi-icon { background: rgba(167,139,250, 0.12);  color: var(--accent-purple, #a78bfa); }

/* Corpo — ocupa o espaço do meio */
.dash-kpi-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.dash-kpi-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  margin-bottom: 2px;
}

.dash-kpi-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-body);
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-kpi-value.dash-pos { color: var(--accent-green, #22c55e); }
.dash-kpi-value.dash-neg { color: var(--accent-red,   #f87171); }

.dash-kpi-sub-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 2px;
}
.dash-kpi-sub-row span {
  font-size: 12px;
  font-family: var(--font-body);
}

.dash-sub-green  { color: var(--accent-green,  #22c55e); }
.dash-sub-red    { color: var(--accent-red,    #f87171); }
.dash-sub-yellow { color: var(--accent-amber,  #facc15); }
.dash-sub-orange { color: var(--accent-orange, #fb923c); }
.dash-sub-blue   { color: var(--accent-blue,   #38bdf8); }

/* Barra de progresso */
.dash-kpi-bar {
  height: 4px;
  background: rgba(128,128,128,.10);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 4px;
}
.dash-kpi-bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width .6s cubic-bezier(.4,0,.2,1);
}
.dash-kpi-bar--green  { background: var(--accent-green,  #22c55e); }
.dash-kpi-bar--blue   { background: var(--accent-blue,   #38bdf8); }
.dash-kpi-bar--red    { background: var(--accent-red,    #f87171); }
.dash-kpi-bar--yellow { background: var(--accent-amber,  #facc15); }

/* ── 5º card: Contratos ── */
.dash-kpi--contratos .dash-kpi-icon { background: rgba(129,140,248,.12); color: #818cf8; }
.dash-kpi--contratos::after { box-shadow: inset 0 0 60px rgba(129,140,248,.06); }

/* Rodapé — tag + seta, igual ao .card-footer */
.dash-kpi-arrow {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-top: auto;
}
.dash-kpi-arrow::after {
  content: '→';
  font-size: 18px;
  color: var(--text-muted);
  transition: transform .2s, color .2s;
}
.dash-kpi:hover .dash-kpi-arrow::after {
  transform: translateX(4px);
  color: var(--text-primary);
}

/* ── Alertas de tarefas vencidas ── */
.dash-alertas {
  background: rgba(248,113,113,.06);
  border: 1px solid rgba(248,113,113,.2);
  border-radius: var(--radius);
  padding: 14px 20px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}

.dash-alertas:hover {
  background: rgba(248,113,113,.10);
  border-color: rgba(248,113,113,.35);
}

.dash-alertas-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.dash-alertas-icon { font-size: 14px; }

.dash-alertas-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-red, #f87171);
  flex: 1;
}

.dash-alertas-count {
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
  background: rgba(248,113,113,.15);
  color: var(--accent-red, #f87171);
  padding: 2px 8px;
  border-radius: 99px;
}

.dash-alertas-link {
  font-size: 12px;
  color: var(--text-muted);
  transition: color .14s;
}

.dash-alertas:hover .dash-alertas-link { color: var(--accent-red, #f87171); }

.dash-alertas-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dash-alerta-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.dash-alerta-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-red, #f87171);
  flex-shrink: 0;
}

.dash-alerta-texto {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-alerta-mais {
  font-size: 11px;
  color: var(--text-muted);
  padding-left: 13px;
}

/* ── Skeleton de carregamento ── */
.dash-kpi--skeleton {
  pointer-events: none;
  cursor: default;
  gap: 12px;
  flex-direction: column;
  align-items: flex-start;
}

.dash-kpi--skeleton::before { display: none; }

.skel-line {
  border-radius: 6px;
  background: linear-gradient(
    90deg,
    rgba(128,128,128,.08) 0%,
    rgba(128,128,128,.15) 50%,
    rgba(128,128,128,.08) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  width: 100%;
}

.skel-sm { height: 10px; width: 60%; }
.skel-lg { height: 22px; }

@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* ════════════════════════════════════════════
   RESPONSIVO
════════════════════════════════════════════ */

@media (max-width: 1380px) {
  .dash-kpis { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 1100px) {
  .dash-kpis { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .dash-kpis {
    grid-template-columns: 1fr;
  }

  .notif-dropdown {
    width: 90vw;
    right: -8px;
  }
}

/* ── Suporte a tema claro ── */
[data-theme="light"] .notif-bell-btn:hover,
[data-theme="light"] .dash-kpi:hover {
  background: rgba(0,0,0,.03);
}

[data-theme="light"] .dash-alertas {
  background: rgba(239,68,68,.05);
  border-color: rgba(239,68,68,.18);
}

[data-theme="light"] .dash-alertas:hover {
  background: rgba(239,68,68,.09);
  border-color: rgba(239,68,68,.3);
}

/* ════════════════════════════════════════════
   SINO — GRUPOS MULTI-MÓDULO
════════════════════════════════════════════ */

.notif-list {
  max-height: 380px;
}

.notif-group {
  border-bottom: 1px solid var(--border);
}
.notif-group:last-child {
  border-bottom: none;
}

.notif-group-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px 7px;
}

.notif-group-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  flex: 1;
}

.notif-group-vazia-inline {
  font-size: 11px;
  color: var(--text-muted);
}

.notif-group-count {
  font-size: 10px;
  font-weight: 700;
  background: rgba(248,113,113,.14);
  color: var(--accent-red, #f87171);
  padding: 1px 6px;
  border-radius: 99px;
  font-family: var(--font-mono);
}

.notif-group-link {
  font-size: 11px;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: var(--font-body, 'IBM Plex Sans', sans-serif);
  transition: color .12s;
}
.notif-group-link:hover { color: var(--accent); }

.notif-group-mais {
  padding: 4px 16px 8px;
  font-size: 11px;
  color: var(--text-muted);
}

/* Item compacto dentro dos grupos */
.notif-item--compact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 16px;
  gap: 8px;
  border-left: 3px solid transparent;
}

.notif-group--red    .notif-item--compact { border-left-color: var(--accent-red,   #f87171); }
.notif-group--orange .notif-item--compact { border-left-color: var(--accent-orange, #fb923c); }
.notif-group--yellow .notif-item--compact { border-left-color: var(--accent-amber,  #facc15); }
.notif-group--blue   .notif-item--compact { border-left-color: var(--accent-blue,   #38bdf8); }

.notif-item--compact .notif-item-nome {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.notif-item-meta-right {
  font-size: 10.5px;
  font-family: var(--font-mono, 'IBM Plex Mono', monospace);
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ════════════════════════════════════════════
   DESTAQUES DO DIA
════════════════════════════════════════════ */

.dash-destaques {
  margin-top: 4px;
}

.dash-dest-header {
  margin-bottom: 8px;
}

.dash-dest-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .10em;
  color: var(--text-muted);
}

.dash-dest-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dash-dest-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 13px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: opacity .15s, transform .12s;
  white-space: nowrap;
}
.dash-dest-pill:hover {
  opacity: .82;
  transform: translateY(-1px);
}

.dash-dest-pill.dest-green  { background: rgba(34,197,94,.10);  border-color: rgba(34,197,94,.22);  color: #22c55e; }
.dash-dest-pill.dest-yellow { background: rgba(250,204,21,.10); border-color: rgba(250,204,21,.22); color: #facc15; }
.dash-dest-pill.dest-red    { background: rgba(248,113,113,.10);border-color: rgba(248,113,113,.22);color: #f87171; }
.dash-dest-pill.dest-orange { background: rgba(251,146,60,.10); border-color: rgba(251,146,60,.22); color: #fb923c; }

/* Tema claro */
[data-theme="light"] .dash-dest-pill.dest-green  { background: rgba(22,163,74,.07);  border-color: rgba(22,163,74,.2);  color: #16a34a; }
[data-theme="light"] .dash-dest-pill.dest-yellow { background: rgba(161,98,7,.07);   border-color: rgba(161,98,7,.2);   color: #a16207; }
[data-theme="light"] .dash-dest-pill.dest-red    { background: rgba(220,38,38,.07);  border-color: rgba(220,38,38,.2);  color: #dc2626; }
[data-theme="light"] .dash-dest-pill.dest-orange { background: rgba(194,65,12,.07);  border-color: rgba(194,65,12,.2);  color: #c2410c; }

@media (max-width: 640px) {
  .dash-dest-pills { flex-direction: column; gap: 6px; }
  .dash-dest-pill  { white-space: normal; border-radius: 10px; }
}