/* IDENTIDADE VISUAL — Grupo Komvós
   Acento teal sobre navy/preto. Tipografia: DM Sans. Tema escuro padrão. */
:root, html[data-theme="dark"] {
  color-scheme: dark;
  --brand-teal: #00AA9E; --brand-mint: #45DCD1;
  --brand-navy: #002D48; --brand-gray: #727376;
  --bg-app: #0a0c10; --bg-sidebar: #07090c; --bg-panel: #12161d;
  --bg-card: rgba(255,255,255,0.04); --bg-card-hover: rgba(69,220,209,0.08);
  --border: rgba(255,255,255,0.09); --border-strong: rgba(69,220,209,0.28);
  --text: #f4f9fb; --text-muted: rgba(244,249,251,0.62); --text-dim: rgba(244,249,251,0.42);
  --status-good: #00AA9E; --status-good-bg: rgba(0,170,158,0.12);
  --status-warn: #F5A623; --status-warn-bg: rgba(245,166,35,0.12);
  --status-bad:  #EF5350; --status-bad-bg:  rgba(239,83,80,0.12);
  --grad-brand: linear-gradient(135deg, #00AA9E 0%, #45DCD1 100%);
  --grad-panel: linear-gradient(180deg, rgba(0,170,158,0.06) 0%, transparent 60%);
  --radius: 16px; --radius-lg: 22px; --radius-sm: 10px;
  --shadow-md: 0 8px 32px rgba(0,0,0,0.4);
  --shadow-glow: 0 0 40px rgba(0,170,158,0.16);
  --chart-tick: #f4f9fb; --chart-grid: rgba(255,255,255,0.06); --chart-tooltip-bg: #07090c;
  --login-erro-fg: #ffb4b2;
  --scroll-thumb: rgba(255,255,255,0.1);
  --bg-input: rgba(0,0,0,0.28);
}
html[data-theme="light"] {
  color-scheme: light;
  --bg-app: #f4f7f9; --bg-sidebar: #ffffff; --bg-panel: #ffffff;
  --bg-card: #ffffff; --bg-card-hover: rgba(0,170,158,0.08);
  --border: rgba(0,45,72,0.1); --border-strong: rgba(0,170,158,0.35);
  --text: #0d2433; --text-muted: rgba(13,36,51,0.62); --text-dim: rgba(13,36,51,0.42);
  --shadow-md: 0 8px 28px rgba(0,45,72,0.08);
  --shadow-glow: 0 0 28px rgba(0,170,158,0.12);
  --chart-tick: #0d2433; --chart-grid: rgba(0,45,72,0.08); --chart-tooltip-bg: #ffffff;
  --login-erro-fg: #8b1e1c;
  --scroll-thumb: rgba(0,45,72,0.18);
  --bg-input: #f4f7f9;
}
html[data-theme="light"] .logo-komvos { filter: invert(1); }
html[data-theme="light"] .mini-badge { background: rgba(0,45,72,0.06); }
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { background: var(--bg-app); color: var(--text);
  font-family: 'DM Sans', -apple-system, sans-serif; font-size: 14px; line-height: 1.5;
  min-height: 100vh; overflow-x: hidden; -webkit-font-smoothing: antialiased; }
body { background:
  radial-gradient(1200px 600px at 15% -10%, rgba(0,170,158,0.08), transparent 60%),
  radial-gradient(900px 500px at 100% 100%, rgba(69,220,209,0.05), transparent 55%),
  var(--bg-app); background-attachment: fixed; }
button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: rgba(69,220,209,0.35); }

.app { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }

/* Sidebar */
.sidebar { background: var(--bg-sidebar); border-right: 1px solid var(--border);
  padding: 24px 16px; position: sticky; top: 0; height: 100vh; max-height: 100vh;
  align-self: start; display: flex; flex-direction: column; gap: 0; overflow: hidden; }
.sidebar-body { flex: 1 1 auto; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; gap: 24px; padding-bottom: 8px; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 20px;
  border-bottom: 1px solid var(--border); }
.brand img { height: 40px; width: auto; flex-shrink: 0; }
.brand img.logo-komvos { height: 44px; border-radius: 50%; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text .brand-title { font-weight: 700; font-size: 15px;
  letter-spacing: 0.02em; color: var(--text); }
.brand-text .brand-sub { font-size: 10px; color: var(--brand-mint);
  text-transform: uppercase; letter-spacing: 0.16em; margin-top: 3px; font-weight: 600; }
.nav-group-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--text-dim); padding: 0 12px 4px; font-weight: 600; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border-radius: var(--radius-sm); color: var(--text-muted); text-decoration: none;
  font-size: 13.5px; font-weight: 500; transition: all 0.15s ease;
  border: 1px solid transparent; background: transparent; width: 100%; text-align: left; }
.nav-item:hover { background: var(--bg-card-hover); color: var(--text); }
.nav-item.active { background: linear-gradient(135deg, rgba(0,170,158,0.14), rgba(69,220,209,0.06));
  color: var(--text); border-color: var(--border-strong); }
.nav-item .icon { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.9;
  stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nav-item.active .icon { color: var(--brand-mint); }
.sidebar-footer { padding: 12px; border-top: 1px solid var(--border);
  font-size: 10px; color: var(--text-dim); text-align: center; letter-spacing: 0.05em;
  margin-top: auto; flex-shrink: 0; display: flex; flex-direction: column; align-items: stretch; gap: 10px; }
.sidebar-brand { display: flex; flex-direction: column; gap: 2px; line-height: 1.35; }
.sidebar-brand-kicker { text-transform: uppercase; letter-spacing: 0.08em; }
.sidebar-footer strong { color: var(--brand-mint); font-weight: 600; font-size: 11px; letter-spacing: 0.02em; }
.sidebar-user { display: block; color: var(--text-muted); font-size: 11px; word-break: break-word; letter-spacing: 0; }
.sidebar-user:empty { display: none; }

.login-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 28px 20px;
  position: relative; overflow: hidden;
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 47px, rgba(69,220,209,0.035) 48px),
    repeating-linear-gradient(90deg, transparent, transparent 47px, rgba(69,220,209,0.035) 48px); }
.login-mark { position: fixed; width: min(92vw, 880px); height: auto; left: 50%; top: 52%;
  transform: translate(-50%, -50%); opacity: 0.07; pointer-events: none; z-index: 0; user-select: none; }
.login-card { position: relative; z-index: 1; width: 100%; max-width: 420px; display: flex; flex-direction: column;
  align-items: center; background: var(--bg-panel);
  background: color-mix(in srgb, var(--bg-panel) 88%, transparent);
  backdrop-filter: blur(16px); border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg); padding: 44px 36px 32px; box-shadow: var(--shadow-md), var(--shadow-glow);
  text-align: center; }
.login-logo { height: 52px; width: auto; max-width: 280px; object-fit: contain; margin-bottom: 22px;
  background: transparent; }
