.m36-tmv2 {
  --tmv2-ink: #152a38;
  --tmv2-muted: #607482;
  --tmv2-line: #d8e2e7;
  --tmv2-soft: #f3f7f8;
  --tmv2-accent: #176b87;
  --tmv2-safe: #14735d;
  --tmv2-blocked: #9b5428;
  color: var(--tmv2-ink);
  overflow: hidden;
}

.m36-tmv2 * {
  box-sizing: border-box;
}

.tmv2-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: start;
  padding: 22px;
  border: 1px solid #cbdde4;
  border-radius: 16px;
  background:
    radial-gradient(circle at 88% 10%, rgba(43, 139, 168, .13), transparent 34%),
    linear-gradient(135deg, #f9fcfd 0%, #eff7f9 100%);
}

.tmv2-eyebrow {
  display: block;
  color: var(--tmv2-accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.tmv2-hero h2 {
  margin: 6px 0 8px;
  font-size: 24px;
  line-height: 1.25;
}

.tmv2-hero p {
  max-width: 820px;
  margin: 0;
  color: var(--tmv2-muted);
  line-height: 1.65;
}

.tmv2-status-stack {
  display: flex;
  max-width: 340px;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.tmv2-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 10px;
  border: 1px solid var(--tmv2-line);
  border-radius: 999px;
  background: #fff;
  color: #365361;
  font-size: 12px;
  font-weight: 700;
}

.tmv2-chip.safe {
  border-color: #a7d8c9;
  background: #edf9f5;
  color: var(--tmv2-safe);
}

.tmv2-chip.blocked {
  border-color: #e5c0a8;
  background: #fff6ef;
  color: var(--tmv2-blocked);
}

.tmv2-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.tmv2-fact {
  min-width: 0;
  padding: 13px 14px;
  border: 1px solid var(--tmv2-line);
  border-radius: 12px;
  background: #fff;
}

.tmv2-fact small {
  display: block;
  margin-bottom: 6px;
  color: var(--tmv2-muted);
}

.tmv2-fact strong {
  display: block;
  overflow: hidden;
  color: var(--tmv2-ink);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tmv2-tabs {
  display: flex;
  gap: 6px;
  margin: 4px 0 14px;
  padding: 5px;
  overflow-x: auto;
  border-radius: 12px;
  background: var(--tmv2-soft);
}

.tmv2-tab {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 7px 13px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #4d6572;
  cursor: pointer;
  font-weight: 700;
}

.tmv2-tab.active {
  background: #fff;
  color: var(--tmv2-accent);
  box-shadow: 0 2px 8px rgba(26, 66, 82, .09);
}

.tmv2-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.tmv2-card {
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--tmv2-line);
  border-radius: 12px;
  background: #fff;
}

.tmv2-card h3,
.tmv2-card h4 {
  margin: 0 0 8px;
}

.tmv2-card p {
  margin: 0;
  color: var(--tmv2-muted);
  line-height: 1.55;
}

.tmv2-card code {
  overflow-wrap: anywhere;
}

.tmv2-operation-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.tmv2-operation {
  padding: 14px;
  border: 1px solid var(--tmv2-line);
  border-radius: 12px;
  background: #fff;
}

.tmv2-operation header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.tmv2-operation p {
  min-height: 42px;
  margin: 0 0 10px;
  color: var(--tmv2-muted);
  font-size: 13px;
  line-height: 1.55;
}

.tmv2-table {
  overflow: auto;
  border: 1px solid var(--tmv2-line);
  border-radius: 12px;
}

.tmv2-table table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
  background: #fff;
}

.tmv2-table th,
.tmv2-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #e5ecef;
  text-align: left;
  vertical-align: top;
}

.tmv2-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f5f8f9;
  color: #526a76;
  font-size: 12px;
}

.tmv2-table tr:last-child td {
  border-bottom: 0;
}

.tmv2-table tbody tr:hover {
  background: #f8fbfc;
}

.tmv2-link {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--tmv2-accent);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.tmv2-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.tmv2-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tmv2-filter input,
.tmv2-filter select {
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid #cbd8de;
  border-radius: 8px;
  background: #fff;
}

.tmv2-advanced details {
  margin-bottom: 10px;
  border: 1px solid var(--tmv2-line);
  border-radius: 10px;
  background: #fff;
}

.tmv2-advanced summary {
  padding: 12px 14px;
  cursor: pointer;
  color: #34505e;
  font-weight: 800;
}

