/* Estatísticas (Manu) — direção "liquid glass" estilo Apple, aprovada
   pelo utilizador a partir de um mockup (ver satis-solution.css/
   hub.css/tarefas.css/dashboard.css para a mesma linguagem já
   aplicada noutras páginas). Este ficheiro só é carregado por
   estatisticas.html, por isso reescrever aqui classes partilhadas
   (.sidebar/.topbar/.panel/.meter/.btn/...) não afeta mais nenhuma
   página. */

:root {
  --es-ink: #1d1d1f;
  --es-ink-soft: #3a3a3c;
  --es-secondary: #6e6e73;
  --es-tertiary: #6a6a70;
  --es-accent: #0a84ff;
  --es-accent-soft: rgba(10, 132, 255, 0.12);
  --es-danger: #d70015;
  --es-danger-soft: rgba(255, 59, 48, 0.11);
  --es-success: #248a3d;
  --es-success-soft: rgba(52, 199, 89, 0.14);
  --es-warning: #c76a00;
  --es-warning-soft: rgba(255, 149, 0, 0.14);
  --es-glass-bg: rgba(255, 255, 255, 0.58);
  --es-glass-bg-strong: rgba(255, 255, 255, 0.8);
  --es-glass-border: rgba(255, 255, 255, 0.85);
  --es-hairline: rgba(60, 60, 67, 0.1);
}

body {
  background: #eef0f4;
  position: relative;
}
body::before {
  content: "";
  position: fixed;
  inset: -10%;
  z-index: 0;
  background:
    radial-gradient(38% 32% at 12% 8%, rgba(10, 132, 255, 0.22), transparent 70%),
    radial-gradient(34% 30% at 88% 14%, rgba(255, 149, 0, 0.14), transparent 70%),
    radial-gradient(46% 40% at 30% 92%, rgba(48, 209, 88, 0.14), transparent 70%),
    radial-gradient(40% 36% at 92% 88%, rgba(191, 90, 242, 0.14), transparent 70%),
    linear-gradient(180deg, #f7f8fb 0%, #eef0f4 60%, #e7e9ef 100%);
  filter: blur(60px);
  pointer-events: none;
}
.app { position: relative; z-index: 1; background: transparent; }

body, .topbar__title, .panel__title, .nav-group__title, .field__label {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", var(--font-sans);
}

/* ---------- sidebar / shell flutuante (desktop) ---------- */
@media (min-width: 1025px) {
  .app { padding: var(--sp-4); gap: var(--sp-4); }
  .sidebar { height: calc(100vh - (var(--sp-4) * 2)); margin: 0; border-radius: 28px; }
  .app__main { height: calc(100vh - (var(--sp-4) * 2)); gap: var(--sp-4); }
  .topbar { border-radius: 24px; }
  .app__content { padding: 0; }
}

.sidebar {
  background: var(--es-glass-bg);
  border: 1px solid var(--es-glass-border);
  backdrop-filter: blur(34px) saturate(180%);
  -webkit-backdrop-filter: blur(34px) saturate(180%);
  box-shadow: 0 20px 50px -20px rgba(20, 30, 60, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}
.sidebar__brand { margin-top: var(--sp-2); }
.sidebar__context {
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--es-hairline);
}
.sidebar__context-label { color: var(--es-tertiary); }
.sidebar__context-value { color: var(--es-ink); }

.nav-group__title { color: var(--es-tertiary); font-weight: 650; }
.nav-item {
  color: var(--es-ink-soft);
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.6); color: var(--es-ink); }
.nav-item.is-active {
  background: linear-gradient(155deg, rgba(10, 132, 255, 0.95), rgba(0, 90, 220, 0.95));
  color: #fff;
  box-shadow: 0 8px 18px -8px rgba(10, 132, 255, 0.65);
}
.nav-item.is-active::before { display: none; }
.nav-item__badge { background: var(--es-danger); color: #fff; }
.nav-item.is-active .nav-item__badge { background: rgba(255, 255, 255, 0.32); }

/* Trilho lateral: uma linha por grupo, com o troço acima do item ativo
   em azul e um marcador em diamante sobre ele; o resto fica em cinza
   claro com um pontinho a marcar o fim da lista. */
.nav-group__items {
  display: grid;
  grid-template-columns: 12px 1fr;
  column-gap: var(--sp-2);
  row-gap: 2px;
}
.nav-rail-cell {
  display: flex;
  justify-content: center;
  position: relative;
}
.nav-rail-cell__line { width: 1px; height: 100%; background: var(--es-hairline); }
.nav-rail-cell--accent .nav-rail-cell__line { background: var(--es-accent); }
.nav-rail-cell--marker::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 7px;
  height: 7px;
  background: var(--es-accent);
  border-radius: 1.5px;
  transform: translate(-50%, -50%) rotate(45deg);
  box-shadow: 0 0 0 3px var(--es-accent-soft);
}
.nav-rail-cell--terminus::before {
  content: "";
  position: absolute;
  bottom: -3px;
  left: 50%;
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: var(--es-hairline);
  transform: translateX(-50%);
}

