/* paleta da marca Liga Solidária (logo: navy + chama azul/laranja/vermelha) */
:root {
  --ls-navy:   #001a8c;   /* texto "Liga Solidária" */
  --ls-navy-d: #00136b;
  --ls-blue:   #0a5cd6;   /* azul da chama */
  --ls-blue-d: #0848aa;
  --ls-blue-l: #cfe0f8;
  --ls-amber:  #f5a623;   /* laranja da chama */
  --ls-red:    #e8181f;   /* vermelho da chama */
  --ls-link:   #0a5cd6;
}

* { box-sizing: border-box; }
body { font: 14px/1.5 -apple-system, "Segoe UI", Roboto, Arial, sans-serif; margin: 0; color: #1f2733; background: #f4f6f9; }
a { color: var(--ls-link); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: #6b7785; }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; }
.warn { color: #c77700; font-weight: 600; }

/* barra do topo: branca com o logo da Liga; faixa fina com as cores da chama acima */
.topbar { position: relative; display: flex; align-items: center; gap: 22px; background: #fff; color: var(--ls-navy);
  padding: 8px clamp(14px, 2vw, 40px); border-bottom: 1px solid #e1e7ef; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.topbar::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: linear-gradient(90deg, var(--ls-blue) 0 33%, var(--ls-amber) 33% 66%, var(--ls-red) 66% 100%); }
.topbar .brand { display: flex; align-items: center; gap: 14px; color: var(--ls-navy); text-decoration: none; }
.topbar .brand:hover { text-decoration: none; }
.topbar .brand-logo { height: 38px; width: auto; display: block; }
.topbar .brand-sep { width: 1px; align-self: stretch; background: #d8dee8; margin: 2px 0; }
.topbar .brand-title { font-weight: 700; font-size: 15px; color: var(--ls-navy); line-height: 1.2; }
.topbar .brand-title .brand-sub { color: #8a96a5; font-weight: 600; }
.topbar nav { display: flex; gap: 18px; margin-left: auto; }
.topbar nav a { color: var(--ls-navy); font-weight: 600; }
.topbar nav a.muted { color: #8a96a5; font-weight: 500; }
.topbar nav a:hover { color: var(--ls-blue); }

/* "chip" do usuário logado (canto direito da topbar) */
.topbar .user-chip { display: flex; align-items: center; gap: 8px; margin-left: 18px; padding: 4px 10px; background: #f1f5fa; border: 1px solid #e1e7ef; border-radius: 999px; font-size: 13px; }
.topbar .user-chip .user-name { color: var(--ls-navy); font-weight: 600; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .user-chip .user-role { background: var(--ls-blue); color: #fff; padding: 1px 7px; border-radius: 999px; font-size: 11px; text-transform: uppercase; letter-spacing: .3px; }
.topbar .user-chip .user-logout { color: #8a96a5; font-size: 16px; text-decoration: none; padding: 0 4px; border-radius: 4px; }
.topbar .user-chip .user-logout:hover { background: var(--ls-red); color: #fff; }

main { width: 100%; box-sizing: border-box; margin: 22px 0; padding: 0 clamp(14px, 2vw, 40px); }
footer.muted { width: 100%; box-sizing: border-box; margin: 30px 0; padding: 14px clamp(14px, 2vw, 40px) 30px; font-size: 12px;
  display: flex; align-items: center; gap: 8px; border-top: 1px solid #e7ecf2; }
footer .footer-flame { height: 18px; width: auto; opacity: .85; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
h1 { font-size: 20px; margin: 8px 0; color: var(--ls-navy); }

.btn { display: inline-block; background: var(--ls-blue); color: #fff; padding: 7px 14px; border-radius: 6px; border: 0; cursor: pointer; font-size: 14px; text-decoration: none; }
.btn:hover { background: var(--ls-blue-d); text-decoration: none; }
.btn.ghost { background: #fff; color: var(--ls-blue); border: 1px solid #c3d4ea; }
.btn.ghost:hover { background: #f3f7fd; }
.btn.small { padding: 3px 9px; font-size: 12.5px; border-radius: 5px; }
.btn.danger { background: var(--ls-red); }
.btn.danger:hover { background: #b81117; }
.link { background: none; border: 0; color: var(--ls-link); cursor: pointer; padding: 0; font: inherit; }
.link.danger { color: var(--ls-red); }

/* coluna de ações fixa ao rolar horizontalmente */
.sticky-col { position: sticky; left: 0; z-index: 2; background: #fff; box-shadow: 2px 0 4px -2px rgba(0,0,0,.15); }
thead .sticky-col { background: #f7f9fc; z-index: 3; }
tr:hover td.sticky-col { background: #f9fbfe; }
tr.inactive td.sticky-col { background: #fff; }

.danger-zone { background: #fff5f5; border: 1px solid #f3c2c2; border-radius: 8px; padding: 14px 18px; max-width: 760px; margin-top: 22px; }
.danger-zone h3 { margin-top: 0; color: #a31515; }

.glossary { background: #fff; border: 1px solid #e1e7ef; border-radius: 8px; padding: 6px 14px; margin: 6px 0 16px; }
.glossary summary { cursor: pointer; font-weight: 600; color: #34404f; padding: 6px 0; }
.glossary ul { margin: 6px 0 12px; padding-left: 22px; }
.glossary li { margin-bottom: 7px; }
td[title] { cursor: help; }

/* ---- cards de insights ---- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 14px; margin: 4px 0 20px; }
.card { background: #fff; border: 1px solid #e1e7ef; border-radius: 10px; padding: 14px 16px; }
.card .lbl { color: #6b7785; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.card.metric .num { font-size: 30px; font-weight: 700; line-height: 1.1; margin-top: 6px; color: var(--ls-navy); }
.card.metric .num .of { font-size: 15px; font-weight: 500; color: #8a96a5; }
.card.metric .sub { margin-top: 4px; font-size: 12.5px; color: #6b7785; }
.card.metric.warnish { border-color: #f0d28a; background: #fffdf5; }
.card.list ul { list-style: none; margin: 10px 0 0; padding: 0; }
.card.list li { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; padding: 3px 0; font-size: 13px; position: relative; }
.card.list li .bar { position: absolute; left: 0; bottom: 0; height: 3px; width: var(--p, 0%); background: var(--ls-blue-l); border-radius: 2px; }
.card.list li .v { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card.list li .c { font-weight: 700; color: var(--ls-blue); font-variant-numeric: tabular-nums; white-space: nowrap; }
.card.list li .c .pct { font-weight: 500; color: #8a96a5; font-size: 12px; }

/* ---- controles da tabela (busca + filtros) ---- */
#table-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 4px 0 10px; }
#table-controls #filtro-texto { flex: 1 1 320px; min-width: 220px; padding: 7px 10px; border: 1px solid #c3d0e0; border-radius: 6px; font: inherit; }
#cat-filters { display: flex; flex-wrap: wrap; gap: 8px; }
#cat-filters select { padding: 6px 8px; border: 1px solid #c3d0e0; border-radius: 6px; font: inherit; background: #fff; max-width: 230px; }
#row-count { margin-left: auto; font-size: 12.5px; white-space: nowrap; }

th.th-sortable { cursor: pointer; user-select: none; }
th.th-sortable:hover { background: #eef3fa; }
th .sort-arrow { color: #9aa6b4; font-size: 11px; }
th.sorted-asc .sort-arrow, th.sorted-desc .sort-arrow { color: var(--ls-blue); }

/* ---- gráficos de barras (Analytics) ---- */
h3 { margin: 18px 0 8px; font-size: 15px; color: var(--ls-navy); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }
.chart-card { background: #fff; border: 1px solid #e1e7ef; border-radius: 10px; padding: 14px 16px 8px; margin-bottom: 14px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 12px; color: #6b7785; margin-bottom: 10px; }
.chart-legend .sw { display: inline-block; width: 11px; height: 11px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.sw.arme, .seg.arme { background: var(--ls-blue); }
.sw.desarme, .seg.desarme { background: var(--ls-amber); }
.chart-bars { display: flex; align-items: flex-end; gap: 4px; height: 170px; overflow-x: auto; padding-bottom: 2px; }
.chart-bars.hours { gap: 2px; }
.chart-bars .bar-col { flex: 1 0 auto; min-width: 22px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.chart-bars.hours .bar-col { min-width: 14px; }
.chart-bars .bar-col.wknd { background: linear-gradient(#f4f6f9, #f4f6f9) no-repeat; background-size: 70% 100%; background-position: center; border-radius: 3px; }
.chart-bars .bar-num { font-size: 10px; color: #8a96a5; height: 12px; line-height: 12px; }
.chart-bars .bar-stack { width: 68%; max-width: 26px; min-height: 2px; display: flex; flex-direction: column; border-radius: 2px 2px 0 0; overflow: hidden; }
.chart-bars .bar-stack .seg { width: 100%; }
.chart-bars .bar-label { font-size: 9.5px; color: #6b7785; margin-top: 4px; text-align: center; line-height: 1.15; white-space: nowrap; }
.chart-bars.hours .bar-label { font-size: 9px; }
code { background: #eef2f7; padding: 1px 5px; border-radius: 4px; font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }
tr.warnish-row td { background: #fffdf5; }
tr.warnish-row:hover td { background: #fffaf0; }
.page-head select, label select { padding: 5px 7px; border: 1px solid #c3d0e0; border-radius: 5px; font: inherit; background: #fff; }

/* ---- responsividade ---- */
@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; gap: 8px 18px; padding: 8px 14px; }
  h1 { font-size: 18px; }
  .page-head { flex-wrap: wrap; }
  .form-grid, .danger-zone, .table-wrap { max-width: 100%; }
  .newkey { flex-wrap: wrap; }
}

.table-wrap { overflow-x: auto; background: #fff; border: 1px solid #e1e7ef; border-radius: 8px; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 7px 10px; border-bottom: 1px solid #eef2f7; text-align: left; vertical-align: top; white-space: nowrap; }
th { background: #f7f9fc; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: #5a6675; position: sticky; top: 0; }
tr:hover td { background: #f9fbfe; }
tr.inactive td { opacity: .5; }
td.actions { white-space: nowrap; }
td.actions a, td.actions form { margin-right: 8px; }

.form-grid { background: #fff; border: 1px solid #e1e7ef; border-radius: 8px; padding: 18px; max-width: 760px; }
fieldset { border: 1px solid #e1e7ef; border-radius: 6px; padding: 12px 16px; margin-bottom: 18px; }
legend { font-weight: 600; color: #34404f; padding: 0 6px; }
label { display: block; margin-bottom: 12px; font-weight: 600; color: #34404f; }
label input[type=text], label input:not([type]), label input[type=email], label textarea, .newkey input {
  display: block; width: 100%; margin-top: 4px; padding: 7px 9px; border: 1px solid #c3d0e0; border-radius: 5px; font: inherit; font-weight: 400; }
label.check { font-weight: 400; }
label.check input { margin-right: 6px; }
label small { display:block; font-weight: 400; margin-top: 3px; }
.newkey { display: flex; gap: 10px; margin-bottom: 12px; }
.newkey input { flex: 1; }
.form-actions { margin-top: 8px; display: flex; gap: 10px; }
h3 { margin: 18px 0 8px; font-size: 15px; }
