﻿/* Pmt.UI shared styles */

/*
 * Host page shell (Connect): lock .main to the viewport so only the tables
 * panel / docs article scrolls — not the whole page. Same pattern as
 * library-download-page. Desktop .main .top-row is sticky (in-flow).
 */
.main:has(> .pmt-page) {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  min-height: 0;
}

.main:has(> .pmt-page) > .top-row {
  flex: 0 0 auto;
}

.pmt-page {
  box-sizing: border-box;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  /* Width available beside the Connect sidebar — not the viewport. */
  container-type: inline-size;
  container-name: pmt-page;
}

.pmt-home {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.pmt-home-tables {
  overflow: hidden;
}
.pmt-home-docs {
  overflow: hidden;
}
.pmt-app {
  max-width: none;
  width: 100%;
  margin: 0;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.pmt-workspace {
  display: grid;
  grid-template-columns: minmax(16rem, 22rem) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 1rem 1.25rem;
  align-items: stretch;
  flex: 1;
  min-height: 0;
}
.pmt-series-select {
  display: none;
  flex-shrink: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid #c5d5d8;
  border-radius: 4px;
  background: #f4f8f9;
}
.pmt-series-select-label {
  flex-shrink: 0;
  margin: 0;
  font-size: 0.8rem;
  font-weight: 700;
  color: #1a3a4a;
}
.pmt-series-select-control {
  flex: 1;
  min-width: 12rem;
  font-size: 0.85rem;
  color: #17343d;
  border-color: #c5d5d8;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2317343d' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
  background-size: 14px 10px;
  padding-right: 2rem;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}
.pmt-series-missing-inline {
  flex-shrink: 0;
  color: #6b7c82;
  font-size: 0.75rem;
  line-height: 1.3;
  white-space: nowrap;
}
.pmt-series-nav {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.55rem;
  border: 1px solid #c5d5d8;
  border-radius: 6px;
  background: #f4f8f9;
  align-self: start;
  max-height: 100%;
  overflow: auto;
  min-height: 0;
}
.pmt-series-nav-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #5a6f76;
  padding: 0.15rem 0.4rem 0.35rem;
}
.pmt-series-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.05rem;
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  color: #17343d;
  border-radius: 4px;
  padding: 0.4rem 0.5rem;
  cursor: pointer;
}
.pmt-series-nav-btn:hover {
  background: #e4eef0;
}
.pmt-series-nav-btn.active {
  background: #82b1b7;
  border-color: #5e8e95;
  color: #0d2429;
  font-weight: 600;
}
.pmt-series-nav-label {
  font-size: 0.82rem;
  line-height: 1.25;
  white-space: normal;
}
.pmt-series-missing {
  color: #6b7c82;
  font-size: 0.75rem;
  line-height: 1.3;
  padding: 0.45rem 0.5rem 0.2rem;
  border-top: 1px solid #d6e2e5;
  margin-top: 0.25rem;
}
.pmt-series-missing span {
  color: #8a9ba1;
}
.pmt-workspace-main {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.pmt-tabs { margin-bottom: 0; flex-wrap: wrap; flex-shrink: 0; }

/* Undo Connect sidebar .nav-item padding that bleeds into Bootstrap tabs */
.pmt-home .nav-item,
.pmt-home .nav-item:first-of-type,
.pmt-home .nav-item:last-of-type {
  padding-top: 0;
  padding-bottom: 0;
  font-size: inherit;
}
.pmt-panel {
  border-top-left-radius: 0;
  border-color: #c5d5d8;
  background: #fcfefe;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.pmt-panel > .card-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
}
.pmt-table1 {
  min-height: 0;
}
.pmt-table {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(16rem, 0.9fr);
  gap: 1rem 1.5rem;
  align-items: start;
}
.pmt-table-main {
  min-width: 0;
}
.pmt-table .pmt-field { margin-bottom: 0.85rem; }
.pmt-table label { display: block; font-size: 0.9rem; margin-bottom: 0.25rem; color: #24383f; font-weight: 500; }
.pmt-input {
  max-width: 220px;
  min-width: min(100%, 10rem);
  width: 100%;
}
.pmt-input-row { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.pmt-round { font-size: 0.8rem; color: #5a6f76; }
.is-invalid-pmt {
  background-color: #ffcccc !important;
  border-color: #cc0000 !important;
}
.pmt-hyc, .pmt-radio {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.2rem 0;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  color: #24383f;
}
.pmt-results {
  padding: 0.65rem 0.75rem 0.15rem;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.pmt-results.has-result {
  background: #f0f7f8;
  border-color: #c5d5d8;
}
.pmt-result-basis {
  margin: 0.15rem 0 0.55rem;
  font-size: 0.8rem;
  color: #5a6f76;
  line-height: 1.35;
}
.pmt-help {
  padding: 0.75rem 0.85rem;
  border: 1px solid #c5d5d8;
  border-radius: 6px;
  background: #fff;
  position: sticky;
  top: 0.5rem;
}
.pmt-help-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
  margin-bottom: 0.55rem;
}
.pmt-help-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: #1a3a4a;
}
.pmt-help-docs {
  padding: 0;
  font-size: 0.8rem;
}
.pmt-help-summary {
  white-space: pre-wrap;
  font-size: 0.88rem;
  color: #24383f;
  line-height: 1.4;
}
.pmt-help-example {
  margin-top: 0.75rem;
  border-top: 1px solid #d6e2e5;
  padding-top: 0.5rem;
}
.pmt-help-example summary {
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  color: #1a5a6e;
}
.pmt-help-example pre {
  margin: 0.5rem 0 0;
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 0.84rem;
  color: #24383f;
}
.pmt-help-fallback {
  margin: 0;
  font-size: 0.88rem;
  color: #4a6068;
}
.pmt-help-link {
  padding: 0;
  font-size: 0.88rem;
  text-align: left;
  white-space: normal;
}
.pmt-footnote { margin-top: 1rem; color: #4a6068; font-size: 0.9rem; }

/* Table 1 reference */
.pmt-table1-title {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  color: #1a3a4a;
}
.pmt-table1-note {
  margin: 0 0 1rem;
  font-size: 0.82rem;
  color: #5a6f76;
}
.pmt-table1-grid {
  display: grid;
  grid-template-columns: repeat(3, max-content);
  gap: 1.25rem 2rem;
  justify-content: start;
  align-items: start;
}
.pmt-table1 h3 {
  margin: 0 0 0.4rem;
  font-size: 0.88rem;
  color: #782323;
}
.pmt-table1 table {
  width: max-content;
  max-width: none;
  border-collapse: collapse;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}
.pmt-table1 th,
.pmt-table1 td {
  text-align: left;
  padding: 0.28rem 0.55rem;
  border-bottom: 1px solid #e4eef0;
  white-space: nowrap;
}
.pmt-table1 th {
  color: #1a5a6e;
  font-weight: 600;
}
.pmt-table1 td:last-child {
  text-align: right;
  font-family: Consolas, "Courier New", monospace;
  padding-left: 1rem;
}

/*
 * Responsive breakpoints use the PMT page container width (space beside the
 * Connect sidebar), not the viewport. A mid-width window with a ~280px sidebar
 * still left series + form + notes side-by-side and crushed the inputs.
 */
@container pmt-page (max-width: 64rem) {
  .pmt-table {
    grid-template-columns: 1fr;
  }

  .pmt-help {
    position: static;
  }
}

@container pmt-page (max-width: 48rem) {
  .pmt-table1-grid {
    grid-template-columns: max-content;
  }

  .pmt-workspace {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 0.75rem;
  }

  .pmt-series-nav {
    display: none;
  }

  .pmt-series-select {
    display: flex;
  }

  .pmt-series-missing-inline {
    white-space: normal;
    width: 100%;
  }
}

/* Viewport fallback when container queries are unavailable. */
@media (max-width: 900px) {
  .pmt-table1-grid {
    grid-template-columns: max-content;
  }
  .pmt-workspace {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 0.75rem;
  }
  .pmt-series-nav {
    display: none;
  }
  .pmt-series-select {
    display: flex;
  }
  .pmt-series-missing-inline {
    white-space: normal;
    width: 100%;
  }
  .pmt-table { grid-template-columns: 1fr; }
  .pmt-help {
    position: static;
  }
}

.pmt-topnav {
  display: flex;
  gap: 0.4rem;
  margin-right: auto;
}
.pmt-section-tabs {
  flex-shrink: 0;
  margin-bottom: 0.85rem;
}
.pmt-section-tabs .nav-tabs,
.pmt-tabs.nav-tabs {
  border-bottom-color: #c5d5d8;
  align-items: flex-end;
}
.pmt-section-tabs .nav-link,
.pmt-tabs .nav-link {
  display: inline-flex;
  align-items: center;
  color: #4a6068;
  border: 1px solid transparent;
  border-top-left-radius: 0.25rem;
  border-top-right-radius: 0.25rem;
  background: transparent;
  padding: 0.45rem 0.9rem;
  line-height: 1.25;
  font-weight: 400;
  vertical-align: bottom;
}
.pmt-section-tabs .nav-link:hover,
.pmt-tabs .nav-link:hover {
  color: #1a3a4a;
  border-color: #d6e2e5 #d6e2e5 #c5d5d8;
  background: #f4f8f9;
}
.pmt-section-tabs .nav-link.active,
.pmt-tabs .nav-link.active {
  color: #0d2429;
  font-weight: 600;
  background: #fcfefe;
  border-color: #c5d5d8 #c5d5d8 #fcfefe;
}
.pmt-section-tabs .nav-link:focus,
.pmt-tabs .nav-link:focus {
  box-shadow: none;
}
.pmt-user { font-size: 0.85rem; color: #4a6068; }

/* Docs â€” TOC + native Razor article (no iframe) */
.pmt-docs-host {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.pmt-docs {
  width: 100%;
  max-width: none;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.pmt-docs-shell {
  display: grid;
  grid-template-columns: minmax(200px, 280px) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 0.75rem;
  flex: 1;
  min-height: 0;
  align-items: stretch;
}
.pmt-docs-topic-select {
  display: none;
  flex-shrink: 0;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid #c5d5d8;
  border-radius: 4px;
  background: #f4f8f9;
}
.pmt-docs-topic-select-label {
  flex-shrink: 0;
  margin: 0;
  font-size: 0.8rem;
  font-weight: 700;
  color: #1a3a4a;
}
.pmt-docs-topic-select-control {
  flex: 1;
  min-width: 0;
  font-size: 0.85rem;
  color: #17343d;
  border-color: #c5d5d8;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2317343d' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
  background-size: 14px 10px;
  padding-right: 2rem;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}
.pmt-docs-main {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid #c5d5d8;
  border-radius: 4px;
  background: #fff;
  overflow: hidden;
}
.pmt-docs-page-nav {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  align-items: center;
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid #c5d5d8;
  background: #f4f8f9;
}
.pmt-docs-page-nav-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: #1a3a4a;
  margin-right: 0.25rem;
}
.pmt-docs-page-nav-link {
  border: none;
  background: transparent;
  color: #17343d;
  font-size: 0.78rem;
  padding: 0.15rem 0.35rem;
  border-radius: 3px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.pmt-docs-page-nav-link:hover {
  background: #e4eef0;
  color: #8b0000;
}
.pmt-docs-page-nav-top {
  margin-left: auto;
  font-weight: 600;
  text-decoration: none;
}
.pmt-docs-article-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0.85rem 1.1rem 1.5rem;
}
.pmt-docs-article {
  color: #17343d;
  font-size: 0.92rem;
  line-height: 1.45;
  max-width: 52rem;
}
.pmt-docs-article h2 {
  font-size: 1.35rem;
  color: #1a3a4a;
  margin: 0 0 0.75rem;
  padding-bottom: 0.35rem;
  border-bottom: 2px solid #82b1b7;
}
.pmt-docs-article h3 {
  font-size: 1.08rem;
  color: #8b0000;
  margin: 1.35rem 0 0.5rem;
  scroll-margin-top: 0.5rem;
}
.pmt-docs-article h4 {
  font-size: 0.95rem;
  color: #1a3a4a;
  margin: 0.85rem 0 0.35rem;
}
.pmt-docs-article p {
  margin: 0.35rem 0;
}
.pmt-docs-article a {
  color: #0d5c66;
}
.pmt-docs-article a:hover {
  color: #8b0000;
}
.pmt-docs-article table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0;
  font-size: 0.85rem;
}
.pmt-docs-article th,
.pmt-docs-article td {
  border: 1px solid #c5d5d8;
  padding: 0.35rem 0.5rem;
  vertical-align: top;
}
.pmt-docs-article th {
  background: #e4eef0;
  color: #1a3a4a;
  font-weight: 600;
}
.pmt-docs-article ul,
.pmt-docs-article ol {
  margin: 0.4rem 0 0.6rem 1.25rem;
  padding: 0;
}
.pmt-docs-topic-links {
  list-style: none;
  margin-left: 0 !important;
  padding: 0;
}
.pmt-docs-topic-links li {
  margin: 0.15rem 0;
}
.pmt-docs-topic-links .btn-link {
  padding: 0;
  font-size: 0.92rem;
  color: #0d5c66;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.pmt-docs-topic-links .btn-link:hover {
  color: #8b0000;
}
.pmt-docs-article .pmt-table1 {
  margin: 0.75rem 0 1.25rem;
  max-width: none;
}
.pmt-docs-article .pmt-table1 h3 {
  color: #1a3a4a;
  font-size: 0.95rem;
  margin: 0 0 0.4rem;
  border: none;
  padding: 0;
}
.pmt-docs-muted {
  color: #4a6068;
  font-size: 0.85rem;
}
.pmt-docs-anchor {
  position: relative;
  top: -0.25rem;
}
.pmt-docs-toc {
  border: 1px solid #c5d5d8;
  background: #f4f8f9;
  border-radius: 4px;
  padding: 0.65rem 0.5rem;
  overflow: auto;
  min-height: 0;
}
.pmt-docs-toc-title {
  font-weight: 700;
  font-size: 0.85rem;
  color: #1a3a4a;
  padding: 0.25rem 0.5rem 0.5rem;
}
.pmt-docs-toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.pmt-docs-toc-link {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: #17343d;
  font-size: 0.82rem;
  padding: 0.4rem 0.5rem;
  border-radius: 3px;
  cursor: pointer;
}
.pmt-docs-toc-link:hover { background: #e4eef0; }
.pmt-docs-toc-link.active {
  background: #82b1b7;
  font-weight: 600;
  color: #0d2429;
}
@media (max-width: 900px) {
  .pmt-docs-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }
  .pmt-docs-toc {
    display: none;
  }
  .pmt-docs-topic-select {
    display: flex;
  }
  .pmt-docs-page-nav {
    max-height: 5.5rem;
    overflow: auto;
  }
  .pmt-docs-page-nav-top {
    margin-left: 0;
  }
  .pmt-docs-article-scroll {
    padding: 0.75rem 0.85rem 1.25rem;
  }
}
