:root {
  /* paleta idêntica à do dashboard.teksea.net (index.php) */
  --brand: #006161;
  --brand-mid: #008080;
  --brand-light: #00a8a8;
  --brand-glow: rgba(0, 168, 168, 0.18);

  --bg: #0d1117;
  --surface: #161b22;
  --surface-2: #1f2630;
  --border: rgba(0, 128, 128, 0.28);
  --border-strong: #1e3535;
  --text: #e6edf3;
  --muted: #8b949e;

  --accent: var(--brand-light);
  --accent-soft: var(--brand-glow);

  --good: #3fb950;
  --good-soft: rgba(63, 185, 80, 0.1);
  --warn: #f59e0b;
  --warn-soft: rgba(245, 158, 11, 0.1);
  --bad: #f85149;
  --bad-soft: rgba(248, 81, 73, 0.1);
  --danger: var(--bad);
  --danger-soft: var(--bad-soft);

  --c-novo: #3b82f6;
  --c-andamento: #a78bfa;
  --c-pausado: #f59e0b;
  --c-aguardando: #06b6d4;
  --c-fechados: #22c55e;
  --c-abertos: #f59e0b;
  --c-cancelados: #64748b;
  --c-total: #00d4aa;

  --mono: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: 14px;
  line-height: 1.6;
}

.num { font-variant-numeric: tabular-nums; }

/* ── SHELL / SIDEBAR ────────────────────────────────────── */
.shell { display: flex; align-items: flex-start; min-height: 100vh; }

.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  min-height: 100vh;
  position: sticky;
  top: 0;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand { padding: 0 8px; }
.brand-row { display: flex; align-items: center; gap: 10px; font-size: 15.5px; font-weight: 700; letter-spacing: .2px; }
.brand img { height: 22px; width: auto; opacity: .9; }
.brand em { font-style: normal; color: var(--accent); }
.brand-sub { display: block; font-size: 10px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; margin-top: 4px; }

.side-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }

.side-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: transparent;
  border: none;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 11px 12px;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background 0.15s, color 0.15s;
}
.side-item .ico { width: 18px; text-align: center; flex-shrink: 0; opacity: .8; }
.side-item:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }
.side-item.active { background: var(--accent-soft); color: var(--accent); }

.side-foot { display: flex; flex-direction: column; gap: 10px; padding: 0 8px; }
.sync-info { font-size: 11.5px; color: var(--muted); }

.content-area { flex: 1; min-width: 0; padding: 18px 28px 48px; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 9px 18px;
  border-radius: 10px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.btn-primary:hover { background: var(--brand-mid); }
.btn-primary:disabled { opacity: .6; cursor: wait; }
.side-foot .btn-primary { width: 100%; }

/* ── TOOLBAR / FILTER ───────────────────────────────────── */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 16px;
}

.filter { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }

.filter input[type="date"], .filter input[type="text"], .filter select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 10px;
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
  outline: none;
}
.filter input:focus, .filter select:focus { border-color: var(--accent); }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 16px;
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.link-reset { color: var(--muted); font-size: 12px; text-decoration: underline; cursor: pointer; }

.range-pill {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--brand);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

/* ── ALERT ──────────────────────────────────────────────── */
.alert {
  background: var(--good-soft);
  border: 1.5px solid #2ea043;
  color: var(--good);
  border-radius: 10px;
  padding: 11px 18px;
  font-size: 13px;
  margin-bottom: 14px;
}
.alert.error { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }

/* ── VIEWS ──────────────────────────────────────────────── */
.view { display: none; }
.view.active { display: block; }

/* ── HERO KPIs — uma linha só de 6, compacto ── */
.hero-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; margin-bottom: 16px; }

.hero-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 2px solid var(--accent-c, var(--accent));
  border-radius: 12px;
  padding: 14px 16px;
}

.hero-card .label { font-size: 10.5px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .4px; }
.hero-card .value { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 25px; font-weight: 800; margin-top: 6px; color: var(--accent-c, var(--text)); line-height: 1; }
.hero-card .hint { font-size: 10px; color: var(--muted); margin-top: 4px; }

