/* ==========================================================================
   Dashboard (dash-*)
   ========================================================================== */
.dash-hero {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  margin-bottom: 1.1rem; padding: 1rem 1.15rem;
  border: 1px solid var(--primary-border-soft); border-radius: var(--radius-lg);
  background: linear-gradient(120deg, var(--primary-soft-strong), var(--primary-soft) 55%, transparent);
}
.dash-hero h2 { margin: 0 0 .2rem; font-size: 1.2rem; letter-spacing: -.02em; color: var(--heading); }
.dash-hero p { margin: 0; color: var(--text-soft); font-size: .9rem; }
.dash-hero strong { color: var(--heading); }

.dash-section { margin-bottom: 1.1rem; }
.dash-section-head { display: flex; align-items: baseline; gap: .75rem; flex-wrap: wrap; margin-bottom: .6rem; }
.dash-section-head h2 { margin: 0; font-size: .95rem; color: var(--heading); }
.dash-section-head p { margin: 0; font-size: .78rem; color: var(--muted); }

/* Cartões de atenção */
.dash-tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .7rem; }
.dash-tile {
  --tone: var(--muted); --tone-bg: transparent;
  position: relative; display: grid; grid-template-columns: 1fr auto; grid-template-areas: "title icon" "value value" "hint hint";
  gap: .1rem .5rem; min-width: 0; padding: .85rem .95rem; color: inherit;
  border: 1px solid var(--border-soft); border-radius: var(--radius-lg); background: var(--surface);
  transition: border-color 120ms ease, background 120ms ease;
}
.dash-tile:hover { color: inherit; border-color: var(--border-strong); background: var(--surface-hover); }
.dash-tile:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.dash-tile-icon { grid-area: icon; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; color: var(--tone); background: var(--tone-bg); }
.dash-tile-title { grid-area: title; align-self: center; font-size: .78rem; font-weight: 700; color: var(--text-soft); }
.dash-tile-value { grid-area: value; font-size: 2rem; line-height: 1.1; font-weight: 800; letter-spacing: -.04em; color: var(--heading); font-variant-numeric: tabular-nums; }
.dash-tile-hint { grid-area: hint; font-size: .72rem; color: var(--muted); }
/* O tom aparece só no ícone (e no número dos alertas); borda e fundo ficam iguais em todos. */
.dash-tile.tone-danger  { --tone: var(--danger);  --tone-bg: var(--danger-soft); }
.dash-tile.tone-danger .dash-tile-value { color: var(--danger); }
.dash-tile.tone-warning { --tone: var(--warning); --tone-bg: var(--warning-soft); }
.dash-tile.tone-warning .dash-tile-value { color: var(--warning); }
.dash-tile.tone-info    { --tone: var(--violet);  --tone-bg: color-mix(in srgb, var(--violet) 10%, transparent); }
.dash-tile.tone-mine    { --tone: var(--primary); --tone-bg: var(--primary-soft); }
.dash-tile.is-clear { --tone: var(--success); --tone-bg: var(--success-soft); }
.dash-tile.is-clear .dash-tile-value { color: var(--muted-2); }

/* Grades */
.dash-grid { display: grid; gap: .85rem; margin-bottom: .85rem; align-items: stretch; }
.dash-grid--main { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
.dash-grid--three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dash-card { padding: 1rem 1.1rem; min-width: 0; }
.dash-card-head { margin-bottom: .8rem; }
.dash-card-head h2 { margin: 0; font-size: .95rem; color: var(--heading); }
.dash-card-head p { margin: .15rem 0 0; font-size: .76rem; color: var(--muted); }
.dash-card-link { display: inline-flex; align-items: center; gap: .35rem; margin-top: .7rem; font-size: .8rem; font-weight: 650; color: var(--link); }
.dash-card-link:hover { color: var(--link-hover); }
.dash-footnote { margin: .85rem 0 0; padding-top: .7rem; border-top: 1px solid var(--border-soft); font-size: .78rem; color: var(--muted); }

/* Lista "Comece por aqui" */
.dash-tickets { list-style: none; margin: 0; padding: 0; display: grid; gap: .25rem; }
.dash-ticket {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .75rem;
  padding: .6rem .65rem; border-radius: 9px; color: inherit; border: 1px solid transparent;
}
.dash-ticket:hover { color: inherit; background: var(--surface-hover); border-color: var(--border-soft); }
.dash-ticket:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.dash-ticket-main { min-width: 0; display: grid; }
.dash-ticket-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .84rem; color: var(--text); }
.dash-ticket-main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .74rem; color: var(--muted); }
.dash-ticket-side { display: grid; justify-items: end; gap: .2rem; }
.dash-ticket-side small { display: inline-flex; align-items: center; gap: .25rem; font-size: .72rem; color: var(--muted); }
.dash-ticket .badge { white-space: nowrap; }