.login-card h1 { font-family: 'DM Sans', sans-serif; font-size: 26px; font-weight: 700; letter-spacing: -0.03em;
  line-height: 1.2; margin-bottom: 10px; }
.login-lead { color: var(--text-muted); font-size: 14px; line-height: 1.5; max-width: 28ch; margin: 0 auto 28px; }
.login-erro { width: 100%; background: var(--status-bad-bg); color: var(--login-erro-fg); border: 1px solid rgba(239,83,80,0.35);
  border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13px; margin-bottom: 16px; text-align: center; }
.login-ms { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  background: #fff; color: #1a1a1a; font-weight: 600; font-size: 15px; text-decoration: none;
  border-radius: 14px; padding: 14px 16px; border: 1px solid #e6e6e6; box-sizing: border-box; }
.login-ms:hover { background: #f3f3f3; }
.login-hint { margin-top: 18px; font-size: 12.5px; color: var(--text-dim); max-width: 32ch; line-height: 1.45; }
.login-grupo { margin-top: 22px; font-size: 12px; font-weight: 600; letter-spacing: .06em; color: var(--brand-mint); }

.btn-theme { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px;
  border-radius: 12px; border: 1px solid var(--border); background: var(--bg-card); color: var(--text);
  cursor: pointer; flex-shrink: 0; }
.btn-theme:hover { border-color: var(--border-strong); background: var(--bg-card-hover); }
.theme-icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; }
html[data-theme="dark"] .theme-icon-moon { display: none; }
html[data-theme="light"] .theme-icon-sun { display: none; }
.login-theme { position: fixed; top: 20px; right: 20px; z-index: 5; }

/* Main */
.main { padding: 28px 36px 56px; max-width: 100%; overflow-x: hidden; }
.topbar { display: flex; justify-content: space-between; align-items: flex-start;
  gap: 24px; margin-bottom: 32px; flex-wrap: wrap; }
.page-title h1 { font-family: 'DM Sans', sans-serif; font-size: 28px; font-weight: 700;
  letter-spacing: -0.03em; color: var(--text); line-height: 1.2; }
.page-title .subtitle { color: var(--text-muted); font-size: 13px; margin-top: 4px; }
.page-title h1 .accent { background: var(--grad-brand); -webkit-background-clip: text;
  background-clip: text; -webkit-text-fill-color: transparent; }
.updated-info { font-size: 11px; color: var(--text-dim); text-transform: uppercase;
  letter-spacing: 0.1em; margin-top: 6px; }

/* Filtros */
.filters { display: grid; grid-template-columns: minmax(140px, 1fr) minmax(140px, 1fr) minmax(280px, 2fr) auto;
  gap: 12px; margin-bottom: 28px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 20px; backdrop-filter: blur(6px); align-items: start; }
.filter-field { display: flex; flex-direction: column; gap: 4px; }
.filter-field label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-dim); font-weight: 600; }
.filter-field input, .filter-field select { background: var(--bg-input); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0 12px;
  height: 38px; font-size: 13px; transition: border-color 0.15s; }
.filter-field input:focus, .filter-field select:focus { outline: none; border-color: var(--brand-teal); }
.filter-field select option { background: var(--bg-panel); color: var(--text); }
.btn { background: var(--grad-brand); color: #001220; border: none; padding: 0 20px;
  height: 38px; align-self: flex-end; border-radius: var(--radius-sm); font-size: 13px;
  font-weight: 700; letter-spacing: 0.02em; transition: transform 0.1s, box-shadow 0.15s;
  display: inline-flex; align-items: center; gap: 8px; }
.btn:hover { box-shadow: var(--shadow-glow); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--text-muted);
  border: 1px solid var(--border); padding: 8px 14px; border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px;
  transition: all 0.15s; text-decoration: none; }
.btn-ghost:hover { border-color: var(--brand-teal); color: var(--text); }

/* Status */
.status-msg { padding: 14px 18px; border-radius: var(--radius); margin-bottom: 20px;
  font-size: 13.5px; display: flex; align-items: center; gap: 10px; }
.status-msg.loading { background: rgba(0,170,158,0.08); color: var(--brand-mint);
  border-left: 3px solid var(--brand-teal); }
.status-msg.error { background: var(--status-bad-bg); color: var(--status-bad);
  border-left: 3px solid var(--status-bad); }
