/* ===========================================================================
   Sistema de Chamados - Magile Informatica
   Design tokens + componentes compartilhados entre chamados.html e bi.html
=========================================================================== */
:root {
  --paper: #f6f3ee;
  --surface: #ffffff;
  --surface-2: #fbf8f3;
  --line: #e6e0d3;
  --line-soft: #eee9dd;
  --text: #1c1f26;
  --text-muted: #6f6a5c;
  --text-faint: #9a9585;
  --accent: #0f7a86;
  --accent-ink: #0a5760;
  --accent-wash: #e4f1f1;
  --warn: #b8791f;
  --warn-wash: #faf0dd;
  --good: #2f8f5b;
  --good-wash: #e5f4ec;
  --critical: #c0463a;
  --critical-wash: #fbe9e6;
  --shadow-sm: 0 1px 2px rgba(30,25,15,.06), 0 1px 1px rgba(30,25,15,.04);
  --shadow-md: 0 8px 24px rgba(30,25,15,.08), 0 2px 6px rgba(30,25,15,.05);
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}

body {
  background: var(--paper);
  color: var(--text);
  font-family: var(--sans);
}

.mono, .fs-3, .fs-4, .fs-5 { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------------
   Navbar
--------------------------------------------------------------------- */
.navbar.bg-dark {
  background: #12161c !important;
  overflow: hidden;
  position: sticky;
}
.navbar.bg-dark::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: radial-gradient(rgba(255,255,255,.14) 1px, transparent 1px);
  background-size: 15px 15px;
  background-position: right -4px top -4px;
  -webkit-mask-image: linear-gradient(to left, #000 0%, #000 45%, transparent 78%);
          mask-image: linear-gradient(to left, #000 0%, #000 45%, transparent 78%);
  pointer-events: none;
}
.navbar.bg-dark::after {
  content: "";
  position: absolute;
  z-index: 0;
  top: 50%; right: 90px;
  width: 110px; height: 110px;
  transform: translateY(-50%);
  background: var(--accent);
  opacity: .10;
  -webkit-mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="1.4"><path d="M4 13a8 8 0 0 1 16 0v5a2 2 0 0 1-2 2h-1v-7h3M4 18v-5h3v7H6a2 2 0 0 1-2-2Z"/></svg>') center / contain no-repeat;
          mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="1.4"><path d="M4 13a8 8 0 0 1 16 0v5a2 2 0 0 1-2 2h-1v-7h3M4 18v-5h3v7H6a2 2 0 0 1-2-2Z"/></svg>') center / contain no-repeat;
  pointer-events: none;
  display: none;
}
@media (min-width: 992px) {
  .navbar.bg-dark::after { display: block; }
}
.navbar.bg-dark .container-fluid { position: relative; z-index: 1; }

.brand-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(155deg, var(--accent) 0%, var(--accent-ink) 100%);
  margin-right: .5rem;
  font-size: .95rem;
  box-shadow: inset 0 -5px 8px rgba(0,0,0,.22), inset 0 3px 5px rgba(255,255,255,.2), 0 2px 6px rgba(10,87,96,.35);
}

/* ---------------------------------------------------------------------
   Cards (KPIs e graficos)
--------------------------------------------------------------------- */
.stat-card,
.chart-card {
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  transition: transform .15s ease, box-shadow .15s ease;
  background: var(--surface);
}

.stat-card:hover,
.chart-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.stat-card .card-body {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  padding: 1rem 1.15rem;
}

.stat-top { display: flex; align-items: center; gap: .6rem; }
.stat-label {
  font-size: .72rem; color: var(--text-muted); font-weight: 500;
  text-transform: uppercase; letter-spacing: .04em;
}
.stat-value-row { display: flex; align-items: flex-end; justify-content: space-between; gap: .5rem; }
.stat-value { font-family: var(--mono); font-size: 1.7rem; font-weight: 600; line-height: 1; color: var(--text); }
.stat-delta { font-size: .72rem; font-weight: 500; padding: .15rem .45rem; border-radius: 100px; white-space: nowrap; font-family: var(--sans); }
.stat-delta.up { color: var(--good); background: var(--good-wash); }
.stat-delta.warn { color: var(--warn); background: var(--warn-wash); }
.stat-spark { width: 100%; height: 28px; display: block; }

.stat-icon {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: #fff;
  box-shadow: inset 0 -5px 8px rgba(0,0,0,.18), inset 0 3px 5px rgba(255,255,255,.25);
}

.chart-card {
  border-top: 4px solid var(--accent, #0d6efd);
}

.chart-card .card-title {
  font-size: .92rem;
  font-weight: 600;
  margin-bottom: .75rem;
  display: flex;
  align-items: center;
  gap: .4rem;
  color: var(--text);
}

.chart-wrap {
  position: relative;
  height: 260px;
}

.evolucao-selecao {
  max-height: 360px;
  overflow-y: auto;
  padding-right: .25rem;
}

.evolucao-selecao .form-check {
  margin-bottom: .35rem;
}

/* ---------------------------------------------------------------------
   Avatares (cliente / funcionario) e marcadores de tipo
--------------------------------------------------------------------- */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  color: #fff;
  font-weight: 600;
  flex: 0 0 auto;
  line-height: 1;
  letter-spacing: .02em;
  font-family: var(--sans);
  box-shadow: inset 0 -5px 8px rgba(0,0,0,.18), inset 0 3px 5px rgba(255,255,255,.22);
}

.avatar-sm { width: 26px; height: 26px; font-size: .65rem; border-radius: 7px; }
.avatar-md { width: 34px; height: 34px; font-size: .8rem; border-radius: 9px; }
.avatar-lg { width: 52px; height: 52px; font-size: 1.15rem; border-radius: 13px; }

.entity-cell {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.color-dot {
  display: inline-block;
  width: .6rem;
  height: .6rem;
  border-radius: 50%;
  margin-right: .45rem;
  flex: 0 0 auto;
}

.cliente-link {
  cursor: pointer;
}

.cliente-link span {
  text-decoration: underline dotted;
}

.cliente-link:hover span {
  color: var(--accent);
  text-decoration: underline solid;
}

.tipo-chip {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .78rem;
  color: var(--text-muted);
}
.tipo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px; height: 20px;
  border-radius: 6px;
  flex: 0 0 auto;
  background: var(--tc-wash, var(--accent-wash));
  color: var(--tc, var(--accent));
  font-size: .68rem;
}

.status-pill {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .74rem; font-weight: 600;
  padding: .25rem .6rem; border-radius: 100px;
  font-family: var(--sans);
}
.status-pill.aberto { color: var(--warn); background: var(--warn-wash); }
.status-pill.fechado { color: var(--good); background: var(--good-wash); }

.age-pill {
  font-size: .72rem; font-weight: 600; padding: .2rem .55rem; border-radius: 100px;
  font-family: var(--mono); white-space: nowrap;
}
.age-pill.fresh { color: var(--good); background: var(--good-wash); }
.age-pill.mid { color: var(--warn); background: var(--warn-wash); }
.age-pill.old { color: var(--critical); background: var(--critical-wash); }
.age-pill.na { color: var(--text-faint); background: var(--surface-2); }

.badge i {
  margin-right: .25rem;
}

/* ---------------------------------------------------------------------
   Tabelas
--------------------------------------------------------------------- */
.table-responsive {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}

.table-responsive table {
  white-space: nowrap;
  color: var(--text);
}

.table-light, .table > :not(caption) > * > * {
  background-color: transparent;
}

.table-light {
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.andam-subrow {
  background: var(--surface-2);
}
.andam-subrow td {
  padding-top: .25rem;
  padding-bottom: .25rem;
  border-top: none;
}

/* ---------------------------------------------------------------------
   Andamentos (timeline)
--------------------------------------------------------------------- */
.andam-item {
  border-left: 3px solid var(--accent);
  padding: .4rem .75rem;
  margin-bottom: .5rem;
  background: var(--surface-2);
  border-radius: 0 .5rem .5rem 0;
}

.andam-item .andam-meta {
  font-size: .75rem;
  color: var(--text-muted);
}

.cursor-pointer {
  cursor: pointer;
}

.section-title {
  margin: 1.5rem 0 .75rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: .45rem;
}

/* ---------------------------------------------------------------------
   Formularios (filtros, modais)
--------------------------------------------------------------------- */
.form-select, .form-control {
  border-color: var(--line);
  font-family: var(--sans);
}
.form-select:focus, .form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 .2rem var(--accent-wash);
}
.form-label {
  font-size: .7rem; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .04em;
}
.btn-primary {
  background: var(--accent); border-color: var(--accent);
}
.btn-primary:hover, .btn-primary:focus {
  background: var(--accent-ink); border-color: var(--accent-ink);
}

@media (max-width: 576px) {
  .navbar-brand {
    font-size: 1rem;
  }
  .fs-3 {
    font-size: 1.4rem !important;
  }
  table.table-sm td, table.table-sm th {
    font-size: .8rem;
  }
}
