/* Thematic dashboard — layered on app.css tokens (teal chrome, red/blue score scale). */

.workspace.board {
  max-width: 100%;
  flex: 1 1 100%;
}

.topbar-heading {
  flex: 1 1 auto;
}

.topbar-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* -- ghost buttons (Guide, Export) --------------------------------------- */

.ghost-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 750;
  font-size: var(--text-sm);
  padding: 8px 15px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.ghost-button:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.ghost-button:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(37, 111, 121, 0.12);
}

.ghost-button:disabled {
  opacity: 0.5;
  cursor: default;
}

.ghost-button-glyph {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

/* -- toolbar: sector filter + export ------------------------------------- */

.board-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 6px 24px 0;
}

.sector-filter,
.view-switch {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 1 auto;
  min-width: 0;
  flex-wrap: wrap;
}

/* segmented company/sector toggle */
.view-toggle {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  padding: 2px;
}

.view-toggle-btn {
  border: none;
  background: none;
  font: inherit;
  font-weight: 750;
  font-size: var(--text-sm);
  color: var(--muted);
  padding: 6px 15px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.view-toggle-btn:hover {
  color: var(--accent-strong);
}

.view-toggle-btn.is-active {
  background: var(--surface);
  color: var(--accent-strong);
  box-shadow: var(--soft-shadow);
}

.view-toggle-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 111, 121, 0.15);
}

/* sector-aggregate rows: shown, not clickable (no per-sector drill-down) */
.company-row.sector-row {
  cursor: default;
}

.company-row.sector-row:hover td,
.company-row.sector-row:focus-visible td {
  box-shadow: none;
}

.sector-filter .field-label {
  font-size: var(--text-xs);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.multiselect {
  position: relative;
}

.multiselect-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 160px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--ink);
  font: inherit;
  font-weight: 750;
  font-size: var(--text-sm);
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.multiselect-toggle:hover {
  border-color: var(--accent);
}

.multiselect-toggle:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(37, 111, 121, 0.12);
}

.multiselect-toggle.has-selection {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.multiselect-caret {
  color: var(--muted);
  font-size: 11px;
}

/* `display` on these flex containers overrides the [hidden] attribute's display:none,
   so restore it explicitly — otherwise the panel/toolbar can never hide. */
.multiselect-panel[hidden],
.board-toolbar[hidden],
.sector-filter[hidden] {
  display: none;
}

.multiselect-panel {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  min-width: 230px;
  max-height: 330px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.multiselect-option {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: 9px;
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--ink);
}

.multiselect-option:hover {
  background: var(--surface-soft);
}

.multiselect-option input {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.multiselect-clear {
  margin-top: 4px;
  border: none;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 8px 10px;
  text-align: left;
  border-radius: 9px;
  cursor: pointer;
}

.multiselect-clear:hover {
  background: var(--surface-soft);
}

.export-button {
  flex: 0 0 auto;
  margin-left: auto;
}

/* -- guide page ---------------------------------------------------------- */

.guide-page {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--soft-shadow);
  padding: 30px 40px 38px;
  width: 100%;
}

.guide-section + .guide-section {
  margin-top: 30px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}

.guide-section-title {
  margin: 0 0 12px;
  font-size: var(--text-xs);
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
}

.guide-text {
  margin: 0 0 12px;
  font-size: var(--text-base);
  line-height: 1.65;
  color: var(--ink);
}

.guide-text:last-child {
  margin-bottom: 0;
}

.guide-text code {
  font-size: 0.92em;
  background: var(--surface-soft);
  padding: 1px 5px;
  border-radius: 5px;
}

/* bulleted list inside a guide section (evidence sources, pillars) */
.guide-list {
  margin: 4px 0 12px;
  padding-left: 22px;
  display: block;
}

.guide-list li {
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--ink);
  margin-bottom: 7px;
}

.guide-list li::marker {
  color: var(--accent);
}

/* numbered limitations — block (not flex) so the list numbers render */
.guide-limits {
  margin: 0;
  padding-left: 24px;
  display: block;
}

.guide-limits li {
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--ink);
  margin-bottom: 14px;
  padding-left: 4px;
}

.guide-limits li:last-child {
  margin-bottom: 0;
}

.guide-limits li::marker {
  color: var(--accent);
  font-weight: 800;
}

/* muted, italic asides — data-as-of note, the not-advice footer */
.guide-note {
  margin: 14px 0 0;
  font-size: var(--text-sm);
  line-height: 1.55;
  color: var(--muted);
  font-style: italic;
}

/* -- picker -------------------------------------------------------------- */

.vintage-picker {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-end;
}

.vintage-select {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  padding: 9px 16px;
  border-radius: 999px;
  cursor: pointer;
}

.vintage-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(37, 111, 121, 0.1);
}

.board-body {
  padding: 18px 24px 8px;
}

.board-status {
  padding: 0 24px 20px;
  color: var(--muted);
  font-size: var(--text-sm);
}

/* -- ranking table ------------------------------------------------------- */

.thematic-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 3px;
  table-layout: fixed;
}

.thematic-table th {
  font-size: var(--text-xs);
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: center;
  padding: 8px 6px;
  vertical-align: bottom;
}

.thematic-table th.col-company {
  text-align: left;
  width: 24%;
}

.thematic-table th.col-overall {
  color: var(--accent-strong);
}

.company-row {
  cursor: pointer;
}

.company-row:hover td,
.company-row:focus-visible td {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--accent);
}

.company-row td {
  border-radius: 12px;
}

td.col-company {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 12px 14px;
  text-align: left;
}

.company-name {
  display: block;
  font-weight: 800;
  color: var(--ink);
  font-size: var(--text-base);
}