/* Linha separadora com margem dos dois lados — não toca nas
   extremidades do card, em vez de um border-top a toda a largura. */
.sidebar__footer { border-top: none; position: relative; }
.sidebar__footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: var(--sp-4);
  right: var(--sp-4);
  height: 1px;
  background: var(--es-hairline);
}
.avatar {
  background: linear-gradient(155deg, #b25a00, #964600);
  color: #fff;
}
.sidebar__user-name { color: var(--es-ink); }
.sidebar__user-role { color: var(--es-secondary); }
.sidebar__logout {
  color: var(--es-secondary);
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--es-hairline);
}
.sidebar__logout:hover { background: rgba(255, 255, 255, 0.75); color: var(--es-ink); }

/* ---------- topbar ---------- */
.topbar {
  background: var(--es-glass-bg-strong);
  border-bottom: 1px solid var(--es-glass-border);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
}
.topbar__title { color: var(--es-ink); letter-spacing: -0.02em; text-transform: none; }
.topbar__subtitle { color: var(--es-secondary); }
.topbar__toggle { color: var(--es-secondary); }
.topbar__toggle:hover { background: rgba(120, 120, 128, 0.12); color: var(--es-ink); }

.field-inline--static {
  border-radius: var(--r-full);
  background: rgba(120, 120, 128, 0.08);
  border-color: var(--es-hairline);
  color: var(--es-ink-soft);
  font-weight: 600;
}
.field-inline--static .icon { color: var(--es-secondary); }

.app__content { position: relative; z-index: 1; }
/* A última secção estica até ao fundo disponível — sem isto ficava só
   com a altura natural do conteúdo e não chegava à mesma linha do
   fundo do card da sidebar. */
.app__content > section:last-of-type { flex: 1; min-height: 0; }
.app__content > section:last-of-type .panel { height: 100%; }

/* ---------- botões / campos ---------- */
.btn { border-radius: var(--r-full); font-weight: 650; }
.btn--outline {
  background: rgba(255, 255, 255, 0.55);
  border-color: var(--es-hairline);
  color: var(--es-ink-soft);
}
.btn--outline:hover { background: rgba(255, 255, 255, 0.8); border-color: var(--es-hairline); }
.btn-icon { border-radius: var(--r-full); color: var(--es-secondary); }
.btn-icon:hover { background: rgba(120, 120, 128, 0.12); color: var(--es-ink); }
.input, .field-inline {
  border-color: var(--es-hairline);
  border-radius: var(--r-full);
  background: rgba(120, 120, 128, 0.08);
  color: var(--es-ink);
}

/* .date-field (calendário popup de assets/js/core/date-picker.js) é um
   componente partilhado — ainda com o visual antigo (branco/navy) por
   estilizar aqui, tal como o resto dos campos. */
.date-field__trigger {
  border-radius: var(--r-full);
  background: rgba(120, 120, 128, 0.08);
  border-color: var(--es-hairline);
  color: var(--es-ink);
}
.date-field__trigger.is-open,
.date-field__trigger:focus-visible {
  border-color: var(--es-accent);
  box-shadow: 0 0 0 3px var(--es-accent-soft);
}
.date-field__value[data-empty="true"] { color: var(--es-tertiary); }
.date-field__icon { color: var(--es-secondary); }