.spinner { width: 14px; height: 14px; border: 2px solid rgba(69,220,209,0.25);
  border-top-color: var(--brand-mint); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Hero */
.hero { display: grid; grid-template-columns: minmax(260px, 320px) 1fr; gap: 20px; margin-bottom: 28px; }
.score-card { background:
  radial-gradient(circle at 50% 0%, rgba(69,220,209,0.15), transparent 70%),
  linear-gradient(180deg, rgba(0,170,158,0.08), rgba(0,45,72,0.9));
  border: 1px solid var(--border-strong); border-radius: var(--radius-lg);
  padding: 24px; display: flex; flex-direction: column; align-items: center;
  justify-content: center; text-align: center; gap: 14px;
  position: relative; overflow: hidden; box-shadow: var(--shadow-glow); }
.score-label-top { font-family: 'DM Sans', sans-serif; text-transform: uppercase;
  letter-spacing: 0.2em; font-size: 11px; color: var(--brand-mint); font-weight: 600; }
.score-ring { position: relative; width: 160px; height: 160px;
  display: flex; align-items: center; justify-content: center; }
.score-ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.score-ring .ring-bg { stroke: rgba(255,255,255,0.06); }
.score-ring .ring-fill { stroke: url(#scoreGrad); stroke-linecap: round;
  transition: stroke-dashoffset 1s cubic-bezier(0.5,1,0.3,1); }
.score-value-big { font-family: 'DM Sans', sans-serif; font-weight: 700;
  font-size: 56px; line-height: 1; letter-spacing: -0.02em;
  background: var(--grad-brand); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; }
.score-desc { font-size: 12px; color: var(--text-muted); max-width: 240px; }
.score-badges { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.mini-badge { font-size: 10px; padding: 3px 8px; border-radius: 10px;
  font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase;
  background: rgba(255,255,255,0.06); color: var(--text-muted); }
.mini-badge.on-target { background: var(--status-good-bg); color: var(--status-good); }
.mini-badge.warn { background: var(--status-warn-bg); color: var(--status-warn); }
.mini-badge.critical { background: var(--status-bad-bg); color: var(--status-bad); }

.kpi-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.kpi-card { background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px 22px;
  transition: all 0.2s; position: relative; overflow: hidden; }
.kpi-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 3px; background: var(--kpi-color, var(--brand-teal)); opacity: 0.85; }
.kpi-card:hover { background: var(--bg-card-hover); border-color: var(--border-strong);
  transform: translateY(-2px); box-shadow: var(--shadow-md); }
.kpi-header { display: flex; justify-content: space-between; align-items: flex-start;
  gap: 10px; margin-bottom: 14px; }
.kpi-title { font-size: 12px; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--text-muted); font-weight: 600; }
.kpi-meta { font-size: 11px; color: var(--text-dim); font-weight: 500; margin-top: 2px; }
.kpi-status { padding: 3px 8px; border-radius: 8px; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em; white-space: nowrap; }
.kpi-status.good { background: var(--status-good-bg); color: var(--status-good); }
.kpi-status.warn { background: var(--status-warn-bg); color: var(--status-warn); }
.kpi-status.bad { background: var(--status-bad-bg); color: var(--status-bad); }
.kpi-value-row { display: flex; align-items: baseline; justify-content: space-between;
  gap: 8px; margin-bottom: 12px; }
.kpi-value { font-family: 'DM Sans', sans-serif; font-weight: 700; font-size: 34px;
  line-height: 1; letter-spacing: -0.01em; color: var(--text); font-variant-numeric: tabular-nums; }
html[data-theme="light"] .score-card {
  background: radial-gradient(circle at 50% 0%, rgba(0,170,158,0.12), transparent 70%),
    linear-gradient(180deg, #ffffff, #f4f7f9);
}
html[data-theme="light"] .score-ring .ring-bg { stroke: rgba(0,45,72,0.1); }

.kpi-progress { height: 5px; background: var(--border); border-radius: 3px;
  overflow: hidden; margin-bottom: 8px; }
.kpi-progress-bar { height: 100%; transition: width 0.8s cubic-bezier(0.5,1,0.3,1);
  border-radius: 3px; }
.kpi-progress-bar.good { background: var(--status-good); }
.kpi-progress-bar.warn { background: var(--status-warn); }
.kpi-progress-bar.bad { background: var(--status-bad); }
.kpi-foot { display: flex; justify-content: space-between; font-size: 11px;
  color: var(--text-dim); gap: 8px; }

/* Seções */
.section-head { display: flex; justify-content: space-between; align-items: center;
  margin: 32px 0 16px; gap: 12px; flex-wrap: wrap; }
.section-title { font-family: 'DM Sans', sans-serif; font-size: 20px; font-weight: 700;
  color: var(--text); display: flex; align-items: center; gap: 10px; }
.section-title::before { content: ''; width: 3px; height: 20px;
  background: var(--grad-brand); border-radius: 2px; }
.section-title .count { font-size: 12px; color: var(--text-dim); font-weight: 500;
  font-family: 'DM Sans', sans-serif; }
.section-actions { display: flex; gap: 8px; align-items: center; }

/* Equipes */
.teams-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.team-card { background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px; cursor: pointer;
  transition: all 0.2s; position: relative; overflow: hidden; }
.team-card::after { content: ''; position: absolute; inset: 0; border-radius: var(--radius-lg);
  background: var(--grad-panel); opacity: 0; transition: opacity 0.25s; pointer-events: none; }
.team-card:hover { border-color: var(--border-strong); transform: translateY(-3px);
  box-shadow: var(--shadow-md); }
.team-card:hover::after { opacity: 1; }
.team-card.active { border-color: var(--brand-teal); box-shadow: var(--shadow-glow); }
.team-card-head { display: flex; justify-content: space-between; align-items: flex-start;
  gap: 8px; margin-bottom: 16px; }
.team-name { font-family: 'DM Sans', sans-serif; font-weight: 700; font-size: 16px;
  letter-spacing: 0.02em; color: var(--text); }
.team-label { font-size: 10px; padding: 3px 8px; border-radius: 10px;
  background: var(--grad-brand); color: #001220; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em; }
.team-score { font-family: 'DM Sans', sans-serif; font-weight: 700; font-size: 32px;
  line-height: 1; letter-spacing: -0.01em; margin-bottom: 4px; font-variant-numeric: tabular-nums; }
.team-score-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-dim); margin-bottom: 14px; }
.team-metrics { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px 12px;
  padding-top: 12px; border-top: 1px solid var(--border); }
.team-metric-item .val { font-family: 'DM Sans', sans-serif; font-weight: 600;
  font-size: 15px; color: var(--text); font-variant-numeric: tabular-nums; }
.team-metric-item .lbl { font-size: 9px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-dim); margin-top: 2px; }

/* Analistas */
.analysts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px; }
.analyst-card { background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px; transition: all 0.2s;
  cursor: pointer; position: relative; }
.analyst-card:hover { border-color: var(--border-strong); background: var(--bg-card-hover);
  transform: translateY(-2px); box-shadow: var(--shadow-md); }
.analyst-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.avatar { width: 42px; height: 42px; border-radius: 50%;
  background: var(--grad-brand); color: #001220;
  display: flex; align-items: center; justify-content: center;
  font-family: 'DM Sans', sans-serif; font-weight: 700; font-size: 15px;
  letter-spacing: 0.02em; flex-shrink: 0; }
