/* pm.css — Patent Mapping Studio styles */

.pm-wrap {
  padding: 24px 32px 64px;
  max-width: 1480px;
  margin: 0 auto;
}

.pm-loading {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 120px 32px;
  text-align: center;
}
.pm-spinner {
  width: 48px; height: 48px; border-radius: 50%;
  border: 4px solid var(--color-border, #e2e8f0);
  border-top-color: var(--color-accent, #0d9488);
  animation: pm-spin 0.8s linear infinite;
  margin-bottom: 20px;
}
@keyframes pm-spin { to { transform: rotate(360deg); } }
.pm-loading-text { font-size: 17px; font-weight: 600; color: var(--color-text); margin-bottom: 6px; }
.pm-loading-sub { font-size: 13px; color: var(--color-text-secondary); }
.pm-error {
  padding: 32px; border-radius: 12px;
  background: rgba(220,38,38,0.08); color: #b91c1c;
  border: 1px solid rgba(220,38,38,0.2); margin: 32px;
}

/* HEADER */
.pm-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 24px 28px; margin-bottom: 24px; gap: 24px;
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}
.pm-eyebrow {
  text-transform: uppercase; letter-spacing: 0.14em;
  font-size: 11px; font-weight: 700; color: var(--color-accent, #0d9488);
  margin-bottom: 8px;
}
.pm-title {
  font-size: 28px; font-weight: 700; margin: 0 0 6px;
  color: var(--color-text);
  font-family: 'Instrument Serif', Georgia, serif;
  letter-spacing: -0.01em;
}
.pm-subtitle { font-size: 13px; color: var(--color-text-secondary); line-height: 1.55; max-width: 640px; }
.pm-header-right { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.pm-tag {
  display: inline-flex; align-items: center; padding: 6px 12px;
  border-radius: 999px; font-size: 12px; font-weight: 600;
  border: 1px solid transparent;
}
.pm-tag-green { background: rgba(16,185,129,0.10); color: #047857; border-color: rgba(16,185,129,0.3); }
.pm-tag-amber { background: rgba(245,158,11,0.10); color: #b45309; border-color: rgba(245,158,11,0.3); }
.pm-tag-blue  { background: rgba(13,148,136,0.08); color: #0f766e; border-color: rgba(13,148,136,0.3); }

/* KPI CARDS */
.pm-kpi-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px; margin-bottom: 24px;
}
.pm-kpi {
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: 12px; padding: 16px 18px;
  box-shadow: 0 1px 2px rgba(15,23,42,0.03);
}
.pm-kpi-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--color-text-muted); font-weight: 600; margin-bottom: 8px; }
.pm-kpi-value { font-size: 28px; font-weight: 700; color: var(--color-text); line-height: 1.1; }
.pm-kpi-sub { font-size: 11.5px; color: var(--color-text-secondary); margin-top: 6px; }

/* FILTERS */
.pm-filters {
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: 14px; padding: 18px 20px; margin-bottom: 20px;
}
.pm-filter-block { margin-bottom: 14px; }
.pm-filter-block:last-child { margin-bottom: 0; }
.pm-filter-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  font-weight: 600; color: var(--color-text-muted); margin-bottom: 8px;
}
.pm-filter-label-sm { font-size: 11px; font-weight: 600; color: var(--color-text-muted);
  text-transform: uppercase; letter-spacing: 0.06em; margin-right: 8px; }
.pm-filter-inline { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.pm-filter-sub { display: flex; align-items: center; gap: 8px; }
.pm-filter-grow { flex: 1; min-width: 220px; }

.pm-zone-tabs {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px;
}
.pm-zone-tab {
  border: 1px solid var(--color-border); background: transparent;
  border-radius: 10px; padding: 10px 12px; cursor: pointer;
  text-align: left; font-family: inherit; color: var(--color-text);
  transition: all 0.15s;
}
.pm-zone-tab:hover { background: var(--color-surface-2, #f1f5f9); }
.pm-zone-tab.active {
  background: var(--color-accent, #0d9488); color: white;
  border-color: var(--color-accent, #0d9488);
}
.pm-zone-tab-id { font-size: 11px; font-weight: 700; opacity: 0.8; letter-spacing: 0.04em; }
.pm-zone-tab-label { font-size: 13px; font-weight: 600; margin-top: 4px; }

.pm-year-row { display: flex; flex-wrap: wrap; gap: 6px; }
.pm-year-btn {
  border: 1px solid var(--color-border); background: transparent;
  border-radius: 8px; padding: 6px 10px; cursor: pointer;
  font-family: inherit; font-size: 12.5px; font-weight: 600;
  color: var(--color-text); transition: all 0.15s;
}
.pm-year-btn:hover { background: var(--color-surface-2, #f1f5f9); }
.pm-year-btn.active {
  background: var(--color-accent, #0d9488); color: white;
  border-color: var(--color-accent, #0d9488);
}

.pm-select, .pm-input {
  font-family: inherit; font-size: 13px;
  padding: 7px 10px; border-radius: 8px;
  border: 1px solid var(--color-border);
  background: var(--color-surface, #fff); color: var(--color-text);
  outline: none; transition: border-color 0.15s;
}
.pm-select:focus, .pm-input:focus { border-color: var(--color-accent, #0d9488); }
.pm-input { width: 100%; }
.pm-reset-btn {
  border: 1px solid var(--color-border); background: transparent;
  border-radius: 8px; padding: 7px 14px; cursor: pointer;
  font-family: inherit; font-size: 12.5px; font-weight: 600;
  color: var(--color-text-secondary);
}
.pm-reset-btn:hover { background: var(--color-surface-2); color: var(--color-text); }

/* V7 §9 DIAGNOSTICS PANEL */
.pm-diag {
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 20px;
}
.pm-diag-warn {
  background: rgba(245,158,11,0.06);
  border-color: rgba(245,158,11,0.35);
}
.pm-diag-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px; gap: 12px; flex-wrap: wrap;
}
.pm-diag-eyebrow {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em;
  font-weight: 700; color: var(--color-accent);
}
.pm-diag-flag {
  font-size: 12px; font-weight: 700; color: #b45309;
  background: rgba(245,158,11,0.18);
  padding: 4px 12px; border-radius: 999px;
}
.pm-diag-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}
.pm-diag-cell {
  padding: 10px 14px;
  background: var(--color-surface-2);
  border-radius: 8px;
  border: 1px solid var(--color-border-light);
}
.pm-diag-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em;
  font-weight: 600; color: var(--color-text-muted); margin-bottom: 6px;
}
.pm-diag-value {
  font-size: 12.5px; color: var(--color-text); line-height: 1.55;
  font-family: ui-monospace, monospace;
}
.pm-diag-note {
  margin-top: 12px; padding: 10px 14px;
  background: rgba(245,158,11,0.10);
  border-left: 3px solid #f59e0b;
  border-radius: 6px;
  font-size: 12.5px; color: var(--color-text); line-height: 1.55;
}
.pm-diag-note em { font-style: italic; color: var(--color-text-secondary); }

/* METHODOLOGY EXPLAINER (per zone) */
.pm-method-explainer {
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 22px 24px;
  margin-bottom: 20px;
}
.pm-method-head { margin-bottom: 16px; }
.pm-method-eyebrow {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.14em;
  font-weight: 700; color: var(--color-accent, #0d9488);
}
.pm-method-zone-title {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 22px; font-weight: 600; margin: 4px 0 0;
  color: var(--color-text);
}
.pm-method-axes {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px;
}
.pm-axis-card {
  padding: 16px 18px; border-radius: 12px;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border-light);
}
.pm-axis-y { border-left: 3px solid #0d9488; }
.pm-axis-x { border-left: 3px solid #f59e0b; }
.pm-axis-tag {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  background: var(--color-accent, #0d9488); color: white;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; margin-bottom: 8px;
}
.pm-axis-x .pm-axis-tag { background: #f59e0b; }
.pm-axis-title { font-size: 16px; font-weight: 700; color: var(--color-text); margin-bottom: 4px; }
.pm-axis-formula {
  font-family: ui-monospace, monospace; font-size: 12.5px;
  color: var(--color-text); padding: 6px 10px;
  background: var(--color-bg); border-radius: 6px;
  margin-bottom: 8px; display: inline-block;
}
.pm-axis-desc { font-size: 12.5px; color: var(--color-text-secondary); line-height: 1.6; }
.pm-axis-props { margin-top: 10px; }
.pm-pchip {
  display: inline-block; padding: 4px 10px;
  background: var(--color-bg); border-radius: 999px;
  border: 1px solid var(--color-border-light);
  font-size: 11.5px; color: var(--color-text);
  margin-right: 4px; margin-bottom: 4px;
}

.pm-quadrant-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
}
.pm-qcard {
  padding: 12px 16px; border-radius: 10px;
  border: 1px solid var(--color-border);
  background: var(--color-surface-2);
}
.pm-qcard-complete {
  background: rgba(245,158,11,0.07);
  border-color: rgba(245,158,11,0.30);
  grid-row: span 1;
}
.pm-qcard-direct  { background: rgba(220,38,38,0.06); border-color: rgba(220,38,38,0.28); }
.pm-qcard-cdu     { background: rgba(251,146,60,0.06); border-color: rgba(251,146,60,0.28); }
.pm-qcard-techno  { background: rgba(6,182,212,0.06); border-color: rgba(6,182,212,0.28); }
.pm-qhead { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 700; color: var(--color-text); }
.pm-qdot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.pm-qcond { font-family: ui-monospace, monospace; font-size: 11px; color: var(--color-text-muted); margin: 4px 0 6px; }
.pm-qmean { font-size: 12px; color: var(--color-text-secondary); line-height: 1.5; }

/* KPI variants */
.pm-kpi-highlight {
  box-shadow: 0 0 0 1px rgba(245,158,11,0.35), 0 4px 12px rgba(245,158,11,0.10);
}
.pm-kpi-bar { display: none; }

/* Header tag colours (new palette) */
.pm-tag-red    { background: rgba(220,38,38,0.10); color: #b91c1c; border-color: rgba(220,38,38,0.30); }
.pm-tag-gold   { background: rgba(245,158,11,0.10); color: #b45309; border-color: rgba(245,158,11,0.30); }
.pm-tag-orange { background: rgba(251,146,60,0.10); color: #c2410c; border-color: rgba(251,146,60,0.30); }
.pm-tag-cyan   { background: rgba(6,182,212,0.08); color: #0e7490; border-color: rgba(6,182,212,0.30); }

/* ★ COMPLETE-NOT-CDU PRIORITY SECTION */
.pm-star-section {
  background: linear-gradient(180deg, rgba(245,158,11,0.06) 0%, rgba(245,158,11,0.02) 100%);
  border: 1px solid rgba(245,158,11,0.35);
  border-radius: 14px;
  padding: 20px 24px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(245,158,11,0.10);
}
.pm-star-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; margin-bottom: 14px; flex-wrap: wrap;
}
.pm-star-eyebrow {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em;
  font-weight: 700; color: #b45309;
}
.pm-star-title {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 22px; font-weight: 600; margin: 4px 0 6px;
  color: var(--color-text);
}
.pm-star-sub { font-size: 12.5px; color: var(--color-text-secondary); line-height: 1.55; max-width: 760px; }
.pm-star-empty { padding: 16px; color: var(--color-text-secondary); font-size: 13px; font-style: italic; }
.pm-star-list { display: flex; flex-direction: column; gap: 4px; }
.pm-star-row {
  display: grid; grid-template-columns: 60px 150px 1fr 220px 70px;
  gap: 12px; padding: 8px 12px;
  background: var(--color-surface);
  border-radius: 8px;
  border: 1px solid var(--color-border-light);
  cursor: pointer; align-items: center;
  font-size: 12.5px; transition: all 0.12s;
}
.pm-star-row:hover {
  background: rgba(245,158,11,0.08);
  border-color: rgba(245,158,11,0.40);
  transform: translateX(2px);
}
.pm-star-yr  { font-family: ui-monospace, monospace; color: var(--color-text-muted); font-size: 11.5px; }
.pm-star-pub { font-family: ui-monospace, monospace; font-size: 11.5px; color: var(--color-text); }
.pm-star-title { color: var(--color-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-star-assn { color: var(--color-text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-star-y { font-family: ui-monospace, monospace; font-weight: 700; color: #b45309; text-align: right; }
.pm-star-more { padding: 10px 12px; color: var(--color-text-muted); font-size: 12px; font-style: italic; text-align: center; }

/* SILICONE STRICTNESS FILTER */
.pm-filter-mini {
  font-size: 10.5px; font-weight: 500;
  color: var(--color-text-muted); margin-left: 8px;
  text-transform: none; letter-spacing: 0;
}
.pm-sili-row {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
}
.pm-sili-btn {
  border: 1px solid var(--color-border);
  background: var(--color-surface-2);
  border-radius: 10px; padding: 12px 14px;
  text-align: left; cursor: pointer;
  font-family: inherit; color: var(--color-text);
  transition: all 0.15s;
}
.pm-sili-btn:hover { background: var(--color-surface); border-color: var(--color-accent); }
.pm-sili-btn.active {
  background: var(--color-accent, #0d9488); color: white;
  border-color: var(--color-accent, #0d9488);
  box-shadow: 0 2px 8px rgba(13,148,136,0.25);
}
.pm-sili-btn.active .pm-sili-btn-sub { color: rgba(255,255,255,0.85); }
.pm-sili-btn-title { font-size: 13.5px; font-weight: 700; margin-bottom: 4px; }
.pm-sili-btn-sub {
  font-size: 11.5px; color: var(--color-text-secondary);
  line-height: 1.4;
}

/* FORMULATOR CHIPS */
.pm-formulator-row {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.pm-fmlr-meta {
  font-family: inherit; font-size: 11.5px; font-weight: 600;
  padding: 6px 12px; border-radius: 999px;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  color: var(--color-text); cursor: pointer;
}
.pm-fmlr-meta:hover { background: var(--color-accent); color: white; border-color: var(--color-accent); }
.pm-fmlr-chip {
  font-family: inherit; font-size: 11.5px;
  padding: 5px 11px; border-radius: 999px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  color: var(--color-text); cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: all 0.12s;
}
.pm-fmlr-chip:hover { border-color: var(--color-accent); }
.pm-fmlr-chip.active {
  background: var(--color-accent, #0d9488); color: white;
  border-color: var(--color-accent, #0d9488);
}
.pm-fmlr-c {
  font-family: ui-monospace, monospace; font-size: 10.5px; font-weight: 700;
  background: rgba(0,0,0,0.10); padding: 1px 6px; border-radius: 999px;
}
.pm-fmlr-chip.active .pm-fmlr-c { background: rgba(255,255,255,0.25); }

@media (max-width: 980px) {
  .pm-sili-row { grid-template-columns: 1fr; }
}

/* DOWNLOAD MATRIX (5 zones × 4 quadrants) */
.pm-matrix-section {
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 20px 24px;
  margin-bottom: 20px;
}
.pm-matrix-head { margin-bottom: 14px; }
.pm-matrix-eyebrow {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em;
  font-weight: 700; color: var(--color-accent, #0d9488);
}
.pm-matrix-title {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 20px; font-weight: 600; margin: 4px 0 6px;
  color: var(--color-text);
}
.pm-matrix-sub { font-size: 12.5px; color: var(--color-text-secondary); line-height: 1.55; max-width: 760px; }

.pm-matrix-table { display: flex; flex-direction: column; gap: 6px; }
.pm-matrix-row {
  display: grid; grid-template-columns: minmax(200px, 1.4fr) repeat(4, 1fr);
  gap: 8px; align-items: stretch;
}
.pm-matrix-header .pm-matrix-cell { background: transparent; box-shadow: none; padding-top: 4px; padding-bottom: 4px; }
.pm-matrix-active .pm-matrix-zonecell { box-shadow: inset 3px 0 0 var(--color-accent); }
.pm-matrix-cell {
  padding: 10px 12px;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border-light);
  border-radius: 10px;
  display: flex; flex-direction: column; justify-content: center;
  min-height: 56px;
}
.pm-matrix-zonecell { background: transparent; border: none; padding-left: 6px; }
.pm-matrix-zone-id {
  font-size: 10.5px; font-weight: 800; letter-spacing: 0.06em;
  color: var(--color-accent, #0d9488);
}
.pm-matrix-zone-label { font-size: 13px; font-weight: 600; color: var(--color-text); margin-top: 2px; }
.pm-matrix-tierhead {
  font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  text-align: center; background: transparent; border: none; border-radius: 0;
  padding-bottom: 8px;
}
.pm-matrix-data {
  cursor: pointer; transition: all 0.12s;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
}
.pm-matrix-data:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(13,148,136,0.12);
  border-color: var(--color-accent);
  background: var(--color-surface);
}
.pm-matrix-empty {
  cursor: default;
  opacity: 0.5;
}
.pm-matrix-empty:hover {
  transform: none; box-shadow: none; border-color: var(--color-border-light);
  background: var(--color-surface-2);
}
.pm-matrix-count { font-size: 22px; font-weight: 800; font-family: ui-monospace, monospace; line-height: 1; }
.pm-matrix-download {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--color-text-muted); margin-top: 4px;
}
.pm-matrix-dim { opacity: 0.4; }

@media (max-width: 980px) {
  .pm-matrix-row { grid-template-columns: 1fr 1fr; }
  .pm-matrix-tierhead { display: none; }
}

/* COMPANY SEARCH BAR */
.pm-company-bar {
  display: flex; align-items: center; gap: 10px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.pm-company-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  font-weight: 700; color: var(--color-text-muted);
}
.pm-company-input {
  flex: 1; min-width: 240px;
  font-family: inherit; font-size: 13.5px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text);
  outline: none;
}
.pm-company-input:focus { border-color: var(--color-accent); }
.pm-company-hint {
  width: 100%; margin-top: 4px;
  font-size: 12px; color: var(--color-text-secondary);
}
.pm-company-hint a { color: var(--color-accent); cursor: pointer; text-decoration: none; }
.pm-company-hint a:hover { text-decoration: underline; }

/* METHODOLOGY BANNER (legacy, kept for compat) */
.pm-method {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 14px 18px; margin-bottom: 20px;
  background: rgba(13,148,136,0.06);
  border: 1px solid rgba(13,148,136,0.18);
  border-radius: 12px;
}
.pm-method-icon { font-size: 20px; line-height: 1; }
.pm-method-text { font-size: 13px; color: var(--color-text); line-height: 1.55; }

/* CHART CARD */
.pm-chart-card {
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border);
  border-radius: 14px; padding: 20px 22px; margin-bottom: 20px;
}
.pm-chart-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 14px; gap: 16px; flex-wrap: wrap;
}
.pm-chart-title { font-size: 16px; font-weight: 700; margin: 0 0 4px; color: var(--color-text); }
.pm-chart-sub { font-size: 12px; color: var(--color-text-secondary); }
.pm-chart-legend { display: flex; gap: 14px; align-items: center; font-size: 12px; color: var(--color-text-secondary); }
.pm-legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; }
.pm-plot { width: 100%; min-height: 540px; }

/* Zoom bar */
.pm-zoom-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 0 14px;
  border-bottom: 1px dashed var(--color-border);
  margin-bottom: 10px;
}
.pm-zoom-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  font-weight: 600; color: var(--color-text-muted); margin-right: 4px;
}
.pm-zoom-btn {
  border: 1px solid var(--color-border);
  background: var(--color-surface-2);
  border-radius: 999px; padding: 6px 14px;
  font-family: inherit; font-size: 12px; font-weight: 600;
  color: var(--color-text); cursor: pointer;
  transition: all 0.15s;
}
.pm-zoom-btn:hover {
  background: var(--color-accent, #0d9488); color: white;
  border-color: var(--color-accent, #0d9488);
}
.pm-zoom-reset { background: transparent; }

/* Clickable assignee row */
.pm-assign-row-clickable { cursor: pointer; padding: 4px 6px; border-radius: 6px; transition: background 0.12s; }
.pm-assign-row-clickable:hover { background: var(--color-surface-2); }
.pm-assign-row-clickable:hover .pm-assign-name { color: var(--color-accent); }

/* Year histogram inside assignee modal */
.pm-year-hist {
  display: flex; align-items: flex-end; gap: 2px;
  padding: 14px 0 6px;
  border-bottom: 1px solid var(--color-border-light);
  margin-bottom: 14px;
  min-height: 100px;
}
.pm-year-bar {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  position: relative; min-width: 10px;
}
.pm-year-bar-fill {
  width: 100%; background: linear-gradient(180deg, #14b8a6, #0d9488);
  border-radius: 3px 3px 0 0; min-height: 2px;
}
.pm-year-bar-label {
  font-size: 9.5px; color: var(--color-text-muted); margin-top: 3px;
  font-family: ui-monospace, monospace;
}
.pm-year-bar-count {
  font-size: 9px; color: var(--color-text); position: absolute;
  top: -14px; font-weight: 600;
}

/* Assignee families table */
.pm-assignee-table {
  border: 1px solid var(--color-border);
  border-radius: 10px; overflow: hidden;
  margin-bottom: 18px;
}
.pm-at-head, .pm-at-row {
  display: grid;
  grid-template-columns: 60px 140px 1fr 64px 64px 120px;
  gap: 12px; padding: 10px 14px;
  align-items: center;
}
/* Prevent X/Y numbers from overflowing into adjacent columns */
.pm-at-col-x, .pm-at-col-y { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pm-at-head {
  background: var(--color-surface-2);
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em;
  font-weight: 700; color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
}
.pm-at-body { max-height: 360px; overflow-y: auto; }
.pm-at-row {
  font-size: 12.5px;
  border-bottom: 1px solid var(--color-border-light);
  cursor: pointer; transition: background 0.12s;
}
.pm-at-row:hover { background: var(--color-surface-2); }
.pm-at-row:last-child { border-bottom: 0; }
.pm-at-col-yr { font-family: ui-monospace, monospace; color: var(--color-text-muted); }
.pm-at-col-pub { font-family: ui-monospace, monospace; font-size: 11.5px; color: var(--color-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pm-at-col-title { color: var(--color-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pm-at-col-x, .pm-at-col-y { text-align: center; font-family: ui-monospace, monospace; font-weight: 600; }
.pm-at-col-tier { text-align: right; }
.pm-at-tier-pill {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em;
}

@media (max-width: 980px) {
  .pm-at-head, .pm-at-row {
    grid-template-columns: 50px 110px 1fr 80px;
  }
  .pm-at-col-x, .pm-at-col-y { display: none; }
  .pm-year-bar-label { display: none; }
}

/* ASSIGNEES + PROPS CARDS */
.pm-assign-card, .pm-props-card {
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border);
  border-radius: 14px; padding: 20px 22px; margin-bottom: 20px;
}
.pm-section-title { font-size: 15px; font-weight: 700; margin: 0 0 14px; color: var(--color-text); }
.pm-section-title-sm { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em;
  font-weight: 600; color: var(--color-text-muted); margin: 18px 0 10px; }

.pm-assign-grid { display: flex; flex-direction: column; gap: 6px; }
.pm-assign-row { display: grid; grid-template-columns: 200px 1fr 50px; align-items: center; gap: 10px; }
.pm-assign-name { font-size: 13px; font-weight: 500; color: var(--color-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pm-assign-bar { height: 10px; background: var(--color-surface-2); border-radius: 999px; overflow: hidden; }
.pm-assign-fill { height: 100%; background: linear-gradient(90deg, #0d9488, #14b8a6); border-radius: 999px; }
.pm-assign-count { font-size: 12.5px; font-weight: 600; color: var(--color-text); text-align: right; }

.pm-props-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.pm-prop-chip {
  padding: 10px 12px; background: var(--color-surface-2);
  border-radius: 10px; border: 1px solid var(--color-border-light);
}
.pm-prop-id { font-size: 11px; font-weight: 700; color: var(--color-accent); letter-spacing: 0.04em; }
.pm-prop-label { font-size: 12.5px; color: var(--color-text); margin-top: 4px; line-height: 1.4; }

/* MODAL */
.pm-modal-overlay {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.62);
  display: flex; align-items: center; justify-content: center;
  z-index: 10000; padding: 24px; backdrop-filter: blur(4px);
}
.pm-modal {
  background: var(--color-surface, #fff);
  border-radius: 16px; padding: 32px 36px;
  max-width: 980px; width: 100%; max-height: 88vh;
  overflow-y: auto; position: relative;
  box-shadow: 0 30px 80px rgba(0,0,0,0.25);
}
.pm-modal-close {
  position: absolute; top: 14px; right: 18px;
  background: transparent; border: none; cursor: pointer;
  font-size: 28px; line-height: 1; color: var(--color-text-muted);
}
.pm-modal-close:hover { color: var(--color-text); }
.pm-modal-eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em;
  font-weight: 700; color: var(--color-accent); margin-bottom: 8px; }
.pm-modal-title { font-size: 22px; margin: 0 0 8px; font-weight: 700;
  font-family: 'Instrument Serif', Georgia, serif; line-height: 1.25; color: var(--color-text); }
.pm-modal-meta { font-size: 12.5px; color: var(--color-text-secondary); display: flex;
  flex-wrap: wrap; gap: 8px; align-items: center; }

.pm-modal-tiers {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px;
  margin: 18px 0;
}
.pm-tier-chip {
  border-radius: 10px; padding: 10px; border: 1px solid var(--color-border);
}
.pm-tier-zone { font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em; opacity: 0.7; }
.pm-tier-tier { font-size: 13px; font-weight: 700; margin-top: 4px; }
.pm-tier-y { font-size: 11.5px; color: var(--color-text-secondary); margin-top: 3px; font-family: ui-monospace, monospace; }
.pm-tier-direct { background: rgba(16,185,129,0.10); border-color: rgba(16,185,129,0.30); color: #047857; }
.pm-tier-flank  { background: rgba(245,158,11,0.10); border-color: rgba(245,158,11,0.30); color: #b45309; }
.pm-tier-noise  { background: var(--color-surface-2); color: var(--color-text-muted); }

.pm-modal-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 14px 0 18px; }
.pm-modal-cell { padding: 10px 12px; background: var(--color-surface-2); border-radius: 10px; }
.pm-cell-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em;
  font-weight: 600; color: var(--color-text-muted); }
.pm-cell-value { font-size: 14px; font-weight: 600; margin-top: 4px; color: var(--color-text); }
.pm-cell-mono { font-family: ui-monospace, 'Menlo', monospace; font-size: 12px; }

.pm-grades-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 10px;
}
.pm-grade-card {
  border: 1px solid var(--color-border); border-radius: 10px;
  padding: 12px 14px;
}
.pm-grade-on { background: rgba(13,148,136,0.05); border-color: rgba(13,148,136,0.25); }
.pm-grade-off { background: var(--color-surface-2); opacity: 0.6; }
.pm-grade-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.pm-grade-key { font-size: 11.5px; font-weight: 700; color: var(--color-accent); letter-spacing: 0.04em; }
.pm-grade-badge {
  padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700;
}
.pm-grade-0 { background: var(--color-border); color: var(--color-text-muted); }
.pm-grade-1 { background: rgba(245,158,11,0.15); color: #b45309; }
.pm-grade-2 { background: rgba(13,148,136,0.18); color: #0f766e; }
.pm-grade-3 { background: rgba(16,185,129,0.20); color: #047857; }
.pm-grade-label { font-size: 12px; color: var(--color-text); margin-bottom: 6px; line-height: 1.4; }
.pm-grade-evidence {
  font-size: 11.5px; color: var(--color-text-secondary);
  margin-top: 6px; padding: 6px 8px; background: var(--color-bg);
  border-radius: 6px; line-height: 1.45; word-break: break-word;
}
.pm-evi-tag {
  display: inline-block; font-size: 9.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; padding: 1px 6px; border-radius: 4px;
  background: var(--color-accent); color: white; margin-right: 4px;
}

.pm-modal-footer { display: flex; gap: 10px; margin-top: 24px; padding-top: 18px;
  border-top: 1px solid var(--color-border); }
.pm-btn-primary {
  background: var(--color-accent, #0d9488); color: white;
  padding: 10px 18px; border-radius: 8px; text-decoration: none;
  font-weight: 600; font-size: 13px;
}
.pm-btn-primary:hover { background: var(--color-accent-hover, #0f766e); }
.pm-btn-secondary {
  background: transparent; border: 1px solid var(--color-border);
  color: var(--color-text); padding: 10px 18px; border-radius: 8px;
  font-weight: 600; font-size: 13px; cursor: pointer; font-family: inherit;
}
.pm-btn-secondary:hover { background: var(--color-surface-2); }

/* Responsive */
@media (max-width: 980px) {
  .pm-wrap { padding: 16px; }
  .pm-zone-tabs { grid-template-columns: repeat(2, 1fr); }
  .pm-modal-tiers { grid-template-columns: repeat(2, 1fr); }
  .pm-modal-row { grid-template-columns: repeat(2, 1fr); }
  .pm-assign-row { grid-template-columns: 130px 1fr 40px; }
}

/* ===== Global "Silicone only" toggle (v28) ===== */
.pm-sili-only-block {
  margin: 16px 0 12px 0;
  padding: 14px 18px;
  background: linear-gradient(135deg, rgba(13, 148, 136, 0.08), rgba(13, 148, 136, 0.02));
  border: 1.5px solid rgba(13, 148, 136, 0.35);
  border-radius: 10px;
}
.pm-sili-only-label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}
.pm-sili-only-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 22px; height: 22px;
  border: 2px solid #0d9488;
  border-radius: 5px;
  background: var(--color-surface);
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  margin-top: 2px;
  transition: background 0.15s, border-color 0.15s;
}
.pm-sili-only-checkbox:hover { border-color: #14b8a6; }
.pm-sili-only-checkbox:checked {
  background: #0d9488;
  border-color: #0d9488;
}
.pm-sili-only-checkbox:checked::after {
  content: '';
  position: absolute;
  left: 6px; top: 1px;
  width: 6px; height: 12px;
  border: solid white;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}
.pm-sili-only-text { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.pm-sili-only-text strong {
  font-size: 14px;
  color: var(--color-text);
  font-weight: 600;
  letter-spacing: 0.01em;
}
.pm-sili-only-sub {
  font-size: 12px;
  color: var(--color-text-secondary);
  line-height: 1.45;
}

/* ===== Clickable KPI tier cards (v39) ===== */
.pm-kpi-clickable {
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-top-width 0.15s ease;
  position: relative;
}
.pm-kpi-clickable:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px -6px rgba(15, 23, 42, 0.18), 0 2px 6px -2px rgba(15, 23, 42, 0.08);
}
.pm-kpi-clickable:focus-visible {
  outline: 2px solid #0d9488;
  outline-offset: 2px;
}
.pm-kpi-clickable:active { transform: translateY(0); }
.pm-kpi-download-hint {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--color-border, #e2e8f0);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #0d9488;
  text-transform: uppercase;
  opacity: 0.72;
  transition: opacity 0.15s;
}
.pm-kpi-clickable:hover .pm-kpi-download-hint { opacity: 1; }

/* ===== "IN-FORCE only" pill in dashboard header (v40) ===== */
.pm-inforce-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  margin-left: 8px;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.45);
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #15803d;
  text-transform: uppercase;
  vertical-align: middle;
  cursor: help;
}
[data-theme="dark"] .pm-inforce-pill {
  background: rgba(74, 222, 128, 0.16);
  border-color: rgba(74, 222, 128, 0.45);
  color: #86efac;
}

/* ===== v50 SEARCH BAR ===== */
.pm-search {
  margin: 18px 0 22px;
  padding: 14px 16px;
  background: var(--color-surface, #ffffff);
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
[data-theme="dark"] .pm-search {
  background: #1e293b;
  border-color: #334155;
}
.pm-search-row1 {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pm-search-icon {
  font-size: 22px;
  color: #64748b;
  user-select: none;
  width: 28px;
  text-align: center;
}
.pm-search-input {
  flex: 1;
  padding: 11px 14px;
  font-size: 15px;
  border: 1px solid var(--color-border, #cbd5e1);
  background: var(--color-bg, #fff);
  color: var(--color-text, #0f172a);
  border-radius: 8px;
  outline: none;
  transition: border-color 120ms, box-shadow 120ms;
  font-family: inherit;
}
.pm-search-input:focus {
  border-color: #01696F;
  box-shadow: 0 0 0 3px rgba(1, 105, 111, 0.15);
}
[data-theme="dark"] .pm-search-input {
  background: #0f172a;
  color: #e2e8f0;
  border-color: #475569;
}
.pm-search-clear,
.pm-search-tips-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--color-border, #cbd5e1);
  background: var(--color-bg, #fff);
  color: #64748b;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 120ms, color 120ms;
}
.pm-search-clear:hover,
.pm-search-tips-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
}
[data-theme="dark"] .pm-search-clear,
[data-theme="dark"] .pm-search-tips-btn {
  background: #0f172a;
  border-color: #475569;
  color: #94a3b8;
}
.pm-search-row2 {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.pm-search-scope-label {
  font-size: 11.5px;
  font-weight: 600;
  color: #64748b;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-right: 4px;
}
.pm-search-tier-pill {
  --pill-c: #94a3b8;
  border: 1.5px solid var(--pill-c);
  background: transparent;
  color: var(--pill-c);
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 120ms, color 120ms;
  font-family: inherit;
}
.pm-search-tier-pill.on {
  background: var(--pill-c);
  color: #fff;
}
.pm-search-tier-pill.off {
  opacity: 0.55;
}
.pm-search-tier-pill:hover {
  opacity: 1;
}
.pm-search-tier-all {
  border: 1px solid var(--color-border, #cbd5e1);
  background: var(--color-bg, #fff);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  cursor: pointer;
  color: #475569;
  font-family: inherit;
  font-weight: 600;
}
.pm-search-tier-all:hover {
  background: #f1f5f9;
}
[data-theme="dark"] .pm-search-tier-all {
  background: #0f172a;
  color: #cbd5e1;
  border-color: #475569;
}
.pm-search-spacer { flex: 1; }
.pm-search-state {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
}
.pm-search-state-ok       { background: rgba(34, 197, 94, 0.12);  color: #16a34a; }
.pm-search-state-loading  { background: rgba(2, 132, 199, 0.12);  color: #0369a1; }
.pm-search-state-pending  { background: rgba(100, 116, 139, 0.10);color: #64748b; }
.pm-search-state-err      { background: rgba(239, 68, 68, 0.12);  color: #b91c1c; }
.pm-search-summary {
  margin-top: 10px;
  padding: 8px 12px;
  background: rgba(1, 105, 111, 0.06);
  border-left: 3px solid #01696F;
  border-radius: 6px;
  font-size: 13px;
  color: #0f172a;
}
[data-theme="dark"] .pm-search-summary { color: #e2e8f0; background: rgba(74, 222, 128, 0.08); border-left-color: #6ee7b7; }
.pm-search-srcbadge {
  display: inline-block;
  margin-right: 6px;
  padding: 2px 8px;
  background: #fff;
  border: 1px solid var(--color-border, #cbd5e1);
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  color: #475569;
}
[data-theme="dark"] .pm-search-srcbadge { background: #1e293b; color: #cbd5e1; border-color: #475569; }
.pm-search-tips {
  margin-top: 12px;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  font-size: 13px;
}
[data-theme="dark"] .pm-search-tips { background: #0f172a; border-color: #475569; }
.pm-search-tips-table {
  margin-top: 8px;
  border-collapse: collapse;
  width: 100%;
}
.pm-search-tips-table td {
  padding: 4px 10px 4px 0;
  vertical-align: top;
}
.pm-search-tips-table code {
  background: #fff;
  padding: 2px 6px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
}
[data-theme="dark"] .pm-search-tips-table code { background: #1e293b; border-color: #475569; color: #e2e8f0; }
.pm-search-tips-foot {
  margin-top: 8px;
  font-size: 12px;
  color: #64748b;
  font-style: italic;
}
/* Search highlight in modal */
.pm-mark {
  background: #fef08a;
  color: #422006;
  padding: 0 2px;
  border-radius: 2px;
  font-weight: 600;
}
[data-theme="dark"] .pm-mark { background: #facc15; color: #1f2937; }
/* Abstract / claims block in family modal */
.pm-deep-text {
  margin: 6px 0 14px;
  padding: 10px 12px;
  background: #f8fafc;
  border-left: 3px solid #cbd5e1;
  border-radius: 4px;
  font-size: 13px;
  line-height: 1.6;
  color: #1e293b;
  max-height: 280px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.pm-deep-claims { font-family: 'DM Mono', ui-monospace, monospace; font-size: 12px; }
[data-theme="dark"] .pm-deep-text { background: #0f172a; color: #e2e8f0; border-left-color: #475569; }
.pm-deep-loading,
.pm-deep-hint {
  margin: 10px 0;
  padding: 8px 12px;
  font-size: 12.5px;
  color: #64748b;
  background: #f8fafc;
  border-radius: 4px;
}
[data-theme="dark"] .pm-deep-loading,
[data-theme="dark"] .pm-deep-hint { background: #0f172a; color: #94a3b8; }

/* v52: search-summary layout with download button on the right */
.pm-search-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.pm-search-summary-stats {
  flex: 1 1 auto;
  min-width: 0;
}
.pm-search-download {
  flex: 0 0 auto;
  background: #01696F;
  color: #fff;
  border: 1px solid #01696F;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 120ms, transform 80ms;
  white-space: nowrap;
}
.pm-search-download:hover {
  background: #04535a;
  border-color: #04535a;
}
.pm-search-download:active { transform: translateY(1px); }
[data-theme="dark"] .pm-search-download {
  background: #4F98A3;
  border-color: #4F98A3;
  color: #0f172a;
}
[data-theme="dark"] .pm-search-download:hover { background: #66adb8; border-color: #66adb8; }

/* v53: explicit Search button next to the input */
.pm-search-btn {
  flex: 0 0 auto;
  background: #01696F;
  color: #fff;
  border: 1px solid #01696F;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  font-family: inherit;
  transition: background 120ms, box-shadow 120ms, transform 80ms;
  position: relative;
}
.pm-search-btn:hover {
  background: #04535a;
  border-color: #04535a;
}
.pm-search-btn:active { transform: translateY(1px); }
/* Pulse + accent when the user has typed something not yet applied */
.pm-search-btn.pending {
  background: #f59e0b;
  border-color: #f59e0b;
  color: #1f2937;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.20);
  animation: pmSearchPulse 1.4s ease-in-out infinite;
}
.pm-search-btn.pending::after {
  content: ' \21B5';
  margin-left: 4px;
  font-weight: 700;
}
@keyframes pmSearchPulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.20); }
  50%      { box-shadow: 0 0 0 5px rgba(245, 158, 11, 0.10); }
}
[data-theme="dark"] .pm-search-btn {
  background: #4F98A3;
  border-color: #4F98A3;
  color: #0f172a;
}
[data-theme="dark"] .pm-search-btn:hover { background: #66adb8; border-color: #66adb8; }
[data-theme="dark"] .pm-search-btn.pending { background: #fbbf24; border-color: #fbbf24; }

/* v54: prominent Reset button under the search bar */
.pm-search-reset-row {
  margin-top: 10px;
  display: flex;
  justify-content: flex-start;
}
.pm-search-reset-btn {
  background: #fff;
  color: #b91c1c;
  border: 1.5px solid #b91c1c;
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.02em;
  transition: background 120ms, color 120ms, transform 80ms;
}
.pm-search-reset-btn:hover {
  background: #b91c1c;
  color: #fff;
}
.pm-search-reset-btn:active { transform: translateY(1px); }
[data-theme="dark"] .pm-search-reset-btn {
  background: transparent;
  color: #f87171;
  border-color: #f87171;
}
[data-theme="dark"] .pm-search-reset-btn:hover { background: #f87171; color: #0f172a; }

/* ========================================================================
   ===  COMBINATION MAP v57 (.cm-* namespace) — see COMBINATION_MAP_v57_SPEC.md
   ======================================================================== */

.cm-wrap {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 22px 22px 18px;
  margin: 20px 0 24px;
  box-shadow: 0 1px 3px rgba(15,23,42,0.04);
}

/* --- Header --- */
.cm-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  flex-wrap: wrap;
  padding-bottom: 14px;
  border-bottom: 1px solid #f1f5f9;
  margin-bottom: 14px;
}
.cm-header-left  { flex: 1 1 480px; min-width: 0; }
.cm-header-right { flex: 0 0 auto; text-align: right; }

.cm-eyebrow {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: #1E3A5F;
  background: #EEF2F7;
  padding: 3px 9px;
  border-radius: 12px;
  margin-bottom: 8px;
}
.cm-title {
  font-size: 22px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 6px;
  line-height: 1.25;
}
.cm-sub {
  color: #475569;
  font-size: 13.5px;
  line-height: 1.5;
  margin-bottom: 8px;
}
.cm-zone-formula {
  color: #1E3A5F;
  font-size: 13px;
  line-height: 1.5;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 8px 12px;
  display: inline-block;
}

.cm-zone-selector { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.cm-zone-btn {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.cm-zone-btn:hover { background: #F1F5F9; color: #0f172a; }
.cm-zone-btn.active {
  background: #1E3A5F;
  color: #fff;
  border-color: #1E3A5F;
}
.cm-legend-stamp {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 10px;
  text-align: right;
  font-style: italic;
}

/* --- White space banner --- */
.cm-whitespace-bar {
  text-align: right;
  margin: 0 0 8px;
}
.cm-whitespace-badge {
  display: inline-block;
  padding: 6px 14px;
  border: 1.5px solid #D62828;
  border-radius: 8px;
  background: #FFE8E8;
  color: #B11C1C;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.4px;
}

/* --- Table --- */
.cm-table-wrap { overflow-x: auto; }
.cm-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
  margin-top: 6px;
}
.cm-th {
  background: #FAFBFC;
  text-align: center;
  padding: 12px 10px 10px;
  border-bottom: 2px solid #e2e8f0;
  font-weight: 600;
  vertical-align: bottom;
}
.cm-th-combo {
  text-align: left;
  padding-left: 16px;
  color: #1E3A5F;
}
.cm-th-techno   .cm-col-title { color: #5BA3D9; }
.cm-th-complete .cm-col-title { color: #2A7AB8; }
.cm-th-cdu      .cm-col-title { color: #F4A261; }
.cm-th-direct   .cm-col-title { color: #D62828; }
.cm-col-title {
  display: block;
  font-size: 14px;
  font-weight: 700;
}
.cm-col-sub {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: #94a3b8;
  font-style: italic;
  margin-top: 2px;
}

.cm-row { transition: background 0.12s; }
.cm-row:hover .cm-cell-combo { background: #F8FAFC; }
.cm-row-near { background: #FFF4E6; }
.cm-row-near:hover { background: #FEEACD; }
.cm-row-full { background: #FFE6E6; }
.cm-row-full:hover { background: #FFD0D0; }

.cm-cell {
  padding: 12px 10px;
  border-bottom: 1px solid #f1f5f9;
  text-align: center;
  vertical-align: middle;
}
.cm-cell-combo {
  text-align: left;
  padding-left: 16px;
  font-weight: 500;
  white-space: nowrap;
}
.cm-combo-code {
  font-family: 'Consolas','Courier New',monospace;
  font-size: 13.5px;
  color: #1E3A5F;
  background: transparent;
  padding: 0;
}
.cm-row-full .cm-combo-code { color: #B11C1C; font-weight: 700; }
.cm-npi-badge {
  display: inline-block;
  min-width: 22px;
  height: 18px;
  line-height: 18px;
  padding: 0 6px;
  margin-left: 10px;
  font-size: 10.5px;
  font-weight: 600;
  color: #64748b;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  text-align: center;
}

.cm-marker-near {
  color: #B26B2A;
  font-weight: 700;
  font-size: 12px;
  margin-right: 4px;
}
.cm-marker-full {
  color: #B11C1C;
  font-weight: 700;
  font-size: 12px;
  margin-right: 4px;
}

/* --- Count cells --- */
.cm-cell-zero .cm-zero {
  color: #CBD5E1;
  font-weight: 500;
}
.cm-cell-techno   .cm-count { color: #5BA3D9; font-weight: 700; font-size: 17px; }
.cm-cell-complete .cm-count { color: #2A7AB8; font-weight: 700; font-size: 17px; }
.cm-cell-cdu      .cm-count { color: #F4A261; font-weight: 700; font-size: 17px; }
.cm-cell-direct   .cm-count { color: #D62828; font-weight: 700; font-size: 17px; }

.cm-g3 {
  color: #5BA3D9;
  opacity: 0.62;
  font-size: 12px;
  font-weight: 500;
  margin-left: 2px;
}
.cm-cell-clickable {
  cursor: pointer;
  transition: background 0.12s;
}
.cm-cell-clickable:hover {
  background: rgba(30, 58, 95, 0.04);
}
.cm-cell-clickable:focus {
  outline: 2px solid #5BA3D9;
  outline-offset: -2px;
}

/* Lead highlight on Complete-not-CDU cells with count > 0 */
.cm-cell-lead {
  background: #E8F0FB;
  border: 1.5px solid #2A7AB8;
  border-radius: 8px;
  position: relative;
}
.cm-cell-lead .cm-count { color: #1E3A5F; }
.cm-cell-lead .cm-star {
  color: #2A7AB8;
  margin-left: 4px;
  font-size: 13px;
}

/* --- Legend --- */
.cm-legend-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  margin-top: 18px;
}
.cm-legend-card {
  padding: 12px 14px;
  border-radius: 8px;
  background: #FAFBFC;
  border: 1px solid #E2E8F0;
}
.cm-legend-lead { background: #E8F0FB; border-color: #B8D2EC; }
.cm-legend-near { background: #FFF4E6; border-color: #F4D9B6; }
.cm-legend-full { background: #FFE6E6; border-color: #F4B6B6; }
.cm-legend-mark {
  font-weight: 700;
  font-size: 12.5px;
  margin-bottom: 4px;
  letter-spacing: 0.3px;
}
.cm-legend-lead .cm-legend-mark { color: #2A7AB8; }
.cm-legend-near .cm-legend-mark { color: #B26B2A; }
.cm-legend-full .cm-legend-mark { color: #B11C1C; }
.cm-legend-body {
  font-size: 12px;
  line-height: 1.5;
  color: #475569;
}

/* --- Footer --- */
.cm-footer {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #f1f5f9;
  font-size: 11px;
  color: #94a3b8;
  font-style: italic;
  text-align: center;
}

/* --- Scatter chip when filter active --- */
.cm-scatter-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 8px 14px;
  background: #1E3A5F;
  color: #fff;
  border-radius: 24px;
  font-size: 13px;
}
.cm-scatter-chip strong { color: #FBC53D; }
.cm-chip-clear {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.4);
  color: #fff;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  font-family: inherit;
}
.cm-chip-clear:hover { background: rgba(255,255,255,0.28); }

/* ========================================================================
   ===  COMBINATION MAP — Side Panel
   ======================================================================== */
.cm-panel-overlay {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 1500;
  display: none;
  justify-content: flex-end;
  align-items: stretch;
}
.cm-panel {
  background: #fff;
  width: 38%;
  min-width: 480px;
  max-width: 700px;
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 32px rgba(15, 23, 42, 0.16);
  animation: cmSlideIn 0.22s ease-out;
}
@keyframes cmSlideIn {
  from { transform: translateX(40px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
.cm-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 22px 24px 16px;
  border-bottom: 1px solid #e2e8f0;
  background: #FAFBFC;
}
.cm-panel-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 4px;
}
.cm-panel-title {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 4px;
}
.cm-panel-count {
  font-size: 13px;
  color: #2A7AB8;
  font-weight: 600;
}
.cm-panel-close {
  background: transparent;
  border: none;
  color: #64748b;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-family: inherit;
}
.cm-panel-close:hover {
  background: #F1F5F9;
  color: #0f172a;
}
.cm-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 24px;
}
.cm-card {
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 12px;
  transition: border-color 0.12s;
}
.cm-card:hover { border-color: #94a3b8; }
.cm-card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.cm-card-pub {
  font-family: 'Consolas','Courier New',monospace;
  font-size: 12.5px;
  font-weight: 700;
  color: #2A7AB8;
  text-decoration: none;
}
.cm-card-pub:hover { text-decoration: underline; }
.cm-card-meta {
  font-size: 11px;
  color: #94a3b8;
}
.cm-card-title {
  font-size: 13.5px;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.4;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cm-card-assn {
  font-size: 12px;
  color: #475569;
  margin-bottom: 10px;
  font-style: italic;
}
.cm-card-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.cm-chip {
  display: inline-block;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 12px;
  font-family: 'Consolas','Courier New',monospace;
}
.cm-chip-g2 {
  background: #FEF3C7;
  color: #92400E;
  border: 1px solid #FDE68A;
}
.cm-chip-g3 {
  background: #DBEAFE;
  color: #1E40AF;
  border: 1px solid #BFDBFE;
}
.cm-card-ev {
  font-size: 11.5px;
  color: #475569;
  line-height: 1.5;
  background: #F8FAFC;
  padding: 6px 10px;
  border-radius: 6px;
  margin-bottom: 4px;
  border-left: 3px solid #CBD5E1;
}
.cm-card-ev-tag {
  display: inline-block;
  font-family: 'Consolas','Courier New',monospace;
  font-size: 10.5px;
  font-weight: 700;
  color: #2A7AB8;
  background: #fff;
  padding: 1px 6px;
  border-radius: 4px;
  margin-right: 6px;
  border: 1px solid #E2E8F0;
}
.cm-panel-footer {
  padding: 14px 24px;
  border-top: 1px solid #e2e8f0;
  background: #FAFBFC;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

/* ========================================================================
   ===  COMBINATION MAP — Responsive (< 1024 px)
   ======================================================================== */
@media (max-width: 1023px) {
  .cm-g3 { display: none; }                   /* hide grade-3 sub-count */
  .cm-legend-row { grid-template-columns: 1fr; }
  .cm-header-right { width: 100%; text-align: left; }
  .cm-legend-stamp { text-align: left; }
  .cm-panel {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }
  .cm-table { font-size: 12.5px; }
  .cm-th, .cm-cell { padding: 8px 6px; }
}

/* Filter scope banner — shown when any dashboard filter is active */
.cm-scope-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  padding: 8px 14px;
  background: #FEF9E6;
  border: 1px solid #F4D9B6;
  border-left: 4px solid #B26B2A;
  border-radius: 6px;
  font-size: 12.5px;
  color: #5F4419;
}
.cm-scope-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #B26B2A;
  box-shadow: 0 0 0 3px rgba(178,107,42,0.15);
  flex: 0 0 auto;
  animation: cmScopePulse 2s ease-in-out infinite;
}
@keyframes cmScopePulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.15); opacity: 0.8; }
}
.cm-scope-text strong { color: #2F2410; font-weight: 700; }

/* Combination Map — Full matrix download button */
.cm-download-row {
  margin-top: 10px;
  text-align: right;
}
.cm-download-btn {
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 600;
  color: #ffffff;
  background: #1E3A5F;
  border: 1px solid #1E3A5F;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
  font-family: inherit;
  letter-spacing: 0.2px;
}
.cm-download-btn:hover {
  background: #0F2640;
  border-color: #0F2640;
}
.cm-download-btn:active {
  transform: translateY(1px);
}
