/* Clustering node - styles. Loaded globally by Dash from /assets, so every rule is scoped under .clu-app.
   The page kit of the main app (assets/app_pages/pages_style.css: .pk-scope, .pk-card, .pk-kpis, .pk-pills,
   .pk-chip, .pk-btn) does most of the work; these rules lay out the node, in the same way as Econometrics and Causal Inference.
   Tokens: panels rgba(0,0,0,0.6), chips rgba(255,255,255,0.06), radius 10px, text #e8e8e8, muted #9fb3c8,
   headings #cfefff, accent #f0a030; bad #e66767, good #3fbf7f. */

.clu-app { color: #e8e8e8; font-size: 13px; }
.clu-app * { box-sizing: border-box; }

/* ---------- header (leave ~200px on the right for the app toolbar) ---------------------------- */
.clu-top { display: flex; align-items: flex-end; gap: 18px; padding: 0 200px 10px 0; }
.clu-brand h3 { margin: 0; font-size: 1.3rem; color: #cfefff; font-weight: 600; letter-spacing: .2px; }
.clu-brand h3 span { color: #9fb3c8; font-weight: 400; font-size: .95rem; }
.clu-brand > div { color: #9fb3c8; font-size: .78rem; max-width: 1040px; line-height: 1.45; }

/* ---------- main grid: rail + screens ---------------------------------------------------------- */
.clu-main { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 14px; align-items: start; }
.clu-rail { display: flex; flex-direction: column; min-width: 0; }
.clu-rail .pk-card { padding: 9px 11px; margin-bottom: 8px; }
.clu-field { margin-bottom: 8px; min-width: 0; }
.clu-k { color: #9fb3c8; font-size: .64rem; text-transform: uppercase; letter-spacing: .6px; margin-bottom: 3px; }
.clu-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; }
.clu-row2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.clu-chipbox { margin-bottom: 8px; }
.clu-chipbox .pfp-chip { width: 100%; }
.clu-chipbox .pfp-chip-tx { flex: 1 1 auto; }
.clu-app .Select-control { min-height: 30px; }
.clu-app .Select--single > .Select-control { height: 30px; }
.clu-app .Select--single > .Select-control .Select-value, .clu-app .Select-placeholder { line-height: 28px !important; }
.clu-app .Select-value-label { color: #e8e8e8 !important; }
.clu-app .Select--multi .Select-value { font-size: .72rem; margin-top: 3px; }
.clu-app .VirtualizedSelectOption { white-space: normal; line-height: 1.25; }
.clu-app input.clu-in { flex: 1 1 110px; min-width: 0; width: 100%; height: 30px; }
.clu-checks label { user-select: none; }
.clu-actions { margin: 2px 0 6px; }
.clu-app .clu-run { font-weight: 600; padding: 5px 16px; }
.clu-status { font-size: .74rem; }
.clu-ok { color: #bfe8c4; }
.clu-ok i { color: #3fbf7f; }
.clu-err { color: #ffd0cb; }
.clu-err i { color: #e66767; }

/* screen tabs (the same look as the other idea apps) */
.clu-tabs { display: flex; flex-wrap: wrap; gap: 4px 20px; margin: 0 0 10px; border-bottom: 1px solid rgba(255,255,255,0.07); }
.clu-tabs label { display: inline-flex !important; margin: 0 !important; cursor: pointer; padding: 2px 0 7px;
                  color: #7f93a8; font-size: 1rem; font-weight: 600; border-bottom: 2px solid transparent;
                  transition: color .15s, border-color .15s; }
.clu-tabs label:hover { color: #cfefff; }
.clu-tabs label:has(input:checked) { color: #cfefff; border-bottom-color: #f0a030; }
.clu-tabs input { display: none; }
.clu-center { min-width: 0; }
.clu-wait { color: #9fb3c8; padding: 40px 10px; text-align: center; }
.clu-wait.clu-err { color: #ffd0cb; }

/* ---------- cards, grids, kpis ------------------------------------------------------------------ */
.clu-card-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.clu-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; margin-bottom: 2px; }
.clu-grid2 > .pk-card, .clu-grid2 > div > .pk-card { margin-bottom: 10px; }
.clu-graph { width: 100%; }
.clu-kpis { margin: 0 0 10px; }
.clu-kpis .pk-kpi { flex: 1 1 140px; background: rgba(0,0,0,0.6); border: 1px solid rgba(255,255,255,0.07); min-width: 0; }
.clu-kpis .pk-kpi.clu-hero { flex: 1.4 1 190px; border-color: rgba(240,160,48,0.45); background: rgba(240,160,48,0.07); }
.clu-kpis .pk-kv { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clu-kpis .pk-kl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clu-kpi-s { color: #7f93a6; font-size: .64rem; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.clu-summary { background: rgba(0,0,0,0.6); border: 1px solid rgba(255,255,255,0.07); border-left: 3px solid #f0a030;
               border-radius: 10px; padding: 10px 14px; font-size: .86rem; color: #e8f4ff; line-height: 1.55; margin-bottom: 10px; }
.clu-summary > i { color: #f0a030; }
.clu-summary > b { font-weight: 600; }
.clu-summary > div { margin-top: 3px; color: #dfe7ee; font-size: .82rem; }
.clu-say { display: flex; gap: 8px; align-items: flex-start; margin: 6px 0; padding: 7px 10px; border-radius: 10px;
           background: rgba(255,255,255,0.04); color: #dfe7ee; font-size: .78rem; line-height: 1.5; }
.clu-say i { color: #f0a030; margin-top: 3px; }
.clu-say.warn { background: rgba(230,103,103,0.09); border: 1px solid rgba(230,103,103,0.3); color: #ffe1dd; }
.clu-say.warn i { color: #e66767; }
.clu-note { color: #7f93a6; font-size: .7rem; line-height: 1.45; margin-top: 6px; }
.clu-p { color: #dfe7ee; font-size: .78rem; line-height: 1.5; margin-top: 6px; }

/* graph legend */

/* controls row above a screen */
.clu-ctrls { display: flex; flex-wrap: wrap; gap: 8px 22px; align-items: flex-end; margin: 6px 0 10px; }
.clu-ctrls > div { min-width: 0; }
.clu-ctrls .clu-dd { min-width: 260px; max-width: 520px; }
.clu-ctrls input.clu-in { width: 130px; flex: 0 0 auto; }

/* ---------- tables ------------------------------------------------------------------------------- */
.clu-scroll { overflow-x: auto; }
.clu-table { width: 100%; border-collapse: collapse; font-size: .76rem; }
.clu-table th { color: #9fb3c8; font-weight: 500; font-size: .64rem; text-transform: uppercase; letter-spacing: .4px;
                text-align: right; padding: 4px 6px; border-bottom: 1px solid rgba(255,255,255,0.1); vertical-align: bottom; }
.clu-table td { padding: 4px 6px; border-bottom: 1px solid rgba(255,255,255,0.05); text-align: right;
                font-variant-numeric: tabular-nums; color: #e8e8e8; white-space: nowrap; }
.clu-table th:first-child, .clu-table td:first-child { text-align: left; white-space: normal; }
.clu-table tbody tr:hover td { background: rgba(255,255,255,0.03); }
.clu-table.txt th, .clu-table.txt td { text-align: left; white-space: normal; line-height: 1.45; vertical-align: top; }
.clu-table.txt td:first-child { color: #cfefff; padding-right: 12px; }
.clu-table td.clu-why { color: #9fb3c8; font-size: .72rem; white-space: normal; text-align: left; line-height: 1.45; min-width: 220px; }
.clu-se { color: #7f93a6; font-size: .7rem; }

/* library, guide */
.clu-app ol.clu-road, .clu-app ul.clu-road { margin: 4px 0 0; padding-left: 20px; color: #dfe7ee; font-size: .76rem; line-height: 1.55; }
.clu-road li { margin-bottom: 6px; }
.clu-step { display: flex; gap: 10px; align-items: flex-start; margin-top: 8px; font-size: .78rem; line-height: 1.5; color: #dfe7ee; }
.clu-step b { color: #e8f4ff; }
.clu-step-n { flex: 0 0 22px; height: 22px; border-radius: 50%; border: 1px solid rgba(240,160,48,0.6); color: #f5d6a3;
              display: inline-flex; align-items: center; justify-content: center; font-size: .72rem; font-weight: 600; }

.clu-foot { color: #6f8295; font-size: .68rem; line-height: 1.45; margin-top: 12px; padding-top: 8px;
            border-top: 1px solid rgba(255,255,255,0.06); }
.clu-foot i { color: #9fb3c8; }

/* ---------- clustering specifics ------------------------------------------------------------------ */
.clu-app input.clu-num { width: 100%; height: 30px; }
.clu-row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.clu-tks { display: flex; flex-wrap: wrap; gap: 3px 4px; }
.clu-tk { display: inline-block; padding: 0 5px; border-radius: 6px; background: rgba(255,255,255,0.06);
          color: #dfe7ee; font-size: .7rem; line-height: 1.5; }
.clu-tk.rep { border: 1px solid rgba(255,255,255,0.75); color: #ffffff; font-weight: 600; }
.clu-table.mem td:nth-child(3) { white-space: normal; text-align: left; min-width: 260px; }
.clu-table.mem th:nth-child(3) { text-align: left; }
.clu-app ul.clu-list { margin: 4px 0 0; padding-left: 20px; color: #dfe7ee; font-size: .76rem; line-height: 1.55; }
.clu-list li { margin-bottom: 6px; }
.clu-ctrls input.clu-in { width: 240px; }
.clu-note.warn { color: #f5d6a3; }

/* ---------- narrow screens ----------------------------------------------------------------------- */
@media (max-width: 1320px) { .clu-grid2 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 1000px) {
  .clu-main { grid-template-columns: minmax(0, 1fr); }
  .clu-top { padding-right: 120px; }
}
@media (max-width: 640px) {
  .clu-top { padding-right: 0; padding-top: 34px; }
  .clu-brand > div { display: none; }
  .clu-tabs { gap: 4px 14px; }
  .clu-tabs label { font-size: .88rem; }
  .clu-ctrls .clu-dd { min-width: 0; width: 100%; }
  .clu-ctrls > div { flex: 1 1 100%; }
  .clu-kpis .pk-kpi { flex: 1 1 45%; }
}