.avatar.rank-1 { box-shadow: 0 0 0 2px #FFD700; }
.avatar.rank-2 { box-shadow: 0 0 0 2px #C0C0C0; }
.avatar.rank-3 { box-shadow: 0 0 0 2px #CD7F32; }
.analyst-info { flex: 1; min-width: 0; }
.analyst-name { font-weight: 600; font-size: 14.5px; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.analyst-team { font-size: 11px; color: var(--text-dim); margin-top: 2px;
  text-transform: uppercase; letter-spacing: 0.08em; }
.analyst-rank { font-family: 'DM Sans', sans-serif; font-weight: 700;
  font-size: 20px; color: var(--text-dim); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.analyst-score-row { display: flex; align-items: baseline; gap: 8px; margin-bottom: 14px; }
.analyst-score { font-family: 'DM Sans', sans-serif; font-weight: 700; font-size: 30px;
  line-height: 1; font-variant-numeric: tabular-nums; }
.analyst-score-lbl { font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--text-muted); }
.analyst-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  padding-top: 12px; border-top: 1px solid var(--border); }
.mini-metric .val { font-family: 'DM Sans', sans-serif; font-weight: 600;
  font-size: 14px; color: var(--text); font-variant-numeric: tabular-nums; }
.mini-metric .lbl { font-size: 9px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-dim); margin-top: 2px; }

/* Métricas clicáveis (drill-down por indicador) */
.mini-metric.clickable,
.team-metric-item.clickable {
  cursor: pointer;
  border-radius: 6px;
  padding: 4px 6px;
  margin: -4px -6px;
  transition: background 0.12s, transform 0.08s;
  position: relative;
}
.mini-metric.clickable:hover,
.team-metric-item.clickable:hover {
  background: rgba(0, 170, 158, 0.10);
}
.mini-metric.clickable:hover .val,
.team-metric-item.clickable:hover .val { color: var(--brand-mint); }
.mini-metric.clickable:hover .lbl,
.team-metric-item.clickable:hover .lbl { color: var(--brand-mint); }
.mini-metric.clickable::after,
.team-metric-item.clickable::after {
  content: '⤓'; position: absolute; top: 2px; right: 4px;
  font-size: 9px; color: transparent; transition: color 0.12s;
}
.mini-metric.clickable:hover::after,
.team-metric-item.clickable:hover::after { color: var(--brand-mint); }
.mini-metric.clickable.busy,
.team-metric-item.clickable.busy { pointer-events: none; opacity: 0.5; }

/* Tabelas */
.table-wrap { background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { background: rgba(0,0,0,0.25); color: var(--text-muted); text-align: left;
  padding: 12px 16px; font-weight: 600; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: 0.09em; border-bottom: 1px solid var(--border); white-space: nowrap; }
th.num { text-align: right; }
td { padding: 12px 16px; border-bottom: 1px solid rgba(255,255,255,0.04);
  font-variant-numeric: tabular-nums; }
td.num { text-align: right; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }
.badge { display: inline-block; padding: 3px 8px; border-radius: 8px;
  background: var(--grad-brand); color: #001220; font-size: 10px; font-weight: 700;
  letter-spacing: 0.06em; }
.chip-good { color: var(--status-good); font-weight: 600; }
.chip-warn { color: var(--status-warn); font-weight: 600; }
.chip-bad  { color: var(--status-bad);  font-weight: 600; }

/* Botão de download nos cards — no fluxo do header (não absoluto), evita overlap */
.card-head-actions {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}
.dl-btn {
  position: static; z-index: 2; flex-shrink: 0;
  background: rgba(0, 170, 158, 0.10); color: var(--brand-mint);
  border: 1px solid transparent; border-radius: 8px;
  width: 30px; height: 30px; display: inline-flex;
  align-items: center; justify-content: center;
  transition: all 0.15s; opacity: 0.75;
}
.dl-btn svg { width: 15px; height: 15px; stroke-width: 2; }
.dl-btn:hover {
  opacity: 1; background: var(--brand-teal); color: #001220;
  border-color: var(--brand-mint); transform: scale(1.05);
}
.dl-btn:active { transform: scale(0.95); }
.dl-btn.busy { pointer-events: none; opacity: 0.5; position: relative; }
.dl-btn.busy::after {
  content: ''; position: absolute; inset: 6px;
  border: 2px solid rgba(69,220,209,0.3); border-top-color: var(--brand-mint);
  border-radius: 50%; animation: spin 0.7s linear infinite;
}
.dl-btn.busy svg { display: none; }
.kpi-card, .team-card, .analyst-card { position: relative; }


/* Toast de feedback do download */
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 999;
  background: var(--bg-panel); border: 1px solid var(--border-strong);
  border-left: 3px solid var(--brand-teal);
  color: var(--text); padding: 12px 18px; border-radius: var(--radius);
  box-shadow: var(--shadow-md); font-size: 13px;
  display: flex; align-items: center; gap: 10px;
  animation: slideUp 0.25s ease; max-width: 380px;
}
.toast.error { border-left-color: var(--status-bad); }
.toast.ok { border-left-color: var(--status-good); }
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Delta (comparação com período anterior) */
.delta {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px; font-weight: 700; padding: 2px 6px;
  border-radius: 6px; font-variant-numeric: tabular-nums;
  background: rgba(255,255,255,0.05); color: var(--text-muted);
  white-space: nowrap;
}
.delta.up { background: var(--status-good-bg); color: var(--status-good); }
.delta.down { background: var(--status-bad-bg); color: var(--status-bad); }
.delta.flat { background: rgba(255,255,255,0.05); color: var(--text-dim); }
.delta svg { width: 10px; height: 10px; stroke-width: 3; }
.delta-inline {
  display: inline-block; margin-left: 6px;
  font-size: 10px; font-weight: 600; font-variant-numeric: tabular-nums;
  color: var(--text-dim);
}
.delta-inline.up { color: var(--status-good); }
.delta-inline.down { color: var(--status-bad); }
.delta-inline.flat { color: var(--text-dim); }

/* Toggle compare */
.compare-toggle {
  display: flex; align-items: center; gap: 8px; font-size: 12px;
  color: var(--text-muted); cursor: pointer; user-select: none;
  padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px;
  transition: all 0.15s; background: transparent;
}
.compare-toggle:hover { border-color: var(--brand-teal); color: var(--text); }
.compare-toggle.active {
  background: rgba(0,170,158,0.10); border-color: var(--border-strong);
  color: var(--brand-mint);
}
.compare-toggle .dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--text-dim);
  transition: background 0.15s;
}
.compare-toggle.active .dot {
  background: var(--brand-mint);
  box-shadow: 0 0 8px var(--brand-mint);
}
.previous-info {
  font-size: 10px; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.08em;
  margin-top: 3px;
}

/* ═════════ PÁGINA INDIVIDUAL DO ANALISTA ═════════════════════════ */
.detail-header {
  display: flex; align-items: center; gap: 20px;
  padding: 20px 24px; margin-bottom: 20px;
  background: linear-gradient(135deg, rgba(0,170,158,0.10), rgba(69,220,209,0.02));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  flex-wrap: wrap;
}
.btn-back {
  background: transparent; color: var(--text-muted);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 14px; font-size: 12px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px;
  transition: all 0.15s;
}
.btn-back:hover { border-color: var(--brand-teal); color: var(--text); }
.detail-avatar {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--grad-brand); color: #001220;
  display: flex; align-items: center; justify-content: center;
  font-family: 'DM Sans', sans-serif; font-weight: 700; font-size: 26px;
  flex-shrink: 0; box-shadow: 0 0 24px rgba(69,220,209,0.25);
}
.detail-user-info { flex: 1; min-width: 200px; }
.detail-name {
  font-family: 'DM Sans', sans-serif; font-weight: 700;
  font-size: 26px; color: var(--text); letter-spacing: -0.01em;
  line-height: 1.1;
}
.detail-team-row {
  display: flex; align-items: center; gap: 10px; margin-top: 6px;
}
.detail-badge-team {
  background: var(--grad-brand); color: #001220;
  padding: 4px 10px; border-radius: 10px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase;
}
.detail-actions { display: flex; gap: 8px; }

/* Achievements */
.achievements {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.achievement {
  background: rgba(0, 170, 158, 0.10); color: var(--brand-mint);
  border: 1px solid rgba(69, 220, 209, 0.25); border-radius: 20px;
  padding: 6px 14px; font-size: 12px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px;
  transition: all 0.15s;
}
.achievement.gold {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), rgba(255, 165, 0, 0.05));
  color: #FFD700; border-color: rgba(255, 215, 0, 0.35);
}
.achievement.silver {
  background: rgba(192, 192, 192, 0.10); color: #C0C0C0;
  border-color: rgba(192, 192, 192, 0.30);
}
.achievement .icon { font-size: 14px; }

/* Grid de 2 colunas para gráficos */
.charts-2col {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
  margin-bottom: 20px;
}
@media (max-width: 900px) {
  .charts-2col { grid-template-columns: 1fr; }
}

/* Score card compacto no detalhe */
.detail-score-row {
  display: grid; grid-template-columns: minmax(240px, 300px) 1fr; gap: 20px;
  margin-bottom: 20px;
}
@media (max-width: 900px) {
  .detail-score-row { grid-template-columns: 1fr; }
}

