/* =============================================================
   Textblocks v3 — Document-reader layout
   ============================================================= */

@layer pages {

/* -----------------------------------------------
   2-column layout: sidebar TOC + content
   Mobile-First: 1 column base, 2 columns on desktop
   ----------------------------------------------- */
.tb-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6, 1.5rem);
  align-items: start;
}
@media (min-width: 992px) {
  .tb-layout {
    grid-template-columns: 220px 1fr;
  }
}

/* -----------------------------------------------
   Sidebar TOC (sticky)
   ----------------------------------------------- */
.tb-sidebar {
  position: sticky;
  top: calc(var(--topnav-height, 56px) + var(--space-4));
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  scrollbar-width: thin;
}

.tb-sidebar__inner {
  background: var(--surface-raised, #fff);
  border: 1px solid var(--border-default, var(--border-default));
  border-radius: var(--radius-lg, 0.75rem);
  padding: var(--space-4, 1rem);
}

.tb-sidebar__header {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding-bottom: var(--space-3);
  margin-bottom: var(--space-2);
  border-bottom: 1px solid var(--border-default, var(--border-default));
}

.tb-sidebar__icon {
  font-size: var(--text-lg);
  color: var(--text-tertiary, #94a3b8);
}

.tb-sidebar__label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-tertiary, #94a3b8);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.tb-sidebar__count {
  margin-left: auto;
  font-size: var(--text-xs);
  color: var(--text-tertiary, #94a3b8);
}

.tb-sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tb-sidebar__link {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.4375rem 0.5rem;
  border-radius: var(--radius-md, 0.5rem);
  text-decoration: none;
  font-size: var(--text-sm);
  color: var(--text-secondary, #475569);
  transition: background var(--transition-fast), color var(--transition-fast);
  line-height: 1.3;
}

.tb-sidebar__link:hover {
  background: var(--surface-hover, #f1f5f9);
  color: var(--text-primary, #1e293b);
}

.tb-sidebar__link.is-active {
  background: color-mix(in srgb, var(--sem-info) 8%, var(--surface-base));
  color: var(--sem-info);
  font-weight: 500;
}

.tb-sidebar__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.tb-sidebar__text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tb-sidebar__badge {
  font-size: var(--text-xs);
  color: var(--text-tertiary, #94a3b8);
  flex-shrink: 0;
  min-width: 1.25rem;
  text-align: right;
}

/* -----------------------------------------------
   Mobile horizontal TOC (hidden on desktop)
   ----------------------------------------------- */
.tb-mobile-toc {
  display: none;
  overflow-x: auto;
  gap: 0.375rem;
  padding-bottom: var(--space-3);
  margin-bottom: var(--space-4, 1rem);
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.tb-mobile-toc::-webkit-scrollbar { display: none; }

.tb-mobile-toc__chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  padding: 0.375rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border-default, var(--border-default));
  background: var(--surface-raised, #fff);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-secondary, #475569);
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

.tb-mobile-toc__chip:hover {
  background: var(--surface-hover, #f1f5f9);
}

.tb-mobile-toc__chip.is-active {
  background: color-mix(in srgb, var(--sem-info) 8%, var(--surface-base));
  color: var(--sem-info);
  border-color: color-mix(in srgb, var(--sem-info) 40%, var(--surface-base));
}

/* -----------------------------------------------
   Section card
   ----------------------------------------------- */
.tb-section {
  background: var(--surface-raised, #fff);
  border: 1px solid var(--border-default, var(--border-default));
  border-radius: var(--radius-lg, 0.75rem);
  margin-bottom: var(--space-5, 1.25rem);
  overflow: hidden;
}

.tb-section__header {
  display: flex;
  align-items: center;
  gap: var(--space-3, 0.75rem);
  padding: 0.875rem 1rem;
  background: var(--surface-raised, #fff);
  border-bottom: 1px solid var(--border-default, var(--border-default));
  user-select: none;
}
@media (min-width: 768px) {
  .tb-section__header {
    padding: 1rem 1.25rem;
  }
}

.tb-section__header[role="button"] {
  cursor: pointer;
  transition: background var(--transition-fast);
}

.tb-section__header[role="button"]:hover {
  background: var(--surface-hover, #f8fafc);
}

.tb-section__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md, 0.5rem);
  background: color-mix(in srgb, var(--text-secondary) 10%, transparent);
  color: var(--text-secondary);
  flex-shrink: 0;
}

.tb-section__icon .material-symbols-outlined {
  font-size: var(--text-lg);
}
@media (min-width: 768px) {
  .tb-section__icon {
    width: 36px;
    height: 36px;
  }
  .tb-section__icon .material-symbols-outlined {
    font-size: var(--text-xl);
  }
}

.tb-section__meta {
  flex: 1;
  min-width: 0;
}

.tb-section__title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary, #1e293b);
  margin: 0;
  line-height: 1.4;
}

.tb-section__subtitle {
  font-size: var(--text-xs);
  color: var(--text-tertiary, #94a3b8);
  margin: 0.125rem 0 0;
  line-height: 1.3;
}

.tb-section__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  height: 1.5rem;
  padding: 0 0.375rem;
  border-radius: 999px;
  background: var(--surface-hover, #f1f5f9);
  color: var(--text-secondary, #475569);
  font-size: var(--text-xs);
  font-weight: 600;
  flex-shrink: 0;
}

.tb-section__chevron {
  font-size: var(--text-xl);
  color: var(--text-tertiary, #94a3b8);
  transition: transform var(--transition-normal);
  flex-shrink: 0;
}

.tb-section__chevron.is-open {
  transform: rotate(180deg);
}

.tb-section__body {
  padding: 0;
}

/* -----------------------------------------------
   Text block item
   ----------------------------------------------- */
.tb-block {
  padding: 0.75rem 1rem;
  overflow-wrap: break-word;
}
@media (min-width: 768px) {
  .tb-block {
    padding: 1rem 1.25rem;
  }
}

.tb-block__header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}
@media (min-width: 768px) {
  .tb-block__header {
    flex-direction: row;
    gap: var(--space-3, 0.75rem);
  }
}

.tb-block__label-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  min-width: 0;
}

.tb-block__label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary, #1e293b);
  margin: 0;
  line-height: 1.4;
}

.tb-block__tags {
  display: flex;
  gap: var(--space-1);
  flex-wrap: wrap;
}

/* -----------------------------------------------
   Tag pills (metadata)
   ----------------------------------------------- */
.tb-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  font-size: var(--text-xs);
  font-weight: 500;
  line-height: 1.5;
}

.tb-tag--doc {
  background: color-mix(in srgb, var(--sem-info) 8%, var(--surface-base));
  color: var(--sem-info);
}

.tb-tag--period {
  background: color-mix(in srgb, var(--sem-positive) 8%, var(--surface-base));
  color: var(--sem-positive);
}

/* Open full text button */
.tb-block__open-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0.3125rem 0.625rem;
  border: 1px solid var(--border-default, var(--border-default));
  border-radius: var(--radius-md, 0.5rem);
  background: var(--surface-raised, #fff);
  color: var(--text-secondary, #475569);
  font-size: var(--text-xs);
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
  white-space: nowrap;
  flex-shrink: 0;
}

.tb-block__open-btn:hover {
  background: var(--surface-hover, #f1f5f9);
  color: var(--text-primary, #1e293b);
  border-color: var(--border-strong, #cbd5e1);
}

.tb-block__open-btn .material-symbols-outlined {
  font-size: var(--text-sm);
}

/* -----------------------------------------------
   Block body: prose text
   ----------------------------------------------- */
.tb-block__body {
  position: relative;
}

.tb-prose {
  font-size: var(--text-sm);
  line-height: 1.75;
  color: var(--text-secondary);
  max-width: 720px;
  letter-spacing: 0.01em;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: break-word;
  max-height: 200px;
  overflow: hidden;
}
@media (min-width: 768px) {
  .tb-prose {
    font-size: var(--text-sm);
    line-height: 1.85;
    max-height: 260px;
  }
}

.tb-prose.is-expanded {
  max-height: none;
}

.tb-prose.is-truncated {
  max-height: 260px;
  overflow: hidden;
}

/* Gradient fade overlay for truncated text */
.tb-block__fade {
  position: absolute;
  bottom: 28px; /* above toggle button */
  left: 0;
  right: 0;
  height: 64px;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    color-mix(in srgb, var(--surface-raised) 85%, transparent) 50%,
    var(--surface-raised) 100%
  );
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.tb-block__body:has(.tb-prose.is-expanded) .tb-block__fade {
  opacity: 0;
}

/* Toggle button */
.tb-block__toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0.25rem 0.5rem;
  margin-top: var(--space-1);
  border: none;
  background: none;
  color: var(--teal-600, #0d9488);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-sm, 0.25rem);
  transition: background var(--transition-fast);
}

.tb-block__toggle:hover {
  background: color-mix(in srgb, var(--sem-info) 8%, var(--surface-base));
}

.tb-block__toggle .material-symbols-outlined {
  font-size: var(--text-lg);
  transition: transform var(--transition-normal);
}

.tb-block__toggle.is-expanded .material-symbols-outlined {
  transform: rotate(180deg);
}

/* Placeholder text */
.tb-block__placeholder {
  font-size: var(--text-sm);
  color: var(--text-tertiary, #94a3b8);
  margin: 0;
}

/* Divider between blocks */
.tb-divider {
  border: none;
  border-top: 1px solid var(--border-default, var(--border-default));
  margin: 0;
}

/* -----------------------------------------------
   History card (timeline)
   ----------------------------------------------- */
.history-card {
  border: 1px solid var(--border-default, var(--border-default));
  border-radius: var(--radius-md, 0.5rem);
  padding: var(--space-3);
  background: var(--surface-raised);
}
@media (min-width: 768px) {
  .history-card {
    padding: var(--space-4);
  }
}

.history-toggle.active {
  border-color: var(--brand-primary);
  background: var(--brand-primary);
  color: var(--text-inverse);
}

.history-timeline {
  margin-top: 0.6rem;
  line-height: 1.7;
}

.history-card:not(.history-card-modal) .history-preview {
  position: relative;
  max-height: 320px;
  overflow: hidden;
}

.history-card:not(.history-card-modal) .history-preview::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 48px;
  background: linear-gradient(180deg, transparent 0%, var(--surface-raised) 70%);
  pointer-events: none;
}

.history-card:not(.history-card-modal) .history-preview .history-dlist {
  max-height: 320px;
  overflow: hidden;
}

.history-card:not(.history-card-modal) .history-timeline {
  max-height: 320px;
  overflow: hidden;
}

.history-dlist {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 0.35rem 0.75rem;
}
@media (min-width: 768px) {
  .history-dlist {
    grid-template-columns: 120px 1fr;
    gap: 0.45rem 1.2rem;
  }
}

.history-dlist dt {
  font-weight: 600;
  color: var(--text-primary);
  align-self: start;
}

.history-dlist dd {
  margin: 0;
  padding: 0;
  color: var(--text-secondary);
}

.history-dlist dd p {
  margin: 0 0 0.6rem;
  line-height: 1.7;
}

.history-raw-text {
  margin: 0;
  padding: 0.75rem 1rem;
  background: var(--surface-sunken);
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-default);
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--font-mono);
  line-height: 1.6;
}

.history-empty {
  color: var(--text-tertiary);
  font-size: var(--text-base);
}

/* -----------------------------------------------
   TextBlock <pre> table display
   ----------------------------------------------- */
.tb-prose .tb-pre,
.tb-prose pre,
.tb-body .tb-pre,
.tb-body pre,
.formatted-text .tb-pre,
.formatted-text pre {
  font-size: var(--text-sm);
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  background: var(--surface-sunken);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin: 0.75rem 0;
  overflow-x: auto;
  max-height: 500px;
  font-family: "SF Mono", "Menlo", "Consolas", "Source Code Pro", monospace;
  font-variant-numeric: tabular-nums;
  tab-size: 4;
  color: var(--text-primary);
}

/* Financial statement unit header */
.tb-fs-unit {
  display: block;
  text-align: right;
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-bottom: var(--space-2);
  font-weight: 500;
}

/* Financial statement title */
.tb-fs-title {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text-primary);
  margin: 0.75rem 0 0.5rem;
  padding-bottom: 0.375rem;
  border-bottom: 2px solid var(--border-default);
}

/* Financial table wrapper */
.tb-fs-table-wrap {
  overflow-x: auto;
  margin: 0.5rem 0 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
}

.tb-fs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-xs);
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}
@media (min-width: 768px) {
  .tb-fs-table {
    font-size: var(--text-sm);
  }
}

.tb-fs-table th {
  background: var(--surface-secondary);
  font-weight: 600;
  color: var(--text-secondary);
  padding: 0.3rem 0.5rem;
  text-align: center;
  border-bottom: 2px solid var(--border-default);
  white-space: nowrap;
  font-size: var(--text-xs);
}
@media (min-width: 768px) {
  .tb-fs-table th {
    padding: 0.5rem 0.75rem;
  }
}

.tb-fs-table td {
  padding: 0.3rem 0.5rem;
  border-bottom: 1px solid var(--surface-sunken);
  color: var(--text-secondary);
}
@media (min-width: 768px) {
  .tb-fs-table td {
    padding: 0.4rem 0.75rem;
  }
}

.tb-fs-table tr:hover td {
  background: var(--surface-sunken);
}

.tb-fs-table td:first-child {
  color: var(--text-primary);
  font-weight: 500;
  white-space: nowrap;
}

.tb-fs-table td.num,
.tb-fs-table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.tb-fs-table tr.section-row td {
  font-weight: 700;
  color: var(--text-primary);
  background: var(--surface-sunken);
  padding-top: 0.625rem;
  border-bottom: 1px solid var(--border-default);
}

.tb-fs-table tr.total-row td {
  font-weight: 700;
  border-top: 2px solid var(--border-default);
  border-bottom: 2px solid var(--border-default);
  background: var(--surface-sunken);
}

.tb-fs-neg {
  color: var(--sem-negative);
}

.tb-fs-note {
  color: var(--text-disabled);
  font-size: var(--text-xs);
}

/* -----------------------------------------------
   Prose typography helpers
   ----------------------------------------------- */
.tb-prose p,
.tb-body p {
  margin: 0 0 0.75rem 0;
}

.tb-h4 {
  margin: 0 0 0.6rem 0;
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-primary);
}

.tb-h5 {
  margin: 0.75rem 0 0.35rem 0;
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-secondary);
}

.tb-sub {
  margin-top: var(--space-2);
}

.tb-sub2 {
  margin-top: 0.35rem;
  padding-left: var(--space-1);
}

.tb-pre {
  white-space: pre-wrap;
  line-height: 1.6;
  font-size: var(--text-xs);
}

.tb-paragraph {
  margin: 0.35rem 0;
}

.tb-bullet {
  display: flex;
  gap: var(--space-2);
  margin: 0.35rem 0;
}

.tb-bullet-mark {
  min-width: 1.8em;
  font-weight: 700;
  color: var(--text-secondary);
}

.tb-bullet-body {
  flex: 1;
}

/* Legacy compat: .shadow-sm (migrated from base.html inline styles) */
.shadow-sm {
  box-shadow: var(--shadow-sm);
}

/* Legacy compat: .tb-body */
.tb-body {
  max-width: 720px;
  line-height: 1.75;
  font-size: var(--text-xs);
  letter-spacing: 0.02em;
}
@media (min-width: 768px) {
  .tb-body {
    font-size: var(--text-sm);
    line-height: 1.8;
  }
}

.tb-body.tb-preview {
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 6;
  line-clamp: 6;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Legacy compat */
.textblock-body.collapsed {
  max-height: 220px;
  overflow: hidden;
}

.textblock-body.tb {
  line-height: 1.75;
  font-size: var(--text-base);
  white-space: normal;
  word-break: break-word;
}

.tb-modal-body {
  white-space: normal;
  line-height: 1.8;
}

/* -----------------------------------------------
   Modal – comprehensive redesign
   ----------------------------------------------- */
#textblockModal .modal-content {
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
}

#textblockModal .modal-header {
  background: linear-gradient(135deg, var(--surface-raised) 0%, var(--surface-sunken) 100%);
  border-bottom: 1px solid var(--border-default);
  padding: 1rem 1.5rem;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

#textblockModal .modal-title {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text-primary);
}

#textblockModal .modal-body {
  padding: var(--space-4);
  max-height: calc(100vh - 180px);
}
@media (min-width: 768px) {
  #textblockModal .modal-body {
    padding: var(--space-6);
  }
}

#textblockModalMeta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-default);
}

