.doc-overlay {
  position: fixed;
  inset: 0;
  z-index: 6000;
  overflow: hidden;
  overscroll-behavior: contain;
  touch-action: none;
}

.doc-overlay[hidden] {
  display: none;
}

.doc-overlay__backdrop {
  position: absolute;
  inset: 0;
  background: var(--overlay-backdrop);
  backdrop-filter: blur(8px);
}

.doc-overlay__panel {
  position: relative;
  z-index: 1;
  width: min(1200px, calc(100vw - 32px));
  height: calc(100dvh - 8px);
  max-height: 1200px;
  margin: 20px auto 4px;
  display: grid;
  grid-template-rows: auto 1fr;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface-doc-panel);
  box-shadow: 0 32px 80px rgba(7, 18, 16, 0.28);
  overflow: hidden;
  overscroll-behavior: contain;
}

.doc-overlay__header {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  min-height: 56px;
  padding: 10px 124px 10px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-doc-header);
}

.doc-overlay__header .eyebrow {
  margin-bottom: 4px;
  font-size: 0.72rem;
}

.doc-overlay__header h2 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.2;
}

.doc-overlay__actions {
  position: absolute;
  top: 50%;
  right: 20px;
  display: inline-flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  transform: translateY(-50%);
}

.doc-overlay__header-button,
.doc-overlay__open-link,
.doc-overlay__close {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
}

.doc-overlay__header-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  line-height: 1;
  white-space: nowrap;
  box-shadow: var(--shadow-soft);
}

.doc-overlay__open-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.doc-overlay__theme-toggle {
  min-height: 40px;
  padding: 0 14px;
}

.doc-overlay__header-button:hover,
.doc-overlay__open-link:hover,
.doc-overlay__close:hover {
  background: var(--surface-accent-soft);
  color: var(--text);
  text-decoration: none;
}

.doc-overlay__header-button:focus-visible,
.doc-overlay__open-link:focus-visible,
.doc-overlay__close:focus-visible,
.doc-overlay__frame:focus-visible {
  outline-offset: 4px;
}

.doc-overlay__frame {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  background: var(--surface-iframe);
  overscroll-behavior: contain;
  touch-action: pan-y;
}

.history-table-wrap {
  overflow-x: auto;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}

#inflationPanel .history-table-wrap {
  overflow: visible;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.history-table th,
.history-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.history-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
  font-size: 0.76rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.history-table--inflation th,
.history-table--inflation td {
  width: 16.66%;
}

.history-table--inflation th:nth-child(odd),
.history-table--inflation td:nth-child(odd) {
  padding-right: 6px;
}

.history-table--inflation th:nth-child(even),
.history-table--inflation td:nth-child(even) {
  padding-left: 6px;
}

.history-table--inflation th:nth-child(2),
.history-table--inflation th:nth-child(4),
.history-table--inflation td:nth-child(2),
.history-table--inflation td:nth-child(4) {
  padding-right: 18px;
  border-right: 1px solid var(--range-separator);
}

.history-table--inflation th:nth-child(3),
.history-table--inflation th:nth-child(5),
.history-table--inflation td:nth-child(3),
.history-table--inflation td:nth-child(5) {
  padding-left: 18px;
}

.history-table__range-cell {
  background: var(--surface-accent-soft);
}

.history-table__range-cell.is-start,
.history-table__range-cell.is-target {
  background: var(--surface-accent-strong);
  font-weight: 800;
}

.history-table__year-cell {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.history-table__tag {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent-1) 18%, var(--surface-strong));
  color: var(--accent-1);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.legal-note {
  margin: 10px 0 0;
  font-size: 0.86rem;
}

.card--compact {
  padding-top: 20px;
  padding-bottom: 20px;
}