/* Fila ativa: barra empilhada com 2px de respiro entre segmentos */
.dash-stack { display: flex; gap: 2px; height: 14px; margin-bottom: .9rem; }
.dash-stack-seg { min-width: 6px; background: var(--primary); }
.dash-stack-seg:first-child { border-radius: 4px 0 0 4px; }
.dash-stack-seg:last-child { border-radius: 0 4px 4px 0; }
.dash-stack-seg:only-child { border-radius: 4px; }
.dash-stack-seg.seg-em_atendimento { background: var(--violet); }
.dash-stack-seg.seg-aguardando { background: var(--warning); }
.dash-stack-seg.seg-escalonado { background: var(--pink); }
.dash-legend { list-style: none; margin: 0; padding: 0; }
.dash-legend a { display: grid; grid-template-columns: auto 1fr auto 2.6rem; align-items: center; gap: .55rem; padding: .5rem .4rem; border-radius: 8px; color: var(--text-soft); font-size: .84rem; }
.dash-legend a:hover { background: var(--surface-hover); color: var(--text); }
.dash-legend .status-dot { width: 9px; height: 9px; }
.dash-legend strong { color: var(--heading); font-variant-numeric: tabular-nums; }
.dash-legend small { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Gráfico de colunas */
.dash-chart { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .5rem; }
.dash-chart-y { display: flex; flex-direction: column; justify-content: space-between; height: 170px; font-size: .68rem; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.dash-chart-plot {
  position: relative; display: flex; align-items: stretch; gap: 6px; height: 170px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(var(--border-soft), var(--border-soft)) 0 0 / 100% 1px no-repeat,
              linear-gradient(var(--border-soft), var(--border-soft)) 0 50% / 100% 1px no-repeat;
}
.dash-col { position: relative; flex: 1 1 0; min-width: 0; display: flex; align-items: flex-end; justify-content: center; border-radius: 4px; outline: none; }
.dash-col:hover, .dash-col:focus-visible { background: var(--primary-soft); }
.dash-bar { width: 100%; max-width: 24px; min-height: 0; border-radius: 4px 4px 0 0; background: var(--primary); }
.dash-col:not(.is-today) .dash-bar { opacity: .72; }
.dash-col:hover .dash-bar, .dash-col:focus-visible .dash-bar { opacity: 1; }
.dash-bar-value { position: absolute; top: 0; left: 50%; transform: translate(-50%, -100%); font-size: .7rem; font-weight: 700; color: var(--text); }
@media (min-width: 901px) {
  .dash-bar-value:not(.is-peak) { display: none; }
}
.dash-tip {
  position: absolute; bottom: calc(100% + 6px); left: 50%; z-index: 5; transform: translateX(-50%);
  display: none; min-width: 108px; padding: .4rem .6rem; text-align: center; white-space: nowrap;
  font-size: .72rem; line-height: 1.35; color: var(--text-soft);
  border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface-3); box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
  pointer-events: none;
}
.dash-tip strong { display: block; font-size: .82rem; color: var(--heading); }
.dash-col:hover .dash-tip, .dash-col:focus-visible .dash-tip { display: block; }
.dash-col:nth-child(-n+2) .dash-tip { left: 0; transform: none; }
.dash-col:nth-last-child(-n+2) .dash-tip { left: auto; right: 0; transform: none; }
.dash-chart-axis { display: flex; gap: 6px; margin-top: .35rem; }
.dash-chart-axis span { flex: 1 1 0; min-width: 0; display: grid; justify-items: center; font-size: .7rem; line-height: 1.2; color: var(--muted); font-variant-numeric: tabular-nums; }
.dash-chart-axis small { font-size: .62rem; color: var(--muted-2); }
.dash-chart-axis .is-today { color: var(--primary); font-weight: 800; }
.dash-table-view { margin-top: .8rem; font-size: .78rem; }
.dash-table-view summary { cursor: pointer; width: fit-content; color: var(--link); font-weight: 600; }
.dash-table-view table { margin-top: .5rem; }

/* Resumo do mês */
.dash-stats { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin: 0; }
.dash-stats > div { padding: .7rem .8rem; border: 1px solid var(--border-soft); border-radius: 10px; background: var(--surface-2); min-width: 0; }
.dash-stats dt { font-size: .72rem; font-weight: 650; color: var(--muted); }
.dash-stats dd { margin: .2rem 0 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .45rem; }
.dash-stats strong { font-size: 1.45rem; line-height: 1.1; font-weight: 800; letter-spacing: -.03em; color: var(--heading); font-variant-numeric: tabular-nums; }
.dash-stats strong.is-good { color: var(--success); }
.dash-stats strong.is-warn { color: var(--warning); }
.dash-stats small { font-size: .7rem; color: var(--muted); }
.dash-delta { display: inline-flex; align-items: center; gap: .2rem; font-size: .76rem; font-weight: 700; color: var(--text-soft); }
.dash-chips { list-style: none; margin: .8rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.dash-chips li { padding: .22rem .6rem; border: 1px solid var(--border-soft); border-radius: 999px; font-size: .74rem; color: var(--text-soft); background: var(--surface-2); }
.dash-chips strong { margin-left: .2rem; color: var(--heading); }

/* Barras horizontais de distribuição (magnitude = uma matiz só) */
.dash-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: .7rem; }
.dash-bars-label { display: flex; justify-content: space-between; gap: .75rem; margin-bottom: .25rem; font-size: .8rem; color: var(--text-soft); }
.dash-bars-label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-bars-label strong { color: var(--heading); font-variant-numeric: tabular-nums; }
.dash-bars-track { height: 8px; border-radius: 4px; background: var(--surface-3); }
.dash-bars-track span { display: block; height: 100%; min-width: 4px; border-radius: 4px; background: var(--primary); }

.dash-empty { display: grid; justify-items: center; gap: .3rem; padding: 1.6rem 1rem; text-align: center; color: var(--muted); font-size: .8rem; }
.dash-empty svg { color: var(--success); }
.dash-empty strong { color: var(--text-soft); font-size: .86rem; }
.dash-empty.small { padding: 1rem; }

/* Guia */
.dash-guide { padding: 0; margin-bottom: 1rem; }
.dash-guide summary { cursor: pointer; display: flex; align-items: center; gap: .5rem; padding: .8rem 1.1rem; font-size: .86rem; font-weight: 700; color: var(--text-soft); }
.dash-guide[open] summary { border-bottom: 1px solid var(--border-soft); }
.dash-guide-body { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; padding: 1rem 1.1rem 1.1rem; font-size: .8rem; color: var(--text-soft); }
.dash-guide-body h3 { margin: 0 0 .5rem; font-size: .8rem; color: var(--heading); }
.dash-guide-body ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
.dash-guide-body li { line-height: 1.45; }
.dash-guide-body .status-dot { display: inline-block; margin-right: .5rem; vertical-align: middle; }

@media (max-width: 1180px) {
  .dash-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dash-grid--three { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .dash-grid--main, .dash-grid--three, .dash-guide-body { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .dash-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
  .dash-tile { padding: .75rem .8rem; }
  .dash-tile-value { font-size: 1.55rem; }
  .dash-tile-hint { display: block; font-size: .68rem; line-height: 1.3; }
  .dash-tile.tone-mine { grid-column: 1 / -1; }
  .dash-hero { align-items: stretch; }
  .dash-hero .btn { width: 100%; justify-content: center; }
  .dash-ticket { grid-template-columns: auto minmax(0, 1fr); align-items: center; }
  .dash-ticket > .badge { grid-column: auto; justify-self: start; }
  .dash-ticket-side { grid-column: 1 / -1; display: flex; justify-content: flex-start; align-items: center; gap: .4rem; }
  .dash-chart-body { min-width: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .dash-chart-plot, .dash-chart-axis { min-width: 28rem; gap: 4px; }
  .dash-chart-plot { padding-top: 1.05rem; }
  .dash-bar-value { top: .1rem; transform: translate(-50%, 0); font-size: .68rem; }
  .dash-col.is-tip-open .dash-tip { display: block; }
  .dash-stats { grid-template-columns: 1fr; }
  .dash-stats strong { font-size: 1.35rem; }
}
@media (prefers-reduced-motion: reduce) { .dash-tile { transition: none; } }