/* ── LAYOUT ─────────────────────────────────────────────── */
.layout-grid { display: grid; grid-template-columns: 1fr 320px; gap: 14px; align-items: start; }
.col-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.col-side { display: flex; flex-direction: column; gap: 14px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
}
.card-head { font-size: 11.5px; font-weight: 700; color: var(--text); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 14px; display: flex; justify-content: space-between; align-items: center; }
.card-head .muted { font-weight: 500; color: var(--muted); font-size: 11px; text-transform: none; letter-spacing: 0; }

.chart-box { position: relative; height: 210px; }

/* ── DONUT ──────────────────────────────────────────────── */
.donut-row { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.donut-box { position: relative; width: 150px; height: 150px; flex-shrink: 0; }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.donut-center span { font-size: 19px; font-weight: 800; }
.donut-center small { font-size: 10px; color: var(--muted); }

.legend-list { flex: 1; min-width: 160px; display: flex; flex-direction: column; gap: 8px; }
.legend-row-item { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.legend-row-item .sw { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }
.legend-row-item b { color: var(--text); font-weight: 700; margin-left: auto; }

.perf-row { display: flex; gap: 8px; margin-top: 14px; }
.perf-box { flex: 1; background: var(--surface-2); border-radius: 12px; padding: 12px; text-align: center; }
.perf-box .v { font-size: 16px; font-weight: 800; }
.perf-box .l { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-top: 2px; }

/* ── RANKED LIST ────────────────────────────────────────── */
.ranked-list { display: flex; flex-direction: column; gap: 12px; }
.ranked-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.ranked-row .name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ranked-row .track { flex: 1.4; height: 6px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.ranked-row .fill { height: 100%; background: var(--accent); border-radius: 4px; }
.ranked-row .n { width: 28px; text-align: right; color: var(--muted); font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ── META RING ──────────────────────────────────────────── */
.meta-ring-wrap { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-bottom: 18px; }
.meta-ring {
  width: 148px; height: 148px; border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--pct) * 1%), var(--surface-2) 0);
  display: flex; align-items: center; justify-content: center;
}
.meta-ring-inner { width: 114px; height: 114px; border-radius: 50%; background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.meta-ring-inner .pct { font-family: var(--mono); font-size: 24px; font-weight: 900; }
.meta-ring-inner .lbl { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-top: 2px; text-align: center; }
.meta-counts { font-size: 12.5px; color: var(--muted); text-align: center; }
.meta-counts b { color: var(--text); }

.meta-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 16px 0; }
.meta-stat { background: var(--surface-2); border-radius: 10px; padding: 10px 6px; text-align: center; }
.meta-stat .v { font-family: var(--mono); font-size: 16px; font-weight: 800; }
.meta-stat .l { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; margin-top: 2px; }

.meta-pace { display: flex; align-items: center; gap: 6px; padding: 9px 12px; border-radius: 10px; font-size: 11.5px; font-weight: 600; }
.meta-pace.on { background: var(--good-soft); color: var(--good); }
.meta-pace.off { background: var(--bad-soft); color: var(--bad); }

/* ── SLA ────────────────────────────────────────────────── */
.sla-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 4px; }
.sla-stat { background: var(--surface-2); border-radius: 10px; padding: 12px; text-align: center; }
.sla-stat .v { font-family: var(--mono); font-size: 20px; font-weight: 800; }
.sla-stat .l { font-size: 9.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; margin-top: 3px; }
.sla-bar { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; margin: 12px 0 6px; }
.sla-bar .fill { height: 100%; border-radius: 4px; }
.sla-caption { font-size: 11px; color: var(--muted); text-align: center; }
.sla-overdue-banner {
  display: flex; align-items: center; gap: 8px;
  background: var(--bad-soft); border: 1px solid var(--bad); color: var(--bad);
  border-radius: 10px; padding: 9px 12px; font-size: 12px; font-weight: 600; margin-top: 12px;
}

