/* ==========================================
   REPORTS & ANALYTICS + EXECUTIVE OVERVIEW (Agent Dashboard, tema escuro)
   Gráficos com marcas finas, grade discreta, texto em tons de tinta
   (nunca na cor da série) e status sempre com ícone + rótulo.
   ========================================== */
/* Itens de menu sem permissão (applyAgentAccess em agent-script.js) */
.menu-item[hidden] { display: none !important; }

.an-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 18px; flex-wrap: wrap; }
.an-head h2 { font-size: 24px; margin-bottom: 4px; }
.an-head p { color: var(--text-muted); font-size: 14px; }
.an-head-actions { display: flex; gap: 10px; }
.an-demo-note { color: #64748b; font-size: 12px; }
.an-demo-note.block { display: block; margin-top: 18px; }

.an-filters { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; background: var(--surface-dark); border: 1px solid #334155; border-radius: 10px; padding: 12px 16px; margin-bottom: 18px; }
.an-filters label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; text-transform: uppercase; font-weight: 700; color: #94a3b8; letter-spacing: .5px; }
.an-filters select { padding: 7px 10px; border-radius: 6px; border: 1px solid #334155; background: #0f172a; color: #fff; font-size: 13px; color-scheme: dark; outline: none; }
.an-filters select:focus { border-color: #3b82f6; }
.an-period-label { margin-left: auto; color: #94a3b8; font-size: 12px; padding-bottom: 8px; }

/* Tiles (números em destaque) */
.an-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.an-tiles.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
#ex-money.an-tiles { grid-template-columns: repeat(5, minmax(0, 1fr)); }
/* "On the books": reservas reais já confirmadas para os próximos 30 dias */
.an-ahead { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 0; margin-bottom: 18px; background: var(--surface-dark); border: 1px solid #334155; border-left: 4px solid #22c55e; border-radius: 10px; overflow: hidden; }
.an-ahead > div { padding: 12px 18px; display: flex; flex-direction: column; gap: 2px; border-right: 1px solid #263244; min-width: 0; }
.an-ahead > div:nth-child(3) { border-right: none; }
.an-ahead span { font-size: 11px; color: #94a3b8; text-transform: uppercase; font-weight: 600; letter-spacing: .4px; }
.an-ahead strong { font-size: 20px; color: #fff; font-variant-numeric: tabular-nums; }
.an-ahead-main strong { color: #4ade80; }
.an-ahead small { font-size: 12px; color: #94a3b8; }
.an-ahead p { grid-column: 1 / -1; margin: 0; padding: 8px 18px; font-size: 12px; color: #64748b; border-top: 1px solid #263244; }
@media (max-width: 900px) { .an-ahead { grid-template-columns: 1fr; } .an-ahead > div { border-right: none; border-bottom: 1px solid #263244; } }
.an-tile { background: var(--surface-dark); border: 1px solid #334155; border-radius: 10px; padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.an-tile-label { font-size: 12px; color: #94a3b8; font-weight: 600; }
.an-tile-value { font-size: 26px; font-weight: 700; color: #f8fafc; line-height: 1.15; }
.an-tile-hint { font-size: 11px; color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.an-delta { font-size: 12px; font-weight: 700; }
.an-delta small { font-weight: 400; color: #64748b; }
.an-delta.good { color: #0ca30c; }
.an-delta.bad { color: #e66767; }
.an-delta.flat { color: #94a3b8; font-weight: 500; }

/* Cartões de gráfico */
.an-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.an-card { background: var(--surface-dark); border: 1px solid #334155; border-radius: 10px; padding: 16px 18px; min-width: 0; }
.an-card.wide { grid-column: 1 / -1; }
.an-card-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; gap: 12px; }
.an-card-head h4 { font-size: 14px; color: #f8fafc; }
.an-card-head span { font-size: 12px; color: #64748b; }
.an-table-toggle { background: transparent; border: 1px solid #334155; color: #94a3b8; border-radius: 6px; font-size: 11px; font-weight: 600; padding: 4px 10px; cursor: pointer; }
.an-table-toggle:hover { color: #fff; border-color: #64748b; }
.an-chart-box { position: relative; height: 260px; }
.an-card.wide .an-chart-box { height: 280px; }
.an-chart-table { max-height: 300px; overflow-y: auto; }

/* Tabelas */
.an-section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .8px; color: #94a3b8; font-weight: 700; margin: 26px 0 10px; }
.an-section-title.first { margin-top: 6px; }
.an-table-wrap { background: var(--surface-dark); border: 1px solid #334155; border-radius: 10px; overflow-x: auto; }
.an-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.an-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: #94a3b8; padding: 10px 14px; border-bottom: 1px solid #334155; background: #172033; white-space: nowrap; position: sticky; top: 0; }
.an-table.sortable th { cursor: pointer; user-select: none; }
.an-table.sortable th:hover, .an-table th.sorted { color: #f8fafc; }
.an-table td { padding: 10px 14px; border-bottom: 1px solid #263244; color: #e2e8f0; vertical-align: middle; }
.an-table td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.an-table tbody tr:hover { background: #0f172a; }
.an-table tbody tr:last-child td { border-bottom: none; }
.an-sub { font-size: 11px; color: #64748b; }
.an-inline { display: inline-flex; align-items: center; gap: 8px; min-width: 150px; }
.an-inline-bar { display: inline-block; height: 6px; border-radius: 3px; background: #3987e5; max-width: 90px; flex-shrink: 0; }

/* Status: ícone + texto, cor só de apoio */
.an-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 12px; white-space: nowrap; border: 1px solid currentColor; }
.an-chip b { font-size: 11px; }
.an-chip.good { color: #0ca30c; }
.an-chip.warning { color: #fab219; }
.an-chip.serious { color: #ec835a; }
.an-chip.critical { color: #f87171; }
.an-chip.neutral { color: #94a3b8; }

/* Executive: lista de atenção */
.ex-attention { display: flex; flex-direction: column; gap: 8px; }
.ex-item { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; gap: 14px; align-items: center; background: var(--surface-dark); border: 1px solid #334155; border-left: 4px solid #334155; border-radius: 8px; padding: 12px 16px; }
.ex-item.critical { border-left-color: #d03b3b; }
.ex-item.serious { border-left-color: #ec835a; }
.ex-item.warning { border-left-color: #fab219; }
.ex-item.good { border-left-color: #0ca30c; grid-template-columns: 110px minmax(0, 1fr); }
.ex-item-text strong { display: block; font-size: 14px; color: #f8fafc; }
.ex-item-text span { font-size: 12px; color: #94a3b8; }

@media (max-width: 1200px) {
  .an-tiles, .an-tiles.five, #ex-money.an-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .an-tiles, .an-tiles.five, #ex-money.an-tiles, .an-grid { grid-template-columns: 1fr 1fr; }
  .ex-item { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .an-tiles, .an-tiles.five, #ex-money.an-tiles, .an-grid { grid-template-columns: 1fr; }
}
