/* Escala 5x2 · estrutura da página: barra superior, coluna de ajustes e área principal. */
.app { min-height: 100vh; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3) var(--sp-5);
  padding: var(--sp-3) var(--sp-5);
  background: var(--topbar-bg); border-bottom: 1px solid var(--topbar-line);
}
.brand { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; margin-right: auto; }
.brand-mark {
  flex: none; width: 40px; height: 40px; border-radius: var(--r-2);
  display: grid; place-items: center; background: var(--brand); color: var(--brand-ink);
}
.brand-mark svg { width: 22px; height: 22px; }
.brand h1 { font-size: var(--fs-5); line-height: 1.1; }
.brand p { font-size: var(--fs-2); color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46ch; }

.topbar-status { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.period { font-size: var(--fs-2); color: var(--ink-2); font-weight: 500; }
.status {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  height: 30px; padding: 0 var(--sp-3); border-radius: 999px;
  background: var(--surface-3); color: var(--ink-2); font-size: var(--fs-2); font-weight: 600;
  border: 0; cursor: pointer; font-family: inherit;
}
.status:hover { filter: brightness(0.96); }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status.is-ok { background: var(--ok-soft); color: var(--ok); }
.status.is-bad { background: var(--bad-soft); color: var(--bad); }

.topbar-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); }

.shell {
  display: grid; grid-template-columns: minmax(330px, 390px) minmax(0, 1fr);
  gap: var(--sp-5); align-items: start;
  max-width: 1760px; margin: 0 auto; padding: var(--sp-5);
}

/* ---- coluna de ajustes ---- */
.side {
  position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-3);
  scrollbar-width: thin;
}
.panel { border-bottom: 1px solid var(--line); }
.panel:last-child { border-bottom: 0; }
.panel > summary {
  display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-4) var(--sp-4);
  cursor: pointer; list-style: none; font-weight: 600; user-select: none;
}
.panel > summary::-webkit-details-marker { display: none; }
.panel > summary:hover { background: var(--surface-2); }
.panel > summary .ico { color: var(--ink-3); }
.panel > summary .ico svg { width: 18px; height: 18px; }
.panel > summary .t { flex: 1; font-family: var(--font-display); font-size: var(--fs-4); }
.panel > summary .chev { color: var(--ink-3); transition: transform 0.15s ease; }
.panel > summary .chev svg { width: 16px; height: 16px; }
.panel[open] > summary .chev { transform: rotate(180deg); }
.panel-body { display: flex; flex-direction: column; gap: var(--sp-4); padding: 0 var(--sp-4) var(--sp-5); }

/* ---- área principal ---- */
.main { display: flex; flex-direction: column; gap: var(--sp-6); min-width: 0; }
.section { display: flex; flex-direction: column; gap: var(--sp-4); min-width: 0; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--sp-2) var(--sp-4); }
.section-head p { font-size: var(--fs-2); color: var(--ink-3); max-width: 70ch; }

.strip {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-3);
}
.kpi { display: flex; flex-direction: column; gap: 2px; padding: var(--sp-4) var(--sp-5); min-width: 0; }
.kpi + .kpi { border-left: 1px solid var(--line); }
.kpi-label { font-size: var(--fs-2); color: var(--ink-3); font-weight: 500; }
.kpi-value { font-family: var(--font-display); font-size: var(--fs-6); line-height: 1.1; font-weight: 700; letter-spacing: -0.02em; }
.kpi-value.is-ok { color: var(--ok); }
.kpi-value.is-bad { color: var(--bad); }
.kpi-note { font-size: var(--fs-1); color: var(--ink-3); }

.notice {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3) var(--sp-4);
  padding: var(--sp-3) var(--sp-4); border-radius: var(--r-2);
  background: var(--warn-soft); color: var(--warn); font-size: var(--fs-2); font-weight: 500;
}
.notice span { flex: 1 1 280px; }

.fineprint { font-size: var(--fs-2); color: var(--ink-3); }
.rules-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-3); }
.rules-box > summary { padding: var(--sp-4) var(--sp-5); cursor: pointer; font-weight: 600; font-family: var(--font-display); font-size: var(--fs-4); }
.rules-box ol { margin: 0; padding: 0 var(--sp-5) var(--sp-5) calc(var(--sp-5) + 20px); display: flex; flex-direction: column; gap: var(--sp-2); color: var(--ink-2); font-size: var(--fs-2); max-width: 78ch; }
.rules-box b { color: var(--ink); }

@media (max-width: 1180px) {
  .shell { grid-template-columns: minmax(0, 1fr); padding: var(--sp-4); }
  .side { position: static; max-height: none; overflow: visible; }
  .strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi:nth-child(3) { border-left: 0; }
  .kpi:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .topbar { padding: var(--sp-3) var(--sp-4); }
}
@media (max-width: 560px) {
  .strip { grid-template-columns: minmax(0, 1fr); }
  .kpi + .kpi { border-left: 0; border-top: 1px solid var(--line); }
  .row2 { grid-template-columns: minmax(0, 1fr); }
  .topbar-actions .btn .lbl { display: none; }
  .topbar-actions .btn { width: 38px; padding: 0; }
}