/* Tabela compacta de tickets */
.tickets-scroll {
  max-height: 500px; overflow-y: auto;
  border-radius: var(--radius-lg);
}
.tickets-scroll table th {
  position: sticky; top: 0; z-index: 5;
}
.ticket-link {
  color: var(--brand-mint); text-decoration: none; font-weight: 600;
}
.ticket-link:hover { text-decoration: underline; }

/* Loader de página */
.detail-loader {
  padding: 60px 20px; text-align: center; color: var(--text-muted);
  font-size: 13px;
}
.detail-loader .spinner {
  margin: 0 auto 12px; width: 30px; height: 30px; border-width: 3px;
}

/* ═════════ MODAL DE TICKET (drill-down) ═════════════════════════ */
.ticket-modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0, 8, 16, 0.72);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center; justify-content: center;
  padding: 24px;
  animation: fadeInOverlay 0.15s ease;
}
.ticket-modal-overlay.open { display: flex; }
@keyframes fadeInOverlay { from { opacity: 0; } to { opacity: 1; } }

.ticket-modal {
  background: var(--bg-panel); border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 900px;
  /* Altura fixa DENTRO do overlay (que tem 24px de padding em cima e
     embaixo). Sem uma altura definida, o body em flex:1 não consegue
     rolar sozinho porque o modal cresce até o conteúdo. */
  height: calc(100vh - 48px); max-height: 900px;
  display: flex; flex-direction: column;
  animation: slideDown 0.2s ease;
  overflow: hidden; min-height: 0;
}
@keyframes slideDown {
  from { transform: translateY(-20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.ticket-modal-head {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(0,170,158,0.08), transparent);
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-shrink: 0;
}
.ticket-modal-title { flex: 1; min-width: 0; }
.ticket-modal-num {
  font-family: 'DM Sans', sans-serif; font-weight: 700;
  font-size: 22px; color: var(--brand-mint);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.ticket-modal-num .protocol {
  font-size: 12px; color: var(--text-dim);
  font-family: 'DM Sans', sans-serif; font-weight: 500;
  letter-spacing: 0.05em;
}
.ticket-modal-status {
  padding: 4px 10px; border-radius: 10px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase;
}
.ticket-modal-status.closed   { background: var(--status-good-bg); color: var(--status-good); }
.ticket-modal-status.resolved { background: var(--status-good-bg); color: var(--status-good); }
.ticket-modal-status.open     { background: var(--status-warn-bg); color: var(--status-warn); }
.ticket-modal-status.canceled { background: rgba(255,255,255,0.06); color: var(--text-dim); }
.ticket-modal-subject {
  font-size: 15px; color: var(--text); font-weight: 500;
  margin-top: 8px; line-height: 1.35;
}
.ticket-modal-close {
  background: transparent; border: 1px solid var(--border);
  color: var(--text-muted); border-radius: 8px;
  width: 32px; height: 32px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px; transition: all 0.15s;
}
.ticket-modal-close:hover { border-color: var(--status-bad); color: var(--status-bad); }
.ticket-modal-body {
  padding: 20px 24px; overflow-y: auto;
  flex: 1 1 auto; min-height: 0;   /* essencial para scroll em flex column */
}

/* Grid de metadados */
.ticket-meta {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px; padding: 16px; margin-bottom: 20px;
  background: rgba(0,0,0,0.20); border-radius: var(--radius);
  border: 1px solid var(--border);
}
.ticket-meta-item .lbl {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-dim); font-weight: 600; margin-bottom: 3px;
}
.ticket-meta-item .val {
  font-size: 13px; color: var(--text); font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.ticket-meta-item .val.warn { color: var(--status-warn); }
.ticket-meta-item .val.bad  { color: var(--status-bad); }
.ticket-meta-item .val.good { color: var(--status-good); }

.ticket-section-title {
  font-family: 'DM Sans', sans-serif; font-size: 14px; font-weight: 700;
  color: var(--brand-mint); text-transform: uppercase;
  letter-spacing: 0.1em; margin: 20px 0 12px;
  display: flex; align-items: center; gap: 10px;
}
.ticket-section-title::before {
  content: ''; width: 3px; height: 14px;
  background: var(--brand-teal); border-radius: 2px;
}
.ticket-section-title .badge-count {
  font-size: 10px; padding: 2px 7px; border-radius: 8px;
  background: rgba(0,170,158,0.15); color: var(--brand-mint);
  font-weight: 700; letter-spacing: 0.05em;
}

/* Timeline de ações */
.timeline {
  display: flex; flex-direction: column; gap: 14px;
  position: relative;
}
.timeline-item {
  display: flex; gap: 12px;
  position: relative;
}
.timeline-marker {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand-teal); color: #001220;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: 'DM Sans', sans-serif; font-weight: 700; font-size: 13px;
  z-index: 2;
}
.timeline-marker.public { background: var(--grad-brand); }
.timeline-marker.internal { background: rgba(69,220,209,0.20); color: var(--brand-mint); }
.timeline-line {
  position: absolute; left: 15px; top: 32px; bottom: -14px;
  width: 2px; background: var(--border);
}
.timeline-item:last-child .timeline-line { display: none; }
.timeline-content {
  flex: 1; min-width: 0;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px;
}
.timeline-header {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 8px; margin-bottom: 6px; flex-wrap: wrap;
}
.timeline-author { font-weight: 600; color: var(--text); font-size: 13px; }
.timeline-meta {
  font-size: 11px; color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.timeline-body {
  font-size: 13px; color: var(--text-muted); line-height: 1.5;
  white-space: pre-wrap; word-wrap: break-word;
  max-height: 220px; overflow-y: auto;
}
.timeline-body img { max-width: 100%; height: auto; }
.timeline-attachments {
  margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px;
}
.timeline-attachment {
  font-size: 11px; padding: 4px 10px;
  background: rgba(0,170,158,0.08); color: var(--brand-mint);
  border: 1px solid rgba(69,220,209,0.2); border-radius: 12px;
  display: inline-flex; align-items: center; gap: 5px;
}

/* Custom fields */
.custom-fields {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.custom-field {
  background: rgba(255,255,255,0.03); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 12px; font-size: 12px;
}
.custom-field .lbl {
  color: var(--text-dim); margin-right: 6px; font-weight: 500;
}
.custom-field .val { color: var(--text); font-weight: 600; }

/* Link no # do ticket */
.ticket-link {
  color: var(--brand-mint); text-decoration: none;
  font-weight: 600; cursor: pointer;
  transition: color 0.1s;
}
.ticket-link:hover { color: var(--brand-teal); text-decoration: underline; }

/* ═════════ DOCUMENTAÇÃO ══════════════════════════════════════════ */
.doc-wrapper {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 900px) {
  .doc-wrapper { grid-template-columns: 1fr; }
}
.doc-toc {
  position: sticky; top: 20px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px;
  max-height: calc(100vh - 40px); overflow-y: auto;
}
.doc-toc h3 {
  font-family: 'DM Sans', sans-serif; font-size: 12px;
  color: var(--brand-mint); text-transform: uppercase;
  letter-spacing: 0.12em; margin-bottom: 10px; font-weight: 700;
}
.doc-toc ol {
  list-style: none; padding: 0; counter-reset: sec;
  display: flex; flex-direction: column; gap: 2px;
}
.doc-toc li { counter-increment: sec; }
.doc-toc a {
  display: block; padding: 6px 10px;
  color: var(--text-muted); text-decoration: none;
  font-size: 12.5px; border-radius: 6px;
  border-left: 2px solid transparent;
  transition: all 0.12s;
}
.doc-toc a::before {
  content: counter(sec) ". ";
  color: var(--text-dim); font-weight: 600;
}
.doc-toc a:hover {
  background: rgba(0,170,158,0.08); color: var(--text);
  border-left-color: var(--brand-teal);
}
.doc-content {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px 32px;
  min-width: 0;
}
.doc-content h2 {
  font-family: 'DM Sans', sans-serif; font-size: 22px; font-weight: 700;
  color: var(--text); letter-spacing: -0.01em;
  margin-top: 32px; margin-bottom: 12px;
  padding-bottom: 8px; border-bottom: 2px solid var(--border-strong);
  scroll-margin-top: 20px;
}
.doc-content h2:first-child { margin-top: 0; }
.doc-content h3 {
  font-family: 'DM Sans', sans-serif; font-size: 16px; font-weight: 700;
  color: var(--brand-mint); text-transform: uppercase; letter-spacing: 0.06em;
  margin-top: 24px; margin-bottom: 10px;
}
.doc-content h4 {
  font-size: 14px; font-weight: 700; color: var(--text);
  margin-top: 16px; margin-bottom: 6px;
}
.doc-content p, .doc-content li {
  font-size: 13.5px; color: var(--text-muted); line-height: 1.65;
  margin-bottom: 8px;
}
.doc-content ul, .doc-content ol {
  padding-left: 20px; margin-bottom: 12px;
}
.doc-content li { margin-bottom: 4px; }
.doc-content strong { color: var(--text); font-weight: 600; }
.doc-content code {
  background: rgba(0,0,0,0.35); color: var(--brand-mint);
  padding: 2px 6px; border-radius: 4px; font-size: 12px;
  font-family: 'SF Mono', Menlo, Consolas, monospace;
}
.doc-content pre {
  background: rgba(0,0,0,0.35); border: 1px solid var(--border);
  border-radius: 8px; padding: 14px 16px;
  overflow-x: auto; margin: 12px 0;
}
.doc-content pre code {
  background: none; padding: 0; color: var(--text-muted);
  font-size: 12px; line-height: 1.5; display: block;
}
.doc-content .callout {
  background: rgba(0,170,158,0.08); border-left: 3px solid var(--brand-teal);
  border-radius: 6px; padding: 12px 16px;
  margin: 12px 0; font-size: 13px; color: var(--text);
}
.doc-content .callout.warn {
  background: rgba(245,166,35,0.10); border-left-color: var(--status-warn);
}
.doc-content .callout.info {
  background: rgba(69,220,209,0.08); border-left-color: var(--brand-mint);
}
.doc-content table {
  width: 100%; margin: 12px 0; font-size: 12.5px;
  border: 1px solid var(--border); border-radius: 8px;
  overflow: hidden;
}
.doc-content table th {
  background: rgba(0,0,0,0.30); text-align: left;
  padding: 8px 12px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted);
}
.doc-content table td {
  padding: 8px 12px; border-top: 1px solid rgba(255,255,255,0.04);
  color: var(--text-muted);
}
.doc-content .formula {
  display: block; background: rgba(0,45,72,0.6);
  border: 1px solid var(--border-strong); border-radius: 8px;
  padding: 12px 16px; margin: 10px 0;
  font-family: 'DM Sans', sans-serif; font-size: 15px;
  color: var(--brand-mint); text-align: center;
  font-variant-numeric: tabular-nums;
}
.doc-actions {
  position: sticky; top: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; margin-bottom: 20px; padding: 12px 16px;
  background: linear-gradient(135deg, rgba(0,170,158,0.10), rgba(69,220,209,0.02));
  border: 1px solid var(--border-strong); border-radius: var(--radius-lg);
  backdrop-filter: blur(8px);
}
.doc-actions .meta {
  font-size: 11px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.doc-actions .meta strong { color: var(--brand-mint); }

/* CSS de impressão — PDF pesquisável */
@media print {
  body { background: #fff !important; color: #000 !important; }
  .sidebar, .topbar, .filters, #status-area,
  .doc-toc, .doc-actions, .mobile-menu { display: none !important; }
  .app { grid-template-columns: 1fr !important; }
  .main { padding: 0 !important; }
  .view { display: none !important; }
  .view[data-view="documentacao"] { display: block !important; }
  .doc-wrapper { grid-template-columns: 1fr !important; gap: 0 !important; }
  .doc-content {
    background: #fff !important; border: none !important;
    padding: 20px 0 !important; color: #000 !important;
    box-shadow: none !important;
  }
  .doc-content h2, .doc-content h3, .doc-content h4,
  .doc-content p, .doc-content li, .doc-content strong {
    color: #000 !important;
  }
  .doc-content h2 { border-bottom: 2px solid #333 !important; }
  .doc-content h3 { color: #00847a !important; }
  .doc-content code {
    background: #f3f4f6 !important; color: #00847a !important;
    border: 1px solid #e0e0e0;
  }
  .doc-content pre {
    background: #f9fafb !important; border: 1px solid #e0e0e0 !important;
  }
  .doc-content .callout {
    background: #f0fdfa !important; border-left-color: #00AA9E !important;
    color: #000 !important;
    page-break-inside: avoid;
  }
  .doc-content .callout.warn { background: #fffbeb !important; border-left-color: #F5A623 !important; }
  .doc-content table {
    border-color: #ddd !important; page-break-inside: avoid;
  }
  .doc-content table th {
    background: #f3f4f6 !important; color: #333 !important;
  }
  .doc-content table td {
    color: #333 !important; border-top-color: #ddd !important;
  }
  .doc-content .formula {
    background: #f0fdfa !important; color: #00847a !important;
    border-color: #99d6d1 !important;
    page-break-inside: avoid;
  }
  h2, h3 { page-break-after: avoid; }
  @page {
    size: A4;
    margin: 20mm 18mm;
  }
}

/* Insights */
.insights-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px; }
.insight { background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px;
  border-left: 3px solid var(--insight-color, var(--brand-teal));
  display: flex; flex-direction: column; gap: 6px; }
.insight-icon { width: 32px; height: 32px; border-radius: 8px;
  background: var(--insight-bg, rgba(0,170,158,0.12));
  color: var(--insight-color, var(--brand-teal));
  display: flex; align-items: center; justify-content: center;
  font-family: 'DM Sans', sans-serif; font-weight: 700; font-size: 18px; margin-bottom: 4px; }
.insight-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--text-dim); font-weight: 600; }
.insight-body { font-size: 13.5px; color: var(--text); line-height: 1.45; }
.insight-body strong { color: var(--insight-color, var(--brand-mint)); font-weight: 700; }

/* Gráficos */
.chart-panel { background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px 24px 24px; }
.chart-tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.chart-tab { background: transparent; color: var(--text-muted);
  border: 1px solid var(--border); padding: 6px 14px; border-radius: 8px;
  font-size: 12px; font-weight: 500; transition: all 0.15s; }
.chart-tab:hover { border-color: var(--brand-teal); color: var(--text); }
.chart-tab.active { background: var(--grad-brand); color: #001220;
  border-color: transparent; font-weight: 700; }
.chart-box { position: relative; height: 380px; }

/* Configurações */
.config-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px; }
.config-block { background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px; }
.config-block h3 { font-family: 'DM Sans', sans-serif; font-size: 15px; font-weight: 700;
  margin-bottom: 12px; color: var(--brand-mint); text-transform: uppercase; letter-spacing: 0.08em; }
.config-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.config-list li { font-size: 13px; padding: 8px 12px; background: rgba(0,0,0,0.2);
  border-radius: var(--radius-sm); color: var(--text-muted);
  border-left: 2px solid var(--brand-teal); font-variant-numeric: tabular-nums; }
.config-list li strong { color: var(--text); font-weight: 600; }
.config-hint { font-size: 11px; color: var(--text-dim); margin-top: 10px; font-style: italic; }
.config-auth { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 18px; margin-bottom: 20px; }
.config-auth-hint { font-size: 11px; color: var(--text-dim); margin-left: auto; max-width: 320px; }
.config-block-head { display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; margin-bottom: 14px; }
.config-block-head h3 { margin-bottom: 0; }
.config-badge { font-family: 'DM Sans', sans-serif; font-weight: 700; font-size: 10.5px;
  letter-spacing: 0.08em; text-transform: uppercase; padding: 3px 9px; border-radius: 99px;
  border: 1px solid var(--border); color: var(--text-dim); white-space: nowrap; }
.config-badge.personalizado { color: var(--brand-mint); border-color: var(--brand-teal); background: rgba(0,170,158,0.12); }
.config-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 10px; }
.config-textarea { width: 100%; min-height: 90px; resize: vertical; background: rgba(0,0,0,0.25);
  color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; font-size: 13px; line-height: 1.6; font-family: inherit; }
.config-textarea:focus { outline: none; border-color: var(--brand-teal); }
.config-actions { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.config-msg { font-size: 12px; }
.config-msg.ok { color: var(--status-good); }
.config-msg.err { color: var(--status-bad); }
.config-historico { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 10px; }
.config-historico-item { display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 6px 0; font-size: 12px; color: var(--text-muted); }
.config-historico-item .venc-data { font-family: 'DM Sans', sans-serif; font-weight: 700;
  color: var(--brand-mint); min-width: 78px; }
.config-historico-item .venc-valor { flex: 1; color: var(--text); }
.config-historico-item .venc-meta { color: var(--text-dim); font-size: 10.5px; white-space: nowrap; }
.config-historico-item .venc-del { background: none; border: none; color: var(--status-bad);
  cursor: pointer; font-size: 11px; padding: 2px 6px; opacity: 0.7; }
.config-historico-item .venc-del:hover { opacity: 1; }
.config-historico-vazio { font-size: 12px; color: var(--text-dim); font-style: italic; padding: 4px 0; }
.config-radio-group { display: flex; flex-direction: column; gap: 10px; margin: 14px 0; }
.config-radio { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 13px;
  color: var(--text-muted); line-height: 1.5; }
.config-radio input[type="radio"] { margin-top: 3px; accent-color: var(--brand-teal); flex-shrink: 0; }
.config-radio strong { color: var(--text); }

/* Views */
.view { display: none; animation: fadeIn 0.25s ease; }
.view.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.page-title { min-width: 0; }
.page-title h1 { word-break: break-word; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.nav-overlay { display: none; }
.pwa-install { display: none; }
.pwa-install.is-visible { display: inline-flex; }
.mobile-menu { display: none; background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text); border-radius: var(--radius-sm); padding: 10px 12px; margin: 0 8px 8px 0;
  min-width: 44px; min-height: 44px; align-items: center; justify-content: center; }

@media (max-width: 1279px) {
  .hero { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart-box { height: 300px; }
}

@media (max-width: 1023px) {
  .app { grid-template-columns: 1fr; }
  .nav-overlay { display: block; position: fixed; inset: 0; background: rgba(0, 8, 16, 0.55);
    z-index: 90; opacity: 0; pointer-events: none; transition: opacity 0.2s; }
  .nav-overlay.open { opacity: 1; pointer-events: auto; }
  .sidebar { position: fixed; z-index: 100; width: min(86vw, 300px); height: 100vh; max-height: 100vh;
    transform: translateX(-105%); transition: transform 0.25s ease; box-shadow: var(--shadow-md); }
  .sidebar.open { transform: translateX(0); }
  .mobile-menu { display: inline-flex; }
  .main { padding: 16px 16px 80px; }
  .filters { grid-template-columns: 1fr 1fr; }
  .config-form-row { grid-template-columns: 1fr; }
  .doc-wrapper { display: block; }
}

@media (max-width: 639px) {
  .filters { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr; }
  .page-title h1 { font-size: 22px; }
  .kpi-value { font-size: 28px; }
  .score-value-big { font-size: 44px; }
  .chart-box { height: 240px; }
  .btn, .btn-ghost, .compare-toggle { min-height: 44px; }
}

/* ── Relatório executivo (site-antigo portado) ─────────────────────────────── */
.empty-st {
  padding: 48px 24px; text-align: center; color: var(--text-muted);
  border: 1px dashed var(--border); border-radius: var(--radius); margin-top: 12px;
}
.report-meta {
  display: flex; justify-content: space-between; gap: 20px; align-items: flex-start;
  margin-bottom: 16px; flex-wrap: wrap;
}
.report-period { color: var(--text-muted); font-size: .82rem; margin-top: 6px; }
.report-meta-side { text-align: right; font-size: .78rem; color: var(--text-muted); line-height: 1.6; }
.report-meta-side strong { color: var(--text); font-size: .88rem; }
.sbadge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px; font-size: .78rem; font-weight: 700;
  border: 1px solid var(--border);
}
.sbadge.excelente { color: var(--status-good); background: var(--status-good-bg); border-color: rgba(0,170,158,.35); }
.sbadge.bom { color: var(--brand-mint); background: rgba(69,220,209,.1); }
.sbadge.atencao { color: var(--status-warn); background: var(--status-warn-bg); border-color: rgba(245,166,35,.35); }

.ind-bar {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin: 8px 0 18px; padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--bg-card); border: 1px solid var(--border);
}
.ind-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); margin-right: 4px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px;
  border-radius: 999px; border: 1px solid var(--border); background: transparent;
  color: var(--text-muted); font-size: .75rem; cursor: pointer; user-select: none;
}
.chip.on { color: var(--text); border-color: var(--border-strong); background: rgba(0,170,158,.12); }
.chip-all {
  border: none; background: transparent; color: var(--brand-teal);
  font-size: .75rem; font-weight: 600; padding: 4px 6px;
}

.kgrid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px; margin-bottom: 18px;
}
.kpi {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px 14px 12px; transition: border-color .2s, transform .2s;
}
.kpi:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.kpi.ok { border-color: rgba(0,170,158,.28); }
.kpi.warn { border-color: rgba(245,166,35,.28); }
.kpi.bad { border-color: rgba(239,83,80,.28); }
.klbl { font-size: .72rem; color: var(--text-muted); margin-bottom: 6px; }
.kvrow { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.kval { font-size: 1.7rem; font-weight: 700; letter-spacing: -.02em; }
.kpi.ok .kval { color: var(--status-good); }
.kpi.warn .kval { color: var(--status-warn); }
.kpi.bad .kval { color: var(--status-bad); }
.kbadge {
  font-size: .65rem; font-weight: 700; padding: 2px 7px; border-radius: 999px;
  background: rgba(255,255,255,.06); color: var(--text-muted);
}
.kbadge.ok { color: var(--status-good); background: var(--status-good-bg); }
.kbadge.warn { color: var(--status-warn); background: var(--status-warn-bg); }
.kbadge.bad { color: var(--status-bad); background: var(--status-bad-bg); }
.kbadge.info { color: var(--brand-mint); }
.ksub { font-size: .72rem; color: var(--text-dim); margin-top: 4px; }
.kbar { height: 3px; background: rgba(128,128,128,.15); border-radius: 2px; margin-top: 10px; overflow: hidden; }
.kfill { height: 100%; border-radius: 2px; }

.charts-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px;
}
.cc {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; position: relative;
}
.ch { font-size: .85rem; font-weight: 600; margin-bottom: 8px; }
.cw { height: 260px; position: relative; }