.tmv2-advanced pre {
  max-height: 420px;
  margin: 0;
  padding: 14px;
  overflow: auto;
  border-top: 1px solid var(--tmv2-line);
  background: #f7fafb;
  font-size: 12px;
  line-height: 1.5;
}

.tmv2-empty,
.tmv2-error {
  padding: 20px;
  border: 1px dashed #c8d6dc;
  border-radius: 12px;
  color: var(--tmv2-muted);
  background: #f8fbfc;
}

.tmv2-error {
  border-color: #e2b6a0;
  color: #8d4625;
  background: #fff7f2;
}

@media (max-width: 1100px) {
  .tmv2-facts,
  .tmv2-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tmv2-operation-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .tmv2-hero {
    grid-template-columns: 1fr;
  }

  .tmv2-status-stack {
    justify-content: flex-start;
  }

  .tmv2-facts,
  .tmv2-grid,
  .tmv2-operation-grid {
    grid-template-columns: 1fr;
  }
}


/* M38 UIP1 lifecycle candidate */
.tmv2-lifecycle { margin:14px 0; padding:16px; border:1px solid var(--tmv2-line); border-radius:14px; background:var(--tmv2-soft); }
.tmv2-lifecycle-header { display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:12px; }
.tmv2-lifecycle-header h3 { margin:4px 0 0; }
.tmv2-lifecycle-header .btn { min-height:44px; flex:0 0 auto; }
.tmv2-lifecycle-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; margin:0; padding:0; list-style:none; }
.tmv2-lifecycle-step { display:grid; grid-template-columns:32px minmax(0,1fr); gap:8px; min-width:0; padding:12px; border:1px solid var(--tmv2-line); border-radius:10px; background:#fff; }
.tmv2-lifecycle-step.safe { border-color:#9dcfbe; }
.tmv2-lifecycle-step.blocked { border-color:#e5c0a8; background:#fffaf6; }
.tmv2-lifecycle-index { display:grid; place-items:center; width:32px; height:32px; border-radius:50%; background:#e7f1f4; color:var(--tmv2-accent); font-weight:800; }
.tmv2-lifecycle-step div span { display:block; margin-top:2px; color:var(--tmv2-muted); }
.tmv2-lifecycle-step p { grid-column:1 / -1; margin:4px 0 0; font-size:13px; line-height:1.45; }
.tmv2-lifecycle-guard { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-top:12px; }
.tmv2-lifecycle-guard p { margin:0; padding:10px 12px; border-radius:9px; background:#fff; color:var(--tmv2-muted); }
@media (max-width:1100px) { .tmv2-lifecycle-grid { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media (max-width:720px) {
  .tmv2-lifecycle-header { align-items:stretch; flex-direction:column; }
  .tmv2-lifecycle-grid,.tmv2-lifecycle-guard { grid-template-columns:1fr; }
}

/* M39 A1 nine-template read-only product surface */
.m39-template-portfolio {
  position: relative;
  isolation: isolate;
}

.m39-template-portfolio [hidden] {
  display: none !important;
}

.m39-template-portfolio button,
.m39-template-portfolio input,
.m39-template-portfolio select,
.m39-template-portfolio summary {
  min-height: 44px;
  font: inherit;
}

.m39-template-portfolio button,
.m39-template-portfolio summary {
  cursor: pointer;
}

.m39-template-portfolio button:focus-visible,
.m39-template-portfolio input:focus-visible,
.m39-template-portfolio select:focus-visible,
.m39-template-portfolio summary:focus-visible {
  outline: 3px solid #ffbf47;
  outline-offset: 3px;
}

.tmv2-chip > span[aria-hidden="true"] {
  margin-right: 6px;
  font-size: 14px;
}

.tmv2-portfolio-hero {
  border-color: #b9d7df;
  background:
    radial-gradient(circle at 84% 16%, rgba(16, 115, 98, .17), transparent 32%),
    linear-gradient(132deg, #f8fcfd 0%, #eaf5f4 100%);
}

.tmv2-hero-summary {
  display: grid;
  min-width: 196px;
  padding: 16px 18px;
  border: 1px solid #c6dce1;
  border-radius: 14px;
  background: rgba(255, 255, 255, .9);
  box-shadow: 0 10px 26px rgba(21, 59, 73, .08);
}

.tmv2-hero-summary strong {
  color: var(--tmv2-accent);
  font-size: 34px;
  line-height: 1;
}

.tmv2-hero-summary span {
  margin-top: 6px;
  font-weight: 800;
}

.tmv2-hero-summary small {
  margin-top: 7px;
  color: var(--tmv2-muted);
  line-height: 1.45;
}

.tmv2-catalog-toolbar {
  display: grid;
  grid-template-columns: minmax(230px, 1.45fr) repeat(4, minmax(130px, .72fr)) auto;
  gap: 10px;
  align-items: end;
  margin: 16px 0;
  padding: 14px;
  border: 1px solid var(--tmv2-line);
  border-radius: 14px;
  background: #f7fafb;
}

.tmv2-catalog-toolbar label {
  display: grid;
  gap: 6px;
  color: #465f6b;
  font-size: 13px;
  font-weight: 800;
}

.tmv2-catalog-toolbar input,
.tmv2-catalog-toolbar select,
.tmv2-catalog-toolbar button,
.tmv2-detail-toolbar button,
.tmv2-card-actions button,
.tmv2-audit-drawer button,
.tmv2-compare-table button,
.tmv2-error button {
  min-width: 44px;
  padding: 9px 12px;
  border: 1px solid #b9cbd3;
  border-radius: 9px;
  background: #fff;
  color: #254654;
  font-weight: 800;
}

.tmv2-catalog-toolbar button:hover,
.tmv2-detail-toolbar button:hover,
.tmv2-card-actions button:hover,
.tmv2-audit-drawer button:hover,
.tmv2-compare-table button:hover {
  border-color: var(--tmv2-accent);
  color: var(--tmv2-accent);
}

.tmv2-catalog-heading,
.tmv2-detail-toolbar,
.tmv2-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.tmv2-catalog-heading {
  margin: 0 0 12px;
}

.tmv2-catalog-heading h3,
.tmv2-catalog-heading p,
.tmv2-section-head h3 {
  margin: 0;
}

.tmv2-catalog-heading p {
  margin-top: 3px;
  color: var(--tmv2-muted);
}

.tmv2-catalog-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.tmv2-catalog-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--tmv2-line);
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 7px 20px rgba(26, 63, 79, .055);
}

.tmv2-catalog-card--hero {
  border-top: 5px solid var(--tmv2-accent);
  box-shadow: 0 12px 28px rgba(24, 95, 117, .1);
}

.tmv2-card-open {
  display: flex;
  width: 100%;
  min-height: 100%;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 11px;
  padding: 17px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--tmv2-ink);
  text-align: left;
}

.tmv2-card-open:hover {
  background: #f8fbfc;
}

.tmv2-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tmv2-card-rank {
  color: var(--tmv2-accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .04em;
}

.tmv2-card-title {
  overflow-wrap: anywhere;
  font-size: 18px;
  line-height: 1.35;
}

.tmv2-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tmv2-card-tags > span {
  padding: 4px 8px;
  border-radius: 7px;
  background: #eef4f6;
  color: #45616e;
  font-size: 12px;
  font-weight: 750;
}

.tmv2-card-summary,
.tmv2-card-owner,
.tmv2-card-next {
  color: var(--tmv2-muted);
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.tmv2-card-source,
.tmv2-card-owner,
.tmv2-card-next {
  display: grid;
  gap: 3px;
  padding-top: 10px;
  border-top: 1px solid #e7eef1;
}

.tmv2-card-source small,
.tmv2-card-owner small,
.tmv2-card-next small,
.tmv2-next-step small {
  color: #6c7f88;
  font-size: 12px;
  font-weight: 800;
}

.tmv2-card-source strong {
  overflow-wrap: anywhere;
}

.tmv2-card-proof,
.tmv2-mini-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tmv2-card-proof strong,
.tmv2-mini-facts strong {
  padding: 7px 9px;
  border-radius: 8px;
  background: #fff3e9;
  color: #85471f;
  font-size: 12px;
}

.tmv2-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 11px 14px 14px;
  border-top: 1px solid #e7eef1;
}

.tmv2-card-actions button:first-child {
  border-color: var(--tmv2-accent);
  background: var(--tmv2-accent);
  color: #fff;
}

.tmv2-detail-toolbar {
  margin-bottom: 12px;
}

.tmv2-detail-toolbar > div {
  display: flex;
  gap: 8px;
}

.tmv2-detail-hero {
  margin-bottom: 14px;
}

.tmv2-source-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 14px;
}

.tmv2-source-grid .tmv2-card h4 {
  overflow-wrap: anywhere;
}

.tmv2-grid--two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.tmv2-w01 {
  margin: 14px 0;
  padding: 17px;
  border: 1px solid #e4b99f;
  border-radius: 15px;
  background: #fffaf6;
}

.tmv2-callout {
  display: flex;
  gap: 10px;
  margin: 13px 0;
  padding: 12px 14px;
  border-radius: 10px;
}

.tmv2-callout--blocked {
  border: 1px solid #e4b99f;
  background: #fff2e8;
  color: #78401f;
}

.tmv2-role-row {
  display: grid;
  grid-template-columns: minmax(140px, .8fr) minmax(130px, .7fr) minmax(190px, 1.5fr);
  gap: 8px;
  margin-top: 9px;
  padding: 9px 0;
  border-top: 1px solid #e3eaed;
}

.tmv2-role-row small {
  color: var(--tmv2-muted);
  line-height: 1.45;
}

.tmv2-group-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 11px 0 0;
  padding: 0;
  list-style: none;
}

.tmv2-group-list li {
  padding: 7px 9px;
  border-radius: 8px;
  background: #f0f5f6;
}

.tmv2-next-step,
.tmv2-capability {
  margin-top: 12px;
  padding: 14px 16px;
  border: 1px solid var(--tmv2-line);
  border-radius: 12px;
  background: #fff;
}

.tmv2-next-step {
  display: grid;
  gap: 5px;
  border-left: 5px solid #a75b2c;
}

.tmv2-next-step p,
.tmv2-capability p {
  margin: 0;
  color: var(--tmv2-muted);
  line-height: 1.55;
}

.tmv2-capability h3 {
  margin: 0 0 6px;
}

.tmv2-audit-mask {
  position: fixed;
  z-index: 10020;
  inset: 0;
  background: rgba(10, 27, 35, .48);
}

.tmv2-audit-drawer {
  position: fixed;
  z-index: 10021;
  top: 0;
  right: 0;
  width: min(620px, 92vw);
  height: 100vh;
  padding: 20px;
  overflow: auto;
  border-left: 1px solid #b9cbd3;
  background: #fff;
  box-shadow: -18px 0 50px rgba(12, 38, 50, .2);
}

.tmv2-audit-drawer > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.tmv2-audit-drawer h3 {
  margin: 4px 0 0;
}

.tmv2-audit-drawer > p {
  color: var(--tmv2-muted);
  line-height: 1.5;
}

.tmv2-audit-drawer details {
  margin-top: 10px;
  border: 1px solid var(--tmv2-line);
  border-radius: 10px;
}

.tmv2-audit-drawer summary {
  padding: 10px 13px;
  font-weight: 800;
}

.tmv2-audit-drawer pre {
  margin: 0;
  padding: 13px;
  overflow: auto;
  border-top: 1px solid var(--tmv2-line);
  background: #f5f8f9;
  font-size: 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.tmv2-compare-wrap {
  margin-top: 14px;
  overflow: auto;
  border: 1px solid var(--tmv2-line);
  border-radius: 14px;
}

.tmv2-compare-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  background: #fff;
}

.tmv2-compare-table th,
.tmv2-compare-table td {
  min-width: 190px;
  padding: 12px;
  border-right: 1px solid #e1e9ec;
  border-bottom: 1px solid #e1e9ec;
  text-align: left;
  vertical-align: top;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.tmv2-compare-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #eef5f6;
}

.tmv2-compare-table tbody th {
  position: sticky;
  left: 0;
  z-index: 1;
  background: #f7fafb;
}

.tmv2-compare-table th small,
.tmv2-provenance-note {
  display: block;
  margin-top: 5px;
  color: var(--tmv2-muted);
  font-weight: 650;
}

.tmv2-compare-table thead button {
  display: block;
  width: 100%;
  margin-bottom: 8px;
  text-align: left;
}

@media (max-width: 1500px) {
  .tmv2-catalog-toolbar {
    grid-template-columns: minmax(240px, 1.4fr) repeat(2, minmax(150px, 1fr));
  }

  .tmv2-catalog-toolbar button {
    width: 100%;
  }
}

@media (max-width: 1180px) {
  .tmv2-catalog-grid,
  .tmv2-source-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .tmv2-catalog-toolbar,
  .tmv2-catalog-grid,
  .tmv2-source-grid,
  .tmv2-grid--two,
  .tmv2-group-list {
    grid-template-columns: 1fr;
  }

  .tmv2-catalog-heading,
  .tmv2-detail-toolbar,
  .tmv2-section-head,
  .tmv2-callout {
    align-items: stretch;
    flex-direction: column;
  }

  .tmv2-detail-toolbar > div,
  .tmv2-card-actions {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .tmv2-role-row {
    grid-template-columns: 1fr;
  }
}