.date-field__panel {
  border-radius: 20px;
  border: 1px solid var(--es-glass-border);
  background: var(--es-glass-bg-strong);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  box-shadow: 0 20px 46px -22px rgba(20, 30, 60, 0.28);
}
.date-field__month { color: var(--es-ink); }
.date-field__nav { color: var(--es-secondary); }
.date-field__nav:hover { background: rgba(120, 120, 128, 0.12); color: var(--es-ink); }
.date-field__weekdays span { color: var(--es-tertiary); }
.date-field__day { color: var(--es-ink-soft); }
.date-field__day:not(.date-field__day--blank):hover { background: rgba(120, 120, 128, 0.1); }
.date-field__day--today { color: var(--es-accent); box-shadow: inset 0 0 0 1px var(--es-accent); }
.date-field__day--selected,
.date-field__day--selected:hover {
  background: linear-gradient(155deg, #0a72e8, #0058c7);
  color: #fff;
}
.date-field__panel-footer { border-top: 1px solid var(--es-hairline); }
.date-field__today { color: var(--es-accent); }
.date-field__clear { color: var(--es-secondary); }
.date-field__today:hover,
.date-field__clear:hover { background: rgba(120, 120, 128, 0.1); }

/* ---------- destaque (taxa de conclusão) ---------- */
.highlight {
  background: linear-gradient(135deg, #0f2547 0%, #0a1a33 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  box-shadow: 0 20px 46px -22px rgba(10, 20, 45, 0.5);
}
.highlight::after {
  background: radial-gradient(circle, rgba(10, 132, 255, 0.28), transparent 70%);
}
.highlight__tag { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.2); }
.highlight__bar-fill { background: linear-gradient(90deg, #0a84ff, #4fa8ff); }
.gauge__value { stroke: #0a84ff; }

/* ---------- métricas ---------- */
.metric {
  background: var(--es-glass-bg-strong);
  border: 1px solid var(--es-glass-border);
  border-radius: 18px;
  box-shadow: 0 12px 28px -20px rgba(20, 30, 60, 0.2);
}
.metric__icon { background: var(--es-accent-soft); color: var(--es-accent); }
.metric__label { color: var(--es-tertiary); }
.metric__value { color: var(--es-ink); letter-spacing: -0.02em; }
.metric__trend--up { color: var(--es-success); }
.metric__trend--down { color: var(--es-danger); }

/* ---------- período ---------- */
.period {
  background: var(--es-glass-bg);
  border: 1px solid var(--es-glass-border);
  border-radius: var(--r-full);
  box-shadow: 0 12px 30px -22px rgba(20, 30, 60, 0.18);
}
.period__label { color: var(--es-ink-soft); }
.period__sep { color: var(--es-tertiary); }

/* ---------- painéis ---------- */
.panel {
  background: var(--es-glass-bg-strong);
  border: 1px solid var(--es-glass-border);
  border-radius: 24px;
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  box-shadow: 0 20px 46px -28px rgba(20, 30, 60, 0.24);
}
.panel__header { background: transparent; border-bottom: 1px solid var(--es-hairline); }
.panel__header .icon { color: var(--es-accent); }
.panel__title { color: var(--es-ink); font-weight: 700; letter-spacing: -0.01em; }
.panel__meta { color: var(--es-secondary); }

/* ---------- meters (prioridade) ---------- */
.meter__label { color: var(--es-ink-soft); }
.meter__value { color: var(--es-secondary); }
.meter__track { background: rgba(120, 120, 128, 0.12); }
.meter--low { --meter-color: var(--es-success); }
.meter--mid { --meter-color: var(--es-warning); }
.meter--high { --meter-color: var(--es-danger); }

/* ---------- SLA ---------- */
.sla {
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--es-hairline);
}
.sla__head { border-bottom: 1px solid var(--es-hairline); }
.sla--low { --sla-color: var(--es-success); }
.sla--mid { --sla-color: var(--es-warning); }
.sla--high { --sla-color: var(--es-danger); }
.sla__caption { color: var(--es-secondary); }
.sla__time--ok { color: var(--es-success); }
.sla__time--warn { color: var(--es-warning); }
.sla__time--bad { color: var(--es-danger); }

/* ---------- ranking ---------- */
.rank__row { border-bottom: 1px solid var(--es-hairline); }
.rank__name { color: var(--es-ink-soft); }
.rank__value { color: var(--es-secondary); }
.rank__bar { background: rgba(120, 120, 128, 0.12); }
.rank__bar-fill { background: var(--es-accent); }

/* -------------------------------------------------------------- */

.highlight {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  padding: var(--sp-4);
  overflow: hidden;
  color: var(--white);
}

.highlight::after {
  content: "";
  position: absolute;
  top: -60px;
  right: -60px;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  pointer-events: none;
}

.highlight__body {
  position: relative;
  flex: 1;
  min-width: 0;
}

.highlight__tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--r-full);
  border: 1px solid;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.highlight__pulse {
  width: 7px;
  height: 7px;
  border-radius: var(--r-full);
  background: #4ade80;
  box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.6);
  animation: pulse 2.2s 3;
}

@keyframes pulse {
  70% { box-shadow: 0 0 0 8px rgba(74, 222, 128, 0); }
  100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); }
}