.card-block {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; margin-top: 14px;
}
.team-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 12px; }
.team-col { background: rgba(0,0,0,.12); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; }
.team-col-header { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.team-col-name { font-weight: 700; font-size: .9rem; }
.team-col-count { font-size: 1.4rem; font-weight: 700; text-align: right; }
.team-col-badge { font-size: .65rem; color: var(--text-dim); }
.team-bar { height: 3px; background: rgba(128,128,128,.15); border-radius: 2px; margin-bottom: 10px; }
.team-bar > div { height: 100%; border-radius: 2px; }
.team-assunto-item {
  display: flex; align-items: center; gap: 8px; padding: 6px 4px;
  border-radius: 6px; cursor: pointer; font-size: .78rem;
}
.team-assunto-item:hover { background: rgba(0,170,158,.08); }
.team-assunto-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.team-assunto-txt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-assunto-cnt { font-weight: 700; font-size: .72rem; white-space: nowrap; }

.emsg { font-size: .9rem; line-height: 1.7; color: var(--text-muted); }
.emsg strong { color: var(--text); }
.emsg ul { margin: 10px 0 10px 20px; line-height: 2; }

.tag {
  display: inline-block; padding: 2px 7px; border-radius: 999px; font-size: .68rem; font-weight: 600;
  background: rgba(128,128,128,.12); color: var(--text-muted); white-space: nowrap;
}
.tag.crítica, .tag.critica, .tag.alta { color: var(--status-bad); background: var(--status-bad-bg); }
.tag.média, .tag.media { color: var(--status-warn); background: var(--status-warn-bg); }
.tag.baixa { color: var(--status-good); background: var(--status-good-bg); }
.tag.no-prazo { color: var(--status-good); background: var(--status-good-bg); }
.tag.fora-prazo { color: var(--status-bad); background: var(--status-bad-bg); }
.tag.novo, .tag.em-atendimento, .tag.aguardando { color: var(--brand-mint); background: rgba(69,220,209,.12); }

.status-banner {
  margin: 8px 0 12px; padding: 10px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-card); color: var(--text-muted); font-size: .85rem;
}
.status-banner.error { color: var(--status-bad); background: var(--status-bad-bg); border-color: rgba(239,83,80,.35); }
.status-banner.ok { color: var(--status-good); background: var(--status-good-bg); border-color: rgba(0,170,158,.35); }