/* MODULO SLA */
.sla-overview-grid { display: grid; grid-template-columns: 360px 1fr; gap: 14px; margin-bottom: 14px; align-items: stretch; }
.sla-hero-card { display: flex; flex-direction: column; }

.sla-hero-row { display: flex; align-items: center; gap: 22px; margin-bottom: 16px; }
.sla-hero-ring {
  width: 108px; height: 108px; border-radius: 50%; flex-shrink: 0;
  background: conic-gradient(var(--ring-c, var(--accent)) calc(var(--pct) * 1%), var(--surface-2) 0);
  display: flex; align-items: center; justify-content: center;
}
.sla-hero-ring-inner { width: 82px; height: 82px; border-radius: 50%; background: var(--surface); display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 19px; font-weight: 800; }
.sla-hero-caption { font-size: 12px; color: var(--muted); }
.sla-hero-caption b { color: var(--text); }

.rate-cell { display: flex; align-items: center; gap: 10px; }
.rate-cell .pct { font-family: var(--mono); font-weight: 700; width: 34px; text-align: right; flex-shrink: 0; }
.rate-cell .track { flex: 1; height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.rate-cell .track .fill { height: 100%; border-radius: 3px; }

/* ── TABELA DE CHAMADOS ─────────────────────────────────── */
.simple-table { width: 100%; border-collapse: collapse; }
.simple-table th { text-align: left; font-size: 10px; text-transform: uppercase; color: var(--muted); padding: 10px 16px; border-bottom: 1px solid var(--border); font-weight: 700; letter-spacing: .5px; }
.simple-table td { padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; line-height: 1.4; }
.simple-table tr:last-child td { border-bottom: none; }
.simple-table tr:hover td { background: rgba(255, 255, 255, 0.02); }

.status-chip { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.status-chip.novo { background: rgba(59, 130, 246, .12); color: var(--c-novo); }
.status-chip.andamento { background: rgba(167, 139, 250, .12); color: var(--c-andamento); }
.status-chip.pausado { background: rgba(245, 158, 11, .12); color: var(--c-pausado); }
.status-chip.cancelado { background: rgba(100, 116, 139, .18); color: var(--c-cancelados); }
.status-chip.resolvido, .status-chip.fechado { background: rgba(34, 197, 94, .12); color: var(--c-fechados); }
.status-chip.atraso { background: var(--bad-soft); color: var(--bad); margin-left: 6px; }

.result-count { color: var(--muted); font-size: 12px; margin-left: auto; }
.empty-row { color: var(--muted); text-align: center; padding: 24px 0 !important; }

.pagination { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 16px; flex-wrap: wrap; }
.page-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 8px;
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
  min-width: 34px;
}
.page-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.page-btn:disabled { opacity: .35; cursor: default; }
.page-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.page-info { color: var(--muted); font-size: 12px; margin: 0 8px; }

/* ── ATUALIZAÇÕES ───────────────────────────────────────── */
.feed-list { display: flex; flex-direction: column; }

.feed-day-head {
  font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .6px;
  padding: 18px 4px 8px; border-bottom: 1px solid var(--border);
}
.feed-day-head:first-child { padding-top: 4px; }

.feed-row { display: flex; align-items: center; gap: 14px; padding: 13px 4px; border-bottom: 1px solid var(--border); font-size: 13px; }
.feed-row:last-child { border-bottom: none; }
.feed-row:hover { background: rgba(255, 255, 255, 0.02); }
.feed-row .fid { color: var(--muted); font-family: var(--mono); font-variant-numeric: tabular-nums; width: 58px; flex-shrink: 0; }
.feed-row .fsubject { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-row .fagent { color: var(--muted); width: 190px; flex-shrink: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-row .fwhen { color: var(--muted); width: 90px; text-align: right; flex-shrink: 0; }

.activity-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; width: 96px; flex-shrink: 0; }
.activity-chip::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.activity-chip.criado { color: var(--c-novo); }
.activity-chip.atualizado { color: var(--c-andamento); }
.activity-chip.resolvido { color: var(--c-fechados); }
.activity-chip.fechado { color: var(--brand-light); }

.empty-feed { color: var(--muted); text-align: center; padding: 32px 0; }

/* ── TEMAS ──────────────────────────────────────────────── */
.theme-list { display: flex; flex-direction: column; gap: 12px; }

.theme-row {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: transparent; border: none; padding: 8px; border-radius: 10px;
  font: inherit; color: inherit; transition: background .15s;
}
.theme-row:hover { background: rgba(255, 255, 255, 0.04); }
.theme-row.uncategorized { opacity: .68; margin-top: 8px; padding-top: 16px; border-top: 1px dashed var(--border); }
.theme-row.uncategorized:hover { opacity: .9; }

.theme-row .top { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 6px; }
.theme-row .top .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--theme-c, var(--accent)); flex-shrink: 0; }
.theme-row .top .name { flex: 1; }
.theme-row .top .pct { color: var(--muted); font-size: 11.5px; font-family: var(--mono); }
.theme-row .top .n { font-weight: 800; font-family: var(--mono); min-width: 44px; text-align: right; }
.theme-row .track { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.theme-row .fill { height: 100%; background: var(--theme-c, var(--accent)); border-radius: 4px; }

/* ── ADMIN ──────────────────────────────────────────────── */
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.admin-grid .card:last-child { grid-column: 1 / -1; }

.admin-form { display: flex; flex-direction: column; gap: 14px; max-width: 360px; }
.admin-form label { font-size: 12px; color: var(--muted); font-weight: 600; }
.admin-form input { background: var(--surface-2); border: 1px solid var(--border); color: var(--text); padding: 9px 12px; border-radius: 8px; font: inherit; outline: none; }
.admin-form input:focus { border-color: var(--accent); }
.admin-msg { font-size: 12.5px; margin-top: 4px; }
.admin-msg.ok { color: var(--good); }
.admin-msg.err { color: var(--danger); }

.sync-status-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.sync-stat { background: var(--surface-2); border-radius: 10px; padding: 12px 14px; }
.sync-stat .l { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; font-weight: 700; }
.sync-stat .v { font-family: var(--mono); font-size: 15px; font-weight: 800; margin-top: 4px; }
.sync-error-box { background: var(--bad-soft); border: 1px solid var(--bad); color: var(--bad); border-radius: 10px; padding: 10px 12px; font-size: 12.5px; margin-top: 12px; }

.about-list { display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--muted); }
.about-list b { color: var(--text); }