.tb-modal-meta-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.1875rem 0.5rem;
  border-radius: var(--radius-xl);
  font-size: var(--text-xs);
  font-weight: 500;
  background: var(--surface-secondary);
  color: var(--text-secondary);
  gap: var(--space-1);
}

.tb-modal-meta-badge.doc-type {
  background: color-mix(in srgb, var(--sem-info) 8%, var(--surface-base));
  color: var(--sem-info);
}

.tb-modal-meta-badge.period {
  background: color-mix(in srgb, var(--sem-positive) 8%, var(--surface-base));
  color: var(--sem-positive);
}

.tb-modal-meta-badge.source {
  background: var(--surface-sunken);
  color: var(--text-disabled);
  font-size: var(--text-xs);
}

#textblockModalBody .tb-body,
#textblockModalBody .tb-prose {
  line-height: 1.85;
  font-size: var(--text-sm);
  letter-spacing: 0.015em;
  color: var(--text-secondary);
  max-width: none;
}
@media (min-width: 768px) {
  #textblockModalBody .tb-body,
  #textblockModalBody .tb-prose {
    font-size: var(--text-base);
  }
}

#textblockModalBody .tb-body p,
#textblockModalBody .tb-prose p {
  margin-bottom: 0.875rem;
}

#textblockModalBody .tb-body .tb-h4 {
  color: var(--text-primary);
  font-size: var(--text-base);
  margin-top: var(--space-6);
  margin-bottom: 0.625rem;
  padding-bottom: 0.375rem;
  border-bottom: 1px solid var(--border-default);
}

