/* Causal Inference node - styles. Loaded globally by Dash from /assets, so every rule is scoped under .cau-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.
   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. */

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

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

/* ---------- main grid: rail + screens ---------------------------------------------------------- */
.cau-main { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 14px; align-items: start; }
.cau-rail { display: flex; flex-direction: column; min-width: 0; }
.cau-rail .pk-card { padding: 9px 11px; margin-bottom: 8px; }
.cau-field { margin-bottom: 8px; min-width: 0; }
.cau-k { color: #9fb3c8; font-size: .64rem; text-transform: uppercase; letter-spacing: .6px; margin-bottom: 3px; }
.cau-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; }
.cau-row2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.cau-chipbox { margin-bottom: 8px; }
.cau-chipbox .pfp-chip { width: 100%; }
.cau-chipbox .pfp-chip-tx { flex: 1 1 auto; }
.cau-app .Select-control { min-height: 30px; }
.cau-app .Select--single > .Select-control { height: 30px; }
.cau-app .Select--single > .Select-control .Select-value, .cau-app .Select-placeholder { line-height: 28px !important; }
.cau-app .Select-value-label { color: #e8e8e8 !important; }
.cau-app .Select--multi .Select-value { font-size: .72rem; margin-top: 3px; }
.cau-app .VirtualizedSelectOption { white-space: normal; line-height: 1.25; }
.cau-vars { margin-bottom: 6px; }
.cau-vars .Select-value-label { display: inline-block; max-width: 98px; overflow: hidden; text-overflow: ellipsis;
                                white-space: nowrap; vertical-align: bottom; }
.cau-app input.cau-in { flex: 1 1 110px; min-width: 0; width: 100%; height: 30px; }
.cau-app textarea.cau-text { width: 100%; min-height: 150px; resize: vertical; background: rgba(255,255,255,0.06);
                             color: #e8f4ff; border: 1px solid rgba(255,255,255,0.12); border-radius: 10px;
                             padding: 7px 9px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
                             font-size: .76rem; line-height: 1.5; outline: none; }
.cau-app textarea.cau-text:focus { border-color: rgba(240,160,48,0.6); }
.cau-checks label { user-select: none; }
.cau-actions { margin: 2px 0 6px; }
.cau-app .cau-run { font-weight: 600; padding: 5px 16px; }
.cau-status { font-size: .74rem; }
.cau-ok { color: #bfe8c4; }
.cau-ok i { color: #3fbf7f; }
.cau-err { color: #ffd0cb; }
.cau-err i { color: #e66767; }

/* screen tabs (the same look as the other idea apps) */
.cau-tabs { display: flex; flex-wrap: wrap; gap: 4px 20px; margin: 0 0 10px; border-bottom: 1px solid rgba(255,255,255,0.07); }
.cau-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; }
.cau-tabs label:hover { color: #cfefff; }
.cau-tabs label:has(input:checked) { color: #cfefff; border-bottom-color: #f0a030; }
.cau-tabs input { display: none; }
.cau-center { min-width: 0; }
.cau-wait { color: #9fb3c8; padding: 40px 10px; text-align: center; }
.cau-wait.cau-err { color: #ffd0cb; }

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

.cau-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; }
.cau-summary > i { color: #f0a030; }
.cau-summary > b { font-weight: 600; }
.cau-summary > div { margin-top: 3px; color: #dfe7ee; font-size: .82rem; }
.cau-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; }
.cau-say i { color: #f0a030; margin-top: 3px; }
.cau-say.warn { background: rgba(230,103,103,0.09); border: 1px solid rgba(230,103,103,0.3); color: #ffe1dd; }
.cau-say.warn i { color: #e66767; }
.cau-note { color: #7f93a6; font-size: .7rem; line-height: 1.45; margin-top: 6px; }
.cau-p { color: #dfe7ee; font-size: .78rem; line-height: 1.5; margin-top: 6px; }
.cau-q { color: #e8f4ff; font-size: .9rem; font-weight: 600; line-height: 1.4; }
.cau-case { border-left: 3px solid #3987e5; }

/* graph legend */
.cau-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 2px; }
.cau-leg { display: inline-flex; align-items: center; gap: 5px; color: #9fb3c8; font-size: .7rem; }
.cau-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.cau-line { width: 16px; height: 3px; border-radius: 2px; display: inline-block; }

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

/* ---------- tables ------------------------------------------------------------------------------- */
.cau-scroll { overflow-x: auto; }
.cau-table { width: 100%; border-collapse: collapse; font-size: .76rem; }
.cau-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; }
.cau-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; }
.cau-table th:first-child, .cau-table td:first-child { text-align: left; white-space: normal; }
.cau-table tbody tr:hover td { background: rgba(255,255,255,0.03); }
.cau-table.txt th, .cau-table.txt td { text-align: left; white-space: normal; line-height: 1.45; vertical-align: top; }
.cau-table.txt td:first-child { color: #cfefff; padding-right: 12px; }
.cau-table td.cau-why { color: #9fb3c8; font-size: .72rem; white-space: normal; text-align: left; line-height: 1.45; min-width: 220px; }
.cau-table.est td:first-child { white-space: normal; min-width: 170px; }
.cau-table.lib td { min-width: 130px; }
.cau-table.lib td:nth-child(3) { min-width: 300px; color: #dfe7ee; }
.cau-se { color: #7f93a6; font-size: .7rem; }
.cau-trap { color: #f5d6a3; margin-top: 4px; }
.cau-app pre.cau-pre { margin: 0; color: #cfdcea; font-size: .7rem; line-height: 1.45; background: none; border: none;
                       padding: 0; white-space: pre; overflow: visible; }
.cau-app .cau-openb { margin-top: 6px; padding: 2px 10px; font-size: .7rem; }

/* library, guide */
.cau-refh { color: #cfefff; font-weight: 600; font-size: .72rem; text-transform: uppercase; letter-spacing: .5px; margin: 10px 0 4px; }
.cau-ref { color: #dfe7ee; font-size: .74rem; line-height: 1.5; margin-bottom: 5px; padding-left: 12px; text-indent: -12px; }
.cau-refw { color: #7f93a6; }
.cau-app ol.cau-road, .cau-app ul.cau-road { margin: 4px 0 0; padding-left: 20px; color: #dfe7ee; font-size: .76rem; line-height: 1.55; }
.cau-road li { margin-bottom: 6px; }
.cau-step { display: flex; gap: 10px; align-items: flex-start; margin-top: 8px; font-size: .78rem; line-height: 1.5; color: #dfe7ee; }
.cau-step b { color: #e8f4ff; }
.cau-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; }

.cau-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); }
.cau-foot i { color: #9fb3c8; }

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