#error { color: var(--danger); margin-top: 18px; font-size: 13px; }

@media (max-width: 1100px) {
  .hero-grid { grid-template-columns: repeat(4, 1fr); }
  .layout-grid { grid-template-columns: 1fr; }
  .sla-overview-grid { grid-template-columns: 1fr; }
  .admin-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .hero-grid { grid-template-columns: repeat(2, 1fr); }
  .two-col { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; min-height: auto; position: relative; flex-direction: row; align-items: center; overflow-x: auto; gap: 16px; }
  .side-nav { flex-direction: row; flex: none; }
  .side-item { white-space: nowrap; }
  .side-foot { flex-direction: row; padding: 0; }
  .content-area { padding: 20px 16px 48px; }
}

/* ── DRILL-DOWN: elementos clicáveis + modal ────────────────── */
.clickable { cursor: pointer; border-radius: 6px; transition: background .15s; }
.clickable:hover { background: rgba(255, 255, 255, 0.06); text-decoration: underline; text-underline-offset: 3px; }

.modal-backdrop {
  display: none;
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0, 0, 0, 0.6);
  align-items: center; justify-content: center;
  padding: 24px;
}
.modal-backdrop.open { display: flex; }

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  width: min(980px, 100%);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; }
.modal-close { background: transparent; border: none; color: var(--muted); font-size: 16px; cursor: pointer; padding: 4px 8px; border-radius: 6px; }
.modal-close:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }

.modal-body { padding: 8px 20px 20px; overflow-y: auto; }