#textblockModalBody .tb-body .tb-h5 {
  color: var(--text-primary);
  font-size: var(--text-base);
  margin-top: var(--space-4);
}

#textblockModalBody .tb-body .tb-pre,
#textblockModalBody .tb-body pre,
#textblockModal .tb-body .tb-pre,
#textblockModal .tb-body pre {
  max-height: none;
  font-size: var(--text-sm);
  color: var(--text-primary);
  background: var(--surface-sunken);
}

/* Search highlight mark */
mark.tb-highlight {
  background: color-mix(in srgb, var(--sem-warning) 25%, var(--surface-base));
  color: inherit;
  padding: 0.0625rem 0.125rem;
  border-radius: var(--radius-xs);
}

mark.tb-highlight.is-current {
  background: var(--sem-warning);
  color: var(--text-inverse);
}

/* Hide sections that don't match search */
.business-section.tb-search-hidden,
.tb-section.tb-search-hidden {
  display: none;
}

.textblock-item.tb-search-hidden,
.tb-block.tb-search-hidden {
  display: none;
}

/* -----------------------------------------------
   V2: Numeric Value Highlighting
   ----------------------------------------------- */
.tb-num {
  font-weight: 600;
  color: var(--sem-info);
  font-variant-numeric: tabular-nums;
}

