/* Reader-first layout, preserving the workbench's existing palette. */
main {
  grid-template-columns: 220px minmax(0, 1fr);
}
.workspace {
  padding: 18px 24px;
}
.topbar {
  min-height: 64px;
  padding: 12px 24px;
}
.filing-header {
  padding: 12px 0 18px;
}
.filing-header h1 {
  font-size: 30px;
}
.reading-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
}
.reading-layout:has(#detail:not([hidden])) {
  grid-template-columns: minmax(0, 1fr) 300px;
}
.reading-main {
  min-width: 0;
}
.toolbar {
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 10px;
}
.tabs {
  flex-wrap: wrap;
}
.tabs button {
  padding: 9px 10px;
}
.search-label {
  width: 260px;
}
#rail-toggle {
  display: none;
}
.reader-controls {
  display: flex;
  align-items: end;
  gap: 10px;
  padding: 12px 0;
}
.reader-controls label {
  flex: 1;
  min-width: 110px;
}
.reader-controls select {
  font-size: 12px;
  padding: 8px;
}
#outline-label {
  max-width: 280px;
}
#document-search {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
  margin: 0 0 12px;
}
#document-search label {
  flex: 1;
  min-width: 180px;
}
#document-search button {
  padding: 10px;
}
#source-search-count {
  min-width: 60px;
  max-width: 180px;
  padding-bottom: 10px;
}
.current-search-match {
  outline: 2px solid #c39820;
  outline-offset: 2px;
  background: #fff0ad;
}
#original {
  height: calc(100dvh - 340px);
  min-height: 480px;
}
#source-view {
  padding-top: 0;
}
#source-unavailable {
  padding: 14px;
  background: #f5f8fc;
  border: 1px solid var(--line);
}
#source-unavailable .actions {
  justify-content: flex-start;
  margin: 0;
}
#locate-original {
  position: absolute;
  width: 1px;
  height: 1px;
  clip-path: inset(50%);
}
#detail {
  position: sticky;
  top: 16px;
  align-self: start;
  max-height: calc(100dvh - 32px);
  overflow: auto;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--blue);
  border-radius: 4px;
  background: #f6f9fe;
}
#detail h2 {
  font-size: 16px;
  line-height: 1.4;
}
#close-detail {
  border: 0;
  background: none;
  padding: 0 6px;
  font-size: 24px;
  color: var(--muted);
}
.detail-heading {
  align-items: start;
}
.source-badge {
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
  color: var(--blue);
}
#detail-value {
  font-size: 24px;
  line-height: 1.3;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}