.filter-empresa { min-width: 260px; }
.filter-empresa .empresa-search {
  height: 34px !important;
  margin-bottom: 6px;
  font-size: 12px;
}
.filter-empresa .empresa-select {
  height: auto !important;
  min-height: 148px;
  padding: 6px 8px !important;
  font-size: 12px;
  line-height: 1.45;
}
.filter-empresa .empresa-select option { padding: 4px 6px; border-radius: 4px; }
.filter-hint {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.35;
}
.filter-actions .btn { align-self: flex-start; margin-top: 18px; }
.accent-text { color: var(--brand-teal); }
.muted { color: var(--text-muted); }
.tiny { font-size: .65rem; }
.ellipsis { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.center { text-align: center; }
.error-text { color: var(--status-bad); }
.note-cell { font-size: .75rem; white-space: pre-wrap; min-width: 120px; max-width: 200px; }

#loading {
  position: fixed; inset: 0; z-index: 80; display: none; place-items: center;
  background: rgba(0,0,0,.45); backdrop-filter: blur(4px); color: var(--text);
}
#loading.active { display: grid; }
#loading .spinner {
  width: 36px; height: 36px; border: 3px solid rgba(255,255,255,.15);
  border-top-color: var(--brand-teal); border-radius: 50%; animation: spin .8s linear infinite;
  margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.bk-modal-overlay {
  position: fixed; inset: 0; z-index: 90; display: none; place-items: center;
  background: rgba(0,0,0,.55); padding: 16px;
}
.bk-modal-overlay.open { display: grid; }
.bk-modal {
  width: min(520px, 100%); background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-md);
}
.bk-modal h3 { margin-bottom: 4px; }
.bk-modal-sub { color: var(--text-muted); font-size: .82rem; margin-bottom: 14px; }
.bk-modal label { display: block; font-size: .72rem; color: var(--text-dim); margin: 10px 0 4px; text-transform: uppercase; letter-spacing: .04em; }
.bk-modal textarea {
  width: 100%; background: var(--bg-input); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); padding: 8px 10px; resize: vertical; font-family: inherit;
}
.bk-modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.bk-edit-btn {
  border: 1px solid var(--border); background: transparent; color: var(--brand-teal);
  border-radius: 6px; padding: 4px 8px; font-size: .72rem;
}

@media (max-width: 960px) {
  .charts-row, .team-row { grid-template-columns: 1fr; }
  .cw { height: 220px; }
}