.tb-num-negative {
  color: var(--sem-negative);
}

.tb-num-percent {
  color: var(--analysis-accent);
}

.tb-num-currency {
  color: var(--sem-positive);
}

/* -----------------------------------------------
   Responsive: Sidebar — hidden on mobile (base), visible on desktop
   ----------------------------------------------- */
.tb-sidebar {
  display: none;
}
.tb-mobile-toc {
  display: flex;
}
@media (min-width: 992px) {
  .tb-sidebar {
    display: block;
  }
  .tb-mobile-toc {
    display: none;
  }
}

/* -----------------------------------------------
   Print Layout
   ----------------------------------------------- */
@media print {
  .tb-sidebar,
  .tb-mobile-toc,
  .tb-block__toggle,
  .tb-block__fade,
  .tb-block__open-btn,
  .tb-section__chevron,
  .nav-tabs,
  .company-header-right,
  .company-quick-actions,
  .breadcrumb-nav,
  .export-dd,
  footer,
  .btn-watchlist-toggle,
  .btn-peer-compare {
    display: none !important;
  }

  .tb-layout {
    grid-template-columns: 1fr;
  }

  .tb-prose,
  .tb-body {
    max-height: none !important;
    overflow: visible !important;
    max-width: 100%;
    font-size: 11pt;
  }

  .tb-block__fade {
    display: none !important;
  }

  .tb-section {
    break-inside: avoid;
    page-break-inside: avoid;
    margin-bottom: var(--space-4);
    box-shadow: none !important;
    border: 1px solid var(--border-default);
  }

  .tb-block {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .tb-section__header {
    background: var(--surface-secondary) !important;
  }

  .tb-fs-table {
    font-size: 9pt;
    border: 1px solid var(--border-strong);
  }

  .tb-fs-table th,
  .tb-fs-table td {
    border: 1px solid var(--border-default);
    padding: 2px 4px;
  }

  .tb-fs-table-wrap {
    border: none;
    box-shadow: none;
  }

  a[href]::after {
    content: none;
  }

  .company-header {
    border-bottom: 2px solid var(--text-primary);
    padding-bottom: var(--space-2);
    margin-bottom: var(--space-4);
  }

  .page-company {
    padding: 0;
    max-width: 100%;
  }
}

/* -----------------------------------------------
   Dark mode overrides
   Ensure borders/backgrounds adapt when tokens.css
   dark variables are active.
   ----------------------------------------------- */
:root[data-theme="dark"] .tb-sidebar__inner,
:root[data-theme="dark"] .tb-mobile-toc__chip,
:root[data-theme="dark"] .tb-tag {
  background: var(--surface-raised, #1e293b);
  border-color: var(--border-default, #475569);
}

:root[data-theme="dark"] .tb-sidebar__header {
  border-bottom-color: var(--border-default, #475569);
}

:root[data-theme="dark"] .tb-body {
  color: var(--text-primary, #f1f5f9);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tb-sidebar__inner,
  :root:not([data-theme="light"]) .tb-mobile-toc__chip,
  :root:not([data-theme="light"]) .tb-tag {
    background: var(--surface-raised, #1e293b);
    border-color: var(--border-default, #475569);
  }

  :root:not([data-theme="light"]) .tb-sidebar__header {
    border-bottom-color: var(--border-default, #475569);
  }

  :root:not([data-theme="light"]) .tb-body {
    color: var(--text-primary, #f1f5f9);
  }
}

} /* end @layer pages */