.highlight__title {
  margin-top: var(--sp-3);
  font-size: var(--fs-2xl);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--white);
}

.highlight__desc {
  margin-top: var(--sp-1);
  font-size: var(--fs-md);
  color: rgba(255, 255, 255, 0.65);
}

.highlight__bar {
  margin-top: var(--sp-4);
  height: 8px;
  border-radius: var(--r-full);
  background: rgba(255, 255, 255, 0.16);
  overflow: hidden;
}

.highlight__bar-fill {
  width: 100%;
  height: 100%;
  border-radius: var(--r-full);
  transform: scaleX(var(--fill, 0));
  transform-origin: left center;
  transition: transform 800ms var(--ease);
}

.gauge {
  position: relative;
  display: grid;
  place-items: center;
  width: 140px;
  height: 140px;
  flex-shrink: 0;
}

.gauge svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  overflow: visible;
}

.gauge__track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.14);
  stroke-width: 8;
}

.gauge__value {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 900ms var(--ease);
}

.gauge__text {
  position: absolute;
  text-align: center;
  line-height: 1.1;
}

.gauge__number {
  font-size: var(--fs-3xl);
  font-weight: 800;
  letter-spacing: -0.03em;
}

.gauge__caption {
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.01em;
  text-transform: none;
  color: rgba(255, 255, 255, 0.78);
}

.metric {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
}

.metric__icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: var(--r-md);
}

.metric__label {
  font-size: var(--fs-sm);
  font-weight: 600;
}

.metric__value {
  font-size: var(--fs-xl);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.metric__trend {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--fs-sm);
  font-weight: 700;
}

.period {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-5);
  flex-wrap: wrap;
}

.period__label {
  font-size: var(--fs-md);
  font-weight: 700;
}

.period__sep { font-size: var(--fs-md); }

.sla-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-4);
}

.sla {
  padding: var(--sp-3);
  border-radius: var(--r-md);
  text-align: center;
}

.sla__head {
  padding-bottom: var(--sp-2);
  margin-bottom: var(--sp-2);
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--sla-color, var(--es-ink));
}

.sla__row + .sla__row { margin-top: var(--sp-2); }

.sla__caption {
  font-size: var(--fs-sm);
}

.sla__time {
  font-size: var(--fs-base);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.panel__body:has(> .rank) {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.rank {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.rank::-webkit-scrollbar { display: none; }

.rank__row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) 0;
}

.rank__row:last-child { border-bottom: none; }

.rank__name {
  font-size: var(--fs-md);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rank__value {
  margin-left: auto;
  font-size: var(--fs-md);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.rank__bar {
  flex: 1;
  height: 6px;
  min-width: 60px;
  border-radius: var(--r-full);
  overflow: hidden;
}

.rank__bar-fill {
  display: block;
  height: 100%;
  border-radius: var(--r-full);
}

@media (max-width: 1024px) {
  .highlight { flex-direction: column-reverse; align-items: stretch; gap: var(--sp-5); }
  .gauge { align-self: center; }
}

@media (max-width: 720px) {
  .sla-grid { grid-template-columns: minmax(0, 1fr); }
}