.detail-actions {
  display: grid;
  gap: 7px;
  margin: 16px 0;
}
.detail-actions button {
  white-space: normal;
}
#detail details {
  border-top: 1px solid var(--line);
  padding: 12px 0;
  font-size: 12px;
}
#detail dl {
  display: block;
}
#detail dt {
  margin-top: 12px;
}
#detail dd {
  max-height: 120px;
}
#detail-period {
  color: var(--muted);
}
.unconverted {
  color: #9a5024;
  background: #fff2e7;
  padding: 2px 6px;
  font-size: 11px;
}
.statement-heading h2 {
  font-size: 18px;
  margin: 16px 0 6px;
}
.statement-grid {
  table-layout: auto;
  min-width: 480px;
}
.statement-grid th,
.statement-grid th:nth-child(n) {
  width: auto;
}
.statement-grid th:first-child {
  width: 45%;
}
.statement-grid td:first-child {
  max-width: 340px;
}
.statement-grid td {
  padding: 9px 12px;
}
.statement-grid td.numeric button {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.statement-grid .section-row td {
  font-weight: 600;
  color: #173052;
  background: #eef3fa;
}
.statement-grid .selected-figure td {
  background: #fff2c7;
}
.statement-grid .subtotal td {
  border-top: 1px solid #9faec3;
  font-weight: 600;
}
.related-card {
  background: #fff;
  border-color: var(--line);
  padding: 16px;
  margin: 16px 0;
}
.related-card h3 {
  font-size: 16px;
}
.related-card .statement-grid {
  min-width: 480px;
}
.related-card .statement-grid th:nth-child(n) {
  width: auto;
}
.related-card .statement-grid th:first-child {
  width: 45%;
}
.related-card td button {
  display: inline;
}
.related-card .table-scroll {
  max-height: 380px;
}
#related-panel h2 {
  font-size: 18px;
}
.insight-heading h2 {
  font:
    24px Georgia,
    serif;
  margin: 20px 0 8px;
}
.insight-heading p {
  font-size: 13px;
  line-height: 1.6;
}
.insight-card {
  border-top: 1px solid var(--line);
  padding: 20px 0;
}
.insight-card h3 {
  font-size: 17px;
  margin: 0 0 8px;
}
.insight-card p {
  line-height: 1.65;
}
.insight-card .evidence-links {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.evidence-links button {
  font-size: 11px;
  padding: 5px 8px;
  white-space: normal;
}
.insight-card .calculation-note {
  font-size: 12px;
  color: var(--muted);
}
.closure {
  display: inline-block;
  font-size: 11px;
  background: #e6f4ef;
  color: #16756b;
  padding: 3px 8px;
}
.closure.incomplete {
  background: #fff2e7;
  color: #9a5024;
}
.insight-row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) 100px 160px;
  gap: 12px;
  align-items: center;
  padding: 8px 0;
  font-size: 12px;
  border-bottom: 1px solid #edf2f8;
}
.insight-row > button {
  border: 0;
  background: none;
  color: var(--blue);
  white-space: normal;
  text-align: left;
  padding: 0;
}
.insight-bar {
  height: 8px;
  background: #dce6f7;
  position: relative;
}
.insight-bar > span {
  height: 100%;
  display: block;
  background: #16756b;
}
.insight-bar.negative > span {
  background: #b26948;
}
.insight-amount {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.note-result {
  border-left: 2px solid #92a9ce;
  padding: 4px 14px;
  margin: 16px 0;
  font-size: 13px;
  line-height: 1.7;
}
.note-result button {
  font-size: 12px;
}
.reading-fullscreen .reading-main {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: white;
  padding: 12px 20px;
  overflow: auto;
}
.reading-fullscreen #original {
  height: calc(100dvh - 165px);
  min-height: 300px;
}
.reading-fullscreen #detail {
  z-index: 11;
  position: fixed;
  right: 20px;
  top: 170px;
  width: 300px;
  box-shadow: 0 8px 30px #17305233;
}
.reading-fullscreen #panel {
  min-height: 0;
}
.reading-fullscreen #related-panel {
  display: none;
}
#warning-list button {
  font-size: 11px;
  margin: 4px;
}
.rail label input {
  width: auto;
}
@media (max-width: 1100px) {
  .reading-layout:has(#detail:not([hidden])) {
    grid-template-columns: minmax(0, 1fr);
  }
  #detail {
    position: fixed;
    right: 18px;
    bottom: 18px;
    top: auto;
    width: 330px;
    z-index: 12;
    max-height: 65dvh;
    box-shadow: 0 8px 30px #17305233;
  }
  .filing-header {
    flex-direction: row;
    align-items: center;
  }
  #metrics {
    font-size: 11px;
    text-align: right;
  }
  .workspace {
    padding: 16px;
  }
}
@media (max-width: 700px) {
  main {
    display: block;
  }
  .topbar {
    padding: 12px 16px;
  }
  .brand {
    font-size: 21px;
  }
  .rail {
    padding: 8px 16px;
  }
  .rail-heading h2 {
    display: none;
  }
  .rail-heading {
    justify-content: space-between;
  }
  #rail-toggle {
    display: block;
    padding: 7px 9px;
    font-size: 12px;
  }
  .rail:not(.rail-open) #rail-content {
    display: none;
  }
  .rail-bottom {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .rail-bottom p {
    grid-column: 1/-1;
  }
  .workspace {
    padding: 12px 16px;
  }
  #status {
    font-size: 11px;
    min-height: 20px;
  }
  .filing-header {
    flex-direction: column;
    align-items: start;
    gap: 6px;
    padding: 10px 0 14px;
  }
  .filing-header h1 {
    font-size: 27px;
    margin-bottom: 6px;
  }
  .filing-header p {
    font-size: 12px;
  }
  #metrics {
    text-align: left;
    white-space: normal;
    line-height: 1.5;
  }
  .tabs {
    gap: 0;
    width: 100%;
  }
  .tabs button {
    padding: 9px 7px;
    font-size: 12px;
  }
  .search-label {
    width: 100%;
  }
  .toolbar {
    gap: 4px;
  }
  .toolbar:has(#tab-source[aria-selected="true"]) .search-label,
  .toolbar:has(#tab-insights[aria-selected="true"]) .search-label {
    display: none;
  }
  .reader-controls {
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 0 8px;
  }
  .reader-controls label {
    min-width: 120px;
  }
  #outline-label {
    max-width: none;
  }
  #reader-expand {
    font-size: 12px;
    padding: 8px;
  }
  #document-search {
    flex-wrap: wrap;
    gap: 6px;
  }
  #document-search label {
    flex-basis: 100%;
  }
  #document-search button {
    padding: 7px 10px;
    font-size: 12px;
  }
  #source-search-count {
    padding: 0;
  }
  #original {
    height: 65dvh;
    min-height: 380px;
  }
  #reader-note {
    font-size: 11px;
  }
  #detail {
    bottom: 8px;
    right: 8px;
    left: 8px;
    width: auto;
    max-height: 57dvh;
    padding: 12px 16px;
  }
  #detail-value {
    font-size: 21px;
  }
  .detail-actions {
    grid-template-columns: 1fr 1fr;
    margin: 10px 0;
    gap: 6px;
  }
  .detail-actions button {
    font-size: 12px;
    padding: 8px;
  }
  #open-source {
    grid-column: 1/-1;
  }
  .source-badge {
    margin: 7px 0;
    padding: 5px 0;
  }
  #detail-period,
  #detail-presentation {
    margin: 6px 0;
  }
  .insight-row {
    grid-template-columns: minmax(120px, 1fr) 90px;
    gap: 8px;
  }
  .insight-bar {
    grid-column: 1/-1;
  }
  .insight-card {
    padding: 16px 0;
  }
  .statement-heading h2 {
    font-size: 16px;
  }
  .statement-grid td,
  .statement-grid th {
    padding: 8px;
  }
  .reading-fullscreen .reading-main {
    padding: 10px;
  }
  .reading-fullscreen #original {
    height: calc(100dvh - 260px);
  }
  .reading-fullscreen #detail {
    left: 8px;
    right: 8px;
    bottom: 8px;
    top: auto;
    width: auto;
  }
  .reading-fullscreen .reading-layout {
    display: block;
  }
  .reading-fullscreen #reader-note {
    display: none;
  }
  #source-unavailable .actions {
    flex-wrap: wrap;
  }
  #source-unavailable .actions > * {
    flex-basis: auto;
  }
  footer {
    gap: 8px;
  }
}
.statement-grid .active-fact {
  background: #fff0ad;
  outline: 2px solid #c39820;
  outline-offset: 2px;
}
#statement-select option {
  white-space: nowrap;
}
.detail-heading {
  flex-direction: row;
}
.statement-grid th.numeric {
  white-space: nowrap;
}
#close-detail {
  flex: 0 0 auto;
}
.insight-card .evidence-links button {
  max-width: 100%;
}
.toolbar:has(#tab-source[aria-selected="true"]) .search-label,
.toolbar:has(#tab-insights[aria-selected="true"]) .search-label {
  display: none;
}
@media (max-width: 700px) {
  #metrics {
    display: none;
  }
  .filing-header {
    padding-bottom: 10px;
  }
  #reader-note {
    line-height: 1.4;
  }
}
