/* Aba Estudo: painel analítico para distribuições e percentuais. */
[data-lx-panel="study"] {
  --study-accent: var(--blue-bright);
  --study-accent-soft: color-mix(in srgb, var(--blue) 16%, var(--surface));
  --study-track: color-mix(in srgb, var(--line-strong) 18%, var(--bg-deep));
  --study-positive: var(--teal);
  color: var(--ink);
}

[data-lx-panel="study"] .lx-study-workspace { min-width: 0; }
[data-lx-panel="study"] .lx-study-filters { align-content: start; }
[data-lx-panel="study"] .lx-study-main {
  gap: 14px;
  padding: clamp(14px, 2vw, 24px);
  overflow: hidden;
}

.lx-study-head {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 2px 2px 14px;
  border-bottom: 1px solid var(--line);
}
.lx-study-head > div { min-width: 0; }
.lx-study-head h2 { margin: 0; font-size: clamp(1.2rem, 2vw, 1.65rem); line-height: 1.2; letter-spacing: -0.025em; }
.lx-study-head p { margin: 6px 0 0; color: var(--muted); font-size: 0.9rem; line-height: 1.5; }
.lx-study-count {
  flex: 0 0 auto;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--quiet);
  font-size: 0.78rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.lx-study-content {
  display: grid;
  align-content: start;
  gap: 18px;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 2px 2px 12px;
  overscroll-behavior: contain;
  scrollbar-color: var(--line-strong) var(--surface);
}
.lx-study-distributions {
  columns: 360px;
  column-gap: 20px;
}
.lx-study-distributions > .lx-study-section { display: inline-block; vertical-align: top; width: 100%; margin: 0 0 20px; break-inside: avoid; }
.lx-study-coverage { margin: 20px 0; padding-top: 16px; border-top: 1px solid var(--line); }
.lx-study-coverage summary { cursor: pointer; font-weight: 700; }
.lx-study-coverage dl { display: grid; gap: 14px; margin: 16px 0 0; }
.lx-study-coverage dt { font-weight: 700; }
.lx-study-coverage dd { margin: 4px 0 0; color: var(--muted); font-size: .85rem; }
.lx-study-metric {
  display: grid;
  align-content: start;
  gap: 5px;
  min-width: 0;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(145deg, var(--study-accent-soft), var(--surface) 72%);
}
.lx-study-metric > span { color: var(--muted); font-size: 0.79rem; font-weight: 700; line-height: 1.35; }
.lx-study-metric strong { font-size: clamp(1.35rem, 3vw, 1.8rem); line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: -0.03em; }
.lx-study-metric small { color: var(--quiet); font-size: 0.75rem; line-height: 1.45; }

.lx-study-section {
  min-width: 0;
  padding: clamp(16px, 2vw, 22px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 8px 26px rgb(0 0 0 / 0.08);
}
.lx-study-section > header { margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.lx-study-section h3 { margin: 0; font-size: 1.05rem; line-height: 1.3; }
.lx-study-section header p { margin: 5px 0 0; color: var(--muted); font-size: 0.84rem; line-height: 1.5; }
.lx-study-chart { display: grid; gap: 14px; min-width: 0; }
.lx-study-bar-row { display: grid; gap: 7px; min-width: 0; }
.lx-study-bar-label { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; min-width: 0; color: var(--muted); font-size: 0.84rem; line-height: 1.4; }
.lx-study-bar-label span { min-width: 0; overflow-wrap: anywhere; }
.lx-study-bar-label strong { flex: 0 0 auto; color: var(--ink); font-size: 0.8rem; font-variant-numeric: tabular-nums; text-align: right; }
.lx-study-track {
  display: block;
  width: 100%;
  height: 11px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  border-radius: 999px;
  background: var(--study-track);
  appearance: none;
  -webkit-appearance: none;
}
.lx-study-track::-webkit-progress-bar { background: var(--study-track); border-radius: inherit; }
.lx-study-track::-webkit-progress-value {
  background: linear-gradient(90deg, var(--blue), var(--study-accent));
  border-radius: inherit;
}
.lx-study-track::-moz-progress-bar { background: var(--blue); border-radius: inherit; }
.lx-study-note {
  margin: 16px 0 0;
  padding: 12px 14px;
  border-left: 3px solid var(--study-accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--study-accent-soft);
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.55;
}
.lx-study-section > p { margin: 0; color: var(--muted); line-height: 1.6; }
.lx-study-section > p + p { margin-top: 12px; }
.lx-study-numeric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 245px), 1fr)); gap: 12px; }
.lx-study-numeric { padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); }
.lx-study-numeric h4 { margin: 0 0 12px; font-size: 1rem; overflow-wrap: anywhere; }
.lx-study-numeric dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0; }
.lx-study-numeric dt { color: var(--muted); font-size: .78rem; }
.lx-study-numeric dd { margin: 4px 0 0; font-weight: 750; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.lx-study-numeric small { display: block; margin-top: 12px; color: var(--muted); line-height: 1.4; }
.lx-study-method { background: color-mix(in srgb, var(--study-accent-soft) 45%, var(--surface)); box-shadow: none; }
.lx-study-method > header { margin-bottom: 10px; padding-bottom: 0; border: 0; }

[data-lx-panel="study"] :is(button, input, select, textarea, a):focus-visible {
  outline: 3px solid var(--blue-bright);
  outline-offset: 2px;
}
[data-lx-panel="study"] :is(input, select, textarea) {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-deep);
  color: var(--ink);
  font: inherit;
}
[data-lx-panel="study"] :is(button, select) { min-height: 40px; }
[data-lx-panel="study"] button {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
[data-lx-panel="study"] button:hover { border-color: var(--line-strong); background: var(--study-accent-soft); }

@media (max-width: 900px) {
  [data-lx-panel="study"] .lx-study-main { padding: 14px; grid-template-rows: auto minmax(0, 1fr); }
  [data-lx-panel="study"] .lx-study-main > .lx-study-head { grid-column: 1; grid-row: 1; }
  [data-lx-panel="study"] .lx-study-main > .lx-filters-toggle { grid-column: 2; grid-row: 1; }
  [data-lx-panel="study"] .lx-study-main > .lx-study-content { grid-row: 2; }
}

@media (max-width: 480px) {
  [data-lx-panel="study"] .lx-study-main { gap: 10px; padding: 10px; }
  .lx-study-head { gap: 8px; padding-bottom: 11px; }
  .lx-study-head p { font-size: 0.82rem; }
  .lx-study-count { padding: 5px 8px; font-size: 0.72rem; }
  .lx-study-content { gap: 12px; }
  .lx-study-distributions { gap: 12px; }
  .lx-study-metric { padding: 12px; }
  .lx-study-section { padding: 14px 12px; }
  .lx-study-bar-label { gap: 8px; font-size: 0.78rem; }
  .lx-study-bar-label strong { font-size: 0.74rem; }
}

@media (max-width: 350px) {
  .lx-study-head { flex-direction: column; align-items: flex-start; }
  .lx-study-distributions { grid-template-columns: minmax(0, 1fr); }
}