.company-meta {
  display: flex;
  gap: 8px;
  margin-top: 4px;
  align-items: center;
}

.company-ticker {
  font-weight: 750;
  color: var(--accent-strong);
  font-size: var(--text-xs);
  letter-spacing: 0.04em;
}

.company-sector {
  font-size: var(--text-xs);
  color: var(--muted);
  background: var(--surface-soft);
  padding: 2px 8px;
  border-radius: 999px;
}

.score-cell {
  text-align: center;
  font-weight: 800;
  font-size: var(--text-base);
  font-variant-numeric: tabular-nums;
  padding: 12px 6px;
}

.score-cell.col-overall {
  font-size: var(--text-lg);
}

.scale-legend {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  font-size: var(--text-xs);
  color: var(--muted);
}

.scale-legend-bar {
  height: 8px;
  width: 160px;
  border-radius: 999px;
  border: 1px solid var(--line);
}

.scale-legend-hint {
  font-style: italic;
}

/* -- company detail (inline, below the ranking) -------------------------- */

.detail-panel {
  margin-top: 26px;
  padding-top: 22px;
  border-top: 2px solid var(--line);
}

.detail-loading {
  color: var(--muted);
  font-size: var(--text-sm);
}

.detail-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.detail-ident {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.detail-security {
  font-weight: 800;
  font-size: var(--text-xl);
  color: var(--ink);
}

.detail-ticker {
  font-weight: 800;
  color: var(--accent-strong);
  letter-spacing: 0.04em;
  font-size: var(--text-sm);
}

.overall-chip {
  margin-left: auto;
  font-weight: 800;
  font-size: var(--text-base);
  padding: 8px 18px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}

.detail-close {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-weight: 800;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  cursor: pointer;
}

.detail-close:hover {
  background: var(--surface-soft);
  color: var(--ink);
}

/* each pillar is a column */
.pillar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  align-items: start;
}

.detail-pillar {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  min-width: 0;
}

/* bolded subquery category (the pillar) — the column header */
.detail-category {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 12px;
  padding-bottom: 9px;
  border-bottom: 2px solid var(--line);
}

.detail-category-name {
  font-size: var(--text-lg);
  font-weight: 850;
  color: var(--ink);
}

.pillar-composite {
  font-weight: 800;
  font-size: var(--text-xs);
  padding: 3px 11px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}

/* each question is a clickable card; its evidence opens in the panel below the grid */
.question-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 15px;
  margin-bottom: 8px;
  box-shadow: var(--soft-shadow);
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.question-card:hover {
  border-color: rgba(37, 111, 121, 0.45);
}

.question-card:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(37, 111, 121, 0.12);
}

.question-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent) inset;
}

.question-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.question-name {
  font-weight: 800;
  color: var(--ink);
  font-size: var(--text-base);
  line-height: 1.3;
}

.question-prompt {
  margin: 5px 0 0;
  font-size: var(--text-sm);
  color: var(--muted);
  line-height: 1.4;
}

.question-card .justification {
  margin: 7px 0 0;
}

.evidence-cue {
  display: inline-block;
  margin-top: 9px;
  font-size: var(--text-xs);
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--accent);
}

.question-card.active .evidence-cue {
  color: var(--accent-strong);
}

.score-chip {
  flex: 0 0 auto;
  font-weight: 800;
  font-size: var(--text-sm);
  padding: 3px 11px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}

/* evidence panel — opens full width beneath the whole pillar grid */
.evidence-panel {
  margin-top: 18px;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
}

.evidence-panel-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.evidence-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.evidence-pillar {
  font-size: var(--text-xs);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
}

.evidence-question {
  font-size: var(--text-lg);
  font-weight: 800;
  color: var(--ink);
}

.evidence-panel-head .score-chip {
  margin-left: auto;
}

.question-meta {
  display: flex;
  gap: 8px;
  margin: 0 0 12px;
  flex-wrap: wrap;
}

.confidence-tag,
.thin-tag,
.uncited-tag {
  font-size: var(--text-xs);
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
}

.confidence-tag {
  background: var(--surface-soft);
  color: var(--muted);
}

.thin-tag {
  background: var(--amber-soft);
  color: #80621c;
}

.justification {
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--ink);
  margin: 6px 0;
}

.points-label {
  font-size: var(--text-xs);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 12px 0 6px;
}

.points-list {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.points-list li {
  font-size: var(--text-sm);
  line-height: 1.45;
  color: var(--ink);
}

.points-against li::marker {
  color: var(--accent);
}

/* -- evidence ------------------------------------------------------------ */

.evidence-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.evidence-item {
  border-left: 3px solid var(--line);
  padding: 4px 0 4px 10px;
}

.evidence-item.is-cited {
  border-left-color: var(--accent);
}

.evidence-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.evidence-index {
  font-weight: 800;
  color: var(--accent-strong);
  font-size: var(--text-xs);
}

.evidence-source {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
}

a.evidence-source:hover {
  text-decoration: underline;
}

.uncited-tag {
  background: var(--surface-soft);
  color: var(--muted);
}

.evidence-text {
  font-size: var(--text-sm);
  line-height: 1.45;
  color: var(--ink);
  margin: 4px 0 0;
}

.all-evidence {
  margin-top: 12px;
}

.all-evidence summary {
  cursor: pointer;
  font-size: var(--text-xs);
  font-weight: 800;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.all-evidence[open] summary {
  margin-bottom: 10px;
}

.question-thin {
  font-size: var(--text-sm);
  color: var(--muted);
  font-style: italic;
}

@media (max-width: 640px) {
  .thematic-table { font-size: var(--text-sm); }
  .thematic-table th.col-company { width: 34%; }
}
